Req #71364 [NEW]: restore_error_handler() should return the actual callable
| From: | hujuice at inservibile dot org | Date: | Thu, 14 Jan 2016 03:02:01 +0000 |
| Subject: | Req #71364 [NEW]: restore_error_handler() should return the actual callable | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-198639@lists.php.net to get a copy of this message | ||
From: hujuice at inservibile dot org
Operating system: Linux
PHP version: 5.6Git-2016-01-14 (snap)
Package: Unknown/Other Function
Bug Type: Feature/Change Request
Bug description:restore_error_handler() should return the actual callable
Description:
------------
restore_error_handler() returns always true, no info.
But in complex situations where included files could add other handlers,
there's no way to be sure that the restored handler is the wanted one.
This doubt could be prevented if restore_error_handler() would return
the actual callable or null if at the end of the stack.
Test script:
---------------
file1.php
=========
<?php
set_error_handler('someFunct');
include 'file2.php';
restore_error_handler(); // Not enough!
file2.php
=========
<?php
set_error_handler('anotherFunct');
Expected result:
----------------
NOT CORRECT! It could be an useful feature
file1.php
=========
<?php
$prev = set_error_handler('someFunct');
include 'file2.php';
do {
$actual = restore_error_handler(); // Run twice
} while ($actual != $prev);
file2.php
=========
<?php
set_error_handler('anotherFunct');
--
Edit bug report at https://bugs.php.net/bug.php?id=71364&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71364&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71364&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71364&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71364&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71364&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71364&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71364&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71364&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71364&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71364&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71364&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71364&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71364&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71364&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71364&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71364&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71364&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71364&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71364&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71364&r=mysqlcfg