";
$bar = new Bug();
$baz = $bar->foo();
$baz2 = $bar->foo2();
$baz3 = $bar->foo3();
print "
";
class Bug {
var $_flag;
function Bug() {
$this->_flag = 0;
}
/* This function gives the Notice, but it shouldn't */
function &foo() {
if (!$this->_flag) {
$false = false;
return $false; /* this is line 23 */
}
$false = false;
return $false;
}
/* This function seems to be equivalent, but it doesn't give the Notice */
function &foo2() {
$false = false;
if (true) {
return $false;
}
$false = false;
return $false;
}
/* This function seems to be equivalent, but it doesn't give the Notice */
function &foo3() {
$false = false;
if (!$this->_flag) {
return $false;
}
$false = false;
return $false;
}
}
?>
Expected result: ---------------- PHP Version is: 4.4.0 no NOTICEs Actual result: -------------- php version is: 4.4.0 Notice: Only variable references should be returned by reference in php440_notice_bug_on_certain_platforms.php on line 23 Unexpected result oberserved on - http://nl01.pcextreme.nl/phpinfo.php (PHP 4.4.0, Linux Linux i686) - PHP 4.4.0 cgi hosted by Powweb.com, Apache/1.3.33 (Unix) FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7d PowWeb/1.1, FreeBSD clust05-www01.powweb.com 4.11-RELEASE FreeBSD 4.11-RELEASE #0: Thu Ma i386 - Gentoo linux, PHP 4.4.0, apache 2, x86: http://dev.nei.ch/bugs/php440_notice_bug/phpinfo_gentoo_with_bug.html Correct behavior observed on - dozens / hundreds other servers, e.g. - Windows XP SP 2, PHP 4.4.0 cgi, apache 2, x86 - Gentoo linux, PHP 4.4.0, apache 2, x86: http://dev.nei.ch/bugs/php440_notice_bug/phpinfo_gentoo_without_bug.html (this is another gentoo box, completely unrelated to the other)