views:

24

answers:

2

I have an old osCommerce site that was PHP4, now running on PHP5. Named constants defined with define() are being evaluated incorrectly:

$string = '<a href="http://www.oscommerce.com" target="_blank">' . BOX_ENTRY_SUPPORT_SITE . '</a><br>';

will show as BOX_ENTRY_SUPPORT_SITE, not the value placeed in BOX_ENTRY_SUPPORT_SITE.

Something needs to be changed in php.ini?

+2  A: 

No, AFAIK constants behavior hasn't changed.

Most likely the constant is not defined; try to find where it's being defined and see if the file is being loaded by your script (ie: by require or include)

NullUserException
Also, activate error reporting, this should show something like "Undefined constant BOX_ENTRY_..., assuming "BOX_ENTRY_...".
deceze
+1  A: 

I never ran into this problem when putting osCommerce sites on PHP5 from PHP4.

Most probably, that define isn't being define()'d correctly. The default behaviour (with error reporting relaxed) is to show the constant like that when it isn't found.

alex
Aha, that's the missing bit of info, that the default behavior of undefined constant is to treat as a string. Error reporting was ~E_NOTICE as set in includes/application_top.php, so the php.ini change was ineffectual. I also found in the application_top.php include where the language specific include code was COMMENTED OUT, and activating that solved my issue.
ransomweaver