php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51807 set_exception_handler
Submitted: 2010-05-13 10:22 UTC Modified: 2010-06-01 03:42 UTC
From: cybermerlin at ya dot ru Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.2 OS: win.xp.sp3
Private report: No CVE-ID: None
 [2010-05-13 10:22 UTC] cybermerlin at ya dot ru
Description:
------------
faultCode1faultStringWarning:set_exception_handler() expects the argument (exception_handler) to be a valid callback in C:\WebServers\htdocs\count\new\test.php on line 6

<line 6>  if(DEBUG) set_exception_handler('exception_handler');

  function exception_handler(Exception $ex){
    $str_time = $ex->getFile() .":". $ex->getLine() ." ". htmlentities($ex->getMessage()) ." (". $ex->getCode() .") [". get_class($ex) ."]\r\n";
    echo $str_time;
  }

Test script:
---------------
if(DEBUG) set_exception_handler('exception_handler');

  function exception_handler(Exception $ex){
    $str_time = $ex->getFile() .":". $ex->getLine() ." ". htmlentities($ex->getMessage()) ." (". $ex->getCode() .") [". get_class($ex) ."]\r\n";
    echo $str_time;
  }


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-13 18:10 UTC] dtajchreber@php.net
-Status: Open +Status: Feedback
 [2010-05-13 18:10 UTC] dtajchreber@php.net
Your test script works fine. But the line number in your error doesn't match up with your script so that makes me think your test script is just a snippet of what you're actually using. You need to provide the entire test script that failed, not snippets of one. 

If the exception_handler function is a class method, you need to change your callback, see: http://php.net/callback
 [2010-06-01 03:42 UTC] dtajchreber@php.net
-Status: Feedback +Status: Bogus
 [2010-06-01 03:42 UTC] dtajchreber@php.net
No response and unable to recreate -> bogus.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 07:01:35 2025 UTC