Fatal Error Cannot Access Protected Property Jexception
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Cannot access protected property JException::$code up vote 1 down vote favorite Fatal error: Cannot access protected property JException::$code in /.../templates/abrax/error.php on line 14 Lines 14-17: if (($this->error->code) == '404') { header('Location: http://www.example.com/404'); exit; } joomla2.5 share|improve this question asked Apr 8 '13 at 2:05 Steve 28941337 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote Use getters, you can't access property directly because it's visibility is not public Like if (($this->error->getCode()) == '404') { ... share|improve this answer answered Apr 8 '13 at 7:36 Marko D 5,47911630 i face this same problem, and i changed the code as you said,but another error show to me: Fatal error: Can't use method return value in write context What's this mean? –Jack Zhang Apr 16 '13 at 13:05 @JackZhang how exactly did you write it, can you copy the line of error? did you put = instead of ==? –Marko D Apr 16 '13 at 13:35 This solves the problem. Joomla 3.3 –davimusprime May 29 '14 at 20:34 add a comment| up vote 0 down vote try this if ($this->_error->get('code') == '404') { header('Location: http://www.example.com/404'); exit; } share|improve this answer answered Apr 14 '15 at 10:17 Aleksey Zubovich 1 add a comment| Your
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PHP cannot access protected property error up vote 17 down vote favorite 3 PHP Fatal error: Cannot access protected property Exception::$message http://stackoverflow.com/questions/15870170/cannot-access-protected-property-jexceptioncode in /web/index.php on line 23 On line 23 I have, echo '
Sign in Pricing Blog Support Search GitHub https://github.com/cyso/TonicDNS/issues/24 This repository Watch 10 Star 28 Fork 10 cyso/TonicDNS Code Issues 7 Pull requests 3 Projects 0 Wiki Pulse http://www.gsedispensing.com/index.php/en/home Graphs New issue PHP Fatal error: Cannot access protected property Exception::$message in /var/www/tonicdns/TonicDNS/classes/AuthenticationResource.class.php on line 54 #24 Closed gfdsa opened this fatal error Issue Mar 31, 2013 · 2 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 2 participants gfdsa commented Mar 31, 2013 Just cloned from master today, when it fails to connect to the fatal error cannot PDO database for authentication catching exception doesn't work as it should: [Sun Mar 31 13:06:54 2013] [error] [client ] PHP Stack trace: [Sun Mar 31 13:06:54 2013] [error] [client ] PHP 1. {main}() /var/www/tonicdns/TonicDNS/docroot/dispatch.php:0 [Sun Mar 31 13:06:54 2013] [error] [client ] PHP 2. Request->loadResource() /var/www/tonicdns/TonicDNS/docroot/dispatch.php:26 [Sun Mar 31 13:06:54 2013] [error] [client ] PHP 3. AuthenticationResource->__construct() /var/www/tonicdns/TonicDNS/lib/tonic.php:557 if i remove ->message: PHP Fatal error: exception 'Exception' with message 'Failed to open database connection' in /var/www/tonicdns/TonicDNS/lib/pdo_token_backend.php:71\nStack trace:\n#0 /var/www/tonicdns/TonicDNS/classes/AuthenticationResource.class.php(47): PDOTokenBackend->__construct()\n#1 /var/www/tonicdns/TonicDNS/lib/tonic.php(557): AuthenticationResource->__construct(Array)\n#2 /var/www/tonicdns/TonicDNS/docroot/dispatch.php(26): Request->loadResource()\n#3 {main} in /var/www/tonicdns/TonicDNS/classes/AuthenticationResource.class.php on line 55 gfdsa commented Mar 31, 2013 also to save some guessing to the folk, including the real problem is always useful: throw new Exception("Failed to open database connection: $e"); CYSO member LordGaav commented Apr 1