#30113 [NEW]: ArrayAccess interface does not implement count functionality

From: Date: Thu, 16 Sep 2004 12:45:01 +0000
Subject: #30113 [NEW]: ArrayAccess interface does not implement count functionality
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-33402@lists.php.net to get a copy of this message
From: kevin at stormtide dot ca Operating system: ANY PHP version: 5.0.1 PHP Bug Type: PECL related Bug description: ArrayAccess interface does not implement count functionality Description: ------------ IN SPL: The ArrayAccess interface does not correcly work with the root level count() function. I realise that the ArrayObject interface supposedly does, however that class requires an array as the basis, and thus is not useful for virtual arrays (like abstracting a large db without ever loading it) Reproduce code: --------------- class somearray implements ArrayAccess { ... overloads and such. function length() { return count($this->internalarrayorabstract); } } $inst = new somearray(); $inst[0] = 'foo'; $inst[1] = 'foo'; $inst[2] = 'foo'; $length = $isnt->length; $countedlength = count($inst); //$length and $countedlength will differ in value with the latter returning 1 always and the former the correct val. Expected result: ---------------- $countedlength == $length Actual result: -------------- $countedlength == 1 -- Edit bug report at http://bugs.php.net/?id=30113&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30113&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30113&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30113&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30113&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30113&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30113&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30113&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30113&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30113&r=support Expected behavior: http://bugs.php.net/fix.php?id=30113&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30113&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30113&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30113&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30113&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30113&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30113&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30113&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30113&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30113&r=mysqlcfg

« previous php.pear.dev (#33402) next »