[ 
https://issues.apache.org/jira/browse/THRIFT-1905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14221126#comment-14221126
 ] 

Alex Medvedev commented on THRIFT-1905:
---------------------------------------

+1 

This problem makes factually impossible use of underscores in struct names 
since underscores get stripped inside all the service method type hints (and in 
interface to), but generated structs itself have original underscores 
untouched. For example Test_SQL_Row class (which refers to struct Test_SQL_Row 
from original Tim Behrendsen's example) can be found inside the generates 
Types.php file. This behavior leads to type mismatch. 

May be we can dispose [usage of classify function in 
compiler|https://github.com/apache/thrift/blob/16a23a6618754a5a87aeb8df99a72516b0272fb3/compiler/cpp/src/generate/t_php_generator.cc#L2370]
 in order to translate original struct names in generated code?

> Struct names with underscores get mangled in PHP compiled output
> ----------------------------------------------------------------
>
>                 Key: THRIFT-1905
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1905
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Compiler
>    Affects Versions: 0.9
>         Environment: Centos 6.4
>            Reporter: Tim Behrendsen
>
> When compiling a thrift file containing a struct name with underscores, the 
> underscores get stripped out in the name if the struct is used as a type hint 
> in a function definition.
> EXAMPLE THRIFT FILE
> ------------------------------------------------------------------
> {noformat}
> namespace php TEST
> struct Test_SQL_Row {
>     1: map<string,string> row
> }
> service New_Service {
>     i16 Tester(1:Test_SQL_Row row),
> }
> {noformat}
> ------------------------------------------------------------------
> SNIPPET FROM COMPILED OUTPUT
> Command: thrift -r --gen php bad.thrift
> ------------------------------------------------------------------
> {noformat}
>   public function Tester(\TEST\TestSQLRow $row)
>   {
>     $this->send_Tester($row);
>     return $this->recv_Tester();
>   }
> {noformat}
> ------------------------------------------------------------------



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

Reply via email to