0

Hi I am using Amazon PHP SDK to upload to s3. I am using fineuploader jQuery plugin on front end. Recently my hosting PHP version was upgraded to PHP5.4.34 and not the upload system is broken and when I look at the logs I see this error.

<br />
<b>Fatal error</b>:  Uncaught exception 'LogicException' with message 'Illegal value passed (no array or string given)' in /home/on2dvd/public_html/fineuploader/aws/aws-autoloader.php:1270
Stack trace:
#0 /home/on2dvd/public_html/fineuploader/aws/aws-autoloader.php(1270): spl_autoload_register(NULL, true)
#1 /home/on2dvd/public_html/fineuploader/s3/s3handler.php(27): require('/home/on2dvd/pu...')
#2 {main}
  thrown in <b>/home/on2dvd/public_html/fineuploader/aws/aws-autoloader.php</b> on line <b>1270</b><br />

I searched alot but could not find any solution for this. The error is in the aws-autoloader.php line 1270 and on this line the code is below. $mapping is an array containing the keys and class names. It was working fine in PHP 5.3 but not working any more after the upgrade.

spl_autoload_register(function ($class) use ($mapping) {
    if (isset($mapping[$class])) {
        require $mapping[$class];
    }
}, true);
Imran Khan
  • 358
  • 3
  • 16

2 Answers2

0

Hi all I found a solution for my problem here.

https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md

I used this function from the above url and it solved my issue.

function autoload($className)
{
    $className = ltrim($className, '\\');
    $fileName  = '';
    $namespace = '';
    if ($lastNsPos = strrpos($className, '\\')) {
        $namespace = substr($className, 0, $lastNsPos);
        $className = substr($className, $lastNsPos + 1);
        $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
    }
    $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';

    require $fileName;
}
spl_autoload_register('autoload');
Imran Khan
  • 358
  • 3
  • 16
0

Check if you have eAccelerator installed: How to monitor eaccelerator

If it's the case, just add this two lines in the .htaccess of the project:

php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0
M_iserte
  • 98
  • 5