[ https://issues.apache.org/jira/browse/THRIFT-3845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15521146#comment-15521146 ]
ASF GitHub Bot commented on THRIFT-3845: ---------------------------------------- Github user nsuke commented on a diff in the pull request: https://github.com/apache/thrift/pull/1022#discussion_r80386819 --- Diff: compiler/cpp/src/generate/t_php_generator.cc --- @@ -1341,9 +1341,13 @@ void t_php_generator::generate_process_function(t_service* tservice, t_function* return; } - f_service_ << indent() << "$bin_accel = ($output instanceof " - << "TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');" + // for compatibility, add method_exists + f_service_ << indent() << "$bin_accel = method_exists($output, 'isBinaryAccelerated')" << endl; + indent_up(); + f_service_ << indent() << " && $output->isBinaryAccelerated()" << endl + << indent() << " && function_exists('thrift_protocol_write_binary');" --- End diff -- The real problem may be that existing code generation here is too specific to one concrete type. What if we move these thrift_protocol_..._binary calls to TBinaryProtocolAccelerated.php ? That way we can move isStrict... checks there too so that we don't need them in TProtocolDecorator either. > TBinaryProtocolAccelerated cannot use thrift_protocol ext > --------------------------------------------------------- > > Key: THRIFT-3845 > URL: https://issues.apache.org/jira/browse/THRIFT-3845 > Project: Thrift > Issue Type: Improvement > Components: PHP - Compiler, PHP - Library > Affects Versions: 0.9.3 > Environment: PHP7 with thrift 0.9.3, with thrift_protocol, at OS X > 10.11 > Reporter: Robert Lu > Priority: Minor > > compiler generate phpcode: > instanceof TBinaryProtocolAccelerated > to indicate use thrift_protocol, but when TBinaryProtocolAccelerated warped > in TMultiplexedProtocol, thrift_protocol doesn't used, because > TMultiplexedProtocol isn't TBinaryProtocolAccelerated's instence. -- This message was sent by Atlassian JIRA (v6.3.4#6332)