Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Undefined variable error

LEGEND ,
Jun 09, 2006 Jun 09, 2006
hi:

i've downloaded a site (developed by another programmer) to make some
modifications locally and i receiving tons of messages:

"Undefined variable: x in ... on line ..."

provoked by code like this:

if($x){
$y = true;
};

the site is working fine in the remote server (PHP 4.3.11) so i guess i
need to modify something in my php.ini (i already had to set
register_globals = On). or may be the remote server has just warnings
disabled?

localhost: OSX 10.4, PHP 5.0.4, Apache 1.3.33

tia,

jdoe
TOPICS
Server side applications
228
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 09, 2006 Jun 09, 2006
ok, the remote server has error_reporting = 2039 and mine is set to 2047
(E_ALL)

John Doe wrote:

> hi:
>
> i've downloaded a site (developed by another programmer) to make some
> modifications locally and i receiving tons of messages:
>
> "Undefined variable: x in ... on line ..."
>
> provoked by code like this:
>
> if($x){
> $y = true;
> };
>
> the site is working fine in the remote server (PHP 4.3.11) so i guess i
> need to modify something in my php.ini (i already had to set
> register_globals = On). or may be the remote server has just warnings
> disabled?
>
> localhost: OSX 10.4, PHP 5.0.4, Apache 1.3.33
>
> tia,
>
> jdoe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 09, 2006 Jun 09, 2006
LATEST
John Doe wrote:
> ok, the remote server has error_reporting = 2039 and mine is set to 2047
> (E_ALL)

Although it's a pain to get rid of undefined variable notices, it's a
good policy. It makes your code more robust, and less susceptible to attack.

I've recently switched on E_STRICT as well. This alerts you to changes
that are likely to place in future versions of PHP.

--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines