[ 
https://issues.apache.org/jira/browse/THRIFT-2981?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Randy Abernethy updated THRIFT-2981:
------------------------------------
    Description: 
Compiling IDL for PHP without a namespace like:

{noformat}
service hi {
     void myFunc()
}
{noformat}

generates hi.php with this at the top:

{noformat}
namespace ; 
{noformat}

 which causes PHP to produce:

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

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.

  was:
Compiling IDL for PHP without a namespace like:

{noformat}
service hi {
     void myFunc()
}
{noformat}

produces  :

{noformat}
namespace ; 
{noformat}

in the generated code which causes PHP to produce:

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

patch forthcoming.


> IDL with no namespace produces unparsable PHP
> ---------------------------------------------
>
>                 Key: THRIFT-2981
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2981
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Compiler
>    Affects Versions: 0.9.2
>         Environment: all
>            Reporter: Randy Abernethy
>            Assignee: Randy Abernethy
>            Priority: Minor
>             Fix For: 0.9.3
>
>         Attachments: 0001-php-gen-namespace-fix.patch
>
>
> Compiling IDL for PHP without a namespace like:
> {noformat}
> service hi {
>      void myFunc()
> }
> {noformat}
> generates hi.php with this at the top:
> {noformat}
> namespace ; 
> {noformat}
>  which causes PHP to produce:
> {noformat}
> PHP Parse error:  syntax error, unexpected ';', expecting identifier 
> (T_STRING) or \\\\ (T_NS_SEPARATOR) or '{' in ... on line 2
> {noformat}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to