Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13715 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57028 invoked by uid 1010); 3 Nov 2004 17:29:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 53063 invoked from network); 3 Nov 2004 17:28:28 -0000 Received: from unknown (HELO iko.gotobg.net) (80.168.8.116) by pb1.pair.com with SMTP; 3 Nov 2004 17:28:28 -0000 Received: from pd95e9886.dip.t-dialin.net ([217.94.152.134] helo=[192.168.0.36]) by iko.gotobg.net with esmtpa (Exim 4.43) id 1CPOvu-0003Hz-KI; Wed, 03 Nov 2004 19:28:30 +0200 Message-ID: <41891499.7080007@hristov.com> Date: Wed, 03 Nov 2004 18:25:45 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a4) Gecko/20040918 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jochem Maas CC: internals@lists.php.net References: <4188DEC8.5060309@gmx.net> <4188DDC9.30000@hristov.com> <4189013F.2050104@gmx.net> <4188F4CC.6000902@hristov.com> <41890B41.5020703@gmx.net> <41890169.1020107@hristov.com> <4189094F.10105@iamjochem.com> In-Reply-To: <4189094F.10105@iamjochem.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - iko.gotobg.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - hristov.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] serialize bug with array that references to itself? From: php@hristov.com (Andrey Hristov) Hi, print_r() and var_dump() are quite different in their nature. print_r() is a thin wrapper around an internal Zend function (as far as I remember) while var_dump() is in ext/standard/var.c The do more or less the same job still some differences in the output (print_r() shows nothing on NULL variables which I find clumsy since lack of output where I expect ouput makes me suspicious). Andrey Jochem Maas wrote: > Andrey Hristov wrote: > >> Well, when there is traversion inside the engine, it checks whether >> it has >> processed a "node" already several times. As far as I remember the >> threshold >> is 3. So once it goes over $Arr, the counter increases to 1, the >> second time >> to 2 and third time it is 3 and ZE reports recursion. > > > is there good reason to set the threshold at 3 iso 2? > > when dumping out objects that make heavy use of 'parent' references this > leads to tons of extra output which would be greatly cutdown if the > threshold was 2 iso 3. > > just to make the point, print_r seems to use a threshold of 2 (which is > why I always try print_r before taking my chances with var_dump): > > > class a { public $self; } > > $A = new a; > $A->self = $A; > var_dump( $A ); > print_r( $A ); > > ?> > >> >> HTH, >> Andrey >> >> Francisco M. Marzoa Alonso wrote: >> >>> BTW., I'm not sure that there's nothing more wrong here. Takin the >>> first part of the code of first example: >>> >>> >> >>> $Arr = array(); >>> $Arr['self'] = &$Arr; >>> var_dump ( $Arr ); >>> >>> ?> >>> >>> It returns: >>> >>> array(1) { >>> ["self"]=> >>> array(1) { >>> ["self"]=> >>> *RECURSION* >>> } >>> } >>> >>> Is that as its expected to be? I meant that perhaps it should be: >>> >>> array(1) { >>> ["self"]=> >>> *RECURSION* >>> } >>> >>> Since the element in $Arr['self'] is yet (or at least should be) a >>> reference to itself... >>> >> >