ID: 44191 Updated by: [EMAIL PROTECTED] Reported By: admin at ifyouwantblood dot de -Status: Open +Status: Closed Bug Type: PCRE related Operating System: Windows XP PHP Version: 5.2.5 New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2008-02-20 19:03:47] admin at ifyouwantblood dot de Description: ------------ preg_grep messes up the given array. Reproduce code: --------------- <?php $array=Array(1,2,3); debug_zval_dump($array); echo "<br>\n"; debug_zval_dump(preg_grep('/asdf/',$array)); echo "<br>\n"; while(list($key,$value)=each($array)) echo "Array: ".$value." "; echo "<br>\n"; debug_zval_dump($array); echo "<br>\n"; ?> Expected result: ---------------- array(3) refcount(2){ [0]=> long(1) refcount(1) [1]=> long(2) refcount(1) [2]=> long(3) refcount(1) } array(0) refcount(1){ } Array: 1 Array: 2 Array: 3 array(3) refcount(2){ [0]=> long(1) refcount(1) [1]=> long(2) refcount(1) [2]=> long(3) refcount(1) } Actual result: -------------- ----PHP6 Build Jan 20 2008 18:04:22---- array(3) refcount(2){ [0]=> long(1) refcount(1) [1]=> long(2) refcount(1) [2]=> long(3) refcount(1) } array(0) refcount(1){ } array(3) refcount(2){ [0]=> long(1) refcount(1) [1]=> long(2) refcount(1) [2]=> long(3) refcount(1) } -----PHP5.2.5 array(3) refcount(2){ [0]=> long(1) refcount(1) [1]=> long(2) refcount(1) [2]=> long(3) refcount(1) } array(0) refcount(1){ } array(3) refcount(2){ [0]=> string(1) "1" refcount(1) [1]=> string(1) "2" refcount(1) [2]=> string(1) "3" refcount(1) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44191&edit=1