Page 1 of 1

[SOLVED] - Constants Usage

Posted: Wed Jun 01, 2005 1:21 pm
by anjanesh
Hi

Im using a specific job cms for my client.
Currently its just setup on the site with no MySQL data. Its working.
I downloaded the code and sql and set it up on my PC.
When I ran the site locally there were many notices - most (or all I think) are because of unknown constants.

Example :
Notice: Use of undefined constant d - assumed 'd' in C:\xxx\xxx.php on line n

When I looked at the code, it like this
$day = date(d);

obviously I changed it to $day = date("d"); and the notice went away.

But I find the entire code is like that - $arrayname[variable] when it should have been $arrayname[$variable].

How is this acceptable ? This cms was bought by my client and I dont understand how these many notices were left out - these dont show in the site though maybe because of display_errors = off.

Thanks

Posted: Wed Jun 01, 2005 1:40 pm
by Skara
...I dont understand how these many notices were left out - these dont show in the site though maybe because of display_errors = off.
Erhm.. You answered your own question? They were likely left out because notices were off. ^^;
Bad programming practice to develop something like that. -_-'

Re: Constants Usage

Posted: Wed Jun 01, 2005 5:30 pm
by Roja
anjanesh wrote: How is this acceptable ? This cms was bought by my client and I dont understand how these many notices were left out - these dont show in the site though maybe because of display_errors = off.
Many developers develop with warnings display off, because they are just warnings, and they think its okay to ignore them.

Obviously, most people here would disagree with that, and I personall don't consider it acceptable for an application to spew warnings.

Talk to the company you purchased it from - perhaps they have a new version, or would be interested in bug fixes for that issue.