Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7 and (multiple) Autoloader fix #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/PHPRtfLite/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
4 changes: 2 additions & 2 deletions lib/PHPRtfLite/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down