#46241 [Com]: Error handler stacking broken

2008-10-28 Thread typo3 at maltejansen dot de
 ID:   46241
 Comment by:   typo3 at maltejansen dot de
 Reported By:  [EMAIL PROTECTED]
 Status:   Assigned
 Bug Type: Reproducible crash
 Operating System: Gentoo
 PHP Version:  5.3.0alpha2
 Assigned To:  colder
 New Comment:

Just a notice.
This bug has the same origin as http://bugs.php.net/bug.php?id=46220


Previous Comments:


[2008-10-22 22:32:01] [EMAIL PROTECTED]

Upgrading to critical, as it is a crash and clear breakage of
functionality.



[2008-10-21 21:04:33] clemens dot kalb at netlogix dot de

Here is one thing that has been more clear in the other, duplicate and
now closed - bug entry (#46338). The first code sample with object
methods does not only miss out on the second error handler, it also
segfaults *on shutdown* of the PHP process:

---SNIP-
Starting program: /usr/bin/php5 segfault2.php
[Thread debugging using libthread_db enabled]
[New Thread -1215695168 (LWP 5622)]
Caught on first level: 'Foo'

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1215695168 (LWP 5622)]
zend_hash_destroy (ht=0xb786bf08) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_hash.c:524
524 p = p-pListNext;
(gdb) bt
#0  zend_hash_destroy (ht=0xb786bf08) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_hash.c:524
#1  0x0836dc41 in _zval_dtor_func (zvalue=0xb786bf70) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_variables.c:43
#2  0x0836d3b3 in zend_ptr_stack_apply (stack=0x880d470, func=0x836dbf0
_zval_dtor_func) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_ptr_stack.c:90
#3  0x0836d3fd in zend_ptr_stack_clean (stack=0x880d470, func=0x836dbf0
_zval_dtor_func, free_elements=1 '\001')
at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_ptr_stack.c:97
#4  0x08360f68 in shutdown_executor () at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_execute_API.c:272
#5  0x0836e28b in zend_deactivate () at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend.c:899
#6  0x08316df6 in php_request_shutdown (dummy=0x0) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/main/main.c:1522
#7  0x08408203 in main (argc=2, argv=0xbffa0b14) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/sapi/cli/php_cli.c:1311
---SNAP-

The problem persists with PHP 5.3.0alpha3-dev (cli) (built: Oct 21 2008
22:10:26).



[2008-10-06 13:03:21] [EMAIL PROTECTED]

Description:

Stacking 2 error handlers is broken. With object methods only the first
error handler is invoked, with functions I even get a PHP crash.

Reproduce code:
---
-- Object methods ---

?php

class ErrorHandling
{

public function errorHandler1( $errno, $errstr )
{
echo Caught on first level: '$errstr'\n;
return true;
}

public function errorHandler2( $errno, $errstr )
{
echo Caught on second level: '$errstr'\n;
return true;
}
}

$err = new ErrorHandling();

set_error_handler( array( $err, 'errorHandler1' ) );
set_error_handler( array( $err, 'errorHandler2' ) );

trigger_error( 'Foo', E_USER_WARNING );

?

-- Functions ---

?php

function errorHandler1( $errno, $errstr )
{
echo Caught on first level: '$errstr'\n;
return true;
}

function errorHandler2( $errno, $errstr )
{   
echo Caught on second level: '$errstr'\n;
return true;
}

set_error_handler( 'errorHandler1' );
set_error_handler( 'errorHandler2' );

trigger_error( 'Foo', E_USER_WARNING );

?

Expected result:

-- Object methods ---
Caught on second level: 'Foo'
-- Functions ---
Caught on second level: 'Foo'

Actual result:
--
-- Object methods --- 
Caught on first level: 'Foo'
-- Functions ---
Caught on first level: 'Foo'
zend_mm_heap corrupted





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



#46241 [Com]: Error handler stacking broken

2008-10-21 Thread clemens dot kalb at netlogix dot de
 ID:   46241
 Comment by:   clemens dot kalb at netlogix dot de
 Reported By:  [EMAIL PROTECTED]
 Status:   Open
 Bug Type: Reproducible crash
 Operating System: Gentoo
 PHP Version:  5.3.0alpha2
 New Comment:

Here is one thing that has been more clear in the other, duplicate and
now closed - bug entry (#46338). The first code sample with object
methods does not only miss out on the second error handler, it also
segfaults *on shutdown* of the PHP process:

---SNIP-
Starting program: /usr/bin/php5 segfault2.php
[Thread debugging using libthread_db enabled]
[New Thread -1215695168 (LWP 5622)]
Caught on first level: 'Foo'

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1215695168 (LWP 5622)]
zend_hash_destroy (ht=0xb786bf08) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_hash.c:524
524 p = p-pListNext;
(gdb) bt
#0  zend_hash_destroy (ht=0xb786bf08) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_hash.c:524
#1  0x0836dc41 in _zval_dtor_func (zvalue=0xb786bf70) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_variables.c:43
#2  0x0836d3b3 in zend_ptr_stack_apply (stack=0x880d470, func=0x836dbf0
_zval_dtor_func) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_ptr_stack.c:90
#3  0x0836d3fd in zend_ptr_stack_clean (stack=0x880d470, func=0x836dbf0
_zval_dtor_func, free_elements=1 '\001')
at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_ptr_stack.c:97
#4  0x08360f68 in shutdown_executor () at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend_execute_API.c:272
#5  0x0836e28b in zend_deactivate () at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/Zend/zend.c:899
#6  0x08316df6 in php_request_shutdown (dummy=0x0) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/main/main.c:1522
#7  0x08408203 in main (argc=2, argv=0xbffa0b14) at
/usr/src/dailybuild/builds/20081021/php5-5.3.0-200810211830/sapi/cli/php_cli.c:1311
---SNAP-

The problem persists with PHP 5.3.0alpha3-dev (cli) (built: Oct 21 2008
22:10:26).


Previous Comments:


[2008-10-06 13:03:21] [EMAIL PROTECTED]

Description:

Stacking 2 error handlers is broken. With object methods only the first
error handler is invoked, with functions I even get a PHP crash.

Reproduce code:
---
-- Object methods ---

?php

class ErrorHandling
{

public function errorHandler1( $errno, $errstr )
{
echo Caught on first level: '$errstr'\n;
return true;
}

public function errorHandler2( $errno, $errstr )
{
echo Caught on second level: '$errstr'\n;
return true;
}
}

$err = new ErrorHandling();

set_error_handler( array( $err, 'errorHandler1' ) );
set_error_handler( array( $err, 'errorHandler2' ) );

trigger_error( 'Foo', E_USER_WARNING );

?

-- Functions ---

?php

function errorHandler1( $errno, $errstr )
{
echo Caught on first level: '$errstr'\n;
return true;
}

function errorHandler2( $errno, $errstr )
{   
echo Caught on second level: '$errstr'\n;
return true;
}

set_error_handler( 'errorHandler1' );
set_error_handler( 'errorHandler2' );

trigger_error( 'Foo', E_USER_WARNING );

?

Expected result:

-- Object methods ---
Caught on second level: 'Foo'
-- Functions ---
Caught on second level: 'Foo'

Actual result:
--
-- Object methods --- 
Caught on first level: 'Foo'
-- Functions ---
Caught on first level: 'Foo'
zend_mm_heap corrupted





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