php / php/php-src

Cannot "unregister" a function, collation or aggregate in SQLite3 extension

Open
#10,726 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Extension: sqlite3 Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php
$db = new SQLite3(':memory:');
$db->createFunction('like', 'strcmp');
$db->createFunction('like', null);

Resulted in this output:

Argument #2 ($callback) must be of type callable, null given

But I expected to be able to unregister the custom like function, as documented in SQLite doc:

To delete an existing SQL function or aggregate, pass NULL pointers for all three function callbacks.

https://www.sqlite.org/c3ref/create_function.html

Passing NULL to SQLite3::create* methods should un-register the existing function.

PHP Version

Any

Operating System

No response

Contributor guide

Open the contributing guide

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 at the SQLite3::createFunction entry point and compare its callback validation with the SQLite documentation linked in the issue. Add coverage for passing null to unregister the custom function, then verify the reported example and related create* behavior produce the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, sqlite
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.