From:             ludwig at gramberg-webdesign dot de
Operating system: Windows 2000
PHP version:      5.2.1
PHP Bug Type:     PCRE related
Bug description:  Exception in callback methoid leads to fatal Error

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

Reply via email to