From 244f92bea0ff074fd024220c7b26cd017cd07d2d Mon Sep 17 00:00:00 2001 From: Simon Benjamin <163124+Benjaminhu@users.noreply.github.com> Date: Mon, 6 May 2019 23:08:32 +0200 Subject: [PATCH 1/2] [mod] PHP 7.3 fix: getRowsCount(), getColumnsCount() [error] count(): Parameter must be an array or an object that implements Countable in Table.php on line 817 & 839 --- lib/PHPRtfLite/Table.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PHPRtfLite/Table.php b/lib/PHPRtfLite/Table.php index 62d354a..df7c8aa 100644 --- a/lib/PHPRtfLite/Table.php +++ b/lib/PHPRtfLite/Table.php @@ -49,13 +49,13 @@ class PHPRtfLite_Table implements PHPRtfLite_Freeable * array of PHPRtfLite_Table_Row instances * @var PHPRtfLite_Table_Row[] */ - protected $_rows; + protected $_rows = array(); /** * array of PHPRtfLite_Table_Column instances * @var PHPRtfLite_Table_Column[] */ - protected $_columns; + protected $_columns = array(); /** * @var string From 4cdd3261ddb6d85c83ad7efafb32152d6b6da3dc Mon Sep 17 00:00:00 2001 From: Simon Benjamin <163124+Benjaminhu@users.noreply.github.com> Date: Fri, 10 May 2019 22:08:55 +0200 Subject: [PATCH 2/2] [mod] autoload() fix [info] Just autoload with your own PHPRtfLite files --- lib/PHPRtfLite/Autoloader.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/PHPRtfLite/Autoloader.php b/lib/PHPRtfLite/Autoloader.php index 5dc5af5..873d8de 100644 --- a/lib/PHPRtfLite/Autoloader.php +++ b/lib/PHPRtfLite/Autoloader.php @@ -59,6 +59,11 @@ public static function autoload($className) if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/m', $className)) { throw new Exception("Class name '$className' is invalid"); } + // Idea: Smarty - Autoloader - https://github.com/smarty-php/smarty/blob/master/libs/Autoloader.php + // Just autoload with your own PHPRtfLite files + if (stripos($className, 'PHPRtfLite') !== 0) { + return; + } $classFile = self::$_baseDir . '/' . str_replace('_', '/', $className) . '.php';