From: php at theos dot me dot uk
Operating system: Debian Sid
PHP version: 5.1.6
PHP Bug Type: PCRE related
Bug description: preg_replace_callback swallows exceptions
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 bug report at http://bugs.php.net/?id=39257&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39257&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39257&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39257&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39257&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39257&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39257&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39257&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39257&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39257&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39257&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39257&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39257&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39257&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39257&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39257&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39257&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39257&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39257&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39257&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39257&r=mysqlcfg