php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46263 Incorrect type hinting stops page execution without error
Submitted: 2008-10-09 08:02 UTC Modified: 2008-10-09 13:03 UTC
From: pankkake at headfucking dot net Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
 [2008-10-09 08:02 UTC] pankkake at headfucking dot net
Description:
------------
When using type hinting on a function with a type that isn't allowed (int, string, etc.), PHP stops the execution of the page (it doesn't seem to crash) without any error, making debugging very hard.

Reproduce code:
---------------
public static function getWatchedColumns(string $class)


(I *know* the code is wrong, that's the point.)

Expected result:
----------------
a PHP error

Actual result:
--------------
blank page

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-09 12:22 UTC] jani@php.net
$ php -r 'public static function getWatchedColumns(string $class)'
PHP Parse error:  syntax error, unexpected T_PUBLIC in Command line code on line 1

Perhaps you should give a better example OR simply tune your error reporting (display_errors = On and error_reporting = E_ALL)..

 [2008-10-09 12:56 UTC] pankkake at headfucking dot net
The probles occurs when calling the function, not defining it.

However by calling
error_reporting(E_ALL);
before, I get :

PHP Catchable fatal error:  Argument 1 passed to sfPropelModerationBehavior::getWatchedColumns() must be an instance of string, string given, called in test.php on line 10 and defined in plugins/sfModerationPlugin/lib/sfPropelModerationBehavior.class.php on line 438

I guess we have an issue in our Symfony configuration, the development environment is supposed to be E_ALL|E_STRICT...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 12:01:33 2024 UTC