1

I made a data class on my localhost which uses a new feature from php 5.3, static() or get_called_class().

Now my webhost supports php 5.2 and I had to try something else, so I tried this :

   public static function get_called_class()
    {
        $objects = array();
        $traces = debug_backtrace();
        foreach ($traces as $trace)
        {
            if (isset($trace['object']))
            {
                if (is_object($trace['object']))
                {
                    $objects[] = $trace['object'];
                }
            }
        }
        if (count($objects))
        {
            return get_class($objects[0]);
        }
    }

The result is about the same, except im getting this object name :

  [__PHP_Incomplete_Class_Name] => user
    [table] => user
    [data:private] => 
    [className:private] => user
    [arFields:private] => Array
        (
            [id] => id
            [firstname] => firstname
            [initials] => initials
            [lastname] => lastname
            [email] => email
            [password] => password
        )

    [id] => 15
    [firstname] => ...
    [initials] => ...
    [lastname] =>...
    [email] => ...
    [password] => ...
)

How can I make it so that the name is user object instead of this?

halfer
  • 19,824
  • 17
  • 99
  • 186
David Ericsson
  • 2,570
  • 2
  • 19
  • 33

0 Answers0