Jens Geyer created THRIFT-6252:
----------------------------------
Summary: Add TConfiguration to the PHP library
Key: THRIFT-6252
URL: https://issues.apache.org/jira/browse/THRIFT-6252
Project: Thrift
Issue Type: New Feature
Components: PHP - Library
Reporter: Jens Geyer
Most Thrift libraries keep their transport and protocol limits in one
{{TConfiguration}} object: {{MaxMessageSize}} (default 100 MiB),
{{MaxFrameSize}} (default 16384000) and {{RecursionLimit}} (default 64). It was
introduced with THRIFT-5021 (netstd) and THRIFT-5237 (C++, Java, c_glib). The
PHP library has no equivalent; its limits are spread over constructor arguments
and constants:
* {{TFramedTransport}} and {{TFramedTransportFactory}} take {{maxFrameSize}},
default 16384000.
* {{TBinaryProtocol}}, {{TCompactProtocol}}, {{TBinaryProtocolAccelerated}} and
their factories take {{maxStringSize}}, default 16384000.
* {{TProtocol}} applies a fixed recursion depth of 64
({{DEFAULT_RECURSION_DEPTH}}), and the {{thrift_protocol}} extension its own
fixed {{MAX_RECURSION_DEPTH}} of 64. Neither can be changed.
* There is no overall message size limit.
h2. Proposal
* Add {{Thrift\TConfiguration}} with {{maxMessageSize}}, {{maxFrameSize}} and
{{recursionLimit}}, using the defaults of the other libraries.
* Let transports carry a configuration and pass it on through layered
transports and factories, as the other libraries do.
* Take {{TFramedTransport}}'s frame limit and the protocols' recursion limit
from it. The existing {{maxFrameSize}} and {{maxStringSize}} arguments keep
working.
* Enforce {{maxMessageSize}} on the read path.
* The {{thrift_protocol}} extension takes its limits from the same object.
h2. Compatibility
A default {{maxMessageSize}} of 100 MiB rejects messages that are accepted
today. That needs a release note and a documented way to raise the limit.
_Drafted with AI assistance (Claude Opus 5)._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)