Skip to content

Regression: extension_loaded('sqlite3') + SQLite3Exception without SQLite3 on default 8.2 profile (re-#17106, ext/sqlite3) #22791

Description

@PurHur

Category

Regression: · php-src-strict · profile / advertisement gate (re-#17106 / re-#19047)

Problem

Default-profile VM advertises extension_loaded('sqlite3') === true and class_exists('SQLite3Exception') === true while class_exists('SQLite3') === false (supportsSqlite3() is 8.4-only). Zend 8.2 without ext/sqlite3: all three false. Zend 8.2 with ext/sqlite3: SQLite3 true and SQLite3Exception false (exception class is PHP 8.3+). Current split is not php-src-shaped on either axis.

Repro Zend 8.2.32 (no ext/sqlite3) VM (2026-07-24, 0ae5aba, default)
extension_loaded('sqlite3') false true
class_exists('SQLite3') false false
class_exists('SQLite3Exception') false true

Sqlite3ExtensionPolicy::advertisesExtensionLoaded() / advertisesExceptionClass() always return true; only advertisesExtension() follows CompilerVersion::supportsSqlite3().

php-src reference

PHP implementation target

  • ext/sqlite3/Sqlite3ExtensionPolicy.php — pair extension_loaded('sqlite3') with supportsSqlite3() (or host-parity policy); gate SQLite3Exception on profile ≥ 8.3 and extension advertisement
  • ext/standard/ThrowableManifest.php / ext/sqlite3/BuiltinClasses.php — stop registering the exception when the extension surface is withheld
  • No new C; PHP-in-PHP advertisement only

Repro

./script/docker-exec.sh -- bash -lc 'cat > /tmp/sqlite3_phantom.php <<\"PHP\"
<?php
echo \"PROFILE=\", getenv(\"PHP_COMPILER_PROFILE\") ?: \"(default)\", PHP_EOL;
echo \"extension_loaded=\", extension_loaded(\"sqlite3\") ? \"yes\" : \"no\", PHP_EOL;
echo \"SQLite3=\", class_exists(\"SQLite3\") ? \"yes\" : \"no\", PHP_EOL;
echo \"SQLite3Exception=\", class_exists(\"SQLite3Exception\") ? \"yes\" : \"no\", PHP_EOL;
PHP
php /tmp/sqlite3_phantom.php; echo EXIT_ZEND:$?
php bin/vm.php /tmp/sqlite3_phantom.php; echo EXIT_VM:$?
PHP_COMPILER_PROFILE=8.4 php bin/vm.php /tmp/sqlite3_phantom.php; echo EXIT_VM84:$?'

Done when

  • Default/8.2 profile: extension_loaded('sqlite3') / SQLite3 / SQLite3Exception match Zend 8.2 reference (all false on hosts without the ext; no exception-without-class split)
  • Profile 8.4: SQLite3 + SQLite3Exception + extension_loaded consistent when the in-tree module is enabled
  • Compliance/repro guard; php-src-strict

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions