#48004 [Opn->Fbk]: Error handler prevents creation of default object

From: Date: Fri, 17 Apr 2009 16:52:40 +0000
Subject: #48004 [Opn->Fbk]: Error handler prevents creation of default object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-135931@lists.php.net to get a copy of this message
 ID:               48004
 Updated by:       jani@php.net
 Reported By:      daniel dot mueller at inexio dot net
-Status:           Open
+Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: FreeBSD 7.1-RELEASE
 PHP Version:      5.3.0RC1
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------

[2009-04-17 11:27:53] daniel dot mueller at inexio dot net

Description:
------------
The creation of a default object from an empty value triggers a
warning
with level E_STRICT.

If an error handler catches this warning, in some cases the automatic
initialization of the object fails.

Without error handler, everything works as expected.

Affected versions: 5.3.0RC1, 5.3.0alpha3
Not affected: 5.2.x 

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

function error_handler($errno, $errstr, $errfile, $errline,
$errcontext)
{
        return true;
}

function test()
{
        $data->id = 1;
        var_dump($data);
}

set_error_handler("error_handler");

test();


Expected result:
----------------
object(stdClass)#1 (1) {
  ["id"]=>
  int(1)
}


Actual result:
--------------
NULL


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48004&edit=1



Thread (5 messages)

« previous php.bugs (#135931) next »