1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 08:58:28 +02:00
Commit Graph

922 Commits

Author SHA1 Message Date
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 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
Niels Dossche 30f03021d1 [ci skip] Remove obsolete todo (#19195)
All arguments are documented on php.net, although result_type is called
mode in the docs and stub.
2025-07-21 10:57:54 +02:00
Jakub Zelenka 545d1536d8 Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
This adds error checks for escape function is pgsql and pdo_pgsql
extensions. It prevents possibility of storing not properly escaped
data which could potentially lead to some security issues.
2025-07-01 09:34:49 -07:00
Ilija Tovilo 49d94cced0 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 17:48:00 +02:00
Jakub Zelenka 66bd809ac9 Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
This adds error checks for escape function is pgsql and pdo_pgsql
extensions. It prevents possibility of storing not properly escaped
data which could potentially lead to some security issues.
2025-07-01 23:01:16 +09:00
Gina Peter Banyard 0cdd3c32de ext/pgsql: Stop using useless convert_to_boolean() API (#18683)
There are better ways of handling this than casting the zval in place
2025-05-29 19:09:11 +01:00
Gina Peter Banyard 2b22ea9630 Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/pgsql: Fix warning not being emittedd when failure to cancel a query
2025-05-29 15:44:08 +01:00
Gina Peter Banyard aae88ac799 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/pgsql: Fix warning not being emittedd when failure to cancel a query
2025-05-29 15:43:52 +01:00
Gina Peter Banyard 40422e9c55 ext/pgsql: Fix warning not being emittedd when failure to cancel a query 2025-05-29 15:42:48 +01:00
Niels Dossche c15cacc902 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix uouv in pg_put_copy_end()
2025-04-21 17:47:55 +02:00
Niels Dossche 4621423e5e Fix uouv in pg_put_copy_end()
Closes GH-18383.
2025-04-21 17:47:37 +02:00
David CARLIER 8f6bc97a36 ext/pgsql: pg_fetch_all_columns/pg_copy_to arrays optimisations. (#18374)
changes to packed arrays for output userland values.
2025-04-21 13:43:44 +01:00
David Carlier 334d9bbc09 ext/pgsql: adding pg_service() alongside other connection infos.
returns the ongoing name of the service, if there is.
available since postgres 18

close GH-18198
2025-03-30 21:45:16 +01:00
David Carlier 50bffd3284 Merge branch 'PHP-8.4' 2025-03-26 17:46:38 +00:00
David Carlier 9c6fe6b0ff Fix GH-18148: pg_copy_from() wrong \n offset check.
Close GH-18149
2025-03-26 17:44:01 +00:00
David CARLIER d5251513b1 ext/pgsql: get_field_name helper, remove unused precaution for pg_type request. (#18025)
it is an internal table and oid is a real Oid (uint32_t) value.
2025-03-19 21:56:00 +00:00
Gina Peter Banyard eb4ccf5758 ext/pgsql: Use new php_streams fast ZPP specifier 2025-03-03 18:08:23 +00:00
David Carlier f82f602ec8 ext/pgsql: few internal changes.
Z_PARAM_STR*/Z_PARAM_PATH. lo_write checks any null byte.

close GH-17587
2025-01-26 19:15:36 +00:00
David Carlier 9ba2667cf5 Merge branch 'PHP-8.4' 2024-12-15 14:56:29 +00:00
David Carlier 2309cac755 Merge branch 'PHP-8.3' into PHP-8.4 2024-12-15 14:55:36 +00:00
David Carlier 0a3442fbe6 ext/pgsql fixing further calls with flexible arguments number.
continuation of GH-17161

close GH-17165
2024-12-15 14:50:59 +00:00
Niels Dossche 57e9429e73 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17158: pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument
2024-12-14 19:49:12 +01:00
Niels Dossche e562b8cf8e Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17158: pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument
2024-12-14 19:49:04 +01:00
Niels Dossche 388f63c310 Fix GH-17158: pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument
Closes GH-17161.
2024-12-14 19:48:40 +01:00
David Carlier e609a21906 ext/pgsql: pgsql_copy_from to support iterable.
inspired from the Pdo\Pgsql new feature GH-15893.

close GH-16124
2024-10-01 19:53:20 +01:00
David Carlier 1da352c367 ext/pgsql: adding pg_close_stmt.
up to postgresql 17, when done with a prepared statement, we could
release it with DEALLOCATE sql command which is fine ; until we want
to implement a cache solution based on statement ids.

Since PostgreSQL 17, PQclosePrepared uses internally the `close` protocol
allowing to reuse the statement name while still freeing it.
Since the close protocol implementation had been added on libpq within
this release, no way to reimplement it.

close GH-14584
2024-09-29 16:26:35 +01:00
Gina Peter Bnayard 5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00