Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98522 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85443 invoked from network); 14 Mar 2017 19:26:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Mar 2017 19:26:51 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.86 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.86 mx105.easyname.com Received: from [77.244.243.86] ([77.244.243.86:53163] helo=mx105.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/B7-38004-AF348C85 for ; Tue, 14 Mar 2017 14:26:50 -0500 Received: from cable-81-173-135-7.netcologne.de ([81.173.135.7] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cns5n-0005QB-VI; Tue, 14 Mar 2017 19:26:50 +0000 Reply-To: internals@lists.php.net References: <04.57.38004.22D38C85@pb1.pair.com> To: Andrea Faulds , internals@lists.php.net Message-ID: Date: Tue, 14 Mar 2017 20:26:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <04.57.38004.22D38C85@pb1.pair.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] [PATCH] Make var_export() output "(object)array(..." instead of "stdClass::__set_state(..." for stdClass From: php@fleshgrinder.com (Fleshgrinder) On 3/14/2017 7:57 PM, Andrea Faulds wrote: > Hi everyone, > > Since stdClass has no __set_state method, var_export() produces unusable > output if given an object of that class. I wrote a patch that would make > var_export() produce a cast to object instead, which could be evaluated > to get back a stdClass: > > https://github.com/php/php-src/pull/2420 > > Any thoughts/comments? > > If you're wondering about whether a __set_state method should be added > to stdClass, I posted some thoughts in the pull request discussion already. > > Thanks! I actually already used __set_state occasionally for userland classes. Adding __set_state to stdClass seems to be more consistent with the rest of PHP, rather than special casing it in one method. I cannot see any issues with this to be honest. -- Richard "Fleshgrinder" Fussenegger