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

713 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
73b15c5a2f ext/sqlite3: Remove redundant test (#21199)
Testing for numRows is redundant as this method isn't implemented. It
was probably meant once to be implemented at some point in the future
when migrating from ext/sqlite to ext/sqlite3.
2026-02-18 17:01:30 +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
Arnaud Le Blanc
65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +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
Niels Dossche
57ce245e1e Reduce code bloat in arginfo by using specialised string releases (#20016)
* Reduce code bloat in arginfo by using specialised string releases

Comparing this patch to master (c7da728574),
with a plain configure command without any options:

```
   text	   data	    bss	    dec	    hex	filename
20683738	1592400	 137712	22413850	156021a	sapi/cli/php
20688522	1592400	 137712	22418634	15614ca	sapi/cli/php_old
```

We see a minor reduction of 0.023% in code size.

* Also use true for the other initialization line

* Also use specialized code for consts
2025-10-02 22:00:20 +02: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
David CARLIER
1d5da8660b ext/sqlite3: relax sqlite3 explain test conditions (#18949) 2025-06-29 13:58:58 +01: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
2acda557cd Pack _php_sqlite3_db_object 2025-02-10 08:42:11 +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
e14f9f4c42 Pack _php_sqlite3_result_object 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
DanielEScherzer
53cb89670c Generated arginfo header files: remove empty zend_function_entry arrays (#15705)
When a class (or enum) has no methods, rather than using an array that only
contains `ZEND_FE_END`, use `NULL` for the functions. The implementation of
class registration for internal classes, `do_register_internal_class()` in
zend_API.c, already skips classes where the functions are `NULL`. By removing
these unneeded arrays, we can reduce the size of the header files, while also
removing an unneeded call to zend_register_functions() for each internal class
with no extra methods.
2024-09-03 23:19:53 +02:00
Máté Kocsis
8d12f666ae Fix registration of internal readonly child classes (#15459)
Currently, internal classes are registered with the following code:

INIT_CLASS_ENTRY(ce, "InternalClass", class_InternalClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ...;

This has worked well so far, except if InternalClass is readonly. It is because some inheritance checks are run by zend_register_internal_class_ex before ZEND_ACC_READONLY_CLASS is added to ce_flags.

The issue is fixed by adding a zend_register_internal_class_with_flags() zend API function that stubs can use from now on. This function makes sure to add the flags before running any checks. Since the new API is not available in lower PHP versions, gen_stub.php has to keep support for the existing API for PHP 8.3 and below.
2024-08-24 12:36:54 +02: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
Peter Kokot
bd77462c7c Update sqlite3 and pdo_sqlite preprocessor macros help texts (#15291) 2024-08-09 14:51:05 +02:00
Peter Kokot
f66feaec0f Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +02:00
Peter Kokot
1ceadaed52 Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Peter Kokot
2b97c84d4c Autotools: Quote PHP_CHECK_LIBRARY arguments (#15136)
This syncs the quotes across the PHP_CHECK_LIBRARY macro arguments.
2024-07-28 18:39:14 +02:00
Peter Kokot
bee84c0468 Autotools: Quote PHP_SUBST arguments in extensions (#14748) 2024-07-02 06:56:18 +02: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
Peter Kokot
cba3891d53 Join SQLite library setup M4 macros to PHP_SETUP_SQLITE (#14372)
Macro can simplify managing minimum version of SQLite library on less
places.
2024-05-30 18:16:30 +02:00