Cannot "unregister" a function, collation or aggregate in SQLite3 extension
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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