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

1827 Commits

Author SHA1 Message Date
Kamil Tekiela
eedbffec2e Empty some values of mysqli_get_charset() (#21361)
* Stop reporting unhelpful values in mysqli_get_charset

* Remove element "comment" as it has been undocumented
2026-03-07 22:09:02 +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
Kamil Tekiela
3ed4d2a82b Drop extraneous parameter (#20977) 2026-01-20 13:06:52 +00:00
Remi Collet
839803847e Merge branch 'PHP-8.5'
* PHP-8.5:
  NEWS
  NEWS
  NEWS
  Fix GH-20528: Regression breaks mysql connexion using an IPv6 address enclosed in square brackets
2025-11-21 09:21:19 +01:00
Remi Collet
7bdeedb430 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  NEWS
  NEWS
  Fix GH-20528: Regression breaks mysql connexion using an IPv6 address enclosed in square brackets
2025-11-21 09:20:41 +01:00
Remi Collet
c9de303087 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS
  Fix GH-20528: Regression breaks mysql connexion using an IPv6 address enclosed in square brackets
2025-11-21 09:19:56 +01:00
Remi Collet
9d71c1e0b6 Fix GH-20528: Regression breaks mysql connexion using an IPv6 address enclosed in square brackets 2025-11-21 09:17:20 +01:00
Niels Dossche
f9678e7b90 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-8978: MySQLi: SSL certificate verification fails (port doubled)
2025-10-15 21:49:39 +02:00
Niels Dossche
dd609116e3 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-8978: MySQLi: SSL certificate verification fails (port doubled)
2025-10-15 21:49:32 +02:00
Niels Dossche
aa82c9c325 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-8978: MySQLi: SSL certificate verification fails (port doubled)
2025-10-15 21:49:25 +02:00
Niels Dossche
472f2fe0a3 Fix GH-8978: MySQLi: SSL certificate verification fails (port doubled)
If there are 2 ports, only the first is used.
However, then the certificate checking fails. So we drop the second port
if there is one.

Closes GH-20021.
2025-10-15 21:49:00 +02:00
Niels Dossche
f60dd15f95 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix bug #67563: mysqli compiled with mysqlnd does not take ipv6 adress as parameter
2025-09-30 15:21:19 +02:00
Niels Dossche
5fd378236f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix bug #67563: mysqli compiled with mysqlnd does not take ipv6 adress as parameter
2025-09-30 15:21:07 +02:00
Niels Dossche
4496322e42 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix bug #67563: mysqli compiled with mysqlnd does not take ipv6 adress as parameter
2025-09-30 15:20:50 +02:00
Niels Dossche
6db12e7cd8 Fix bug #67563: mysqli compiled with mysqlnd does not take ipv6 adress as parameter
In the past, when libmysqlclient could be used, it accepted ipv6 addresses
as hostname without enclosing it first in brackets. However, in mysqlnd
this never worked. In the past this caused a discrepancy between the two
implementations.
Nowadays, mysqli only works with mysqlnd so we don't even have to cater
to libmysqlclient. However, a plain ipv6 address should still work as a
hostname. Also for people migrating to newer PHP versions it's nice if
this keeps working.

The solution is to check if we're dealing with an ipv6 address not yet
enclosed in brackets. In that case we add the brackets automatically.

Closes GH-19750.
2025-09-30 15:20:14 +02:00
Tim Düsterhus
b7c4331e9b mysqlnd: Use return true / return false for functions returning bool
Changes done with Coccinelle:

    @r1@
    identifier fn;
    typedef bool;
    symbol false;
    symbol true;
    @@

    bool fn ( ... )
    {
    <...
    return
    (
    - 0
    + false
    |
    - 1
    + true
    )
    ;
    ...>
    }

Coccinelle patch sourced from
torvalds/linux@46b5c9b856.
2025-09-24 18:51:40 +02:00
Tim Düsterhus
b12eae465c mysqlnd: 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
Marc Bennewitz
76a97f56d6 Mysqlnd: Removed useless precompilter cond (#19120) 2025-08-28 14:42:02 +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
Peter Kokot
c2af281c0c Use <winsock2.h> instead of legacy <winsock.h> (#19037)
This also omits defining unused HAVE_WINSOCK_H macro when building
ext/sockets.
2025-07-07 09:40:03 +02:00
Андрей Ковалёв
b871261c10 ext/mysqlnd/mysqlnd_auth.c: Add error handling for invalid public key size (#18663)
Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>

Signed-off-by: Andrey Kovalev <ded@altlinux.org>
Co-authored-by: Andrey Kovalev <ded@altlinux.org>
2025-06-02 11:55:25 +02:00
Kamil Tekiela
25f4f7982c Drop unused variables (#18023) 2025-04-19 13:26:09 +01:00
Tim Düsterhus
633400bb56 mysqlnd: Make st_mysqlnd_stats.values a dynamic struct member (#18246)
This avoids another separate allocation.
2025-04-06 18:56:57 +02:00
Christoph M. Becker
aa76127d01 Address more Clang warnings (GH-17506)
We prefer clean solutions (such as declaring the proper type in the
first place, or introducing a portable format specifier) where easily
possible, but resort to casts otherwise.

We also port f1480ab14b.
2025-01-21 20:05:29 +01:00
Gina Peter Banyard
6ef58da59e ext/mysqlnd: Refactor usage of strlcpy() (#17185)
The two calls that MySQLnd does to this handler all pass a buffer the same size as the error_msg field
Thus, we know that we can just memcpy the error message into the buffer.

See https://nrk.neocities.org/articles/not-a-fan-of-strlcpy for a rationale against the usage of `strlcpy()`
2024-12-28 23:00:08 +00:00
Christoph M. Becker
7e1d035077 Factor out SETUP_ZLIB_LIB() (GH-16798)
Note that this function is similar to `SETUP_OPENSSL`, but since the
zlib headers are not necessarily required, we append `_LIB`.

We are also more liberal regarding zlib(_a).lib, because
extensions requiring zlib are looking only for zlib.lib if ext/zlib has
been built as shared extension.  This is overly restrictive at best,
and actually makes no sense, since (a) we're not shipping shared zlib
builds for years, and (b) users could have a zlib.lib which is a static
build (they could even just rename zlib_a.lib to zlib.lib).
2024-11-27 18:35:34 +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
Jakub Zelenka
d37a20c4a2 Fix MySQLnd possible buffer over read in auth_protocol 2024-11-20 11:06:53 +01:00
Jakub Zelenka
c595455300 Fix GHSA-h35g-vwh6-m678: Mysqlnd - various heap buffer over-reads
This fixes issues causing buffer over-read that leak heap content:
- RESP packet field default left over for COM_LIST
- RESP packet upsert filename
- OK packet message
- RESP packet for stmt row data
  - ps_fetch_from_1_to_8_bytes
  - ps_fetch_float
  - ps_fetch_double
  - ps_fetch_time
  - ps_fetch_date
  - ps_fetch_datetime
  - ps_fetch_string
  - ps_fetch_bit
- RESP packet for query row data (just possible overflow on 32bit)

It also adds various protocol tests using a new fake server.
2024-11-20 11:06:26 +01:00
Peter Kokot
41347f017b [skip ci] Fix MYSQLND_HAVE_SSL preprocessor help texts
The MYSQLND_HAVE_SSL indicate that mysqlnd has extended SSL support
enabled through either OpenSSL when building with Autotools, and through
crypt32 library on Windows.

Fixes https://github.com/php/php-src/pull/15164#discussion_r1803834585

Closes GH-16474.
2024-11-10 20:41:06 +01:00
^_^
555b603d23 mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT (#13618) 2024-08-26 12:52:26 +09:00
Kamil Tekiela
195d59a83c Remove dead code 2024-08-25 10:32:50 +02:00
Kamil Tekiela
2446500d97 Remove unsupported mysqlnd options 2024-08-25 10:32:50 +02:00
Kamil Tekiela
c290996db6 Remove MYSQLI_TYPE_INTERVAL constant 2024-08-21 12:14:47 +02:00
Kamil Tekiela
a1ab846231 MySQL 9: Add support for VECTOR type (#15431) 2024-08-20 17:34:52 +02:00
Christoph M. Becker
57f02e2aba Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15432: Heap corruption when querying a vector
2024-08-20 15:45:42 +02:00
Christoph M. Becker
a3dbd39be0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15432: Heap corruption when querying a vector
2024-08-20 15:44:40 +02:00
Christoph M. Becker
b1211c1e4a Fix GH-15432: Heap corruption when querying a vector
Since the mysqlnd result set is arena allocated, we must not simply
free it, but rather call the appropriate `free_result` method.

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
2024-08-20 15:43:21 +02:00
Kamil Tekiela
6c7ff08920 Drop MYSQLI_CURSOR_TYPE_FOR_UPDATE & MYSQLI_CURSOR_TYPE_SCROLLABLE (#15486) 2024-08-19 13:54:40 +02:00
Kamil Tekiela
c316382acb Remove MYSQLI_STMT_ATTR_PREFETCH_ROWS constant (#15485)
This feature was never implemented, and since the
beginning, using this constant with mysqlnd would
result in an error.
This feature was only available with libmysqlclient
which can no longer be used with mysqli.
There are no plans to implement it in the future.
2024-08-19 13:04:56 +02:00
Christoph M. Becker
4a77ce2022 Remove unnecessary Windows specific time formatting (GH-15474)
`gettimeofday()` is supported by PHP on Windows for ages; and generally
`localtime()` is supported on Windows for a long time.  As such, there
is no need for the Windows specific formatting code.

However, the general Windows caveat regarding `time_t` applies, namely
that it is usually `__time64_t`, unless `_USE_32BIT_TIME_T` is declared,
what we do for 32bit architectures, in which case it is `__time32_t`.
Now, `struct timeval` is imported from WinSock2.h, where the members are
declared as long (i.e. 32bit on both x86 and x64).  That means passing
a pointer to `tv_sec` to `localtime()` likely fails on x64, or at least
doesn't yield the desired result.  Therefore, we assign `tv_sec` to an
appropriate `time_t` variable, and also make sure that the `time_buffer`
is zero-terminated even if the `localtime()` call still fails.
2024-08-18 12:43:41 +02:00
Peter Kokot
b56f81cddc Add configure phase dependencies to mysqlnd extension (#15380)
The hash extension is required in mysqlnd extension for using sha
functions when extended SSL is enabled (MYSQLND_HAVE_SSL).
2024-08-14 01:18:28 +02:00
Peter Kokot
cf6bbdfb0c Autotools: Improve ftp and mysqlnd SSL configure options (#15164)
This makes the configure log messages and help text more intuitive what
is being enabled and when.
2024-08-03 22:13:36 +02:00
Peter Kokot
a1b45bb87a Autotools: Sync PHP_SETUP_* M4 macros (#15117)
- arguments quoted
- MYSQLND_HAVE_SSL help text synced
2024-07-27 11:20:07 +02:00
Peter Kokot
6857c7c8d6 Autotools: Expand m4_normalize sooner (#15018)
Quoted m4_normalize will expand and change its argument later in the
macro call when M4 is processing the *.m4 sources. Without quotes the
already normalized string is passed to the macro directly. In these
specific cases generated configure script is the same. This is more for
consistency to have this synced and not repeat the pattern too much
in the future when copy/pasting. Note, that many AC_* macros require
similar behavior already (for example, AC_CHECK_FUNCS.)
2024-07-19 15:20:04 +02: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
3cbf5aa63e Normalize mysqlnd extension sources (#14654)
The m4_normalize() can simplify the list argument. It removes leading
and trailing spaces and tabs, sequences of backslash-then-newline, and
replaces multiple spaces, tabs, and newlines with a single space.
2024-06-25 19:33:51 +02:00
Peter Kokot
b12ccb319f Add PHP_SETUP_ZLIB M4 macro (#14591)
This enables the zlib library (https://zlib.net/) from a single place to
match the minimum required version across the php-src. This provides a
possible simpler version bump in the future. Macro's 2nd and 3rd
arguments can pass additional actions whether zlib library is found or
not for the possible future adjustments in the ext/standard where also
zlib might be required.

Support for pkg-config was introduced in 1.2.3.1.
The minimum zlib version has been bumped to 1.2.3.1



* Bump minimum zlib version to 1.2.11

This is aligned with CentOS 8, which has 1.2.11 in the default packages.

* [skip ci] Move zlib version change to UPGRADING

This matches the OpenSSL style version change notice already done in
this file.
2024-06-21 15:05:34 +02:00