Bug #63013 [Opn->Fbk]: Error not thrown with constructor call
| From: | aharvey@php.net | Date: | Thu, 06 Sep 2012 01:40:34 +0000 |
| Subject: | Bug #63013 [Opn->Fbk]: Error not thrown with constructor call | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-173204@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63013&edit=1
ID: 63013
Updated by: aharvey@php.net
Reported by: samu dot voutilainen at gmail dot com
Summary: Error not thrown with constructor call
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Linux
PHP Version: 5.4.6
Block user comment: N
Private report: N
New Comment:
I can't reproduce this either. We'll have to wait for the new example.
Can you also provide your display_errors and error_reporting settings, please?
Previous Comments:
------------------------------------------------------------------------
[2012-09-05 14:24:35] samu dot voutilainen at gmail dot com
I donât get the warnings for the case I had; this simpler example does though. Iâll
construct an example with proper namespaces to see if it causes it.
------------------------------------------------------------------------
[2012-09-05 13:20:23] laruence@php.net
PHP will warn you:
PHP Warning: Missing argument 1 for AbstractHandler::__construct(), called in
/tmp/1.php on line 30 and defined in /tmp/1.php on line 18
PHP Warning: Missing argument 2 for AbstractHandler::__construct(), called in
/tmp/1.php on line 30 and defined in /tmp/1.php on line 18
PHP Warning: Missing argument 3 for AbstractHandler::__construct(), called in
/tmp/1.php on line 30 and defined in /tmp/1.php on line 18
------------------------------------------------------------------------
[2012-09-05 10:41:20] samu dot voutilainen at gmail dot com
Also the code I have uses namespaces.
------------------------------------------------------------------------
[2012-09-05 10:37:20] samu dot voutilainen at gmail dot com
Description:
------------
When inheriting from a class and calling constructor with invalid arguments, it wonât throw any
error, but die silently. There is no information in web server log or PHP-FPMâs logs and
nothing is returned to client either.
Test script:
---------------
class SlamObject {
}
class Utility extends SlamObject {
}
abstract class AbstractHandler extends Utility {
protected $version;
protected $session;
protected $output;
public function __construct($session, $output, $version) {
$this->session = $session;
$this->output = $output;
$this->version = $version;
}
}
class Foo extends AbstractClass {
}
$foo = new Foo();
Expected result:
----------------
At the point of Foo, fatal error is thrown telling that you called constructor with wrong arguments.
Actual result:
--------------
Silent death at this point with no information anywhere.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63013&edit=1