From: Pierre Joye Date: Wed, 29 Aug 2007 06:26:30 +0000 (+0000) Subject: - gd bug #102, alternative fix when an old library is used X-Git-Tag: php-5.2.4~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a83c2153f97d39c29c3a03c873e880c5d9579291;p=php - gd bug #102, alternative fix when an old library is used --- diff --git a/ext/gd/gd.c b/ext/gd/gd.c index f880b69905..8dbdcdd4f1 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -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) {