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

IDL with no namespace produces unparsable PHP

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.9.2
    • 0.9.3
    • PHP - Compiler
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: