You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
imagettfbbox (possibly other TTF-related functions, I haven't tested) does not accept a UNC path to font file in PHP 8.2 on Windows 11. Code works as expected with local filename. Code worked fine with UNC path in PHP 7.4.1. UNC path/filename is accessible to user that Apache/PHP is running under (as shown in sample code).
The following code:
<?php$font = '\\\\HOSTNAME\\path\\to\\arial.ttf'; // this file exists here, is readable to user PHP runs as//$font = 'C:\\path\\to\\arial.ttf'; // this works//$font = './arial.ttf'; // this works too, since font is in same folder as .php fileecho'file_exists($font)='.(file_exists($font) ? 'TRUE' : 'FALSE').'<br>';
echo'is_readable($font)='.(is_readable($font) ? 'TRUE' : 'FALSE').'<br>';
echo'is_file($font)=' .(is_file($font) ? 'TRUE' : 'FALSE').'<br>';
imagettfbbox(10, 0, $font, 'hello');
Resulted in this output:
file_exists($font)=TRUE
is_readable($font)=TRUE
is_file($font)=TRUE
E_WARNING: imagettfbbox(): Could not find/open font
But I expected this output instead:
file_exists($font)=TRUE
is_readable($font)=TRUE
is_file($font)=TRUE
// and no error message
PHP Version
PHP 8.2.0
Operating System
Windows 11 Pro x64
The text was updated successfully, but these errors were encountered:
libgd uses an incorrect absolute path check in gdft.c.
It checks if either the path starts with a '/' (only valid on Posix
btw), or whether it contains something of the form C:\ or C:/.
However, this overlooks the possibility of using UNC paths on Windows.
As we already do PHP-specific stuff with VCWD_ macros, use
IS_ABSOLUTE_PATH to check for an absolute path which will take into
account UNC paths as well.
Description
imagettfbbox
(possibly other TTF-related functions, I haven't tested) does not accept a UNC path to font file in PHP 8.2 on Windows 11. Code works as expected with local filename. Code worked fine with UNC path in PHP 7.4.1. UNC path/filename is accessible to user that Apache/PHP is running under (as shown in sample code).The following code:
Resulted in this output:
But I expected this output instead:
PHP Version
PHP 8.2.0
Operating System
Windows 11 Pro x64
The text was updated successfully, but these errors were encountered: