Skip to content

Commit

Permalink
Fixed null deprecation in Zend/Pdf/Resource/Font/Simple
Browse files Browse the repository at this point in the history
  • Loading branch information
kiatng committed Nov 15, 2024
1 parent 9d88eb8 commit 3e21fb7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions library/Zend/Pdf/Resource/Font/Simple.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ public function glyphNumberForCharacter($characterCode)
*/
public function getCoveredPercentage($string, $charEncoding = '')
{
if ($string === null || $string === '') {
return 0;
}

/* Convert the string to UTF-16BE encoding so we can match the string's
* character codes to those found in the cmap.
*/
Expand Down Expand Up @@ -261,6 +265,10 @@ public function widthForGlyph($glyphNumber)
*/
public function encodeString($string, $charEncoding)
{
if ($string === null || $string === '') {
return '';
}

if (PHP_OS == 'AIX') {
return $string; // returning here b/c AIX doesnt know what CP1252 is
}
Expand All @@ -279,6 +287,10 @@ public function encodeString($string, $charEncoding)
*/
public function decodeString($string, $charEncoding)
{
if ($string === null || $string === '') {
return '';
}

return iconv('CP1252', $charEncoding, $string);
}
}

0 comments on commit 3e21fb7

Please sign in to comment.