1

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 placed in BOX_ENTRY_SUPPORT_SITE.

Something needs to be changed in php.ini?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
ransomweaver
  • 472
  • 6
  • 19
  • 1
    Try to activate logging/displaying of notices in PHP. You'll probably see a diagnostic message telling you no constant `BOX_ENTRY_SUPPORT_SITE` is defined. – Artefacto Jul 26 '10 at 02:37

2 Answers2

2

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
  • 83,810
  • 28
  • 209
  • 234
  • 1
    Also, activate error reporting, this should show something like "Undefined constant BOX_ENTRY_..., assuming "BOX_ENTRY_...". – deceze Jul 26 '10 at 02:38
1

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
  • 479,566
  • 201
  • 878
  • 984
  • 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 Jul 26 '10 at 19:01