php / php/doc-en

SQLite3::loadExtension() in PHP 7 Appends Extra ".so" to Extension Filename

Open
#4,542 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

From manual page: https://www.php.net/manual/en/sqlite3.loadextension.php


When using PHP 7’s SQLite3 extension, the method SQLite3::loadExtension() improperly appends an additional ".so" to the filename provided, leading to load failure. While the SQLite CLI correctly loads the SQLite3 extension without requiring any file extension (e.g., sqlite> .load ./libsqlite_hashes, thus automatically appending the extension when needed), PHP 8 requires specifying the file extension, e.g., SQLite3::loadExtension('libsqlite_hashes.so'). Lastly, PHP 7 fails to load the SQLite3 extension with or without specifying the file extension as it ends up looking for a file with a double extension (e.g., libsqlite_hashes.so.so).

Reproducing steps can be found at https://github.com/nyurik/sqlite-hashes/issues/71

Notice that, loadExtension won't work in any PHP version (7 or 8) if the extension part of the SQLite 3 extension filename is omitted.

This behavior is not properly documented in the manual, which claims support for a broad range of PHP versions (PHP 5 >= 5.3.0, PHP 7, PHP 8) and do not emphasize the importance of specifying the file extension (e.g., .so for Linux).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the SQLite3::loadExtension() manual page and compare its PHP 7 and PHP 8 behavior with the reproduction described in nyurik/sqlite-hashes issue 71. Update the documentation to explain when the shared-library extension, such as .so, must be included and accurately describe the supported PHP versions; done means the version-specific filename requirement is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, sqlite
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.