[SOLVED] - Constants Usage

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

[SOLVED] - Constants Usage

Post 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
Last edited by anjanesh on Fri Jun 03, 2005 1:26 am, edited 1 time in total.
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post 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. -_-'
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: Constants Usage

Post 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.
Post Reply