Edit report at https://bugs.php.net/bug.php?id=55801&edit=1
ID: 55801 Updated by: m...@php.net Reported by: mapi at pdepend dot org Summary: Behavior of unserialize has changed Status: Assigned Type: Bug Package: Variables related Operating System: Linux (Fedora 15) PHP Version: 5.4.0beta1 Assigned To: mike Block user comment: N Private report: N New Comment: Ok, I think I found the problematic POC: in line 486 of PHP_Depend_Code_AbstractCallable you call serialize() while another (the prime) serialize calls __sleep() on an instance of this class. What's the intention of this __temp__ thing? Previous Comments: ------------------------------------------------------------------------ [2011-10-03 09:45:19] m...@php.net Obviously I did, but it's unclear how... The reproduce case doesn't help much either. ------------------------------------------------------------------------ [2011-10-01 13:58:26] johan...@php.net mike, seems like you broke this. Please take a look. ------------------------------------------------------------------------ [2011-10-01 12:25:51] mapi at pdepend dot org Bingo! With revision 299770 this bug occurs the first time. If I checkout and compile revision 299769 of trunk, everything works as expected. With revision 299770 I get those annoying unserialized arrays with NULL values. ------------------------------------------------------------------------ [2011-09-30 16:09:44] johan...@php.net Can you try reverting SVN revision r299770 and then run your test? - That's mostly a guess, though. bug #36424 http://svn.php.net/viewvc/?view=revision&revision=299770 ------------------------------------------------------------------------ [2011-09-28 16:29:50] mapi at pdepend dot org It seems that this has something todo with the visibility of properties that should be serialized. If I do the following: ~ $ rm -rf ~/.pdepend ~ $ git clone https://github.com/pdepend/pdepend.git ~ $ cd pdepend ~ $ vim src/main/php/PHP/Depend/Code/AbstractClassOrInterface.php +86 -> Change from PROTECTED to PUBLIC protected $parentClassReference = null; -> public $parentClassReference = null; ~ $ vim src/main/php/PHP/Depend/Code/AbstractClassOrInterface.php +132 -> Change from PROTECTED to PUBLIC protected $nodes = array(); -> public $nodes = array(); ~ $ php540 src/bin/pdepend.php --summary-xml=sum.xml src/main/php/PHP/Depend/Code/ASTArrayType.php ~ $ php540 src/bin/pdepend.php --summary-xml=sum.xml src/main/php/PHP/Depend/Code/ASTArrayType.php ... Executing CyclomaticComplexity-Analyzer: Fatal error: Call to a member function findChildrenOfType() on a non-object in /tmp/pdepend/src/main/php/PHP/Depend/Code/AbstractClassOrInterface.php on line 268 If I now revert the visibility of both properties from PUBLIC to PROTECTED, it works: ~ $ vim src/main/php/PHP/Depend/Code/AbstractClassOrInterface.php +86 -> Change from PUBLIC to PROTECTED public $parentClassReference = null; -> protected $parentClassReference = null; ~ $ vim src/main/php/PHP/Depend/Code/AbstractClassOrInterface.php +132 -> Change from PUBLIC to PROTECTED public $nodes = array(); -> protected $nodes = array(); ~ $ php540 src/bin/pdepend.php --summary-xml=sum.xml src/main/php/PHP/Depend/Code/ASTArrayType.php This means that a PUBLIC property that was serialized can be restored in a PROTECTED property while unserializing the object structure. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55801 -- Edit this bug report at https://bugs.php.net/bug.php?id=55801&edit=1