#21462 [Opn->Bgs]: set_error_handler not properly executed?
| From: | iliaa@php.net | Date: | Tue, 07 Jan 2003 03:03:41 +0000 |
| Subject: | #21462 [Opn->Bgs]: set_error_handler not properly executed? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-29266@lists.php.net to get a copy of this message | ||
ID: 21462
Updated by: iliaa@php.net
Reported By: duh@dowebwedo.com
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Linux Slackware
PHP Version: 4.3.0
New Comment:
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
You cannot 'capture' fatal errors, your approach to checking function
avaliablity is flawed. Instead of trying to execute the function, why
not use function_exists(), which will accurately tell you if a function
is avaliable or not.
Previous Comments:
------------------------------------------------------------------------
[2003-01-06 15:03:02] jbernier@dalcom-intl.com
I am also experimenting this. My function used as error handling now
gives me array in all the parameters.
Ex. :
function my_error_handler($errno,$errstr,$errfile,$errline,$variables)
$errno = array
$errstr = array
etc...
------------------------------------------------------------------------
[2003-01-06 09:01:50] duh@dowebwedo.com
Today we upgraded from php 4.2.3 (apache 1.3.26) to php 4.3.0.
We use freetype functionality in a set of functions and to keep this
very flexible the following code (except for the debugging prints) is
used to determine what freetype version was installed in order to use
the right functions (imagefttext or imagettftext).
This function (the set_error_handler) stopped working properly after
upgrading to 4.3.0
print freetype_version();
function freetype_version() {
// change error handler
set_error_handler("freetype_version_handler");
// remove freetype version from session
unset($_SESSION['freetype_version']);
// determine check array
$checkers = array(
"imagefttext" => 2, // freetype version
specific function -> freetype version
"imagettftext" => 1
);
// run checkers
while (list($key,$val)=each($checkers)) {
printf("%s:%s<br>\n",$key,$val);
eval(sprintf("%s();",$key));
}
// restore old error handler
restore_error_handler();
// return version (null = no freetype support)
return $_SESSION['freetype_version'];
}
function
freetype_version_handler($errno,$errstr,$errfile,$errline,$variables)
{
print "errorrr!<br>\n";
if (eregi(sprintf("wrong parameter count for
%s",$variables['key']),$errstr)) {
$_SESSION['freetype_version'] = $variables['val'];
}
}
The code outputs the following error:
Fatal error: Call to undefined function: imagefttext() in
/sda6/domains/betterbeyourself.com_staging/includes/fnc_lang.inc(651) :
eval()'d code on line 1
We allready use a custom error handler so the above handler is
nested... this however worked very well in 4.2.3 I also noticed the
same problems in some 4.3.0 developmental cvs snapshots (don't know
which snapshots they were though) and thought it was a bug to be solved
before the stable release but appearantly it's still there....
Grtz,
Jeroen
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21462&edit=1