Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2981

IDL with no namespace produces unparsable PHP

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.9.2
    • Fix Version/s: 0.9.3
    • Component/s: PHP - Compiler
    • Labels:
      None
    • Environment:

      all

      Description

      Compiling IDL for PHP without a namespace like:

      service hi {
           void myFunc()
      }
      

      generates hi.php with this at the top:

      namespace ; 
      

      which causes PHP to produce:

      PHP Parse error:  syntax error, unexpected ';', expecting identifier (T_STRING) or \\\\ (T_NS_SEPARATOR) or '{' in ... on line 2
      

      The compiler is generating the namespace statement even when there isn't one, which blows up the PHP interpreter. Patch supresses service and type file output of namespace unless there actually is one.

        Attachments

        1. 0001-php-gen-namespace-fix.patch
          1 kB
          Randy Abernethy

          Activity

            People

            • Assignee:
              codesf Randy Abernethy
              Reporter:
              codesf Randy Abernethy
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: