0

I get the following error:

`Fatal error: Class 'DummyClass' not found in...`

<?php

 require_once("3rdparty/simplesaml/lib/_autoload.php");

 class login extends DummyClass { (this is the line the error refers to)

 [...]

 }

?>

If I comment out the require_once it works perfectly fine.

DummyClass is defined externally and can be found in the prepend-file. (I don't think it matters for this problem as it works as expected if I comment out require_once)

The path to the file should also be correct as it gives me a "Failed opening required..." Error if I change the path.

I also tried switching between PHP 5.6 and 7 - no difference.

So, I would like to ask you for help. Do you have any hints / ideas, why I might get that error?

Zoe
  • 27,060
  • 21
  • 118
  • 148
  • 1
    This sounds like it could be an issue of namespacing. What namespace is `DummyClass` defined in and what namespace is your script in now? If `DummyClass` is in the default namespace, does `extends \DummyClass` help? – Michael Berkowski Nov 23 '18 at 17:28
  • 1
    Another thing to ask - were you using an autoload function already before including the simplesaml autoload? – Michael Berkowski Nov 23 '18 at 17:35
  • Yes, the prepend-file contains a `function __autoload($classname){`. The `\DummyClass` did not help. Although, I am just trying to figure out the namespaces. As it's a whole framework behind "DummyClass", it's not as easy to just echo something. – TheElbenreich Nov 23 '18 at 17:52
  • \_\_NAMESPACE__ does not contain anything, neither with or without the problematic line. – TheElbenreich Nov 23 '18 at 17:57

1 Answers1

0

Problem solved.

The old framework was using the old __autoload function, which is deprecated. SimpleSAMLPHP used the new function. Those autoload-combinations cause one of them to override the other.

Solution:

Switch from __autoload to spl_autoload_register.

Similar Question: Override vendor autoload composer