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

1311 Commits

Author SHA1 Message Date
Weilin Du
2918caee20 ext/*: Remove break after return (#21485) 2026-03-23 20:30:13 +01:00
Arshid
d3727f44e7 ext/pgsql: Remove unreachable break (#21482) 2026-03-21 09:39:44 +00:00
武田 憲太郎
31962aa086 ext/pgsql: Enable lo_tell64/lo_truncate64 by removing dead VE_PG_LO64 guards
The guards reference undefined VE_PG_LO64, a misspelling of
HAVE_PG_LO64 (removed in GH-14628), making the 64-bit code paths
permanently dead. Remove the guards to unconditionally enable the
64-bit variants for PostgreSQL >= 9.3, consistent with pg_lo_seek().

Dropped from GH-21386 as not suitable for backport.

close GH-21437
2026-03-14 05:22:43 +00:00
Gina Peter Banyard
c658d3c787 ext/pgsql: use smart_str_append_double() instead of snprintf call (#21406) 2026-03-11 01:51:53 +00:00
David Carlier
148dc1dd66 Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/pgsql: Fix preprocessor guard typo that silently disabled a feature
2026-03-09 07:45:20 +00:00
David Carlier
b0470d1669 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/pgsql: Fix preprocessor guard typo that silently disabled a feature
2026-03-09 07:42:53 +00:00
武田 憲太郎
35d98cb6ce ext/pgsql: Fix preprocessor guard typo that silently disabled a feature
Fix `PQTRACE_SUPPRESS_TIMESTAMPS` guard misspelling in pgsql.stub.php.

The guard has been misspelled as `PQTRACE_SUPPPRESS_TIMESTAMPS`
(three P's) since 7ec8ae12c4, preventing the
`PGSQL_TRACE_SUPPRESS_TIMESTAMPS` constant from being registered.

close GH-21386
2026-03-09 07:41:04 +00:00
KentarouTakeda
c56e8caaed ext/pgsql, ext/pdo_pgsql: Remove preprocessor guards for symbols predating libpq 10 (#21384)
While working on php/doc-en#5409 to clean up outdated PostgreSQL
version notes in the documentation, I noticed that the source code
also retains #ifdef guards for symbols guaranteed to exist in
libpq >= 10.0 (the minimum enforced in build/php.m4 via
PQencryptPasswordConn).

Removed guards (all confirmed in PostgreSQL 10 documentation):

- `PG_DIAG_{INTERNAL_POSITION,INTERNAL_QUERY}`: libpq 8.0+
- `PG_DIAG_{SCHEMA,TABLE,COLUMN,DATATYPE,CONSTRAINT}_NAME`: libpq 9.3+
- `PG_DIAG_SEVERITY_NONLOCALIZED`: libpq 9.6+
- `CONNECTION_SSL_STARTUP`: libpq 8.0+
- `CONNECTION_CONSUME`: libpq 10.0+

Refs:
- https://www.postgresql.org/docs/10/libpq-exec.html#LIBPQ-PQRESULTERRORFIELD
- https://www.postgresql.org/docs/10/libpq-connect.html#LIBPQ-PQCONNECTSTARTPARAMS
- 53e31d5883/build/php.m4 (L1927)
2026-03-08 05:42:50 +00: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
David Carlier
297b25316b Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/pgsql: fix GH-21165 unit test.
2026-02-17 04:27:35 +00:00
David Carlier
8ca6e13c2d Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/pgsql: fix GH-21165 unit test.
2026-02-17 04:27:21 +00:00
David Carlier
f7af877cfe ext/pgsql: fix GH-21165 unit test.
making it fails early instead.

close GH-21234
2026-02-17 04:26:42 +00:00
David Carlier
49f903ccc2 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21162: pg_connect() on error memory leak.
2026-02-15 21:27:29 +00:00
David Carlier
6c8a71b3b7 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21162: pg_connect() on error memory leak.
2026-02-15 21:27:19 +00:00
David Carlier
539c5d9f76 Fix GH-21162: pg_connect() on error memory leak.
The PHP_PQ_ERROR macro calls php_error_docref() which triggers user error handlers
thus libpq does not have the chance to clean the resources (and empty
connections string are allowed) on failure thus we avoid this macro
and delay the error handling after.

close GH-21165
2026-02-15 21:26:23 +00:00
Arshid
daa3513c32 ext/pgsql: pg_lo_export/pg_connection_reset returning a boolean value using RETURN_BOOL (#21150) 2026-02-06 06:59:33 +00:00
Khaled Alam
32bd33983d Remove unreachable code after zend_error_noreturn calls (GH-20983) 2026-02-02 14:14:15 +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
e9e0fe45e5 Merge branch 'PHP-8.5'
* PHP-8.5:
  exp/pgsql: insert/update query string build possible UB fix.
2026-01-19 06:18:26 +00:00
David Carlier
709c2f73aa Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  exp/pgsql: insert/update query string build possible UB fix.
2026-01-19 06:17:40 +00:00
David Carlier
5785ff7728 exp/pgsql: insert/update query string build possible UB fix.
From PQescapeIdentifier() docs

```
A terminating zero byte is not required, and should not be counted in
length
```
2026-01-19 06:17:23 +00:00
Niels Dossche
ef87a146fb pgsql: Don't allocate memory for default arguments (#20757) 2025-12-23 00:39:09 +01:00
Gina Peter Banyard
0953e898db Fix pg_fetch_object() when an error occurs in subroutine (#20407)
This is a follow-up of GH-20068
2025-11-06 22:47:28 +00:00
Gina Peter Banyard
129f6e536d ext/pgsql: Refactor parameter parsing for a few functions (#20068) 2025-11-05 22:33:25 +00:00
Niels Dossche
5b5fe437f5 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20374: PHP with tidy and custom-tags
  pgsql: Fix memory leak when object init fails (#20387)
2025-11-04 20:21:17 +01:00
Niels Dossche
b8e9f7c44c Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20374: PHP with tidy and custom-tags
  pgsql: Fix memory leak when object init fails (#20387)
2025-11-04 20:21:09 +01:00
Niels Dossche
07aab0c356 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20374: PHP with tidy and custom-tags
  pgsql: Fix memory leak when object init fails (#20387)
2025-11-04 20:20:26 +01:00
Niels Dossche
04323955c1 pgsql: Fix memory leak when object init fails (#20387)
The return value is already overwritten by this point so we do have to
clean up the old return value (i.e. dataset) after all.
2025-11-04 19:59:38 +01:00
Gina Peter Banyard
00f42bb61d Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix include paths for new pgsql tests
2025-11-04 04:43:04 +00:00
Gina Peter Banyard
3afac4c7f1 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix include paths for new pgsql tests
2025-11-04 04:42:53 +00:00
Gina Peter Banyard
14ed75e560 Fix include paths for new pgsql tests 2025-11-04 04:42:42 +00:00
Gina Peter Banyard
67e5d6cc2d Merge branch 'PHP-8.5'
* PHP-8.5:
  Update NEWS for recent pgsql bugfix
  ext/pgsql: Fix segfaults when attempting to fetch row into a non-instantiable class name (#20180)
2025-11-04 00:10:03 +00:00
Gina Peter Banyard
7c6affd617 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update NEWS for recent pgsql bugfix
  ext/pgsql: Fix segfaults when attempting to fetch row into a non-instantiable class name (#20180)
2025-11-04 00:09:44 +00:00
Gina Peter Banyard
afca514c3b Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Update NEWS for recent pgsql bugfix
  ext/pgsql: Fix segfaults when attempting to fetch row into a non-instantiable class name (#20180)
2025-11-04 00:08:42 +00:00
Gina Peter Banyard
94dc6ae871 ext/pgsql: Fix segfaults when attempting to fetch row into a non-instantiable class name (#20180)
Also fix Windows CI with Postgres and CLEAN sections

---------

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-11-04 00:04:30 +00:00
Niels Dossche
5eec4d8001 pgsql: Avoid duplicating strings and factor out parameter building code 2025-10-20 20:41:38 +02:00
Niels Dossche
da9638298c pgsql: Avoid unnecessary work in pgsql_copy_from_query() if the input already ends in a newline 2025-10-20 20:41:38 +02:00
Niels Dossche
e2396a6ffb pgsql: Simplify pgsql_copy_from_query() by using character buffers
This also avoids some unnecessary zend_string overhead.
2025-10-20 20:41:38 +02:00
Niels Dossche
8e84e9a551 pgsql: Use cheaper string conversion functions 2025-10-20 20:41:38 +02:00
Niels Dossche
81fef09d01 Merge branch 'PHP-8.5'
* PHP-8.5:
  pgsql: Fix memory leak when first string conversion fails
2025-10-18 23:59:54 +02:00
Niels Dossche
9282111d9f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  pgsql: Fix memory leak when first string conversion fails
2025-10-18 23:59:48 +02:00
Niels Dossche
d992cd8315 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  pgsql: Fix memory leak when first string conversion fails
2025-10-18 23:59:41 +02:00
Niels Dossche
cf3b70d23c pgsql: Fix memory leak when first string conversion fails
If the first string conversion fails, then i==0, but memory was still
allocated for `params`. However, we skip freeing `params` when i==0.

Closes GH-20213.
2025-10-18 23:59:15 +02:00
Tim Düsterhus
985d681501 tree-wide: Replace zval_is_true() by zend_is_true() (#20065)
* tree-wide: Replace `zval_is_true()` by `zend_is_true()`

The former is a direct alias of the latter which is much more often used.

* zend_operators: Remove `zval_is_true()`
2025-10-07 20:44:32 +02:00
Tim Düsterhus
d793de1a8c pgsql: Use true / false instead of 1 / 0 for bool parameters
Changes done with Coccinelle:

    @r1@
    identifier F;
    identifier p;
    typedef bool;
    parameter list [n1] PL1;
    parameter list [n2] PL2;
    @@

    F(PL1, bool p, PL2) {
    ...
    }

    @r2@
    identifier r1.F;
    expression list [r1.n1] EL1;
    expression list [r1.n2] EL2;
    @@

    F(EL1,
    (
    - 1
    + true
    |
    - 0
    + false
    )
    , EL2)
2025-09-24 18:51:40 +02:00
David Carlier
b73d8b373a Merge branch 'PHP-8.4' 2025-08-15 08:08:16 +01:00
David Carlier
fd4db3e178 Merge branch 'PHP-8.3' into PHP-8.4 2025-08-15 08:05:14 +01:00
Mark Karpeles
987a3a5c8e Fix GH-19484 i: potential use after free when using persistent pgsql connections.
By setting the notice processor to a no-op when a persistent connection is cleaned for future use.

Close GH-19485
2025-08-15 08:04:14 +01:00
Gina Peter Banyard
841afdc486 streams: use type zend_result instead of type int 2025-08-04 15:30:57 +01:00
DanielEScherzer
1eadf553f1 Arginfo: avoid using temporary zvals for initializing attribute values (#19141)
Instead of
* adding a zval on the stack
* initializing it
* copying the value to the attribute

Just initialize the value directly in the zend_attribute_arg
2025-07-21 13:33:51 -07:00