[php-src] Issue #10344: imagettfbbox(): Could not find/open font UNC path
| From: | JamesHeinrich | Date: | Mon, 16 Jan 2023 17:15:34 +0000 |
| Subject: | [php-src] Issue #10344: imagettfbbox(): Could not find/open font UNC path | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243464@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10344
Author: JamesHeinrich
### 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
<?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