You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So this is one of those cases where PHP is just plain weird / annoying.
In \Spot\Entity::fields($entityName) you have the check:
if(!is_subclass_of($entityName, '\Spot\Entity')) {
throw new \Spot\Exception($entityName . " must be subclass of '\Spot\Entity'.");
}
however, is_subclass_of() returns false if the class hasn't been loaded. I don't know if you care about this case, or how many different checks you'd have to add in all over the code to support it, but I just ran into this issue while trying to fix my autoloader's 5.3 support.
The text was updated successfully, but these errors were encountered:
Interesting. Definitely not the expected behavior, although it kinda makes sense - PHP can't know the class structure or parents until the class is loaded/included because of it's shared-nothing nature. I could add an additional check to see if the class has been loaded, but like you said -- I'm not sure how many other places I would have to add the check also. I'll think about it and take a look at the existing code a bit.
So this is one of those cases where PHP is just plain weird / annoying.
In \Spot\Entity::fields($entityName) you have the check:
if(!is_subclass_of($entityName, '\Spot\Entity')) {
throw new \Spot\Exception($entityName . " must be subclass of '\Spot\Entity'.");
}
however, is_subclass_of() returns false if the class hasn't been loaded. I don't know if you care about this case, or how many different checks you'd have to add in all over the code to support it, but I just ran into this issue while trying to fix my autoloader's 5.3 support.
The text was updated successfully, but these errors were encountered: