【问题标题】:When I click on export this error occurs in phpmyadmin当我单击导出时,phpmyadmin 中会发生此错误
【发布时间】:2020-06-09 02:53:22
【问题描述】:

./../../php/tcpdf/include/tcpdf_fonts.php#1671 中的警告 chr() 期望参数 1 为 int,给定字符串

回溯

tcpdf_fonts.php#1671: chr(string '') tcpdf_fonts.php#1803: TCPDF_FONTS::unichr( 细绳 '', 布尔真, ) tcpdf_fonts.php#2095: TCPDF_FONTS::UTF8ArrSubString( 大批, 整数 0, 整数 1, 布尔真, ) tcpdf.php#1960: TCPDF_FONTS::utf8Bidi( 大批, 细绳 '', 布尔假, 布尔真, 空值, ) ./libraries/classes/Pdf.php#50: TCPDF->__construct( 字符串“L”, 字符串'pt', 字符串'A3', 布尔真, 字符串 'UTF-8', 布尔假, 布尔假, ) ./libraries/classes/Plugins/Export/Helpers/Pdf.php#58: PhpMyAdmin\Pdf->__construct( 字符串“L”, 字符串'pt', 字符串'A3', 布尔真, 字符串 'UTF-8', 布尔假, 布尔假, ) ./libraries/classes/Plugins/Export/ExportPdf.php#70: PhpMyAdmin\Plugins\Export\Helpers\Pdf->__construct( 字符串“L”, 字符串'pt', 字符串'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( 字符串“出口”, 字符串“库/类/插件/导出/”, 大批, ) ./db_export.php#147: PhpMyAdmin\Display\Export->getDisplay( 字符串“数据库”, 字符串'wordpress', 细绳 '', 细绳 '', 整数 14, 整数 0, string 'TablesStructureDataSelect all wp_commentmetawp_cmetswp_linkswp_optionswp_postmetawp_postswp_termmetawp_termswp_term_relationshipswp_term_taxonomywp_usermetawp_userswp_yoast_seo_linkswp_yoast_seo_meta ', )

【问题讨论】:

    标签: php mysql wordpress phpmyadmin


    【解决方案1】:

    运行这个命令:

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

    在公共方法体中加入这个条件is_numeric($c),所以改一下:

    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 '';
        }
    }
    

    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 '';
            }
        }
    }
    
    

    【讨论】:

      【解决方案2】:

      我已经解决了这个问题,我只是升级了 PHPMyAdmin 和 MYSQL 最新版本。

      【讨论】:

        【解决方案3】:

        假设您在 PHP 7.4 上运行,一个快速的解决方案是降级您的 PHP 版本。或者参考这个网址https://github.com/tecnickcom/TCPDF/pull/123/commits/34eb0dff48eb0b0d5f38f4cfd92ef6d47aefc8b4

        使用 TCPDF 修复了这个错误

        【讨论】:

          猜你喜欢
          • 2015-06-07
          • 2021-06-28
          • 1970-01-01
          • 2014-08-09
          • 2022-01-11
          • 2021-04-23
          • 1970-01-01
          • 1970-01-01
          • 2020-10-18
          相关资源
          最近更新 更多