php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32272 Error handling doesn't work properly.
Submitted: 2005-03-11 04:27 UTC Modified: 2005-06-19 02:29 UTC
From: zedar at zedar dot org Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5CVS-2005-03-11 (dev) OS: Linux 2.4.26
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: zedar at zedar dot org
New email:
PHP Version: OS:

 

 [2005-03-11 04:27 UTC] zedar at zedar dot org
Description:
------------
I have set an error handler to handle E_ALL errors, but i 
still get standard PHP error messages in some instances. 

Reproduce code:
---------------
function debug ($errno, $errstr, $errfile, $errline, $errcontext) {
 print "<pre>";
 print "Error: $errstr";
 $backtrace = debug_backtrace ();
 $first = 1;
 $i = 1;
 foreach ($backtrace as $context) {
  if ($first) {
   $first = 0;
  } else {
   print "\n\t$i: $context[file] line $context[line]  ";
   if ($context['class']) {
    print "(".$context['class']."->".$context['function'].")";
   } elseif ($context['function']) {
    print "(".$context['function'].")";
   }
   $i++;
  }
 }
 print "</pre>"; 
}
set_error_handler ('debug', E_ALL);

Expected result:
----------------
Very verbose debug output such as: 
Error: Use of undefined constant self - assumed 'self' 
        1: /www2/wame.net/system/include/class/dbObject.php 
line 169  (dbObject->cacheData) 
        2: /www2/wame.net/system/include/class/dbObject.php 
line 128  (ProviderRealm->cacheData) 
        3: /www2/wame.net/system/include/class/dbObject.php 
line 240  (ProviderRealm->dbRead) 
        4: /www2/wame.net/system/include/class/dbObject.php 
line 203  (ProviderRealm->dbWrite) 
        5: /www2/wame.net/system/include/class/dbObject.php 
line 203  (Provider->__destruct) 
        6: /www2/wame.net/system/include/class/dbObject.php 
line 203  (Provider->dbWrite) 
        7:  line   (dbObject->__destruct) 

Actual result:
--------------
Note that this is not the same error as above, as this 
error is the one the handler doesn't deal with properly. 
 
Fatal error: Access to undeclared static property:  
dbObject::$_elements  
in /www2/wame.net/system/include/class/dbObject.php on  
line 212  

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-11 08:45 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Those are compile time warnings - which occur before your script starts to execute. This means that your error reporting function can not be called, as it's not even defined (or called).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 12 07:01:29 2024 UTC