1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

367 Commits

Author SHA1 Message Date
Weilin Du
2918caee20 ext/*: Remove break after return (#21485) 2026-03-23 20:30:13 +01:00
Alexandre Daubois
11a95749b1 Convert more zend_parse_parameters_none() to fast ZPP (#21330) 2026-03-04 14:07:46 +01:00
Peter Kokot
435e67e075 Remove HAVE_SQLITE3_{CLOSE_V2,ERRSTR} (#18963)
As of PHP 8.5 the minimum required SQLite library is 3.7.17, and this
removes the following preprocessor macros checks:

- HAVE_SQLITE3_CLOSE_V2 (sqlite3_close_v2() function is available since
  SQLite 3.7.14.)
- HAVE_SQLITE3_ERRSTR (sqlite3_errstr() function is available since
  SQLite 3.7.15)
- SQLITE_VERSION_NUMBER should be now always greater than 3006011
  (3.6.11).
2026-02-11 13:13:18 +01:00
David CARLIER
8f55b0850f ext/sqlite3: Sqlite3::openBlob() code path simplification. (#20969)
* ext/sqlite3: Sqlite3::openBlob() code path simplification.

since the stream is opened in non persistent mode, the failure code path
is dead (so are the missing leaks fixes).
2026-01-20 21:34:50 +00:00
Niels Dossche
0d7e53535b Fix NUL byte truncation in sqlite3 TEXT column handling
As a bonus, this should probably also be a tad faster.

Closes GH-20704.
2025-12-15 22:47:41 +01:00
Niels Dossche
ec337122d5 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20699: SQLite3Result fetchArray return array|false, null returned
2025-12-14 23:18:21 +01:00
Niels Dossche
0ef52c3d89 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20699: SQLite3Result fetchArray return array|false, null returned
2025-12-14 23:18:16 +01:00
Niels Dossche
f3d5dd0feb Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20699: SQLite3Result fetchArray return array|false, null returned
2025-12-14 23:17:58 +01:00
Niels Dossche
acd0898bdf Fix GH-20699: SQLite3Result fetchArray return array|false, null returned
Closes GH-20701.
2025-12-14 23:17:31 +01:00
Niels Dossche
197a455bc0 sqlite3: remove nonsensical return_value dtor (#20360) 2025-11-02 23:47:10 +01:00
Tim Düsterhus
56c98cb077 sqlite3: Use true / false instead of 1 / 0 when assigning to bool
Changes done with Coccinelle:

    @@
    bool b;
    @@

    - b = 0
    + b = false

    @@
    bool b;
    @@

    - b = 1
    + b = true
2025-09-24 18:51:40 +02:00
Niels Dossche
6d15475815 sqlite3: Split off column name cache generation
Also no need to reset the cache unconditionally in fetchAll().
2025-06-24 22:09:54 +02:00
Niels Dossche
e7678cdaa4 sqlite3: Use Z_TRY_ADDREF 2025-06-24 22:09:54 +02:00
David Carlier
375316d0e2 ext/sqlite3: Sqlite3Result::fetchAll()
support associative and indexes arrays for results.

close GH-1884
2025-06-23 08:01:31 +01:00
David Carlier
22bd2ae63f ext/sqlite3: explain statement support addition.
similar to what have been done for pdo/sqlite as having statement
explain support to simulate how a query would operate or
for more advanced users, analysing the VM routines used
for possible optimisations.

close GH-18853
2025-06-23 07:57:45 +01:00
Jakub Zelenka
89934b405e Merge branch 'PHP-8.4' 2025-06-21 20:17:15 +02:00
Jakub Zelenka
bbac59148c Merge branch 'PHP-8.3' into PHP-8.4 2025-06-21 20:16:13 +02:00
Jakub Zelenka
a36b8fdc94 Fix GH-13264: fgets() and stream_get_line() do not return false on filter fatal error
This happens because there are no checks in php_stream_fill_read_buffer
calls. This should not fail always but only on fatal error so special
flag is needed for that.

Closes GH-18778
2025-06-21 20:13:09 +02:00
David Carlier
058c0348fd ext/sqlite3: adding busy() call.
checks if the prepared statement had been fetched but did not complete yet.

close GH-18843
2025-06-13 06:08:44 +01:00
David CARLIER
bd8c770439 ext/sqlite3: querySingle amd fetchArray methods optimisations. (#18385)
pre-allocated size for the former and packed array.
2025-04-21 16:37:34 +01:00
Niels Dossche
1fa15abe92 Remove pointless call to zval_ptr_dtor() in sqlite3 (#17906)
This is IS_LONG.
2025-02-23 21:04:47 +01:00
Niels Dossche
6a4b0c922c Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leaks in pdo_sqlite callback registration
  Fix cycle leak in sqlite3 setAuthorizer()
2025-02-23 16:36:06 +01:00
Niels Dossche
76035090b6 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix cycle leak in sqlite3 setAuthorizer()
2025-02-23 16:35:25 +01:00
Niels Dossche
353f21487f Fix cycle leak in sqlite3 setAuthorizer()
Closes GH-17903.
2025-02-23 16:34:41 +01:00
Niels Dossche
9ee08999f4 Convert initialised to bool 2025-02-10 08:42:11 +01:00
Niels Dossche
dbf7d4402c Convert is_prepared_statement to bool 2025-02-10 08:42:11 +01:00
Niels Dossche
5eae6d1405 Don't store the object zval directly 2025-02-10 08:42:11 +01:00
Niels Dossche
c0d910d506 Get rid of always-false intern checks
These checks are always false because we're receiving a valid
zend_object.
2025-02-10 08:42:11 +01:00
Niels Dossche
bc74cff479 Get rid of unnecessary wrapping a statement in a free list object
This simplifies the code and reduces memory usage.
2025-02-10 08:42:11 +01:00
Niels Dossche
43ac692a09 Use faster string operations in sqlite3 2025-02-10 08:42:11 +01:00
Niels Dossche
b2c891f88e Avoid string duplications in sqlite drivers (#17115)
These string duplications are necessary to unregister the callback
later. We can just keep using zend_string to avoid memory duplications.
2024-12-18 17:32:11 +01:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
e7c4d54d65 Use new helper function for "cannot be empty" ValueErrors 2024-08-21 21:12:17 +01:00
Arnaud Le Blanc
11accb5cdf Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Gina Peter Banyard
fd2d869642 Clean-up some more headers (#14416)
Remove unused headers (such as php_ini.h for extensions that don't define INI settings)
Use more specific headers when possible
2024-06-08 17:15:36 +01:00
David CARLIER
47c41d4a0f ext/sqlite: Sqlite3Stmt::bindParam/bindValue named parameters change. (#14393)
memmove seems unnecessary on `:` autoprepend.
2024-05-31 21:34:37 +01:00
Cristian Rodríguez
8e62e2b829 Mark multple functions as static (#13864)
* Mark many functions as static

Multiple functions are missing the static qualifier.

* remove unused struct sigactions

struct sigaction act, old_term, old_quit, old_int;
all unused.

* optimizer: minXOR and maxXOR are unused
2024-05-22 13:11:46 +02:00
Gina Peter Banyard
6303d1fc6a ext/sqlite3: Use new F ZPP modifier (#14040) 2024-05-01 15:38:48 +01:00
Niels Dossche
700fbca58d Change getThis() into ZEND_THIS where possible (#13641) 2024-03-08 22:19:06 +01:00
Niels Dossche
d463d215e1 Minor sqlite3 cleanups (#13141)
* Remove always-true stmt_obj->db_obj condition

This is always true because SQLITE3_CHECK_INITIALIZED checks this.

* Remove always-true param_number check

This is always true because we return early when the value < 1.
2024-01-13 20:47:04 +01:00
Máté Kocsis
2cd8f3e625 Retain a RETURN_THROWS() in ext/sqlite3 2023-12-04 22:52:20 +01:00
Niels Dossche
49980ee89d Use zend_get_gc_buffer_add_fcc() 2023-09-09 20:00:01 +02:00
Niels Dossche
1d59b37742 Fix build with sqlite3 gc and fci/fcc api 2023-09-09 16:07:10 +02:00
Niels Dossche
cb6fac5b8a Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-11878: SQLite3 callback functions cause a memory leak with a callable array
2023-09-09 15:35:03 +02:00
Niels Dossche
6851c7b867 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11878: SQLite3 callback functions cause a memory leak with a callable array
2023-09-09 15:34:38 +02:00
Niels Dossche
07a9d2fb32 Fix GH-11878: SQLite3 callback functions cause a memory leak with a callable array
In this test file, the free_obj handler is called with a refcount of 2,
caused by the fact we do a GC_ADDREF() to increase its refcount while
its refcount is still 1 because the Foo object hasn't been destroyed yet
(due to the cycle caused by the sqlite function callback).
Solve this by introducing a get_gc handler.

Closes GH-11881.
2023-09-09 15:33:50 +02:00
Ilija Tovilo
3fb09940fc Revert "Skip profiling of sqlite3_step"
This reverts commit bb31a75321.

It doesn't seem like this actually fixed the problem.
2023-09-07 10:35:06 +02:00
Ilija Tovilo
bb31a75321 Skip profiling of sqlite3_step
It looks like sqlite3_step can vary quite drastically from one request to the
next. This seems to be caused by more or fewer calls to sqlite3VdbeSorterWrite.
It would be great if we could find a way to make execution of this function more
consistent, but at this point I don't know how.

Closes GH-12130
2023-09-05 17:38:00 +02:00
Niels Dossche
bb9fb3c59b Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix replaced error handling in SQLite3Stmt::__construct
2023-07-07 10:29:52 +02:00
Niels Dossche
ca661f2c34 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix replaced error handling in SQLite3Stmt::__construct
2023-07-07 10:27:42 +02:00