mpdf icon indicating copy to clipboard operation
mpdf copied to clipboard

PHP Warning: unpack() on ini mbstring.func_overload = 0 setting

Open kkjdroid opened this issue 4 years ago • 0 comments

This is similar to #91, but without the problematic setting described in that issue.

mPDF is v8.0.11, PHP is v7.2.24. Characters that are covered by ASCII work fine. CJK characters do not, but I don't have fonts for those yet, so that isn't surprising.

test.php:

<?php
require_once('./vendor/autoload.php');

use \Mpdf\Mpdf;
use \Mpdf\Config\ConfigVariables;
use \Mpdf\Config\FontVariables;
use \Mpdf\Output\Destination;

$defaultConfig = (new ConfigVariables())->getDefaults();
$fontDirs = $defaultConfig['fontDir'];

$defaultFontConfig = (new FontVariables())->getDefaults();
$fontData = $defaultFontConfig['fontdata'];
$mpdf = new Mpdf(
[
    'tempDir' => sys_get_temp_dir(),
    'mode' => 's',
    'fontDir' => array_merge($fontDirs, 
    [
        './static/fonts',
    ]),
    'fontdata' => $fontData +
    [
        'noto_sans' =>
        [
            'R' => 'NotoSans-Regular.ttf',
            'I' => 'NotoSans-Italic.ttf',
            'B' => 'NotoSans-Bold.ttf',
            'BI' => 'NotoSans-BoldItalic.ttf',
            'E' => 'NotoColorEmoji.ttf',
        ],
        'noto_color_emoji' =>
        [
            'R' => 'NotoColorEmoji.ttf',
        ],
    ],
    'default_font' => 'noto_sans',
    'backupSubsFont' =>
    [
        'noto_sans',
        'noto_color_emoji',
    ],
    'useSubstitutions' => true,
    'charset-in' => 'utf-8',
]);
$mpdf->WriteHTML("😋");
$temp_pdf_file = "./test.pdf";
$mpdf->Output($temp_pdf_file, Destination::FILE);

$ php test.php
Output:

PHP Notice:  Undefined offset: 48400 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4122
PHP Notice:  Undefined offset: 48401 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4123
PHP Notice:  Undefined offset: 21826 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4122
PHP Notice:  Undefined offset: 21827 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4123
PHP Notice:  Undefined offset: 53970 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4122
PHP Notice:  Undefined offset: 53971 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4123
PHP Notice:  Undefined offset: 18189 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4122
PHP Notice:  Undefined offset: 18190 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4123
PHP Warning:  unpack(): Type n: not enough input, need 2, have 0 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4379
PHP Warning:  unpack(): Type n: not enough input, need 2, have 0 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4379
PHP Warning:  unpack(): Type n: not enough input, need 2, have 0 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4379
PHP Warning:  unpack(): Type n: not enough input, need 2, have 0 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4379
PHP Warning:  unpack(): Type n: not enough input, need 2, have 0 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4379
PHP Warning:  unpack(): Type n: not enough input, need 2, have 0 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4379
PHP Warning:  unpack(): Type n: not enough input, need 2, have 0 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4379
PHP Warning:  unpack(): Type n: not enough input, need 2, have 0 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4379
PHP Notice:  Undefined offset: 48400 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4365
PHP Notice:  Undefined offset: 48401 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4366
PHP Notice:  Undefined offset: 21826 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4365
PHP Notice:  Undefined offset: 21827 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4366
PHP Notice:  Undefined offset: 53970 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4365
PHP Notice:  Undefined offset: 53971 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4366
PHP Notice:  Undefined offset: 18189 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4365
PHP Notice:  Undefined offset: 18190 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.php on line 4366

test.pdf has a single "tofu" character.

kkjdroid avatar Jun 11 '21 14:06 kkjdroid