0

I am using php 5.2.6 in AppServ on a Windows machine and PHPExcel does not seem to work and produces no errors. I have error_reporting set to E_ALL.

On my Linux machine where I am using php 5.6 and using vagrant/homestead the same code works just fine.

Here is my code: http://pastebin.com/6dJC8gaP

I added some echos to see where exactly it dies, and it seems to die on line 9. I had thought maybe it was an issue with php 5.2 and :: referencing, so I tried using the call_user_func, which also works on my php 5.6 but does not work on my php 5.2

Tyler
  • 3,713
  • 6
  • 37
  • 63

2 Answers2

0

http://php.net/manual/en/function.call-user-func.php

<?php

namespace Foobar;

class Foo {
    static public function test() {
        print "Hello world!\n";
    }
}

call_user_func(__NAMESPACE__ .'\Foo::test'); // As of PHP 5.3.0
call_user_func(array(__NAMESPACE__ .'\Foo', 'test')); // As of PHP 5.3.0

?>

Per page:

Quote:

In PHP v5.2, you /can/ use call_user_func(array($this, 'parent::SOME_FUNCTION')).

If you don't have custom __autoload() function, you are good to go.

If you do have custom __autoload(), you need to make it `parent' aware. Something like:

Rationale: PHP 5.2 surprisingly tries to autoload a class named 'parent'. However, if you don't do anything in __autoload() for the 'parent' class, it'll work just fine.

Vladimir Ramik
  • 1,920
  • 2
  • 13
  • 23
  • I appreciate the response, apparently that was not the issue. I was using call_user_func. – Tyler Mar 17 '15 at 04:55
0

In PHPExcel/Settings.php there are two references to libxml_disable_entity_loader function.

That function is not available until php 5.2.11, and the @ in front of it was causing a silent error.

I did as they suggested and wrapped that function in function_exist checks. Everything works fine now.

Reference: https://github.com/PHPOffice/PHPExcel/issues/339

Tyler
  • 3,713
  • 6
  • 37
  • 63