#43480 [Asn->Opn]: current,next,prev with objects

From: Date: Sun, 02 Dec 2007 22:24:11 +0000
Subject: #43480 [Asn->Opn]: current,next,prev with objects
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120288@lists.php.net to get a copy of this message
ID: 43480 Updated by: tony2001@php.net Reported By: nicholsr@php.net -Status: Assigned +Status: Open Bug Type: Arrays related Operating System: all PHP Version: 5.3CVS-2007-12-02 (snap) Assigned To: jani New Comment: The change makes sense to me. Using array funcs with objects is quite useless feature that should be dropped IMO. Previous Comments: ------------------------------------------------------------------------ [2007-12-02 22:22:57] johannes@php.net Jani, I'd say it's related to your zend_parse_parameters MFH'ing. ------------------------------------------------------------------------ [2007-12-02 22:20:57] nicholsr@php.net 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 this bug report at http://bugs.php.net/?id=43480&edit=1

« previous php.bugs (#120288) next »