get_called_class hack not working with eval-code.
- by Ekampp
Hi there.
I am using a ge_called_class hack for allowing late static binding in php version 5.2 (found here).
I have the following in my code:
# db_record.php
$ac = "ForumThread";
$objects = $ac::find("all");
This will not work in php 5.2 for some reason, so I have done this:
# db_record.php
$ac = "ForumThread";
eval("\$objects = {$ac}::find('all');");
This on the other hand will not work with the get_called_class function. I get an error that the file function can't read the evaled section of code.
So how do I solve this problem?
Best regards.