5
I always end up discovering a lot of crazy in this language that I love: PHP!
What would be this mysterious class __PHP_Incomplete_Class
?
I "found" her accidentally, when I gave a get_declared_classes
Then, in my curiosity, I tried to instantiate the same.
$incomplete = new __PHP_Incomplete_Class;
However, when I try to access or assign a value to any property, a Notice
is generated:
$incomplete = new __PHP_Incomplete_Class;
$incomplete->test = 'teste';
Notice: main(): The script tried to execute a method or access a Property of an incomplete Object. Please ensure that the class Definition "Unknown" of the Object you are trying to Operate on was Loaded before unserialize() gets called or provide a __autoload() Function to load the class Definition in /var/www/lab/index.php on line 5
What would that mistake be?
What would that be __PHP_Incomplete_Class
?
And where did that come from main
in the Notice that was generated?
Updating:
Apart from everything that has been said before, there is another interesting question about __PHP_Incomplete_Class
: The function is_object
returns FALSE
when we checked her out.
Behold:
var_dump(is_object(new __PHP_Incomplete_Class())); // (boolean) false
Very enlightening! But I still find funny the way PHP handles some things :)
– Wallace Maxters
Not much standardization, not even of method names (snake_case and Camelcase)
– Ricardo
Besides, I had to go to the ends of the earth to find this information
– Ricardo