php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7347 PHP does not report fatal errors
Submitted: 2000-10-19 14:02 UTC Modified: 2000-12-07 11:55 UTC
From: cjw at cwible dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.3pl1 OS: RedHat Linux 6.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cjw at cwible dot com
New email:
PHP Version: OS:

 

 [2000-10-19 14:02 UTC] cjw at cwible dot 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;
        }
    };

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-22 11:07 UTC] stas@php.net
Seems to be a real bug, probably linked to "undefined passed by reference" bug.
 [2000-11-05 11:41 UTC] stas@php.net
Since that "undef-by-reference" bug was fixed, pelase check a latest version from snaps.php.net if this bug is fixed.
 [2000-12-07 11:55 UTC] sniper@php.net
Reopen, if this still happens when using latest snapshot
from http://snaps.php.net/

--Jani
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jul 15 12:00:01 2026 UTC