Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-178

PHP5 to PHP4 converter fails on inherited class constants

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      When an inherited class refers to a constant defined by one of its ancestors by 'self::FOO', the php5 to php4 converter incorrectly translates the name.

      For instance, CRM_Import_Parser defines a constant VALID, a reference to "self::VALID" in CRM_Import_Parser_Contact should be translated to "CRM_IMPORT_PARSER_VALID", but instead becomes "CRM_IMPORT_PARSER_CONTACT_VALID".

      Similarly, using "parent::FOO" simply translates to "PARENT_FOO".

      One workaround is to always refer to constants using explicit class names. This is a good enough fix, but it would be nice if the converter could do the right thing in both situations.

      If fixing the converter is too much work, we should audit the code for inherited constant references, apply the workaround, and adopt the convention of always using explicit class names for constants.

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              brian Brian McFee
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: