php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40618 Exception in callback methoid leads to fatal Error
Submitted: 2007-02-24 14:17 UTC Modified: 2007-03-06 01:00 UTC
Votes:4
Avg. Score:3.5 ± 1.1
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:2 (50.0%)
From: ludwig at gramberg-webdesign dot de Assigned:
Status: No Feedback Package: PCRE related
PHP Version: 5.2.1 OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ludwig at gramberg-webdesign dot de
New email:
PHP Version: OS:

 

 [2007-02-24 14:17 UTC] ludwig at gramberg-webdesign dot de
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-26 08:06 UTC] tony2001@php.net
Warning: preg_replace_callback(): Unable to call custom replacement function in /tmp/4.php on line 14
Yay, exception! <---------
 [2007-02-26 09:17 UTC] ludwig at gramberg-webdesign dot de
This bug exists under 5.2.1/win. I saw it here first as a bug under 5.2.1/debian and there it said the bug would is gone in 5.2.1 but under win it's definetly not.

Just get the latest XAMPP, install it under win and run the code. The line 13/14 is just because i copied the code from the other bug report since it's the same.
 [2007-02-26 09:25 UTC] tony2001@php.net
>This bug exists under 5.2.1/win.
What kind of bug? The exception is thrown and successfully caught.
I agree that the warning is not needed in this case, I'll discuss it with the extension maintainer.

>Just get the latest XAMPP, install it under win and run the code
Please provide a short but complete reproduce code.
 [2007-03-06 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 22:01:27 2024 UTC