php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22472 set_error_handler
Submitted: 2003-02-28 04:04 UTC Modified: 2003-03-05 06:36 UTC
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:1 (25.0%)
From: nightik at intech dot ru Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.0 OS: Windows 2000 Advanced Server
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: nightik at intech dot ru
New email:
PHP Version: OS:

 

 [2003-02-28 04:04 UTC] nightik at intech dot ru
There is bug
---- example.php ----
<?php

class example {

   function example() {
      set_error_handler(array(&$this, "_error_handler"));
      // do somthing generate... 
      trigger_error("Error", E_WARNING);

   }

   function _error_handler($errno, $errstr, $errfile, $errline) {
	echo "<b>$errno</b>: $errstr in $errfile in line $errline <br>";

   }
}

$class = new example();
?>

Some times this script outputs:
-------
Warning: Error in z:\home\lego\www\test_err.php on line 8
-------
but some times outputs:
-------
512: Error in z:\home\lego\www\test_err.php in line 8 
-------

So, some times system error handler works, but enother times method _error_handler from example class works.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-28 11:06 UTC] iliaa@php.net
You should be using E_USER_WARNING not E_WARNING. Once I make this change I am unable to replicate the error you are seeing.
 [2003-03-01 02:57 UTC] nightik at intech dot ru
If use E_USER_WARNING, E_USER_ERROR, E_USER_NOTICE this problem stay.
 [2003-03-04 20:04 UTC] sniper@php.net
Don't trigger errors in the constructor.

 [2003-03-05 02:33 UTC] nightik at intech dot ru
I need track errors in the constructor and in the functions that called in the construcor.
 [2003-03-05 02:53 UTC] nightik at intech dot ru
This example very simple, in the real life I use strongly difficult class.
 [2003-03-05 06:36 UTC] sniper@php.net
Why do you want to track errors in the error handler itself? 
I can't reproduce this problem with 4.3.2-dev anyway so 
try the latest CVS snapshot from http://snaps.php.net/ first before reopening this anymore.


 [2003-03-05 21:21 UTC] tim dot php at ebw dot ca
i still get the error even if i move the trigger_error out of the class (using php 4.3.2-dev). try refreshing the page a couple times... it seems random.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Aug 16 05:00:03 2025 UTC