FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=17398&edit=1

ID: 17398
Updated by: helgith@gmail.com
Reported By: i at walkinraven dot name
Summary: Error: PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
-Status: Open
+Status: Bogus
Type: Bug
Package: PEAR
Operating System: Ubuntu 8.04
Package Version: Unknown
PHP Version: 5.2.4
Roadmap Versions:
New Comment:

-Status: Open
+Status: Bogus
Thank you for submitting this ticket but it is not a bug. It is a
deprecation warning which is present on PHP 5 while the PEAR installer
(e.g. the PEAR class) is PHP 4 compatible, and this deprecation warning
can only be removed if we break backwards compatibility for PHP 4, which
would not sit well with many companies.

As it's only an warning then you can safely ignore it.


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

[2010-05-13 17:46:52] walkinraven

Description:
------------
You will get error message 'Assigning the return value of new by
reference is deprecated', if you code as below:

1.Define two user-defined error handler functions for
'set_error_handler' and 'set_exception_handler', globally;

2.Define a class for initializing the PHP environment, named
'PHP_Initializer' for example;

3.In ' PHP_Initializer::__construct', call 'set_error_handler',
'set_exception_handler' and
'PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);'

4.You will get error message: 'Assigning the return value of new by
reference is deprecated'

Test script:
---------------
URL ( 35 lines ): http://docs.google.com/View?id=dgt79v8r_119cf9hrvdj

Expected result:
----------------
I don't think an error should be produced with my code.

Actual result:
--------------
Error message: 'Assigning the return value of new by reference is
deprecated'

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

