THRIFT-5975: Drop pre-namespace lib/php/src/{Thrift,autoload}.php#3453
Merged
Conversation
Client: php Both files are dead code from the pre-PSR-4 era: - lib/php/src/Thrift.php defined global-namespace TType, TMessageType, TException, TBase and TApplicationException. It is not loaded by anything (composer's PSR-4 maps Thrift\\ to lib/php/lib/, the PHP generator emits "use Thrift\\..." imports only) and on its own tail it include_once's protocol/TProtocol.php and transport/TTransport.php paths that do not exist under lib/php/src/, so the file would fatal if it were ever included. - lib/php/src/autoload.php relies on PHP's __autoload(), which was removed in PHP 8.0 (composer.json now requires php ^8.1). It also references a --gen php:autoload generator flag that no longer exists in compiler/cpp/src/thrift/generate/t_php_generator.cc; the only remaining alternative loader is the classmap mode, which targets namespaced lib/php/lib/ classes. Both entries are removed from EXTRA_DIST in lib/php/Makefile.am. The PHP extension under lib/php/src/ext/thrift_protocol/ is unaffected. Generated-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes two dead pre-PSR-4 files from
lib/php/src/:lib/php/src/Thrift.php— defined global-namespaceTType,TMessageType,TException,TBase,TApplicationException. Nothing loads it: composer's PSR-4 mapsThrift\→lib/php/lib/, and the PHP generator emits onlyuse Thrift\…imports. The file's own tail doesinclude_once $GLOBALS['THRIFT_ROOT'].'/protocol/TProtocol.php'and/transport/TTransport.php— paths that don't exist underlib/php/src/, so it would fatal if included.lib/php/src/autoload.php— relies on PHP's__autoload(), removed in PHP 8.0 (composer.jsonrequiresphp ^8.1). Its docblock still advertises a--gen php:autoloadgenerator flag that no longer exists incompiler/cpp/src/thrift/generate/t_php_generator.cc(onlyclassmapremains, and it targets namespacedlib/php/lib/classes).Both entries are also removed from
EXTRA_DISTinlib/php/Makefile.am. The active PHP extension underlib/php/src/ext/thrift_protocol/is untouched — it is still built in CI and called viafunction_exists(...)fromTBinaryProtocolAccelerated/TBinarySerializer.JIRA: https://issues.apache.org/jira/browse/THRIFT-5975
Checklist
lib/php/lib/for years)[skip ci]anywhere in the commit message to free up build resources.