From:             [EMAIL PROTECTED]
Operating system: Linux Slackware
PHP version:      4.3.0
PHP Bug Type:     Unknown/Other Function
Bug description:  set_error_handler not properly executed?

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 bug report at http://bugs.php.net/?id=21462&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21462&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21462&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21462&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21462&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21462&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21462&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21462&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21462&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21462&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21462&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21462&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21462&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21462&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21462&r=gnused

Reply via email to