Fatal: must be of type Countable|array, string given
-
Seeing the following fatal on multiple sites as
$psNameis a string instead of an array as shown in fatal.PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in /srv/htdocs/wp-content/plugins/pdf-print/mpdf/classes/ttfontsuni.php:613
Stack trace:
#0 /srv/htdocs/wp-content/plugins/pdf-print/mpdf/classes/ttfontsuni.php(202): TTFontFile->extractInfo(false, true, 255)
#1 /srv/htdocs/wp-content/plugins/pdf-print/mpdf/mpdf.php(3880): TTFontFile->getMetrics('/srv/htdocs/wp-...', 'dejavusansmono', 0, false, true, 255)
#2 /srv/htdocs/wp-content/plugins/pdf-print/mpdf/mpdf.php(4246): mPDF->AddFont('dejavusansmono', '')
#3 /srv/htdocs/wp-content/plugins/pdf-print/mpdf/mpdf.php(13624): mPDF->SetFont('dejavusansmono')
#4 /srv/htdocs/wp-content/plugins/pdf-print/mpdf/mpdf.php(1287): mPDF->SetDefaultFont('dejavusansmono')
#5 /srv/htdocs/wp-content/plugins/pdf-print/pdf-print.php(1398): mPDF->__construct('', 'A4', 11.0, 'dejavusansmono', 15, 15, 16, 16)
#6 /wordpress/core/6.8.1/wp-includes/class-wp-hook.php(324): pdfprnt_print(Object(WP))
#7 /wordpress/core/6.8.1/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#8 /wordpress/core/6.8.1/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#9 /wordpress/core/6.8.1/wp-includes/class-wp.php(835): do_action_ref_array('wp', Array)
#10 /wordpress/core/6.8.1/wp-includes/functions.php(1342): WP->main('')
#11 /wordpress/core/6.8.1/wp-blog-header.php(16): wp()
#12 /wordpress/core/6.8.1/index.php(17): require('/wordpress/core...')
#13 {main}
thrown in /srv/htdocs/wp-content/plugins/pdf-print/mpdf/classes/ttfontsuni.php on line 613Related code:
for ($i = 0; $i < count($psName); $i++)
Can you please add better data type handling or use strlen instead of count if it should be a string?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Fatal: must be of type Countable|array, string given’ is closed to new replies.