|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-03-29 09:48 UTC] deepdiver at owncloud dot com
Description: ------------ As soon as a semi-collon is in the path the font can no longer be loaded. Tested with php 5.6 as well as php 7.2 Test script: --------------- <?php $fontFile = __DIR__ . '/fonts/foo;bar/OpenSans-Regular.ttf'; $image = imagecreate(128, 128); $textColor = imagecolorallocate($image, 0, 0, 0); imagettftext($image, 18, 0, 0, 0, $textColor, $fontFile, 'lorem'); PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 22:00:02 2025 UTC |
> The root directory was computed based on ci config > parameters which had the semi colon in place well fix that crap, php runs on different operating systems and not all of them allows every char static function NormalizeFilename(string $filename): string { static $allowed_chars; if(empty($allowed_chars)) { $allowed_chars = array_flip(str_split('0123456789abcdefghijklmnopqrstuvwxyz_.-')); } $filename = trim(strtolower($filename)); $filename = str_replace([chr(246),chr(214),chr(196),chr(228),chr(252),chr(220),chr(223)], ['oe','oe','ae','ae','ue','ue','ss'], $filename); $input_array = str_split(str_replace("\0", '', $filename)); foreach($input_array as $key=>$char) { if(!isset($allowed_chars[$char])) { $input_array[$key] = '_'; } } $filename = implode('', $input_array); while(strpos($filename, '..') !== false) { $filename = str_replace('..', '.', $filename); } while(strpos($filename, '__') !== false) { $filename = str_replace('__', '_', $filename); } $filename = str_replace('.php.', '.', $filename); return $filename; }