-
-
Save cvuorinen/e7a19101d40c9fa0a959 to your computer and use it in GitHub Desktop.
Is this a bug in PHP? Running execute.php on Ubuntu with PHP 5.5.4 executes successfully, but on CentOS with same PHP version it gives Fatal error.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Autoloader that does not need subdirectories (because Gist does not support subdirectories). | |
// Same thing happens with default SPL autoloader where namespaced files are in subdirectories. | |
spl_autoload_register( | |
function($class) { | |
spl_autoload(str_replace("\\", "_", $class)); | |
} | |
); | |
$bar = new Some\Bar(); | |
$foo = new Some\Foo(); | |
$foo->bar($bar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Other; | |
class Bar { | |
public function baz() { | |
echo "self: " . get_class($this) . "\n"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Some; | |
use Other\Bar as OtherBar; | |
class Bar extends OtherBar { | |
public function baz() { | |
echo "self: " . get_class($this) . "\n"; | |
echo "parent: " . get_parent_class($this) . "\n"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Some; | |
use Other\Bar; | |
class Foo { | |
public function bar(Bar $bar) { | |
$bar->baz(); | |
} | |
} |
5.5.30,the same issue occurs when opcache is disabled and disappears when opcache is enabled.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
5.6.30 - actual