php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33621 Exit code 0377 when calling a non-existant method using a dynamic call
Submitted: 2005-07-09 05:17 UTC Modified: 2005-07-11 08:51 UTC
From: davey@php.net Assigned: dmitry (profile)
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5CVS-2005-07-09 (dev) OS: Ubuntu Linux 5.04
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: davey@php.net
New email:
PHP Version: OS:

 

 [2005-07-09 05:17 UTC] davey@php.net
Description:
------------
I'm using head as of 5 minutes ago, approx: 23:10 EST

Calling a non-existant method using the $obj->{$var}() notation causes an unexplained exit of the script with the exit code 0377.

Reproduce code:
---------------
<?php

class foo {
    function __construct()
    {
        $var = "foo";
        $this->{$var}();
    }
}

$foo = new foo;

?>

Expected result:
----------------
Nothing

Actual result:
--------------
With --enable-debug all I get this from gdb:

(gdb) run -f /var/www/php-cvs/testcase/evil_death_variable_method_call_nonexistant.php
Starting program: /var/www/php-cvs/php-src/sapi/cli/php -f /var/www/php-cvs/testcase/evil_death_variable_method_call_nonexistant.php
[Thread debugging using libthread_db enabled]
[New Thread -1214975328 (LWP 9095)]

Program exited with code 0377.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-09 05:56 UTC] davey@php.net
After further testing, I have found two more cases where this error occurs:

When __call is defined, but no args are specified (i.e. function __call() { }) and is_callable() or method_exists() are called, Exit Code 0377 is also given.

Whilst I understand this is an erroneous situation, it should either not care (i.e. func_get_args is being used for some stupid reason) or throw an error.

- Davey
 [2005-07-09 11:39 UTC] tony2001@php.net
Are you sure you have display_errors set to ON ?
I can't see any "crashes" here, only Fatal error and the following exit with status 0377.
Exactly the same result you'll get with 
<?php nonex(); ?>
 [2005-07-11 08:51 UTC] dmitry@php.net
Seems you lose fatal error messages. Set "disaplay_error" and "error_reporting" directives in your php.ini.

Fatal error: Call to undefined method foo::foo() in ...

Fatal error: Method foo::__call() must take exactly 2 arguments in ...
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat May 03 06:01:27 2025 UTC