PHP 4.0 Bug #7347 Updated: PHP does not report fatal errors
| From: | stas@php.net | Date: | Sun, 22 Oct 2000 15:07:45 +0000 |
| Subject: | PHP 4.0 Bug #7347 Updated: PHP does not report fatal errors | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-35779@lists.php.net to get a copy of this message | ||
ID: 7347
Updated by: stas
Reported By: cjw@cwible.com
Status: Analyzed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
Seems to be a real bug, probably linked to "undefined passed by reference" bug.
Previous Comments:
---------------------------------------------------------------------------
[2000-10-19 14:02:22] cjw@cwible.com
When I run the code below, as it stands. I get the following output - which is clearly incorrect!
Cullin
Performing test A:...
testA:
forceError: called
holder->test() called!
testPrint: a: Param 2
testPrint: b: Param 2
Performing test B:...
testB: 1
forceError: called
Fatal error: Call to a member function on a non-object in /usr/home/cjw/www/function.php on line 36
<?
/* try changing the values for testA and testB */
/* from true to false. You will find that when */
/* testA is called with a false or undefuned */
/* value, PHP will not report any errors */
/* and the testPrint will print incorrect */
/* parameters. - Go figure! cwible@cwible.com */
print "<B>Performing test A:...<BR></B>";
testA(getHashVal('false'));
print "<P>";
print "<B>Performing test B:...<BR></B>";
print testB(getHashVal('true'));
/* create a new object, then call forceError */
function testA (&$var_a) {
print "testA: $var_a<BR>";
$obj = new holder();
forceError();
};
/* create a new object, then call forceError */
/* the only difference here is that $var_a */
/* is not a reference - go figure */
function testB ($var_a) {
print "testB: $var_a<BR>";
$obj = new holder();
forceError();
};
/* call a method on an undefined object */
function forceError () {
print "forceError: called<BR>n";
$notanobject->test();
testPrint("Param 1","Param 2");
};
/* just print our parameters */
function testPrint($a,$b) {
print "testPrint: a: " . $a . "<BR>n";
print "testPrint: b: " . $b . "<BR>n";
};
/* return a value from a hash */
function getHashVal($var) {
$hash['true'] = true;
unset($hash['false']);
return($hash[$var]);
}
/* a class that just prints text */
class holder {
function test() {
print "<B>holder->test() called!</B><BR>n";
return;
}
};
?>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7347