Re: lang/php8X whith databases/php8X-sqlite3 and databases/sqlite3 segfaults in Quarterly

From: Wolfgang Zenker <wolfgang_at_lyxys.ka.sub.org>
Date: Mon, 02 Sep 2024 16:01:08 UTC
Am Mon, Sep 02, 2024 at 05:19:01PM +0200 schrieb Moin Rahman:
>> On Sep 2, 2024, at 5:10 PM, Wolfgang Zenker <wolfgang@lyxys.ka.sub.org> wrote:

>> I have a problem with using the PHP sqlite3 module in the 2024Q3 branch.
>> Scripts segfault on calling
>>  $dbObj = new SQLite3('example.db');
>> Tested with php 8.2 and 8.3, strongly suspect the other versions have
>> the problem as well.

>> For which port(s) should I open a problem report here? The culprit could
>> be either the php-port, the php-sqlite3 subport or the sqlite3 port.
>> I built a small test environment and the sqlite3 cli tool works ok,
>> and I don't see much changes in the php-sqlite3 subports, so I suspect
>> the problematic part is in the php ports.

>> The problem did not exist in the 2024Q2 branch and does not exist in
>> HEAD.

>> Does it make sense to open problem reports on the quarterly branch at
>> all or should I ask the maintainers to MFH the php and sqlite3 ports?
>> 
>> Looking forward to your suggestions.

> Please share the details of the exact versions of the ports.

> Kind regards,
> Moin

Failing setup on php 8.2:
- php82-8.2.20
- php82-sqlite3-8.2.20
- sqlite3-3.46.0,1

Failing setup on php 8.3:
- php83-8.3.8
- php83-sqlite3-8.3.8
- sqlite3-3.46.0,1

php 8.1 and php 8.4 setups not tested yet.

Working versions from 2024Q2 branch:
- php82.8.2.18 / php83-8.3.6
- php82-sqlite3-8.2.18 / php83-sqlite3-8.3.6
- sqlite3-3.45.1,1

How to reproduce:

1) Build a small test-database
$ sqlite3 example.db
SQLite version 3.46.0 2024-05-23 13:25:27
Enter ".help" for usage hints.
sqlite> create table people(name text, role text);
sqlite> insert into people values('Alice', 'restaurant');
sqlite> insert into people VALUES ('Bob', 'your uncle');
sqlite> .quit

2) Use a small php script sqlitetest.php
<?php

$dbObj = new SQLite3('example.db');
$results = $dbObj->query("SELECT * FROM people WHERE role = 'your uncle'");

while ($row = $results->fetchArray()) {
        printf("%s's %s\n", $row['name'], $row['role']);
}
?>

3) verify database works with sqlite3 cli
$ sqlite3 example.db
SQLite version 3.46.0 2024-05-23 13:25:27
Enter ".help" for usage hints.
sqlite> select name from people where role = 'your uncle';
sqlite> .quit

should return "Bob".

4) test php script
$ php sqlitetest.php

returns Segmentation fault