Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I click on export this error occurs in phpmyadmin

Warning in ./../../php/tcpdf/include/tcpdf_fonts.php#1671 chr() expects parameter 1 to be int, string given

Backtrace

tcpdf_fonts.php#1671: chr(string '') tcpdf_fonts.php#1803: TCPDF_FONTS::unichr( string '', boolean true, ) tcpdf_fonts.php#2095: TCPDF_FONTS::UTF8ArrSubString( array, integer 0, integer 1, boolean true, ) tcpdf.php#1960: TCPDF_FONTS::utf8Bidi( array, string '', boolean false, boolean true, NULL, ) ./libraries/classes/Pdf.php#50: TCPDF->__construct( string 'L', string 'pt', string 'A3', boolean true, string 'UTF-8', boolean false, boolean false, ) ./libraries/classes/Plugins/Export/Helpers/Pdf.php#58: PhpMyAdmin\Pdf->__construct( string 'L', string 'pt', string 'A3', boolean true, string 'UTF-8', boolean false, boolean false, ) ./libraries/classes/Plugins/Export/ExportPdf.php#70: PhpMyAdmin\Plugins\Export\Helpers\Pdf->__construct( string 'L', string 'pt', string 'A3', ) ./libraries/classes/Plugins/Export/ExportPdf.php#55: PhpMyAdmin\Plugins\Export\ExportPdf->initSpecificVariables()enter image description here ./libraries/classes/Plugins.php#99: PhpMyAdmin\Plugins\Export\ExportPdf->__construct() ./libraries/classes/Display/Export.php#677: PhpMyAdmin\Plugins::getPlugins( string 'export', string 'libraries/classes/Plugins/Export/', array, ) ./db_export.php#147: PhpMyAdmin\Display\Export->getDisplay( string 'database', string 'wordpress', string '', string '', integer 14, integer 0, string 'TablesStructureDataSelect all wp_commentmetawp_commentswp_linkswp_optionswp_postmetawp_postswp_termmetawp_termswp_term_relationshipswp_term_taxonomywp_usermetawp_userswp_yoast_seo_linkswp_yoast_seo_meta ', )

enter image description here

like image 897
raviraj Avatar asked Oct 29 '25 22:10

raviraj


1 Answers

Run this command:

sudo nano +1671 /usr/share/php/tcpdf/include/tcpdf_fonts.php

Add this condition is_numeric($c) in the public method body, so change:

public static function unichr($c, $unicode=true) {
    if (!$unicode) {
        return chr($c);
    } elseif ($c <= 0x7F) {
        // one byte
        return chr($c);
    } elseif ($c <= 0x7FF) {
        // two bytes
        return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F);
    } elseif ($c <= 0xFFFF) {
        // three bytes
        return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
    } elseif ($c <= 0x10FFFF) {
        // four bytes
        return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
    } else {
        return '';
    }
}

To

public static function unichr($c, $unicode=true) {
    if (is_numeric($c)){
        if (!$unicode) {
            return chr($c);
        } elseif ($c <= 0x7F) {
            // one byte
            return chr($c);
        } elseif ($c <= 0x7FF) {
            // two bytes
            return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F);
        } elseif ($c <= 0xFFFF) {
            // three bytes
            return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
        } elseif ($c <= 0x10FFFF) {
            // four bytes
            return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
        } else {
            return '';
        }
    }
}

like image 122
Pejman Kheyri Avatar answered Oct 31 '25 12:10

Pejman Kheyri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!