Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php error notices displaying

Status
Not open for further replies.
Jul 28, 2005
358
FR
Hi all,

I have been developing a site in php, and everything is fine. However I have just uploaded it to the production server where it will be tested before launching and I am getting
Code:
Notice: Undefined variable: propertytype in /
error everywhere.

I know it's bad practice to ignore these messages in theory, but I know exactly how these variables are set etc. so don't want the notices to display.

In php.ini, the error reporting is set to error_reporting = E_ALL & ~E_NOTICE so I would think that the notices shouldn't display and I can't work out wjy they are.

Any way round this that anybody know?

Thanks,

Richard
 
you are right in that the directive E_ALL ~E_NOTICE should suppress notices. so why is it not...

1. check your code for a call to error_reporting() which will override the php.ini directive in many cases
2. instead of examining php.ini, call phpinfo() and have a look at the value being reported (this will report a mask value. E_ALL ~E_NOTICE should be 2039 (2047 - 8). it may be that the php.ini that you think you are using is not actually the one being loaded.
 
Definitely odd, I checked the phpinfo file and it reported the locationof the php.ini. This has the expected error reporting setting but still the notices come up.

In the end I put the line
Code:
error_reporting(E_ALL ^ E_NOTICE);
in the offending files (virtually all of them grr!!).

This has cleared the notices coming up so I'll stick to that for the moment.

Vet weird unless it is hidden somewhere in the other ini file sthat php parses.

Thanks anyway,

Richard
 
other ini files? i'm not aware of any.

php gets its settings from
its ini file (if it can find one)
a default setup (if it can't find an ini file or a directive is not set properly in an ini file that it does find)
any directives supplied by the webserver (hpptd.conf or .htaccess)
any recasting of the directives included in the code at runtime.

so if your installation is not doing this and you have eliminated all possible sources of user configuration error, then you may well have a corrupt installation of php.

it reported the locationof the php.ini. This has the expected error reporting setting but still the notices come up.
irrespective of the php.ini file what did phpinfo report as the setting for error_reporting?

In the end I put the line
Code:
error_reporting(E_ALL ^ E_NOTICE);
in the offending files (virtually all of them grr!!).

rather than going to the effort you did, would it not have worked ok to turn error display off?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top