1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Commit Graph

902 Commits

Author SHA1 Message Date
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
Gina Peter Bnayard
e7c4d54d65 Use new helper function for "cannot be empty" ValueErrors 2024-08-21 21:12:17 +01:00
David CARLIER
bb8d667f8f Fix GH-15102: ext/pgsql use after free on persistent connection renewal. (#15115)
simplifying the workflow by just using PQreset which force a new
connection internally, connection process ids ought to be different,
 and let the existing checks do the rest.
2024-07-26 23:12:26 +01:00
David Carlier
ba54cebb44 ext/pgsql: pg_convert/pg_insert/pg_update/pg_delete caching regexes.
Close GH-15039
2024-07-20 23:04:48 +01:00
David CARLIER
39b1006306 ext/pgsql: db metadata simplification for table names. (#15036) 2024-07-19 22:47:52 +01:00
Peter Kokot
42530c6543 Remove unused SMART_STR_PREALLOC (#14848) 2024-07-07 01:04:53 +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
Peter Kokot
4f450b6264 Bump minimum libpq version to 10.0 (#14628)
This bumps the libpq client-side PostgreSQL library minimum required
version from 9.1 to 10.0.

- Sanity check: PQlibVersion -> PQencryptPasswordConn (available since
  libpq 10.0)
- PQsetErrorContextVisibility (available since libpq 9.6)
- lo_truncate64 (available since libpq 9.3), if 32-bit system doesn't
  support lo_*64 functions, error is returned and functions are always
  available

Additionally, the conditional functions usages in pdo_pgsql and pgsql
extensions that got piled up are cleaned and synced:

- pg_prepare (PQprepare available since libpq 7.4)
- pg_query_params (PQexecParams available since libpq 7.4)
- pg_result_error_field (PQresultErrorField available since libpq 7.4)
- pg_send_prepare (PQsendPrepare available since libpq 7.4)
- pg_send_query_params (PQsendQueryParams available since libpq 7.4)
- pg_set_error_verbosity (PQsetErrorVerbosity available since libpq 7.4)
- pg_transaction_status (PQtransactionStatus available since libpq 7.4)

The Windows libpq version is currently at version 11.4:
https://github.com/winlibs/postgresql

Discussion: https://news-web.php.net/php.internals/123609
Follow-up of GH-14540
2024-06-25 20:50:04 +02:00
David Carlier
564914ac1a ext/pgsql: adding postgresql 17 new libpq wrapper call.
pg_set_chunked_rows_size to allow to fetch results in chunk of max N rows.

close GH-14571
2024-06-15 19:56:15 +01:00
David Carlier
2bb8fbd0a8 ext/pgsql: add pg_jit server info.
since PostgreSQL 11, LLVM JIT feature had been brought thus reporting
the settings to the client connection.

Close GH-14566
2024-06-14 16:27:00 +01:00
Peter Kokot
2969889fb8 Remove conditional pg_encoding_to_char usage (#14557)
The pg_encoding_to_char is available in PostgreSQL since ~7.3 where also
the --enable-multibyte option was removed. PHP minimum PostgreSQL
version at this point is 9.1, which also has the pg_encoding_to_char
declaration in libpq-fe.h.

This removes conditional usage and the HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
symbol.
2024-06-13 16:00:16 +02:00
Peter Kokot
5baef94d00 Remove conditional usage of PQfreemem (#14559)
PQfreemem is available since PostgreSQL 7.4.
2024-06-13 13:34:08 +02:00
Peter Kokot
d545b1d643 Add missing ext/pcre dependency for ext/pgsql (#14541) 2024-06-11 23:38:23 +02:00
Peter Kokot
65ff5117ab Check for PQERRORS_SQLSTATE in PGVerbosity enum (#14519)
The PG_VERSION_NUM is not available in intended public PostgreSQL
headers unless the pg_config.h is included or the PostgreSQL server
development headers are installed separately. This instead resorts to
checking for the PGVerbosity enum value. The PQERRORS_SQLSTATE was added
to PostgreSQL 12.0. At the time of writing, on Windows, PostgreSQL is at 11.4 so
it is not defined there yet.
2024-06-09 11:47:06 +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
e69bccd7c7 ext/pgsql: adding pg_socket_poll.
Using PQSocketPoll to poll on a connection's socket.
Returns immediatly is there no event expected on read and write.
Other than that, it is a thin wrapper on top of poll, thus reflecting
 its return value.

close GH-14366
2024-05-31 20:10:49 +01:00
David Carlier
162a311cc8 ext/pgsql: adding pg_put_copy_data/pg_put_copy_end.
pg_put_copy_data allows to send COPY commands to the server.
pg_put_copy_end signals the end of the n commands.

Both return 3 states ; 1, 0 and -1 when 1 is success, 0 the buffer queue
is full then -1 for errors.

Close GH-14325
2024-05-28 18:35:40 +01:00
David Carlier
9aa3a0d702 ext/pgsql: adding pg_change_password functionality.
handy call to change an user password while taking care transparently
of the password's encryption.

close GH-14262
2024-05-20 12:57:37 +01:00
David CARLIER
0218af87f2 ext/pgsql: using fast ZPP api for calls. (#14099) 2024-05-15 19:32:02 +01:00
武田 憲太郎
77fa4c0fce ext/pgsql: add pg_result_memory_size
Close GH-14214
2024-05-13 22:58:02 +01:00
David Carlier
243827b83f Fix GH-13519: another attempt after the faulty fix.
Close GH-14055
2024-04-27 12:15:59 +01:00