summaryrefslogtreecommitdiff
path: root/ext/sqlite3/sqlite3.c
Commit message (Collapse)AuthorAgeFilesLines
* Make handling of NULL bytes in file paths more consistent (WIP)Dik Takken2020-09-291-17/+2
| | | | | | | | | | | | Not all extensions consistently throw exceptions when the user passes a path name containing null bytes. Also, some extensions would throw a ValueError while others would throw a TypeError. Error messages also varied. Now a ValueError is thrown after all failed path checks, at least for as far as these occur in functions that are exposed to userland. Closes GH-6216.
* Use Error for uninitialized SQLite objectGeorge Peter Banyard2020-09-121-4/+4
| | | | Closes GH-6113
* Merge branch 'PHP-7.4' into masterChristoph M. Becker2020-08-211-1/+1
|\ | | | | | | | | * PHP-7.4: sqlite3 linkage issue on some systems/package combination fix.
| * sqlite3 linkage issue on some systems/package combination fix.David Carlier2020-08-211-1/+1
| | | | | | | | | | | | | | Checking the version is not enough, the function might be available but the symbols are not present still. Closes GH-5993
* | Add a few callable method parameter types to ext/sqlite3Máté Kocsis2020-08-141-38/+13
| | | | | | | | Closes GH-5988
* | Add all the missing parameter types to stubsMáté Kocsis2020-08-131-5/+6
| | | | | | | | Closes GH-5955
* | Remove no_separation flagNikita Popov2020-07-071-1/+0
| |
* | Disallow separation in a number of callbacksNikita Popov2020-07-071-1/+1
| | | | | | | | All of these clearly do not need separation support.
* | Remove proto comments from C filesMax Semenik2020-07-061-98/+49
| | | | | | | | Closes GH-5758
* | Add ZVAL_OBJ_COPY macroNikita Popov2020-06-171-8/+4
| | | | | | | | | | For the common ZVAL_OBJ + GC_ADDREF pattern. This mirrors the existing ZVAL_STR_COPY API.
* | Revert accidental changeNikita Popov2020-06-121-2/+2
| | | | | | | | | | | | | | | | | | Not sure how this happened, but I seem to have reverted 2fd278bc211c2102422c8d8ce0905dfc43cb5c7f as part of 13868508386208f5a1a43b6c17991ad6f3652fea. Restore the change.
* | Use unused attribute for _dummyNikita Popov2020-06-121-2/+2
| | | | | | | | | | | | | | | | | | The (void)_dummy is apparently considered a read of an uninitialized variable. As it is a _Bool now, which has trap representations, this is no longer considered legal and results in somewhat odd ubsan warnings of the form: runtime error: load of value 0, which is not a valid value for type 'zend_bool' (aka 'bool')
* | Merge branch 'PHP-7.4'Anatol Belski2020-06-111-2/+2
|\ \ | |/ | | | | | | * PHP-7.4: sqlite3: Fix possible use after free
| * sqlite3: Fix possible use after freeAnatol Belski2020-06-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Exception should be thrown before the db handle is destroyed. The backtrace excerpt ==26628== Invalid read of size 4 ==26628== at 0x53C49E3: sqlite3_errmsg (in /usr/lib64/libsqlite3.so.0.8.6) ==26628== by 0x38C4E9: zim_sqlite3_open (sqlite3.c:142) ==26628== by 0x8977BF: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:1618) ==26628== by 0x8F801E: execute_ex (zend_vm_execute.h:53824) ==26628== by 0x8FC0BB: zend_execute (zend_vm_execute.h:57920) ==26628== by 0x828F54: zend_execute_scripts (zend.c:1672) ==26628== by 0x793C2C: php_execute_script (main.c:2621) ==26628== by 0x8FEA44: do_cli (php_cli.c:964) ==26628== by 0x8FF9DC: main (php_cli.c:1359) Signed-off-by: Anatol Belski <ab@php.net>
* | Implement #47074: phpinfo() reports "On" as 1 for the some extensionsChristoph M. Becker2020-06-041-1/+1
| | | | | | | | What is modified as boolean, should also be displayed as boolean.
* | Fix [-Wundef] warning in SQLite3 extensionGeorge Peter Banyard2020-05-201-2/+2
| |
* | Allow null callback to array_filter()Nikita Popov2020-05-131-1/+1
| | | | | | | | With same behavior as not passing it.
* | Fix order of ZPP in ext/sqlite3Máté Kocsis2020-04-201-49/+50
| |
* | Generate function entries from stubsMáté Kocsis2020-04-201-107/+43
| | | | | | | | | | Converts ext/pcntl, ext/simplexml, ext/snmp, ext/soap, ext/sqlite3. Closes GH-5421
* | Improve some ValueError messagesMáté Kocsis2020-04-061-5/+8
| | | | | | | | Closes GH-5340
* | Merge branch 'PHP-7.4'Christoph M. Becker2020-02-211-4/+1
|\ \ | |/ | | | | | | * PHP-7.4: Fix #79294: ::columnType() may fail after SQLite3Stmt::reset()
| * Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-02-211-4/+1
| |\ | | | | | | | | | | | | * PHP-7.3: Fix #79294: ::columnType() may fail after SQLite3Stmt::reset()
| | * Fix #79294: ::columnType() may fail after SQLite3Stmt::reset()Christoph M. Becker2020-02-211-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for feature request #53466 did not properly handle resetting of the corresponding statement; the problem with this is that the statement does not know about its result sets. But even if we could fix this, the `complete` handling still appears to be brittle, since the `sqlite3_column_type()`docs[1] state: | If the SQL statement does not currently point to a valid row, or if | the column index is out of range, the result is undefined. Fortunately, we can use `sqlite3_data_count()` instead, since[2]: | If prepared statement P does not have results ready to return (via | calls to the sqlite3_column() family of interfaces) then | sqlite3_data_count(P) returns 0. Thus, we guard `SQLite3::columnType()` with `sqlite3_data_count()`, and completely drop updating the `php_sqlite3_result_object.complete` field, but keep it for ABI BC purposes. [1] <https://www.sqlite.org/c3ref/column_blob.html> [2] <https://www.sqlite.org/c3ref/data_count.html>
| * | Apply tidy formattingNikita Popov2020-02-031-1/+1
| | | | | | | | | | | | Mostly reindent PHP scripts to spaces.
* | | Make error messages more consistent by fixing capitalizationMáté Kocsis2020-01-171-2/+2
| | | | | | | | | | | | Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
* | | Fix build if SQLITE_RECURSIVE is not supportedMatteo Beccati2020-01-041-0/+2
| | |
* | | Use RETURN_THROWS() after zend_throw_exception() in most of the extensionsMáté Kocsis2020-01-021-4/+4
| | |
* | | Use RETURN_THROWS() after zend_value_error()Máté Kocsis2019-12-311-2/+2
| | |
* | | Use RETURN_THROWS() during ZPP in most of the extensionsMáté Kocsis2019-12-311-37/+37
| | | | | | | | | | | | Except for some bigger ones: reflection, sodium, spl
* | | Add setAuthorizer method to SQLite3BohwaZ2019-12-201-17/+160
| | | | | | | | | | | | | | | This adds the possibility to define a userland callback that will be used to authorize or not an action on the database.
* | | Remove mention of PHP major version in Copyright headersGabriel Caruso2019-09-251-2/+0
| | | | | | | | | | | | Closes GH-4732.
* | | Implement NUL byte checks for dbnamesChristoph M. Becker2019-09-171-0/+12
| | | | | | | | | | | | | | | | | | Since we're passing these parameter to C functions accepting `char*` without any further checking, we should reject strings with NUL bytes in the first place.
* | | Unify ZPP handling in ext/sqlite3Christoph M. Becker2019-08-151-3/+3
| | | | | | | | | | | | | | | | | | Since `zend_parse_parameters()` now throws on failure, it doesn't make sense anymore to use `zend_parse_parameters_throw()` instead, and also it's useless to set an explicit return value.
* | | Don't repeat yourselfChristoph M. Becker2019-08-151-35/+11
| | | | | | | | | | | | | | | | | | SQLite3::bindParam() and SQLite3::bindValue() have identical implementation (the only thing that differs is the second parameter's passing mode), so we unify the implementation.
* | | Convert sqlite3 functions arginfo to php stubsCraig Duncan2019-08-151-150/+42
|/ /
* | Report errors from stream read and write operationsNikita Popov2019-07-221-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The php_stream_read() and php_stream_write() functions now return an ssize_t value, with negative results indicating failure. Functions like fread() and fwrite() will return false in that case. As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams should not be regarded as error conditions, and be reported as successful zero-length reads/writes instead. The handling of EINTR remains unclear and is internally inconsistent (e.g. some code-paths will automatically retry on EINTR, while some won't). I'm landing this now to make sure the stream wrapper ops API changes make it into 7.4 -- however, if the user-facing changes turn out to be problematic we have the option of clamping negative returns to zero in php_stream_read() and php_stream_write() to restore the old behavior in a relatively non-intrusive manner.
* | Implement SQLite extended result code functionalityRobert Kopack2019-07-021-20/+76
| |
* | Fix leak on sqlite3 open errorNikita Popov2019-06-251-0/+2
| | | | | | | | | | sqlite3_open creates the database object even if the operation fails.
* | Implement SQLite3 backup APIBohwaZ2019-06-171-0/+68
| |
* | Cheaper checks for exceptions thrown from __toString()Dmitry Stogov2019-06-061-4/+4
| |
* | Allow exceptions in __toString()Nikita Popov2019-06-051-8/+19
| | | | | | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/tostring_exceptions And convert some object to string conversion related recoverable fatal errors into Error exceptions. Improve exception safety of internal code performing string conversions.
* | Replace ZVAL_COPY() and ZVAL_COPY_VALUE() for IS_OBJECT by cheaper macrosDmitry Stogov2019-05-281-7/+11
| |
* | Merge branch 'PHP-7.3' into PHP-7.4Stanislav Malyshev2019-05-271-0/+9
|\ \ | |/ | | | | | | * PHP-7.3: Fix bug #77967 - Bypassing open_basedir restrictions via file uris
| * Merge branch 'PHP-7.2' into PHP-7.3Stanislav Malyshev2019-05-271-0/+9
| |\ | | | | | | | | | | | | * PHP-7.2: Fix bug #77967 - Bypassing open_basedir restrictions via file uris
| | * Merge branch 'PHP-7.1' into PHP-7.2Stanislav Malyshev2019-05-271-0/+9
| | |\ | | | | | | | | | | | | | | | | * PHP-7.1: Fix bug #77967 - Bypassing open_basedir restrictions via file uris
| | | * Fix bug #77967 - Bypassing open_basedir restrictions via file urisStanislav Malyshev2019-05-271-0/+9
| | | |
| | | * SQLite3: add DEFENSIVE config for SQLite >= 3.26.0 as a mitigation strategy ↵bohwaz2019-03-111-0/+9
| | | | | | | | | | | | | | | | against potential security flaws
* | | | Add RETURN_EMPTY_ARRAY() / RETVAL_EMPTY_ARRAY()Nikita Popov2019-05-141-1/+1
| | | | | | | | | | | | | | | | The usual wrappers around ZVAL_EMPTY_ARRAY()...
* | | | Avoid misc uninitialized variable warningsNikita Popov2019-04-121-7/+7
| | | |
* | | | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-03-111-0/+9
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.3: SQLite3: add DEFENSIVE config for SQLite >= 3.26.0 as a mitigation strategy against potential security flaws