Migrating OOP php4 -> 5 - $this re-assign - Recreating an instance scope outside

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vituko
    New Member
    • Dec 2006
    • 48

    Migrating OOP php4 -> 5 - $this re-assign - Recreating an instance scope outside

    Hi, I have another problem migrating to php5.

    An important piece of my "web kernel" is a system of include / require throw exceptions :

    Instead of : require $x
    I do : trigger_error ('INC_'.$x...)

    Error_handler :
    ...
    $this = $errcontext ["this"] ; //Error!!!!!
    include $x ;
    ...

    It allows me to decide some things, to find dinamically files, to log for debug, ... I liked very much this solution and changing that it's a lot of work.

    You can require a file in the code of a class method, and the inserted code fits there transparently. So, how can I emulate this when I've changed the scope temporaly, I'm in a third function.
    I have to pass the instance reference from a class method to another scope (function -> error_handler -> included file) keeping the $this reference transparently.

    Any ideas?
    Thanks
  • vituko
    New Member
    • Dec 2006
    • 48

    #2
    I think I've found a possible solution with the runkit extension : runkit_method_a dd (using a temporary and externally created method). Like aggregate_metho ds in php4...

    Any better solution?

    Thanks anyway!

    Comment

    Working...