#39257 [Opn->Fbk]: preg_replace_callback swallows exceptions
| From: | tony2001@php.net | Date: | Wed, 25 Oct 2006 18:31:07 +0000 |
| Subject: | #39257 [Opn->Fbk]: preg_replace_callback swallows exceptions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103989@lists.php.net to get a copy of this message | ||
ID: 39257
Updated by: tony2001@php.net
Reported By: php at theos dot me dot uk
-Status: Open
+Status: Feedback
Bug Type: PCRE related
Operating System: Debian Sid
PHP Version: 5.1.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Cannot reproduce.
Previous Comments:
------------------------------------------------------------------------
[2006-10-25 17:52:27] php at theos dot me dot uk
Description:
------------
If a function called by preg_replace_callback throws an
exception this exception is not propagated up to the
function which called preg_replace_callback. Instead a PHP
error is produced. This error contains no information about
what the problem was or where it occurred.
Reproduce code:
---------------
<?php
function thrower() {
throw new Exception("Hello");
}
try {
$b = preg_replace_callback('/./', 'thrower', 'a');
} catch ( Exception $e ) {
echo 'Yay, exception!';
}
?>
Expected result:
----------------
code to output
Yay, exception!
Actual result:
--------------
Warning: preg_replace_callback(): Unable to call custom
replacement function on line 13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39257&edit=1