#34452 [NEW]: __set type hinting does not provide enough information
| From: | stochnagara at hotmail dot com | Date: | Sat, 10 Sep 2005 07:11:39 +0000 |
| Subject: | #34452 [NEW]: __set type hinting does not provide enough information | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-84820@lists.php.net to get a copy of this message | ||
From: stochnagara at hotmail dot com
Operating system:
PHP version: 5CVS-2005-09-10 (snap)
PHP Bug Type: Class/Object related
Bug description: __set type hinting does not provide enough information
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
--
Edit bug report at http://bugs.php.net/?id=34452&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34452&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34452&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34452&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34452&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34452&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34452&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34452&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34452&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34452&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34452&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34452&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34452&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34452&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34452&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34452&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34452&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34452&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34452&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34452&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34452&r=mysqlcfg