ID: 47576 User updated by: fischikowski at web dot de Reported By: fischikowski at web dot de -Status: Feedback +Status: Open Bug Type: Scripting Engine problem Operating System: Windows Vista 32bit PHP Version: 5.2.9 New Comment:
Too bad... on my system (and the systems of two friends) we could reproduce this bug. Maybe we will find out more about the circumstances, when we try to reproduce it during our lecture (starting end of april). Until then I will not be able to provide any new feedback. Previous Comments: ------------------------------------------------------------------------ [2009-04-06 12:52:06] j...@php.net Works fine on windows, linux 32/64bit for me. ------------------------------------------------------------------------ [2009-03-10 14:43:21] fischikowski at web dot de I don't think to use any. I am using PHP on an apache-webserver, if that makes a difference. Could also not reproduce this on linux with Version 5.2.6, had no higher versions on a linux system to test it. Will try that later. ------------------------------------------------------------------------ [2009-03-10 13:51:43] scott...@php.net I can't reproduce this on Linux or OS X Do you have any Zend Extensions enabled such as eAccelerator, APC, Zend Optimizer or anything like that? ------------------------------------------------------------------------ [2009-03-10 10:42:39] fischikowski at web dot de Except from the "<?php" and "?>" I already posted the shorter script. <?php function test() { $array = array("test"); foreach($array as $element) { for($j=0;$j<5;$j++) { continue 2; } //inserting code here affects return-value return true; } return false; } echo test()?"true":"false"; ?> ------------------------------------------------------------------------ [2009-03-05 17:34:29] fischikowski at web dot de Description: ------------ The echo ""; affects the "return true;" below. As long as the echo is there everything works as expected, if you put "//" in front of the echo, the return will be called even if it should not. Reproduce code: --------------- function matchHostList($host, $list_file) { $host = explode(".", $host); //$list_contents = explode("\n", file_get_contents($list_file)); $list_contents = array("www.google.de"); foreach($list_contents as $list_host) { $list_host = explode(".", rtrim($list_host)); //if the list-host is more specific than the tested host we can't match if(count($host) < count($list_host)) continue; for($i = 1;$i<=count($list_host) && $i <= count($host);$i++) { if($list_host[count($list_host)-$i] != $host[count($host)-$i]) continue 2; } echo ""; //this is necessary to avoid wrong return return true; } return false; } echo matchHostList("false.google.de", "")?"true":"false"; Expected result: ---------------- When running as shown above this returns false (because "continue 2;" continues the loop above the "return true;"), this is OK. If you remove the echo ""; above the "return true;" You would expect that nothing changes (because we only removed some null-output), but in fact the return value changes to true. Actual result: -------------- see Expected result ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47576&edit=1