#43480 [NEW]: current,next,prev with objects

From: Date: Sun, 02 Dec 2007 22:20:57 +0000
Subject: #43480 [NEW]: current,next,prev with objects
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120285@lists.php.net to get a copy of this message
From: nicholsr@php.net Operating system: all PHP version: 5.3CVS-2007-12-02 (snap) PHP Bug Type: Arrays related Bug description: current,next,prev with objects Description: ------------ The array functions current, next,prev and possibly others no longer work on objects on php5.3. The expected result below was obtained on php 5.2. I noticed that at least one of the testcases were changed in order to avoid calling out this change in behaviour so i wondered if it was deliberate. Specifically, ext/standard/tests/array/009.phpt in PHP 5.2 will check for object behaviour but this was removed in 5.3. Reproduce code: --------------- <?php class myclass { public $prop1="prop1"; public $prop2="prop2"; }; $obj=new myclass(); var_dump (current($obj)); next ($obj); var_dump (current($obj)); ?> Expected result: ---------------- string(5) "prop1" string(5) "prop2" Actual result: -------------- Warning: current() expects parameter 1 to be array, object given in 1.php on line 12 NULL Warning: next() expects parameter 1 to be array, object given in 1.php on line 13 Warning: current() expects parameter 1 to be array, object given in 1.php on line 14 NULL -- Edit bug report at http://bugs.php.net/?id=43480&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43480&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43480&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43480&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43480&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43480&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43480&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43480&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43480&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43480&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43480&r=support Expected behavior: http://bugs.php.net/fix.php?id=43480&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43480&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43480&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43480&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43480&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43480&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43480&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43480&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43480&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43480&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43480&r=mysqlcfg

« previous php.bugs (#120285) next »