Search Discussions

  • I at May 14, 2010 at 2:36 am
    Edit report at http://pear.php.net/bugs/bug.php?id=17398&edit=1

    ID: 17398
    Comment by: i@walkinraven.name
    Reported By: i at walkinraven dot name
    Summary: Error: PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
    Status: Bogus
    Type: Bug
    Package: PEAR
    Operating System: Ubuntu 8.04
    Package Version: Unknown
    PHP Version: 5.2.4
    Roadmap Versions:
    New Comment:

    Thank you for replying, I understand PHP 4 compatibility is more
    important thing. Then I have to solve the problem by adding a if
    statement in my user-defined error handler function:

    the code:
    function exception_error_handler($errno, $errstr, $errfile, $errline )
    {
    if ( $errstr==='Assigning the return value of new by reference is
    deprecated')
    { return; }
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
    }

    But I have some worried about that: Does this error message is unique?
    Whether the code above will ignore some other error that should be dealt
    with? If I put $errfile/$errline into the if statement, then when the
    source file changed, it could be a big trouble to trace the if
    statement.

    A better way may be: if ( $errno<x ) { return }, to ignore all low
    level error that is not important anymore, but the PHP manual do not
    tell me the detail about the error level, I even don't know the $errno
    bigger means it more serious or the opposite and which number of $errno,
    means can be safely ignored.

    I think a unique error code is needed here, but I know that may also
    cause some trouble on backwards compatibility.

    Oh, :-(


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

    [2010-05-13 22:33:32] dufuz

    -Status: Open
    +Status: Bogus
    Thank you for submitting this ticket but it is not a bug. It is a
    deprecation warning which is present on PHP 5 while the PEAR installer
    (e.g. the PEAR class) is PHP 4 compatible, and this deprecation warning
    can only be removed if we break backwards compatibility for PHP 4, which
    would not sit well with many companies.

    As it's only an warning then you can safely ignore it.

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

    [2010-05-13 17:46:52] walkinraven

    Description:
    ------------
    You will get error message 'Assigning the return value of new by
    reference is deprecated', if you code as below:

    1.Define two user-defined error handler functions for
    'set_error_handler' and 'set_exception_handler', globally;

    2.Define a class for initializing the PHP environment, named
    'PHP_Initializer' for example;

    3.In ' PHP_Initializer::__construct', call 'set_error_handler',
    'set_exception_handler' and
    'PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);'

    4.You will get error message: 'Assigning the return value of new by
    reference is deprecated'

    Test script:
    ---------------
    URL ( 35 lines ): http://docs.google.com/View?id=dgt79v8r_119cf9hrvdj

    Expected result:
    ----------------
    I don't think an error should be produced with my code.

    Actual result:
    --------------
    Error message: 'Assigning the return value of new by reference is
    deprecated'

    ------------------------------------------------------------------------
  • Helgith at May 14, 2010 at 2:36 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=17398&edit=1

    ID: 17398
    Updated by: helgith@gmail.com
    Reported By: i at walkinraven dot name
    Summary: Error: PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
    Status: Bogus
    Type: Bug
    Package: PEAR
    Operating System: Ubuntu 8.04
    Package Version: Unknown
    PHP Version: 5.2.4
    Roadmap Versions:
    New Comment:

    You might want to read up on
    http://php.net/manual/en/function.error-reporting.php

    This would allow you to see all errors and notices but ignore the
    deprecated messages:
    error_reporting(E_ALL ^ E_DEPRECATED);

    You can also set this in you php.ini directly

    This way you do not have to do that if() in your error handler.


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

    [2010-05-14 03:29:50] walkinraven

    Thank you for replying, I understand PHP 4 compatibility is more
    important thing. Then I have to solve the problem by adding a if
    statement in my user-defined error handler function:

    the code:
    function exception_error_handler($errno, $errstr, $errfile, $errline )
    {
    if ( $errstr==='Assigning the return value of new by reference is
    deprecated')
    { return; }
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
    }

    But I have some worried about that: Does this error message is unique?
    Whether the code above will ignore some other error that should be dealt
    with? If I put $errfile/$errline into the if statement, then when the
    source file changed, it could be a big trouble to trace the if
    statement.

    A better way may be: if ( $errno<x ) { return }, to ignore all low
    level error that is not important anymore, but the PHP manual do not
    tell me the detail about the error level, I even don't know the $errno
    bigger means it more serious or the opposite and which number of $errno,
    means can be safely ignored.

    I think a unique error code is needed here, but I know that may also
    cause some trouble on backwards compatibility.

    Oh, :-(

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

    [2010-05-13 22:33:32] dufuz

    -Status: Open
    +Status: Bogus
    Thank you for submitting this ticket but it is not a bug. It is a
    deprecation warning which is present on PHP 5 while the PEAR installer
    (e.g. the PEAR class) is PHP 4 compatible, and this deprecation warning
    can only be removed if we break backwards compatibility for PHP 4, which
    would not sit well with many companies.

    As it's only an warning then you can safely ignore it.

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

    [2010-05-13 17:46:52] walkinraven

    Description:
    ------------
    You will get error message 'Assigning the return value of new by
    reference is deprecated', if you code as below:

    1.Define two user-defined error handler functions for
    'set_error_handler' and 'set_exception_handler', globally;

    2.Define a class for initializing the PHP environment, named
    'PHP_Initializer' for example;

    3.In ' PHP_Initializer::__construct', call 'set_error_handler',
    'set_exception_handler' and
    'PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);'

    4.You will get error message: 'Assigning the return value of new by
    reference is deprecated'

    Test script:
    ---------------
    URL ( 35 lines ): http://docs.google.com/View?id=dgt79v8r_119cf9hrvdj

    Expected result:
    ----------------
    I don't think an error should be produced with my code.

    Actual result:
    --------------
    Error message: 'Assigning the return value of new by reference is
    deprecated'

    ------------------------------------------------------------------------
  • I at May 15, 2010 at 1:27 am
    Edit report at http://pear.php.net/bugs/bug.php?id=17398&edit=1

    ID: 17398
    Comment by: i@walkinraven.name
    Reported By: i at walkinraven dot name
    Summary: Error: PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
    Status: Bogus
    Type: Bug
    Package: PEAR
    Operating System: Ubuntu 8.04
    Package Version: Unknown
    PHP Version: 5.2.4
    Roadmap Versions:
    New Comment:

    Thank you very much. You DO save me from the trouble!


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

    [2010-05-14 15:29:48] dufuz

    You might want to read up on
    http://php.net/manual/en/function.error-reporting.php

    This would allow you to see all errors and notices but ignore the
    deprecated messages:
    error_reporting(E_ALL ^ E_DEPRECATED);

    You can also set this in you php.ini directly

    This way you do not have to do that if() in your error handler.

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

    [2010-05-14 03:29:50] walkinraven

    Thank you for replying, I understand PHP 4 compatibility is more
    important thing. Then I have to solve the problem by adding a if
    statement in my user-defined error handler function:

    the code:
    function exception_error_handler($errno, $errstr, $errfile, $errline )
    {
    if ( $errstr==='Assigning the return value of new by reference is
    deprecated')
    { return; }
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
    }

    But I have some worried about that: Does this error message is unique?
    Whether the code above will ignore some other error that should be dealt
    with? If I put $errfile/$errline into the if statement, then when the
    source file changed, it could be a big trouble to trace the if
    statement.

    A better way may be: if ( $errno<x ) { return }, to ignore all low
    level error that is not important anymore, but the PHP manual do not
    tell me the detail about the error level, I even don't know the $errno
    bigger means it more serious or the opposite and which number of $errno,
    means can be safely ignored.

    I think a unique error code is needed here, but I know that may also
    cause some trouble on backwards compatibility.

    Oh, :-(

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

    [2010-05-13 22:33:32] dufuz

    -Status: Open
    +Status: Bogus
    Thank you for submitting this ticket but it is not a bug. It is a
    deprecation warning which is present on PHP 5 while the PEAR installer
    (e.g. the PEAR class) is PHP 4 compatible, and this deprecation warning
    can only be removed if we break backwards compatibility for PHP 4, which
    would not sit well with many companies.

    As it's only an warning then you can safely ignore it.

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

    [2010-05-13 17:46:52] walkinraven

    Description:
    ------------
    You will get error message 'Assigning the return value of new by
    reference is deprecated', if you code as below:

    1.Define two user-defined error handler functions for
    'set_error_handler' and 'set_exception_handler', globally;

    2.Define a class for initializing the PHP environment, named
    'PHP_Initializer' for example;

    3.In ' PHP_Initializer::__construct', call 'set_error_handler',
    'set_exception_handler' and
    'PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);'

    4.You will get error message: 'Assigning the return value of new by
    reference is deprecated'

    Test script:
    ---------------
    URL ( 35 lines ): http://docs.google.com/View?id=dgt79v8r_119cf9hrvdj

    Expected result:
    ----------------
    I don't think an error should be produced with my code.

    Actual result:
    --------------
    Error message: 'Assigning the return value of new by reference is
    deprecated'

    ------------------------------------------------------------------------
  • I at May 16, 2010 at 1:53 am
    Edit report at http://pear.php.net/bugs/bug.php?id=17398&edit=1

    ID: 17398
    Comment by: i@walkinraven.name
    Reported By: i at walkinraven dot name
    Summary: Error: PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
    Status: Bogus
    Type: Bug
    Package: PEAR
    Operating System: Ubuntu 8.04
    Package Version: Unknown
    PHP Version: 5.2.4
    Roadmap Versions:
    New Comment:

    New problem: I've found 'error_reporting' setting is ignored at all,
    anyone may refer to <
    http://www.php.net/manual/en/function.set-error-handler.php > where it
    says: 'error_reporting() settings will have no effect and your error
    handler will be called regardless - however you are still able to read
    the current value of error_reporting and act appropriately.'

    -----------------------------------
    code:
    function exception_error_handler($errno, $errstr, $errfile, $errline )
    {
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
    }
    -----------------------------------

    I think the best way is to use a switch statement like 'PHP manual:
    set_error_handler, Example #1'

    And the error caused by 'PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);'
    is E_STRICT, not E_DEPRECATED.


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

    [2010-05-15 02:21:00] walkinraven

    Thank you very much. You DO save me from the trouble!

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

    [2010-05-14 15:29:48] dufuz

    You might want to read up on
    http://php.net/manual/en/function.error-reporting.php

    This would allow you to see all errors and notices but ignore the
    deprecated messages:
    error_reporting(E_ALL ^ E_DEPRECATED);

    You can also set this in you php.ini directly

    This way you do not have to do that if() in your error handler.

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

    [2010-05-14 03:29:50] walkinraven

    Thank you for replying, I understand PHP 4 compatibility is more
    important thing. Then I have to solve the problem by adding a if
    statement in my user-defined error handler function:

    the code:
    function exception_error_handler($errno, $errstr, $errfile, $errline )
    {
    if ( $errstr==='Assigning the return value of new by reference is
    deprecated')
    { return; }
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
    }

    But I have some worried about that: Does this error message is unique?
    Whether the code above will ignore some other error that should be dealt
    with? If I put $errfile/$errline into the if statement, then when the
    source file changed, it could be a big trouble to trace the if
    statement.

    A better way may be: if ( $errno<x ) { return }, to ignore all low
    level error that is not important anymore, but the PHP manual do not
    tell me the detail about the error level, I even don't know the $errno
    bigger means it more serious or the opposite and which number of $errno,
    means can be safely ignored.

    I think a unique error code is needed here, but I know that may also
    cause some trouble on backwards compatibility.

    Oh, :-(

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

    [2010-05-13 22:33:32] dufuz

    -Status: Open
    +Status: Bogus
    Thank you for submitting this ticket but it is not a bug. It is a
    deprecation warning which is present on PHP 5 while the PEAR installer
    (e.g. the PEAR class) is PHP 4 compatible, and this deprecation warning
    can only be removed if we break backwards compatibility for PHP 4, which
    would not sit well with many companies.

    As it's only an warning then you can safely ignore it.

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

    [2010-05-13 17:46:52] walkinraven

    Description:
    ------------
    You will get error message 'Assigning the return value of new by
    reference is deprecated', if you code as below:

    1.Define two user-defined error handler functions for
    'set_error_handler' and 'set_exception_handler', globally;

    2.Define a class for initializing the PHP environment, named
    'PHP_Initializer' for example;

    3.In ' PHP_Initializer::__construct', call 'set_error_handler',
    'set_exception_handler' and
    'PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);'

    4.You will get error message: 'Assigning the return value of new by
    reference is deprecated'

    Test script:
    ---------------
    URL ( 35 lines ): http://docs.google.com/View?id=dgt79v8r_119cf9hrvdj

    Expected result:
    ----------------
    I don't think an error should be produced with my code.

    Actual result:
    --------------
    Error message: 'Assigning the return value of new by reference is
    deprecated'

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedMay 13, '10 at 9:40p
activeMay 16, '10 at 1:53a
posts5
users2
websitepear.php.net

2 users in discussion

I: 3 posts Helgith: 2 posts

People

Translate

site design / logo © 2022 Grokbase