#33169 [NEW]: ArrayAccess doesn't work at all
From: tomas_matousek at hotmail dot com Operating system: WinXP PHP version: 5.0.4 PHP Bug Type: Zend Engine 2 problem Bug description: ArrayAccess doesn't work at all Description: I looks like you have never do in-depth testing with ArrayAccess. I you did you must realize many things are wrong there. It took me less then 5 minutes to kill PHP several times using this naively implemented feature. Reproduce code: --- class ArrayClass implements ArrayAccess { public $a = array(); function offsetExists($index) { return array_key_exists($index, $this->a); } function offsetGet($index) { return $this->a[$index]; } function offsetSet($index, $newval) { return $this->a[$index] = $newval; } function offsetUnset($index) { unset($this->a[$index]); } } Expected result: It's unclear for me what should I expect. Definitly not the crashes. Can anyone explain, what should I expect from e.g. $obj[1][2][3] = 1; ? And what should $a =& $obj[1][2][3]; do? Actual result: -- $obj[array()] = 1; // crash $obj[][] = 1; // crash $x =& $obj[1] // crash $obj[$obj[1]] = 1; // if offsetGet() returns null, the offsetSet() is called then $obj[1]++; // doesn't work at all even if both offsetGet and offsetSet are modified to return by reference -- Edit bug report at http://bugs.php.net/?id=33169&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33169&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33169&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33169&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33169&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33169&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33169&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33169&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33169&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33169&r=support Expected behavior: http://bugs.php.net/fix.php?id=33169&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33169&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33169&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33169&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33169&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33169&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33169&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33169&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33169&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33169&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33169&r=mysqlcfg
#33169 [Opn]: ArrayAccess doesn't work at all
ID: 33169 User updated by: tomas_matousek at hotmail dot com Reported By: tomas_matousek at hotmail dot com Status: Open Bug Type: Zend Engine 2 problem Operating System: WinXP PHP Version: 5.0.4 New Comment: I'm sorry for mystifying with: $obj[][] = 1; it doesn't crash yet reports strange error even if I return an array by reference from offsetGet(): Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in C:\Web\$PhpTests\y.php on line 32. this also works fine: $obj[$obj[1]] = 1; but others don't $obj[$obj[1]] = 1; Previous Comments: [2005-05-28 10:09:46] tomas_matousek at hotmail dot com Description: I looks like you have never do in-depth testing with ArrayAccess. I you did you must realize many things are wrong there. It took me less then 5 minutes to kill PHP several times using this naively implemented feature. Reproduce code: --- class ArrayClass implements ArrayAccess { public $a = array(); function offsetExists($index) { return array_key_exists($index, $this->a); } function offsetGet($index) { return $this->a[$index]; } function offsetSet($index, $newval) { return $this->a[$index] = $newval; } function offsetUnset($index) { unset($this->a[$index]); } } Expected result: It's unclear for me what should I expect. Definitly not the crashes. Can anyone explain, what should I expect from e.g. $obj[1][2][3] = 1; ? And what should $a =& $obj[1][2][3]; do? Actual result: -- $obj[array()] = 1; // crash $obj[][] = 1; // crash $x =& $obj[1] // crash $obj[$obj[1]] = 1; // if offsetGet() returns null, the offsetSet() is called then $obj[1]++; // doesn't work at all even if both offsetGet and offsetSet are modified to return by reference -- Edit this bug report at http://bugs.php.net/?id=33169&edit=1
#32979 [Fbk->Opn]: socket stream opened with stream_socket_client doesnt work with stream_select
ID: 32979 User updated by: mjpph at stardust dot fi Reported By: mjpph at stardust dot fi -Status: Feedback +Status: Open Bug Type: Network related Operating System: Linux (Fedora Core 3) PHP Version: 5CVS-2005-05-08 (dev) Assigned To: wez New Comment: Sure thing, just tell me what to do. I've never even heard of valgrind before, but it seems FC3 comes with one. Previous Comments: [2005-05-28 04:39:07] [EMAIL PROTECTED] That's the missing piece of the puzzle. openssl replaces the default tcp transport, but passes through to the default when you don't request ssl. So, the behaviour should be identical. Can you run the openssl enabled version under valgrind for me, to see if something is misbehaving? It'll give me a headstart when I sit down to solve the problem in the morning. Thanks. [2005-05-27 22:05:33] mjpph at stardust dot fi It's too bad that the openssl screws up the stream_select or stream_socket_client in some weird way as I intended to use stream_socket_enable_crypto() with the stream_socket_client() and it's dependant of openssl. [2005-05-27 21:52:35] mjpph at stardust dot fi The strangest thing.. I had time to do some test compiles with the 200505260030 snapshot and I got some working. I took my usual parameters off from configure one by one, after I removed --with-openssl the script started suddenly working. Then I did test compile with ./configure --with-openssl and without any parameters. The one --with-openssl failed the script and the one without it worked just fine. It seems that the openssl support does some havoc which causes the failures. I did proper make clean / make distclean between the compiles and doublechecked the results. Linux is a Fedora Core 3, standard install with development support enabled. The test script is as follows, the host machine has sendmail running as a test service. Strace from the working PHP (without any configure parameters): read(3, "http://bugs.php.net/32979 -- Edit this bug report at http://bugs.php.net/?id=32979&edit=1
#32979 [Opn]: socket stream opened with stream_socket_client doesnt work with stream_select
ID: 32979 User updated by: mjpph at stardust dot fi Reported By: mjpph at stardust dot fi Status: Open Bug Type: Network related Operating System: Linux (Fedora Core 3) PHP Version: 5CVS-2005-05-08 (dev) Assigned To: wez New Comment: I guess you need valgrind --tool=callgrind. Also on another matter, I'm unable to compile the newest CVS on FC3. I get this error even without any configure options : libtool: link: `ext/libxml/libxml.lo' is not a valid libtool object. Previous Comments: [2005-05-28 11:03:00] mjpph at stardust dot fi Sure thing, just tell me what to do. I've never even heard of valgrind before, but it seems FC3 comes with one. [2005-05-28 04:39:07] [EMAIL PROTECTED] That's the missing piece of the puzzle. openssl replaces the default tcp transport, but passes through to the default when you don't request ssl. So, the behaviour should be identical. Can you run the openssl enabled version under valgrind for me, to see if something is misbehaving? It'll give me a headstart when I sit down to solve the problem in the morning. Thanks. [2005-05-27 22:05:33] mjpph at stardust dot fi It's too bad that the openssl screws up the stream_select or stream_socket_client in some weird way as I intended to use stream_socket_enable_crypto() with the stream_socket_client() and it's dependant of openssl. [2005-05-27 21:52:35] mjpph at stardust dot fi The strangest thing.. I had time to do some test compiles with the 200505260030 snapshot and I got some working. I took my usual parameters off from configure one by one, after I removed --with-openssl the script started suddenly working. Then I did test compile with ./configure --with-openssl and without any parameters. The one --with-openssl failed the script and the one without it worked just fine. It seems that the openssl support does some havoc which causes the failures. I did proper make clean / make distclean between the compiles and doublechecked the results. Linux is a Fedora Core 3, standard install with development support enabled. The test script is as follows, the host machine has sendmail running as a test service. Strace from the working PHP (without any configure parameters): read(3, "http://bugs.php.net/32979 -- Edit this bug report at http://bugs.php.net/?id=32979&edit=1
#32979 [Opn]: socket stream opened with stream_socket_client doesnt work with stream_select
ID: 32979 User updated by: mjpph at stardust dot fi Reported By: mjpph at stardust dot fi Status: Open Bug Type: Network related Operating System: Linux (Fedora Core 3) PHP Version: 5CVS-2005-05-08 (dev) Assigned To: wez New Comment: A problem. I'm running x86_64 FC3 and PHP and valgrind seems to be able to do 32bit executables only. Previous Comments: [2005-05-28 11:06:46] mjpph at stardust dot fi I guess you need valgrind --tool=callgrind. Also on another matter, I'm unable to compile the newest CVS on FC3. I get this error even without any configure options : libtool: link: `ext/libxml/libxml.lo' is not a valid libtool object. [2005-05-28 11:03:00] mjpph at stardust dot fi Sure thing, just tell me what to do. I've never even heard of valgrind before, but it seems FC3 comes with one. [2005-05-28 04:39:07] [EMAIL PROTECTED] That's the missing piece of the puzzle. openssl replaces the default tcp transport, but passes through to the default when you don't request ssl. So, the behaviour should be identical. Can you run the openssl enabled version under valgrind for me, to see if something is misbehaving? It'll give me a headstart when I sit down to solve the problem in the morning. Thanks. [2005-05-27 22:05:33] mjpph at stardust dot fi It's too bad that the openssl screws up the stream_select or stream_socket_client in some weird way as I intended to use stream_socket_enable_crypto() with the stream_socket_client() and it's dependant of openssl. [2005-05-27 21:52:35] mjpph at stardust dot fi The strangest thing.. I had time to do some test compiles with the 200505260030 snapshot and I got some working. I took my usual parameters off from configure one by one, after I removed --with-openssl the script started suddenly working. Then I did test compile with ./configure --with-openssl and without any parameters. The one --with-openssl failed the script and the one without it worked just fine. It seems that the openssl support does some havoc which causes the failures. I did proper make clean / make distclean between the compiles and doublechecked the results. Linux is a Fedora Core 3, standard install with development support enabled. The test script is as follows, the host machine has sendmail running as a test service. Strace from the working PHP (without any configure parameters): read(3, "http://bugs.php.net/32979 -- Edit this bug report at http://bugs.php.net/?id=32979&edit=1
#33169 [Opn->Fbk]: ArrayAccess doesn't work at all
ID: 33169 Updated by: [EMAIL PROTECTED] Reported By: tomas_matousek at hotmail dot com -Status: Open +Status: Feedback Bug Type: Zend Engine 2 problem Operating System: WinXP PHP Version: 5.0.4 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip Can't reproduce any of these problems with latest CVS (of course, if "Warning: Illegal offset type" is not a mentined "crash"). Previous Comments: [2005-05-28 10:20:56] tomas_matousek at hotmail dot com I'm sorry for mystifying with: $obj[][] = 1; it doesn't crash yet reports strange error even if I return an array by reference from offsetGet(): Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in C:\Web\$PhpTests\y.php on line 32. this also works fine: $obj[$obj[1]] = 1; but others don't $obj[$obj[1]] = 1; [2005-05-28 10:09:46] tomas_matousek at hotmail dot com Description: I looks like you have never do in-depth testing with ArrayAccess. I you did you must realize many things are wrong there. It took me less then 5 minutes to kill PHP several times using this naively implemented feature. Reproduce code: --- class ArrayClass implements ArrayAccess { public $a = array(); function offsetExists($index) { return array_key_exists($index, $this->a); } function offsetGet($index) { return $this->a[$index]; } function offsetSet($index, $newval) { return $this->a[$index] = $newval; } function offsetUnset($index) { unset($this->a[$index]); } } Expected result: It's unclear for me what should I expect. Definitly not the crashes. Can anyone explain, what should I expect from e.g. $obj[1][2][3] = 1; ? And what should $a =& $obj[1][2][3]; do? Actual result: -- $obj[array()] = 1; // crash $obj[][] = 1; // crash $x =& $obj[1] // crash $obj[$obj[1]] = 1; // if offsetGet() returns null, the offsetSet() is called then $obj[1]++; // doesn't work at all even if both offsetGet and offsetSet are modified to return by reference -- Edit this bug report at http://bugs.php.net/?id=33169&edit=1
#32979 [Opn]: socket stream opened with stream_socket_client doesnt work with stream_select
ID: 32979 User updated by: mjpph at stardust dot fi Reported By: mjpph at stardust dot fi Status: Open Bug Type: Network related Operating System: Linux (Fedora Core 3) PHP Version: 5CVS-2005-05-08 (dev) Assigned To: wez New Comment: Looks like this might also be a x86_64 problem. As I compiled the same exact version on i386 FC3 and got it working even with openssl compiled in. Previous Comments: [2005-05-28 11:37:29] mjpph at stardust dot fi A problem. I'm running x86_64 FC3 and PHP and valgrind seems to be able to do 32bit executables only. [2005-05-28 11:06:46] mjpph at stardust dot fi I guess you need valgrind --tool=callgrind. Also on another matter, I'm unable to compile the newest CVS on FC3. I get this error even without any configure options : libtool: link: `ext/libxml/libxml.lo' is not a valid libtool object. [2005-05-28 11:03:00] mjpph at stardust dot fi Sure thing, just tell me what to do. I've never even heard of valgrind before, but it seems FC3 comes with one. [2005-05-28 04:39:07] [EMAIL PROTECTED] That's the missing piece of the puzzle. openssl replaces the default tcp transport, but passes through to the default when you don't request ssl. So, the behaviour should be identical. Can you run the openssl enabled version under valgrind for me, to see if something is misbehaving? It'll give me a headstart when I sit down to solve the problem in the morning. Thanks. [2005-05-27 22:05:33] mjpph at stardust dot fi It's too bad that the openssl screws up the stream_select or stream_socket_client in some weird way as I intended to use stream_socket_enable_crypto() with the stream_socket_client() and it's dependant of openssl. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/32979 -- Edit this bug report at http://bugs.php.net/?id=32979&edit=1
#33170 [NEW]: IPv6: gethostbyname() fails on resolving IPv6 hostnames
From: web at vollbrecht dot net Operating system: Linux 2.6.10-1 PHP version: 4.3.10 PHP Bug Type: Network related Bug description: IPv6: gethostbyname() fails on resolving IPv6 hostnames Description: perhaps related to #12678. gethostbyname() gives the IPv6 hostname back instead if the IPv6 ip. In IPv4 everything works fine. Note: IPs and hostnames in the following snipplets are replaced with example entries. It was tested with working IPs both in IPv4 and IPv6. Reproduce code: --- $client_ip = $_SERVER["REMOTE_ADDR"]; $client_hostname = gethostbyaddr($_SERVER["REMOTE_ADDR"]); $client_hostname2ip = gethostbyname(gethostbyaddr($_SERVER["REMOTE_ADDR"])); echo $client_ip."->".$client_hostname."->".$client_hostname2ip; Expected result: In IPv4: 10.11.12.13->server.domain.de->10.11.12.13 In IPv6: 3ffe:1::1->server.ipv6.domain.de->3ffe:1::1 Actual result: -- In IPv4 (working fine): 10.11.12.13->server.domain.de->10.11.12.13 In IPv6 (last output broken): 3ffe:1::1->server.ipv6.domain.de->server.ipv6.domain.de -- Edit bug report at http://bugs.php.net/?id=33170&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33170&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33170&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33170&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33170&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33170&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33170&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33170&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33170&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33170&r=support Expected behavior: http://bugs.php.net/fix.php?id=33170&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33170&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33170&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33170&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33170&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33170&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33170&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33170&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33170&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33170&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33170&r=mysqlcfg
#33169 [Fbk->Bgs]: ArrayAccess doesn't work at all
ID: 33169 User updated by: tomas_matousek at hotmail dot com Reported By: tomas_matousek at hotmail dot com -Status: Feedback +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: WinXP PHP Version: 5.0.4 New Comment: Sorry for confusing report. I've tested in on 5.0.3 instead of 5.0.4. In the previous version, almost nothing has worked. In 5.0.4. it seems to be ok. So this is a bogus, sorry for that. Previous Comments: [2005-05-28 11:46:50] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip Can't reproduce any of these problems with latest CVS (of course, if "Warning: Illegal offset type" is not a mentined "crash"). [2005-05-28 10:20:56] tomas_matousek at hotmail dot com I'm sorry for mystifying with: $obj[][] = 1; it doesn't crash yet reports strange error even if I return an array by reference from offsetGet(): Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in C:\Web\$PhpTests\y.php on line 32. this also works fine: $obj[$obj[1]] = 1; but others don't $obj[$obj[1]] = 1; [2005-05-28 10:09:46] tomas_matousek at hotmail dot com Description: I looks like you have never do in-depth testing with ArrayAccess. I you did you must realize many things are wrong there. It took me less then 5 minutes to kill PHP several times using this naively implemented feature. Reproduce code: --- class ArrayClass implements ArrayAccess { public $a = array(); function offsetExists($index) { return array_key_exists($index, $this->a); } function offsetGet($index) { return $this->a[$index]; } function offsetSet($index, $newval) { return $this->a[$index] = $newval; } function offsetUnset($index) { unset($this->a[$index]); } } Expected result: It's unclear for me what should I expect. Definitly not the crashes. Can anyone explain, what should I expect from e.g. $obj[1][2][3] = 1; ? And what should $a =& $obj[1][2][3]; do? Actual result: -- $obj[array()] = 1; // crash $obj[][] = 1; // crash $x =& $obj[1] // crash $obj[$obj[1]] = 1; // if offsetGet() returns null, the offsetSet() is called then $obj[1]++; // doesn't work at all even if both offsetGet and offsetSet are modified to return by reference -- Edit this bug report at http://bugs.php.net/?id=33169&edit=1
#33171 [NEW]: foreach enumerates private fields declared in base classes
From: ladislav dot prosek at matfyz dot cz Operating system: Win XP Pro SP2 PHP version: 5.0.4 PHP Bug Type: Zend Engine 2 problem Bug description: foreach enumerates private fields declared in base classes Description: Using foreach on $this results in enumerating not only visible fields (i.e. public and protected field declared along the inheritance hierarchy + private fields declared in current class) but also all private fields declared along the inheritance hierarchy. This is wrong since those fields are not visible and should not be accessible. By the way, the foreach documentation page still says "foreach works only on arrays...". Perhaps you should consider updating it ;-) Reproduce code: --- class A { private $c = "A's c"; } class B extends A { private $c = "B's c"; public function go() { foreach ($this as $key => $val) { echo "$key => $val\n"; } } }; $x = new B; $x->go(); Expected result: c => B's c Actual result: -- c => B's c c => A's c -- Edit bug report at http://bugs.php.net/?id=33171&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33171&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33171&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33171&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33171&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33171&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33171&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33171&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33171&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33171&r=support Expected behavior: http://bugs.php.net/fix.php?id=33171&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33171&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33171&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33171&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33171&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33171&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33171&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33171&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33171&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33171&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33171&r=mysqlcfg
#33172 [NEW]: changing array during foreach iteration
From: tomas_matousek at hotmail dot com Operating system: WinXP PHP version: 5.0.4 PHP Bug Type: Scripting Engine problem Bug description: changing array during foreach iteration Description: The behavior of foreach statment with reference value is not imho right if the array gets modified during iteration. See the code I've pasted here. If the array is written to (either by unset or by a write operation) during iteration, the effect of & is canceled, i.e. the values are not modified since the write operation. This seems to me as bug because it is inconsistent with the "definition" of foreach which should say that foreach($a as $k => $v) {} is (more or less) equivalent to $copy_of_a = $a; while(next($copy_of_a)) { $k = key($copy_of_a); $v = $copy_of_a[$k]; } With the &, one can deduce the following "definition": foreach($a as $k =>& $v) { } is equivalent to $copy_of_a = $a; while(next($copy_of_a)) { $k = key($copy_of_a); $v =& $a[$k]; } Using =& operator, a new value should be added if it has been unset in the original array. Reproduce code: --- $a = array(0,1,2,3,4,5,6,7,8); $i = 0; foreach ($a as $k =>& $v) { $v+=100; if ($i++==2) { unset($a[5]); } } var_dump($a); Expected result: array(8) { [0]=> int(100) [1]=> int(101) [2]=> int(102) [3]=> int(3) // modification of values stops here [4]=> int(4) [6]=> int(6) [7]=> int(7) [8]=> int(8) } Actual result: -- array(8) { [0]=> int(100) [1]=> int(101) [2]=> int(102) [3]=> int(103) [4]=> int(104) [6]=> int(106) [7]=> int(107) [8]=> int(108) [5]=>// note: the new value should be added here int(100) } -- Edit bug report at http://bugs.php.net/?id=33172&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33172&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33172&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33172&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33172&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33172&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33172&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33172&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33172&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33172&r=support Expected behavior: http://bugs.php.net/fix.php?id=33172&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33172&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33172&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33172&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33172&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33172&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33172&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33172&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33172&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33172&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33172&r=mysqlcfg
#33172 [Opn]: changing array during foreach iteration
ID: 33172 User updated by: tomas_matousek at hotmail dot com Reported By: tomas_matousek at hotmail dot com Status: Open Bug Type: Scripting Engine problem Operating System: WinXP PHP Version: 5.0.4 New Comment: Well, I've swapped the expected and the actual results. I would expect all values of the array to be modified. Previous Comments: [2005-05-28 16:24:41] tomas_matousek at hotmail dot com Description: The behavior of foreach statment with reference value is not imho right if the array gets modified during iteration. See the code I've pasted here. If the array is written to (either by unset or by a write operation) during iteration, the effect of & is canceled, i.e. the values are not modified since the write operation. This seems to me as bug because it is inconsistent with the "definition" of foreach which should say that foreach($a as $k => $v) {} is (more or less) equivalent to $copy_of_a = $a; while(next($copy_of_a)) { $k = key($copy_of_a); $v = $copy_of_a[$k]; } With the &, one can deduce the following "definition": foreach($a as $k =>& $v) { } is equivalent to $copy_of_a = $a; while(next($copy_of_a)) { $k = key($copy_of_a); $v =& $a[$k]; } Using =& operator, a new value should be added if it has been unset in the original array. Reproduce code: --- $a = array(0,1,2,3,4,5,6,7,8); $i = 0; foreach ($a as $k =>& $v) { $v+=100; if ($i++==2) { unset($a[5]); } } var_dump($a); Expected result: array(8) { [0]=> int(100) [1]=> int(101) [2]=> int(102) [3]=> int(3) // modification of values stops here [4]=> int(4) [6]=> int(6) [7]=> int(7) [8]=> int(8) } Actual result: -- array(8) { [0]=> int(100) [1]=> int(101) [2]=> int(102) [3]=> int(103) [4]=> int(104) [6]=> int(106) [7]=> int(107) [8]=> int(108) [5]=>// note: the new value should be added here int(100) } -- Edit this bug report at http://bugs.php.net/?id=33172&edit=1
#33173 [NEW]: Bug in PHP 4.3.11 display_error.
From: max at jestsuper dot pl Operating system: FreeBSD PHP version: 4.3.11 PHP Bug Type: *General Issues Bug description: Bug in PHP 4.3.11 display_error. Description: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Author: cXIb8O3(Maksymilian Arciemowicz) Date: 28.5.2005 from securityreason.com TEAM - --- 0. Bug in PHP 4.3.11 display_error. --- This bug can be danger, because someone can do xss and Phishing attack. Problem exist in display_errors.. Example php script: and now request is ?varible=XXX so can we see any error. - --- Warning: main(XXX): failed to open stream: No such file or directory in /www/dupa.php on line 2 Warning: main(): Failed opening 'XXX' for inclusion (include_path='.:') in /www/dupa.php on line 2 - --- Normal. But now varible have for example SR And error messages is: - --- Warning: main( SR ): failed to open stream: No such file or directory in /www/dupa.php on line 2 Warning: main(): Failed opening 'SR' for inclusion (include_path='.:') in /www/dupa.php on line 2 - --- So XSS... Danger can be tag