Closed
Description
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:
<?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 file
echo '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