Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Autoloader, using prepend parameter php >= 5.3 #388

Closed
doofer opened this issue Jun 17, 2014 · 4 comments
Closed

Autoloader, using prepend parameter php >= 5.3 #388

doofer opened this issue Jun 17, 2014 · 4 comments
Assignees
Milestone

Comments

@doofer
Copy link

doofer commented Jun 17, 2014

File:
PHPExcel/Autoloader.php

Location:
58: return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'), true, true);

This breaks compatibility with php < 5.3.
http://www.php.net/manual/ro/function.spl-autoload-register.php

@MarkBaker
Copy link
Member

Does PHP < 5.3 actually error with this? Standard PHP behaviour when a function is called with extra arguments is simply to ignore those extra arguments

@doofer
Copy link
Author

doofer commented Jun 17, 2014

It does not trigger an error but it does not register the Autoloader, so it fails with :
| Fatal error: Class 'PHPExcel_Shared_String' not found
Upon removing the prepend parameter it seems to work fine, my PHP version is 5.2.11

@MarkBaker
Copy link
Member

Fixed

@Progi1984 Progi1984 added this to the 1.8.0 milestone Sep 8, 2014
@Kyaalena-zz
Copy link

Kyaalena-zz commented Mar 9, 2017

tengo el mismo error Fatal error: Class 'PHPExcel_Shared_String' not found in \PHPExcel\Autoloader.php on line 11

line 11 -> PHPExcel_Shared_String::buildCharacterSets();

However I see that already what they comment in the library, some other suggestion?
class PHPExcel_Autoloader
{
/**
* Register the Autoloader with SPL
*
*/
public static function register()
{
if (function_exists('__autoload')) {
// Register any existing autoloader function with SPL, so we don't get any clashes
spl_autoload_register('__autoload');

    }
    // Register ourselves with SPL
    if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
        return spl_autoload_register(array('PHPExcel_Autoloader', 'load'), true, true);
    } else {
        return spl_autoload_register(array('PHPExcel_Autoloader', 'load'));
    }
} 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants