Skip to content

THRIFT-5975: Drop pre-namespace lib/php/src/{Thrift,autoload}.php#3453

Merged
sveneld merged 1 commit into
apache:masterfrom
sveneld:THRIFT-5975
May 10, 2026
Merged

THRIFT-5975: Drop pre-namespace lib/php/src/{Thrift,autoload}.php#3453
sveneld merged 1 commit into
apache:masterfrom
sveneld:THRIFT-5975

Conversation

@sveneld
Copy link
Copy Markdown
Contributor

@sveneld sveneld commented May 9, 2026

Summary

Removes two dead pre-PSR-4 files from lib/php/src/:

  • lib/php/src/Thrift.php — defined global-namespace TType, TMessageType, TException, TBase, TApplicationException. Nothing loads it: composer's PSR-4 maps Thrift\lib/php/lib/, and the PHP generator emits only use Thrift\… imports. The file's own tail does include_once $GLOBALS['THRIFT_ROOT'].'/protocol/TProtocol.php' and /transport/TTransport.php — paths that don't exist under lib/php/src/, so it would fatal if included.
  • lib/php/src/autoload.php — relies on PHP's __autoload(), removed in PHP 8.0 (composer.json requires php ^8.1). Its docblock still advertises a --gen php:autoload generator flag that no longer exists in compiler/cpp/src/thrift/generate/t_php_generator.cc (only classmap remains, and it targets namespaced lib/php/lib/ classes).

Both entries are also removed from EXTRA_DIST in lib/php/Makefile.am. The active PHP extension under lib/php/src/ext/thrift_protocol/ is untouched — it is still built in CI and called via function_exists(...) from TBinaryProtocolAccelerated / TBinarySerializer.

JIRA: https://issues.apache.org/jira/browse/THRIFT-5975

Checklist

  • Did you create an Apache Jira ticket? — THRIFT-5975
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit?
  • Did you do your best to avoid breaking changes? — yes; only unreachable / non-functional code is removed (the PSR-4 namespaced replacements have lived in lib/php/lib/ for years)
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

@mergeable mergeable Bot added php build and general CI cmake, automake and build system changes labels May 9, 2026
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>
@sveneld sveneld merged commit 880568c into apache:master May 10, 2026
93 of 94 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build and general CI cmake, automake and build system changes php

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant