php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34452 __set type hinting does not provide enough information
Submitted: 2005-09-10 09:11 UTC Modified: 2005-09-12 11:35 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: stochnagara at hotmail dot com Assigned: dmitry
Status: Wont fix Package: Class/Object related
PHP Version: 5CVS-2005-09-10 (snap) OS:
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-09-10 09:11 UTC] stochnagara at hotmail dot com
Description:
------------
This problem is about the error message shown when a type hinting parameter is incorrect and fatal error occurs.

There was a recent changed which enhanced the error message to show the caller of the function/methos which caused a fatal error and debugging became much easier since then.

But there is one case where the additional information is not provided - when __set method is called magically. See example below.

As you may see, the 'defined in ...' statement is missing.

Reproduce code:
---------------
<?
class foo {}

class demo {
	function __set ($name, foo $abc) {}
	function set ($name, foo $abc) {}
}

$demo = new demo;

/* CASE 1 */
$demo->set ('abc', null);

/* CASE 2 */
$demo->__set ('abc', null);

/* CASE 3 */
$demo->abc = null;


Expected result:
----------------
in case 1:

Fatal error: Argument 2 must not be null, called in ...\test.php on line 10 and defined in ...\test.php on line 6

in case 2:

Fatal error: Argument 2 must not be null, called in ...\test.php on line 11 and defined in ...\test.php on line 5

in case 3:

Fatal error: Argument 2 must not be null, called in ...\test.php on line 12 and defined in ...\test.php on line 5



Actual result:
--------------
in case 1:

Fatal error: Argument 2 must not be null, called in ...\test.php on line 10 and defined in ...\test.php on line 6

in case 2:

Fatal error: Argument 2 must not be null, called in ...\test.php on line 11 and defined in ...\test.php on line 5

in case 3:

Fatal error: Argument 2 must not be null in ...\test.php on line 5


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-10 23:27 UTC] sniper@php.net
Dmitry, can you fix this?

 [2005-09-12 11:35 UTC] dmitry@php.net
We should live with current behavior, because __set() is called implicity. There is no call and second parameter in "$demo->abc = null;".

 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC