Closed oxygen closed 7 years ago
Currently I am forced to set_error_handler() to a handler which ignores errors, run PHPFontLib stuff, then restore_error_handler(). Not pretty.
set_error_handler(function($nSeverity, $strMessage, $strFilePath, $nLineNumber){
if(
$nSeverity!=E_NOTICE
&& strpos($strMessage, "Invalid argument supplied for foreach")===false
)
{
throw new ErrorException($strMessage, /*nExceptionCode*/ 0, $nSeverity, $strFilePath, $nLineNumber);
}
}, -1);
[...] FontLib calls
restore_error_handler();
Do you have a sample font giving this warning ? I never had this problem.
See PR #37. If you run the HTML in the PR through dompdf, you'll get that error in php-font-lib.
About half the fonts (or more) in GoogleFonts if I remember correctly.
Fixed by 010c3e0e22a9ab0d9f93678692c80865f041e2d2
If running with highest strictness level
There are places where undefined array indexes default to 0 or something.
For example: \FontLib\BinaryStream::w($type, $data) [...]
$data[$i] doesn't always exist.
Suggested fix: