web design, England, Britain, UK, belgium
 

Disable Joomla php error reporting with @ (at) symbol - Joomla & VirtueMart Tips & How To's

Disable Joomla php error reporting with @ (at) symbol.

Home Joomla VirtueMart Tips Disable Joomla php error reporting with @ (at) symbol

Mon

07

Dec

Disable Joomla php error reporting with @ (at) symbol
  • Joomla 1.5
  • VirtueMart 1.1

I have had a couple of occasions when uncooperative, client chosen hosts have overridden the Joomla error reporting setting.
In this case unimportant "Notice" errors can be disabled from within the code.



Joomla Disable php error reporting with @ (at) symbol The first step is to open the file in a text editor, that is reported in the error message, in this case plugins/content/ultimate_social_bookmarking_plugin.php on line 77.
The error here is a "Notice:", the lowest level of error that php returns, i.e. an error that won't break the code but is there. It is for you to judge whether it worth trying to fix the php error or just stop it being reported.
If it was a code breaking error then of course it would need to be fixed. Also if the error reporting was switched off completely on the server (as it should be for a production site) then the error wouldn't be displayed anyway.
In this case due to an uncooperative host who wouldn't disable the error reporting and was overriding the Joomla setting disabling the individual error reporting within the code was the easiest option.
So the line 77 giving the error "Notice: Undefined property: stdClass::$catid" was -
if ($article->catid == trim($ex))
Joomla Disable php error reporting with @ (at) symbol just means that $catid hasn't been defined in the code and doesn't effect the operation of the module.
Therefore we can change the code to -
if (@$article->catid == trim($ex))
Notice the @(at) symbol before the variable? This tells the php engine not to report any propblems with this variable.
Now the module displays correctly.

Last Updated on Monday, 07 December 2009 11:40
 
VirtueMart
Your Cart is currently empty.



Disable Joomla php error reporting with @ (at) symbol|Joomla & VirtueMart Tips & How To's



Disable Joomla php error reporting with @ (at) symbol.


error, code, reporting, notice, catid, php, case, joomla, wouldn, line, article, trim, module, reported, variable, setting, uncooperative, disabling, overriding, propblems, individual, option, easiest, disable, displays, production, server, site, correctly, host, displayed, giving, undefined, means, operation, completely, hasn, doesn, defined, symbol

|

We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of the site have already been set.
To find out more about the cookies we use and how to delete them, see our privacy policy.

I accept cookies from this site.