Okay... Here's the patch again. This is only one patch to correct the
error handling of the GD extension when using T1Lib... If someone really
wants me to post a second patch for the imagepscopyfont() function I
will, but it's a really trivial... I just suggested we throw a warning
instead of completely removing the function from the extension for BC
reasons...

Here's the error handling patch:

Index: gd.c
===================================================================
RCS file: /repository/php4/ext/gd/gd.c,v
retrieving revision 1.261
diff -u -r1.261 gd.c
--- gd.c        31 Mar 2003 08:49:19 -0000      1.261
+++ gd.c        3 Apr 2003 05:45:59 -0000
@@ -3188,21 +3188,7 @@
        f_ind = T1_AddFont(Z_STRVAL_PP(file));
 
        if (f_ind < 0) {
-               switch (f_ind) {
-                       case -1:
-                               php_error_docref(NULL TSRMLS_CC,
E_WARNING, "Couldn't find the font file");
-                               RETURN_FALSE;
-                               break;
-                       case -2:
-                       case -3:
-                               php_error_docref(NULL TSRMLS_CC,
E_WARNING, "Memory allocation fault in t1lib");
-                               RETURN_FALSE;
-                               break;
-                       default:
-                               php_error_docref(NULL TSRMLS_CC,
E_WARNING, "An unknown error occurred in t1lib");
-                               RETURN_FALSE;
-                               break;
-               }
+           php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib Error:
%s", T1_StrError(f_ind));
        }
 
        if (T1_LoadFont(f_ind)) {
@@ -3476,7 +3462,7 @@
 
        if (!str_path) {
                if (T1_errno) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING,
"libt1 returned error %d", T1_errno);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING,
"T1Lib Error: %s", T1_StrError(T1_errno));
                }
                RETURN_FALSE;
        }
@@ -3495,7 +3481,7 @@
        str_img = T1_AAFillOutline(str_path, 0);
 
        if (T1_errno) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "libt1
returned error %d", T1_errno);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib
Error: %s", T1_StrError(T1_errno));
                RETURN_FALSE;
        }
 

John

-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-
John Coggeshall
john at coggeshall dot org                  http://www.coggeshall.org/
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to