]> granicus.if.org Git - php/commitdiff
- gd bug #102, alternative fix when an old library is used
authorPierre Joye <pajoye@php.net>
Wed, 29 Aug 2007 06:26:30 +0000 (06:26 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 29 Aug 2007 06:26:30 +0000 (06:26 +0000)
ext/gd/gd.c

index f880b69905950079d874ad0f134e5be247112c58..8dbdcdd4f14aa20d07aa2599c94906b5e9704d24 100644 (file)
@@ -4353,6 +4353,9 @@ PHP_FUNCTION(imagepsloadfont)
 {
        zval **file;
        int f_ind, *font;
+#ifdef PHP_WIN32
+       struct stat st;
+#endif
 
        if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
                ZEND_WRONG_PARAM_COUNT();
@@ -4360,6 +4363,13 @@ PHP_FUNCTION(imagepsloadfont)
 
        convert_to_string_ex(file);
 
+#ifdef PHP_WIN32
+       if (VCWD_STAT(Z_STRVAL_PP(file), &st) < 0) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Font file not found (%s)", Z_STRVAL_PP(file));
+               RETURN_FALSE;
+       }
+#endif
+
        f_ind = T1_AddFont(Z_STRVAL_PP(file));
 
        if (f_ind < 0) {