Opened 4 years ago
Closed 11 months ago
#223 closed defect (fixed)
E_DEPRECATED error at parsing - Custom error handler cant access previously declared classes
| Reported by: | patphobos | Owned by: | moo |
|---|---|---|---|
| Priority: | major | Milestone: | 3.0.0 |
| Component: | cacher | Version: | |
| Keywords: | E_DEPRECATED | Cc: | |
| Application: | PHP Version: | 5.3 | |
| Other Exts: | SAPI: | Irrelevant | |
| Probability: | Always | Blocked By: | |
| Blocking: |
Description
<?php
error_reporting(E_ALL);
set_error_handler('error');
function error($errno, $errstr, $errfile, $errline, $errcontext)
{
echo "PHP ERROR - error n°" . $errno . ' : ' . $errstr . "\n";
if (!class_exists('test42'))
echo " - hit a bug, test42";
die();
}
class test42 { }
require_once 'page_with_an_error.php';
?>
page_with_an_error.php:
<?php
function test(&$val) { }
$val = 'this is a test';
// Deprecated :
test(&$val);
?>
the custom error handler is catching the E_DEPRECATED error, but when cached, the error handler cant use any of previously existing objects (like test42 in this example).
Another testcase, that made my php5.3 to segfault :
<?php
error_reporting(E_ALL);
set_error_handler('error');
function error($errno, $errstr, $errfile, $errline, $errcontext)
{
if (!defined('DISPLAY_ERROR'))
define('DISPLAY_ERROR', true);
if (DISPLAY_ERROR)
echo "PHP ERROR - error n°" . $errno . ' : ' . $errstr . "\n";
}
// 1st error E_DEPRECATED inside page_with_an_error.php
include 'page_with_an_error.php';
// 2nd error
asort();
?>
'page_with_an_error.php' is the same file with the deprecated call by reference error.
Change History (6)
comment:1 Changed 4 years ago by patphobos
comment:2 Changed 4 years ago by patphobos
(not all E_DEPRECATED error had this problem, only DEPRECATED_ERROR occuring at parsing, using deprecated function work fine)
comment:3 Changed 4 years ago by moo
- Status changed from new to accepted
this was fixed in 2.0 already, but i'm not sure if it's fine to backport it to 1.3 yet. pending
comment:4 Changed 11 months ago by moo
- Milestone changed from 1.3.3 to 2.0.1
Milestone 1.3.3 deleted
comment:5 Changed 11 months ago by moo
- Status changed from accepted to new
comment:6 Changed 11 months ago by moo
- Resolution set to fixed
- Status changed from new to closed
already fixed in 2.0/3.0. 1.3 is old
Note: See
TracTickets for help on using
tickets.


(i'm using xcache 1.3.0 stable, cant select this version on the trac form.)