apryan Posted August 14, 2016 Share Posted August 14, 2016 [14-Aug-2016 02:55:33 UTC] PHP Fatal error: Uncaught Error: Call to a member function proccess() on string in /srv/prod/Html/Render/Abstract.php:271 Stack trace: #0 /srv/prod/Html/Render/Abstract.php(257): Moto_Html_Render_Abstract->renderObject(Object(ObjectVO), Object(ContentHolderVO)) #1 /srv/prod/Html/Render/Holder.php(42): Moto_Html_Render_Abstract->renderElement(Object(ObjectVO), Object(ContentHolderVO)) #2 /srv/prod/Html/Render/Holder.php(26): Moto_Html_Render_Holder->_default(Object(ContentHolderVO)) #3 /srv/prod/Html/HelpRender.php(113): Moto_Html_Render_Holder->proccess(Object(ContentHolderVO), Object(WebsiteVO)) #4 /srv/prod/Html/HelpRender.php(92): Moto_Html_HelpRender->_renderHolders(Object(WebsiteVO)) #5 /srv/prod/templates/website/layout.tpl.php(297): Moto_Html_HelpRender->dispatch(Object(Moto_Html_Content), 'page') #6 /srv/prod/sfTemplating/sfTemplateRendererPhp.php(36): require('/srv/a in /srv/prod/Html/Render/Abstract.php on line 271 Hi, i've ran into an issue with a template and wanted to get some help. I've done some printf's to try debugging the root cause and hitting a loss. If anyone has any additional suggestions on what I can try, please let me know. Any help is greatly appreciated! current code from Abstract.php on line 271: public function renderObject($obj, $parent = NULL) { error_log("Render: " . print_r($render, TRUE), 3, "/var/tmp/my-errors.log"); error_log("Obj: ". print_r($obj, TRUE), 3, "/var/tmp/my-errors.log"); error_log("Parent: ". print_r($parent, TRUE), 3, "/var/tmp/my-errors.log"); $render = $this->getRender("object"); if( $render != NULL ) { return $render->proccess($obj, $parent); } return ""; } Output from error_log is posted here: http://pastebin.com/WksZxECW Quote Link to comment https://forums.phpfreaks.com/topic/301887-php-object-error-php-fatal-error-uncaught-error-call-to-a-member-function-proccess-on-string/ Share on other sites More sharing options...
requinix Posted August 14, 2016 Share Posted August 14, 2016 As the error message says, $render $render = $this->getRender("object");is a string. Not an object. Are you misunderstanding how getRender() works? Quote Link to comment https://forums.phpfreaks.com/topic/301887-php-object-error-php-fatal-error-uncaught-error-call-to-a-member-function-proccess-on-string/#findComment-1536129 Share on other sites More sharing options...
apryan Posted August 14, 2016 Author Share Posted August 14, 2016 yes, i don't know how either function work. getRender I believe is trying to pull the render id i believe though. Could you explain what the functions are suppose to be doing? i appreciate it. public function proccess($obj, $parent = NULL) { $this->_parent = $parent; $html = ""; if( is_array($obj) ) { $obj = (object) $obj; } if( method_exists($obj, "xxxinit") ) { $obj->xxxinit(); } $method_name = "_" . $obj->type; if( method_exists($this, $method_name) ) { $html .= $this->$method_name($obj); } else { $html .= $this->_default($obj); } return $html; } public function getRender($name, $auto = true) { if( !preg_match("/^[a-z\\_]+\$/i", $name) ) { return NULL; } if( !isset(self::$_renders[$name]) ) { if( $auto ) { $name = ucfirst($name); } $filename = str_replace("_", "/", $name) . ".php"; if( !file_exists(dirname(__FILE__) . "/" . $filename) ) { return NULL; } $class = "Moto_Html_Render_" . $name; if( class_exists($class) ) { self::$_renders[$name] = new $class($this->_engine); } else { self::$_renders[$name]; } } return self::$_renders[$name]; } Quote Link to comment https://forums.phpfreaks.com/topic/301887-php-object-error-php-fatal-error-uncaught-error-call-to-a-member-function-proccess-on-string/#findComment-1536131 Share on other sites More sharing options...
requinix Posted August 14, 2016 Share Posted August 14, 2016 That code will return an object (or null). There's something else going on. Quote Link to comment https://forums.phpfreaks.com/topic/301887-php-object-error-php-fatal-error-uncaught-error-call-to-a-member-function-proccess-on-string/#findComment-1536136 Share on other sites More sharing options...
apryan Posted August 15, 2016 Author Share Posted August 15, 2016 That code will return an object (or null). There's something else going on. It seems $render isn't showing any data anyway as it is blank when the error occurs. I did move the function to within !=NULL and it still shows the error log but doesn't contain any data. Any idea what I could check? The error does occur on first page load. I was able to bypass the page load on some occasions however once in, no object is loaded on the pages. Just the background images. Quote Link to comment https://forums.phpfreaks.com/topic/301887-php-object-error-php-fatal-error-uncaught-error-call-to-a-member-function-proccess-on-string/#findComment-1536200 Share on other sites More sharing options...
requinix Posted August 16, 2016 Share Posted August 16, 2016 I have no idea what your code is so no, I don't really have any ideas for what to look for. Assuming you have a copy installed locally, try running with a debugger. Quote Link to comment https://forums.phpfreaks.com/topic/301887-php-object-error-php-fatal-error-uncaught-error-call-to-a-member-function-proccess-on-string/#findComment-1536201 Share on other sites More sharing options...
cyberRobot Posted August 18, 2016 Share Posted August 18, 2016 (edited) For what it's worth, the error_log() code is executed before $render is defined. See the following snippet: error_log("Render: " . print_r($render, TRUE), 3, "/var/tmp/my-errors.log"); error_log("Obj: ". print_r($obj, TRUE), 3, "/var/tmp/my-errors.log"); error_log("Parent: ". print_r($parent, TRUE), 3, "/var/tmp/my-errors.log"); $render = $this->getRender("object"); Edited August 18, 2016 by cyberRobot Quote Link to comment https://forums.phpfreaks.com/topic/301887-php-object-error-php-fatal-error-uncaught-error-call-to-a-member-function-proccess-on-string/#findComment-1536314 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.