php - Class not found after "require_once"

483

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 therequire_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 outrequire_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?

128

Answer

Solution:

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 tospl_autoload_register.

Similar Question: Override vendor autoload composer

People are also looking for solutions to the problem: Use PHP GD in Laravel get garbled

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.