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

418 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
f17c5ad83b Windows build: Add new function CHECK_HEADER() (#21191)
The current function `CHECK_HEADER_ADD_INCLUDE()` automatically defines
`HAVE_<HEADER_NAME_H>` preprocessor macros, which makes it difficult to
sync with other build systems. Specially, if some `HAVE_` macro is used
in the code and this function defines this macro but Autotools doesn't.

The new `CHECK_HEADER()` function behaves similar except it doesn't
define the `HAVE_<HEADER_NAME_H>` preprocessor macro.

This removes the following unused compile definitions:

HAVE_ARGON2_H
HAVE_AVIF_H
HAVE_BZLIB_H
HAVE_CAPSTONE_CAPSTONE_H
HAVE_CURL_EASY_H
HAVE_DB_H
HAVE_DECODE_H
HAVE_DEPOT_H
HAVE_EDITLINE_READLINE_H
HAVE_ENCHANT_H
HAVE_ENCODE_H
HAVE_FFI_H
HAVE_FIREBIRD_INTERFACE_H
HAVE_FT2BUILD_H
HAVE_GD_H
HAVE_GLIB_H
HAVE_GMP_H
HAVE_HTTPD_H
HAVE_IBASE_H
HAVE_IR_IR_H
HAVE_KECCAKHASH_H
HAVE_LBER_H
HAVE_LDAP_H
HAVE_LIBEXSLT_EXSLT_H
HAVE_LIBINTL_H
HAVE_LIBPQ_FE_H
HAVE_LIBTIDY_TIDY_H
HAVE_LIBXML_PARSER_H
HAVE_LIBXML_TREE_H
HAVE_LIBXML_XMLWRITER_H
HAVE_LIBXSLT_XSLT_H
HAVE_LMDB_H
HAVE_MBSTRING_H
HAVE_MYSQL_H
HAVE_ONIGURUMA_H
HAVE_OPENSSL_SSL_H
HAVE_PNG_H
HAVE_SNMP_H
HAVE_SODIUM_H
HAVE_SQLITE3_H
HAVE_SQLITE3EXT_H
HAVE_SYBFRONT_H
HAVE_TIDY_H
HAVE_TIDY_TIDY_H
HAVE_TIDYBUFFIO_H
HAVE_TIMELIB_CONFIG_H
HAVE_UNICODE_USPOOF_H
HAVE_UNICODE_UTF_H
HAVE_XPM_H
HAVE_ZIP_H
HAVE_ZIPCONF_H
HAVE_ZLIB_H

The following compile definitions are defined explicitly:

- HAVE_ICONV_H
- HAVE_MSCOREE_H
- HAVE_SQL_H
- HAVE_SQLEXT_H

Additionally, the `SETUP_OPENSSL()` function doesn't accept the 6th
argument anymore.
2026-03-03 20:06:40 +01:00
Arnaud Le Blanc
65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
Niels Dossche
04bf2e5c4a Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-19962: arrayIndexThenCheck static analysis warning in firebird
2025-12-28 13:09:18 +01:00
Niels Dossche
4f9a39ea78 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-19962: arrayIndexThenCheck static analysis warning in firebird
2025-12-28 13:09:13 +01:00
Niels Dossche
29e04acc6f Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19962: arrayIndexThenCheck static analysis warning in firebird
2025-12-28 13:09:05 +01:00
Niels Dossche
bae78c614a Fix GH-19962: arrayIndexThenCheck static analysis warning in firebird
Same as ce534c612b.
2025-12-28 13:08:40 +01:00
Niels Dossche
e6906dbca6 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-19961: Static analysis arrayIndexThenCheck warning in firebird (#20790)
2025-12-28 13:04:40 +01:00
Niels Dossche
576d61493b Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-19961: Static analysis arrayIndexThenCheck warning in firebird (#20790)
2025-12-28 13:04:34 +01:00
Niels Dossche
fa8bb98ec0 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19961: Static analysis arrayIndexThenCheck warning in firebird (#20790)
2025-12-28 13:04:27 +01:00
Niels Dossche
ce534c612b Fix GH-19961: Static analysis arrayIndexThenCheck warning in firebird (#20790)
Static analysis reports that the bounds check comes after reading the
byte from the buffer.
In practice, this is tagged data that loops until the end tag is found
and therefore there isn't really a bug. The extra length check is only
there for extra hardening.
So we simply silence the static analysers and improve the hardening.

See also https://docwiki.embarcadero.com/InterBase/15/en/Isc_dsql_sql_info()
2025-12-28 13:04:16 +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
3da898a7d9 pdo_firebird: 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
Alexandre Daubois
254934b2ee Avoid using unsafe sprintf() (#19598) 2025-09-05 10:10:04 +02:00
Arnaud Le Blanc
6f32e1c690 Deprecate driver specific PDO constants
RFC: https://wiki.php.net/rfc/deprecations_php_8_5.

Closes GH-19526
2025-08-26 09:06:19 +02:00
Saki Takamachi
23687672f3 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed GH-17383 - pdo_firebird: PDOException has wrong code and message since PHP 8.4 (#18072)
2025-04-19 14:11:35 +09:00
Saki Takamachi
685baf77df Fixed GH-17383 - pdo_firebird: PDOException has wrong code and message since PHP 8.4 (#18072)
Closes #18072
Fixes #17383
2025-04-19 14:11:20 +09:00
Saki Takamachi
3b87093bff Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed GH-18276 - persistent connection - "zend_mm_heap corrupted" with setAttribute() (#18280) Closes #18280 Fixes #18276
2025-04-15 09:07:06 +09:00
Saki Takamachi
0f5372dbaa followup in master for #18280 (#18302)
Closes #18302
2025-04-15 09:06:38 +09:00
Saki Takamachi
bd9f03a336 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fixed GH-18276 - persistent connection - "zend_mm_heap corrupted" with setAttribute() (#18280) Closes #18280 Fixes #18276
2025-04-15 09:04:39 +09:00
Saki Takamachi
9d4f8b5379 Fixed GH-18276 - persistent connection - "zend_mm_heap corrupted" with setAttribute() (#18280)
Closes #18280
Fixes #18276
2025-04-15 09:01:40 +09:00
Saki Takamachi
e954bf6750 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed pdo_firebird_handle_factory to check ret when starting a transaction (#17632)
2025-03-15 08:52:03 +09:00
Saki Takamachi
e96a35b9a8 Fixed pdo_firebird_handle_factory to check ret when starting a transaction (#17632)
Changed to not execute php_firebird_begin_transaction
if transaction cannot be started successfully

Closes #17632
2025-03-15 08:51:49 +09:00
Niels Dossche
404c96e2bb Avoid string copies for date/time format in firebird (#17902) 2025-02-23 14:14:42 +01:00
Niels Dossche
6f4579af85 Introduce php_pdo_stmt_valid_db_obj_handle() (#17567) 2025-01-28 21:54:11 +01:00
Niels Dossche
f2b010f503 Merge branch 'PHP-8.4'
* PHP-8.4:
  Update test expectation for different Firebird version
2025-01-24 22:10:21 +01:00
Niels Dossche
77130794a3 Update test expectation for different Firebird version
libfbclient 5.0.1 with server 4.0.1 has a different error message and
code.
> Read only sql transaction

Closes GH-17565.
2025-01-24 22:10:08 +01:00
Gina Peter Banyard
5b06a066f6 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
2025-01-24 20:22:13 +00:00
Gina Peter Banyard
8ed0d7fe96 Merge branch 'PHP-8.4'
* PHP-8.4:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
2025-01-24 20:20:11 +00:00
Gina Peter Banyard
eda8ce728a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
  Fix GHA config yml error
2025-01-24 20:20:01 +00:00
Niels Dossche
2ae897fff7 Fix crash in firebird statement dtor
If both the driver object and statement end up in the GC buffer and are
freed by the GC, then the destruction order is not deterministic and it
is possible that the driver object is freed before the statement. In
that case, accessing S->H will cause a UAF. As the resources are already
released we simply skip the destruction if the driver object is already
destroyed.
2025-01-24 20:16:12 +00:00
Gina Peter Banyard
ad4cbf4e7f ext/pdo_firebird: Add LSAN suppression for isc_attach_database() (#17544) 2025-01-22 20:51:00 +00:00
Christoph M. Becker
7512685767 Use built-ins for addition and subtraction on Windows (GH-17472)
For Clang, we just need to define the respective macros, since these
built-ins are available in all supported Clang versions (>= 4.0.0,
currently)[1].

For MSVC (and possibly other compilers) we use the respective APIs of
intsafe.h[2] which are available as of Windows 7/Server 2008 R2.

This avoids the UB due to signed integer overflow that may happen with
our fallback implementations.

We also drop the superfluous SHORT_MAX definition from pdo_firebird.
This shouldn't be defined unconditionally, but since it is apparently
unused, we remove it altogether.

[1] <https://releases.llvm.org/4.0.0/tools/clang/docs/LanguageExtensions.html>
[2] <https://learn.microsoft.com/en-us/windows/win32/api/intsafe/>
2025-01-15 12:58:12 +01:00
Shivam Mathur
b1220da496 ext/pdo_firebird: Fix label follow by declaration (#17229)
A label should be followed by a statement and not a declaration, else old gcc gives the following error: a label can only be part of a statement and a declaration is not a statement

To fix this we wrap the code in the switch case block in braces.
2024-12-21 16:56:53 +05:30
Gina Peter Banyard
916288e85c ext/pdo_firebird: Throw ValueError if cursor name is too long (#17173)
Co-authored-by: Saki Takamachi <34942839+SakiTakamachi@users.noreply.github.com>
2024-12-17 13:15:47 +00:00
Niels Dossche
912b13a779 Test Firebird in 32-bit Linux CI (#17045)
Co-authored-by: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= <takeda@youmind.jp>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-12-06 17:27:59 +01:00
Jakub Zelenka
4b211a7769 Merge branch 'PHP-8.4' 2024-11-20 11:14:32 +01:00
Jakub Zelenka
7c96af42b7 Merge branch 'PHP-8.3' into PHP-8.4 2024-11-20 11:14:04 +01:00
Jakub Zelenka
ffff27f734 Merge branch 'PHP-8.2' into PHP-8.3 2024-11-20 11:12:19 +01:00
Niels Dossche
7a25e7728d Fix GHSA-5hqh-c84r-qjcv: Integer overflow in the firebird quoter causing OOB writes 2024-11-20 11:05:55 +01:00
Christoph M. Becker
d19fdaa4b7 Drop legacy fallback for isc_get_client_version() (GH-16343)
The respective code had been introduced 20 years ago, and we can assume
that the function is available at least of Firebird 3.0, what we
require anyway.
2024-10-19 16:05:46 +02:00
Christoph M. Becker
85cf4a39d7 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix PDO_Firebird tests for 32bit
2024-10-07 19:53:04 +02:00
Christoph M. Becker
626dc50989 Fix PDO_Firebird tests for 32bit
These tests are failing because the integers are too large to be cast
to a PHP int.  We fix this by expecting either an int or a string.

Closes GH-16278.
2024-10-07 19:52:39 +02:00
KentarouTakeda
fec2055af2 test(pdo_firebird): Fix the dummy server running on localhost to IPv4 (#16115) 2024-09-29 12:43:34 +02:00
Niels Dossche
e82b3b2dd5 Remove non-sensical checks from firebird (#16114)
These conditions are always true because they are arrays that are
address-taken, i.e. their addresses will never be NULL.
2024-09-29 11:31:25 +02:00
Niels Dossche
b21d2ca93b Fix bogus fallthrough path in firebird_handle_get_attribute(), again
This reapplies b8e9c5ba6a after it was accidentally removed via
225034dbbc.
2024-09-28 13:19:33 +02:00
Christoph M. Becker
50b3a0d011 Add comments about internal headers (GH-15689)
A common convention is to name internal C header files as `*_int.h`.
Since a couple of these are actually installed, we add comments that
this is not supposed to happen, (a) to avoid installing further
internal headers, and (b) to pave the way to fix this in the next major
PHP version.

Somewhat special is php_gmp_int.h, where "int" is meant as abbreviation
for "interface".

Another common convention is appending `_priv` or `_private`, but since
there have not been any issues regarding these headers so far, we
refrain from adding respective comments to these headers.

Anyhow, it might be a good idea to introduce some common naming
convention for such internal/private headers.
2024-09-08 16:11:25 +02:00
Simonov Denis
eb3e7a2c0c ext/pdo_firebird: Fixed GH-15604 Always make input parameters nullable (#15605)
Fixes #15604
Closes #15605
2024-08-31 17:06:41 +09:00
Peter Kokot
09d5b7102a Fix -Wunused-function warning in ext/pdo_firebird (#15646)
When FB_API_VER equals to 30, for example, on Ubuntu, there is this
warning thrown with certain compiler configurations:

    /php-src/ext/pdo_firebird/pdo_firebird_utils.cpp:21:13: warning:
    ‘void fb_copy_status(const ISC_STATUS*, ISC_STATUS*, size_t)’
    defined but not used [-Wunused-function]
       21 | static void fb_copy_status(const ISC_STATUS* from, ISC_STATUS* to, size_t maxLength)
          |             ^~~~~~~~~~~~~~
2024-08-30 01:22:52 +02:00