Professional Web Applications Themes

#46241 [NEW]: Erro handler stacking broken - PHP Bugs

From: net Operating system: Gentoo PHP version: 5.3.0alpha2 PHP Bug Type: Reproducible crash Bug description: Erro handler stacking broken 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( ...

  1. #1

    Default #46241 [NEW]: Erro handler stacking broken

    From: net
    Operating system: Gentoo
    PHP version: 5.3.0alpha2
    PHP Bug Type: Reproducible crash
    Bug description: Erro handler stacking broken

    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 bug report at http://bugs.php.net/?id=46241&edit=1
    --
    Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46241&r=trysnapshot52
    Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46241&r=trysnapshot53
    Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46241&r=trysnapshot60
    Fixed in CVS: http://bugs.php.net/fix.php?id=46241&r=fixedcvs
    Fixed in release: http://bugs.php.net/fix.php?id=46241&r=alreadyfixed
    Need backtrace: http://bugs.php.net/fix.php?id=46241&r=needtrace
    Need Reproduce Script: http://bugs.php.net/fix.php?id=46241&r=needscript
    Try newer version: http://bugs.php.net/fix.php?id=46241&r=oldversion
    Not developer issue: http://bugs.php.net/fix.php?id=46241&r=support
    Expected behavior: http://bugs.php.net/fix.php?id=46241&r=notwrong
    Not enough info: http://bugs.php.net/fix.php?id=46241&r=notenoughinfo
    Submitted twice: http://bugs.php.net/fix.php?id=46241&r=submittedtwice
    register_globals: http://bugs.php.net/fix.php?id=46241&r=globals
    PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46241&r=php4
    Daylight Savings: http://bugs.php.net/fix.php?id=46241&r=dst
    IIS Stability: http://bugs.php.net/fix.php?id=46241&r=isapi
    Install GNU Sed: http://bugs.php.net/fix.php?id=46241&r=gnused
    Floating point limitations: http://bugs.php.net/fix.php?id=46241&r=float
    No Zend Extensions: http://bugs.php.net/fix.php?id=46241&r=nozend
    MySQL Configuration Error: http://bugs.php.net/fix.php?id=46241&r=mysqlcfg

    toby@php.net Guest

  2. #2

    Default #46241 [Com]: Error handler stacking broken

    ID: 46241
    Comment by: clemens dot kalb at netlogix dot de
    Reported By: net
    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] net

    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=46241&edit=1

    clemens Guest

  3. #3

    Default #46241 [Opn->Ctl]: Error handler stacking broken

    ID: 46241
    Updated by: net
    Reported By: net
    -Status: Open
    +Status: Critical
    Bug Type: Reproducible crash
    Operating System: Gentoo
    PHP Version: 5.3.0alpha2
    New Comment:

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


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

    [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] net

    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=46241&edit=1

    ezyang@php.net Guest

Similar Threads

  1. cfhttp erro
    By larry_s_w in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: March 24th, 10:35 PM
  2. DataGrid's UpdateCommand event handler and CancelCommand handler problem
    By David Mans in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: July 29th, 05:52 AM
  3. Fast signal handler switching & thread-specific handler.
    By Paul Pluzhnikov in forum UNIX Programming
    Replies: 0
    Last Post: July 18th, 03:05 PM
  4. RIGHT function #erro
    By Frank Dulk in forum Microsoft Access
    Replies: 2
    Last Post: July 16th, 04:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139