Re: [PHP-DEV] serialize bug with array that references to itself?

2004-11-03 Thread Francisco M. Marzoa Alonso
I think I understand the reason because I obtain that output, but I cannot figure out the motivations for doing it in that way. I should probably take a look at ZE sources. Thx. a lot by your help. Andrey Hristov wrote: Well, when there is traversion inside the engine, it checks whether it has

Re: [PHP-DEV] serialize bug with array that references to itself?

2004-11-03 Thread Francisco M. Marzoa Alonso
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

Re: [PHP-DEV] serialize bug with array that references to itself?

2004-11-03 Thread Francisco M. Marzoa Alonso
Should I fill a bug notification report or so? (where are them? ;-)) Andrey Hristov wrote: Francisco M. Marzoa Alonso wrote: Try this code: $Arr = array(); $Arr['self'] = &$Arr; var_dump ( $Arr ); $serdata = serialize ($Arr); $Arr2 = unserialize ( $serdata ); echo "\n\n

[PHP-DEV] serialize bug with array that references to itself?

2004-11-03 Thread Francisco M. Marzoa Alonso
Try this code: $Arr = array(); $Arr['self'] = &$Arr; var_dump ( $Arr ); $serdata = serialize ($Arr); $Arr2 = unserialize ( $serdata ); echo "\n\n"; var_dump ( $Arr2 ); ?> The second array is expected to be exactly as $Arr, but it doesn't. This is the output for that code: array(1) { ["self"]=

Re: [PHP-DEV] Convert an array in an object instance

2004-10-26 Thread Francisco M. Marzoa Alonso
7; that servers for this purpouse: http://www.emerson.emory.edu/services/perl/perldoc/manual/perlfunc/bless.html But I didn't found an equivalent in PHP. I'm writting my own serialization routines and I need this to unserialize objects. Thx. Derick Rethans wrote: On Mon, 25 Oct 2004, Francisc

[PHP-DEV] Convert an array in an object instance

2004-10-25 Thread Francisco M. Marzoa Alonso
Hi, Is it possible to convert an array in an object instance? I can convert an object in an array as follows: $Test = new MyClass (); $TestArray = (array) $Test; Then I've an array with all members of the object $Test, but it seems that I cannot simply do: $TestObject = (MyClass) $TestArray; To r

[PHP-DEV] See if a class is a subclass of other?

2004-10-22 Thread Francisco M. Marzoa Alonso
Is there any manner to know if a class is a subclass of another from class name as string? I meant something in the line of is_subclass_of but using the name of the child class instead of an object instance. TIA -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http

Re: [PHP-DEV] [PHP] Serializing objects with protected members

2004-10-22 Thread Francisco M. Marzoa Alonso
Thanks a lot, it was very useful. Andrey Hristov wrote: [...] There is a hack to access private data of an object. [...] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] [PHP] Serializing objects with protected members

2004-10-22 Thread Francisco M. Marzoa Alonso
Hi, I'm trying to wrote my own serialization routines and I've found a previsible problem: protected members are not visible to my serialization routine. This is ok and it should be as is, but I've seen that PHP's serialize function have access to that members anyway, so the question is: Is there a

[PHP-DEV] Nesting level too deep - recursive dependency?

2004-10-18 Thread Francisco M. Marzoa Alonso
This code: class TestClass { public $myself; function __construct () { $this->myself = $this; } } $TestObj = new TestClass (); if ( $TestObj->myself == $TestObj ) { echo "They are same.\n"; } ?> Gives me a "Fatal error: Nesting level too deep - recursive dependency?" on lin