Hello internals! My name is Andrew and I write php literally since childhood (something around 10 years), now PHP - is my profession. And today once again debugging foreign code, I was ready to go to the hospital to see a psychiatrist. First, some of the code: Do you think that can output this feature?
function test(A $a) { var_dump(get_class($a)); } I always thought that only 'string (1) "A"', I have never been so wrong (c). The code below will display 'string (1) "B"' class A { } class B { public $id = 1; } set_error_handler(function () { return true; }); function test(A $a) { var_dump(get_class($a)); } test(new B()); I think this is very unexpected behavior, and suggest you to consider the possibility of removing this behavior in PHP7. Best regards. Andrew Kluev.