|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-12-23 10:57 UTC] derick@php.net
[2004-12-29 18:36 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
Description: ------------ After setting up PHP4.3.10 my application stoped working with error message saying about error in one of PEAR files. After looking into code that caused error I figured out a very strange thing: the array_keys function gets as parameter a valid array but returns NULL. I tried to reproduce the bug without using PEAR files but didn't succeed. So I will describe the issue using PEAR code. File: PEAR/DB/dataobject.php (version 1.7.2) (DB_DataObject PEAR package) P.S. I have no Zend debuger/optimizer/.... or any 3rd party extensions installed php -v result: C:\wwwroot\bug>php -v PHP 4.3.10 (cgi-fcgi) (built: Dec 14 2004 17:47:59) Copyright (c) 1997-2004 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies Reproduce code: --------------- 795 if (is_object($from)) { 796 $table = $from->__table; 797 $from = array_keys($from->table()); 798 } $from->table() returns a valid array , but $from after assignment becomes NULL. If we modidfy the code in the following way: 795 if (is_object($from)) { 796 $table = $from->__table; $tmp = $from->table(); var_dump($tmp); 797 $from = array_keys($tmp); var_dump($from) die('theend'); 798 } the result will be: array(2) { ["id"]=> int(129) ["name"]=> int(2) } NULL theend moreover if we modify the code in another way: if (is_object($from)) { $table = $from->__table; $tmp = $from->table(); $from = null; $from = array_keys($tmp); } PHP crashes and Windows offers to send a report to Bill Gates :)