1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 00:18:23 +02:00
Commit Graph

1782 Commits

Author SHA1 Message Date
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
Niels Dossche b1fd3477b2 mysqlnd: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Kamil Tekiela 73abf4fe93 Merge branch 'PHP-8.3'
* PHP-8.3:
  Clear mysql error in fetch_into
2024-05-17 13:16:59 +02:00
Kamil Tekiela 05efcc245e Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Clear mysql error in fetch_into
2024-05-17 13:13:18 +02:00
Kamil Tekiela a59868aef8 Clear mysql error in fetch_into
Closes GH-14256
2024-05-17 13:08:42 +02:00
Peter Kokot b5b9c13c3d Add missing MYSQLND_SHARED_LIBADD substitution (#14228)
This is used in Makefile when building mysqlnd as shared to get zlib and
crypto libraries linked in the mysqlnd.so (-lz -lcrypto). For static
build these are in the resulting binary like before.
2024-05-17 12:21:11 +02:00
Peter Kokot 44ed17cab5 Replace configure option --with-openssl-dir (#14028)
This is a leftover from the refactoring of the --with-openssl-dir option
that once accepted the path to OpenSSL but wasn't renamed back then.

Instead of --with-openssl-dir, SSL support in ext/ftp and ext/mysqlnd
can be enabled implicitly when building with ext/openssl enabled
(--with-openssl) or explicitly by using new separate configure options
--with-ftp-ssl and --with-mysqlnd-ssl.
2024-05-13 22:54:54 +02:00
Niels Dossche 43cbeb3bf0 Add an assertion for certainty 2024-04-21 16:07:40 +02:00
Niels Dossche bb8234d2bd Use php_stream_auto_cleanup() consistently 2024-04-21 16:07:40 +02:00
Niels Dossche 0b69c3aea4 Fix crash in shutdown when using a named pipe with a persistent mysqli connection
The code originally posted in GH-10599 triggers the bug for
non-persistent connections, but changing the host to `p:.` reveals that
there is also a crash bug for persistent connections.
2024-04-21 16:07:40 +02:00
Niels Dossche a20d9d72b1 Factor common code out into mysqlnd_fixup_regular_list()
This prevents the code from getting desynced again, which was the reason
for the leak of GH-10599.
2024-04-21 16:07:40 +02:00
Niels Dossche 319fb50eca Fix memory leak in mysqlnd_vio::open_pipe
This fixes the memory leak part of GH-10599.
2024-04-21 16:07:40 +02:00
Niels Dossche 06b87f912b Remove broken hack in mysqlnd_vio::close_stream
What happens is that the persistent network stream resource gets freed, yet
stays inside EG(persistent_list). This causes a crash on shutdown when the
persistent list is getting cleared, as the engine will try to free the network
stream again.

The code in close_stream gets confused between persistent vs
non-persistent allocations when EG(active) is false.
This code was introduced in c3019a1 to fix crashes when the persistent list
gets destroyed before module shutdown is called. This is indeed a potential
problem that was fixed on the master branch in 5941cda.

This fixes the crash reason of GH-10599.
2024-04-21 16:07:39 +02:00
Jakub Zelenka d24086b7ba Merge branch 'PHP-8.3' 2024-04-12 11:04:41 +01:00
Jakub Zelenka fbcad699cb Merge branch 'PHP-8.2' into PHP-8.3 2024-04-12 10:57:42 +01:00
Jakub Zelenka 3b93f13199 Revert "ext/mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT"
This reverts commit 5035b85090.

This broke Doctrine DBAL tests - more discussion in GH-13618.
2024-04-12 10:56:09 +01:00
Kamil Tekiela 72f94a127f Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT
2024-04-10 13:37:36 +02:00
Kamil Tekiela acf9047346 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT
2024-04-10 13:35:14 +02:00
Appla 5035b85090 ext/mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT
Closes GH-13618.
2024-04-10 13:33:04 +02:00
Niels Dossche e08a5dce8f Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Fix shift out of bounds on 32-bit non-fast-path platforms (#10941)
2024-04-04 19:29:36 +02:00
Niels Dossche 5daf080b6b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix shift out of bounds on 32-bit non-fast-path platforms (#10941)
2024-04-04 19:29:29 +02:00
Niels Dossche 8bfde5d01e Fix shift out of bounds on 32-bit non-fast-path platforms (#10941)
The x86-32 build uses a fast path, but when I disabled the fast path I
got the following compile error with -Werror:
mysqlnd_portability.h:221:95: error: right shift count >= width of type [-Werror=shift-count-overflow]

For 32-bit platforms that don't have the fast path, this can cause
undefined behaviour at runtime. Some CPUs just mask the shift amount
so in those cases you even get wrong results.
This is not always found during the build because -Werror is off by
default.
2024-04-04 19:28:10 +02:00
Niels Dossche 33c2d6b9a4 Remove redundant check in mysqlnd_conn_data::connect (#13849)
`conn` is dereferenced at top so it is always non-NULL.
2024-03-31 16:16:49 +02:00
Niels Dossche f6447b337e Remove redundant check in mysqlnd_fetch_stmt_row_cursor (#13850)
result is always non-NULL because it is dereferenced above.
Similarly, result->unbuf and stmt must also be non-NULL.
2024-03-31 16:16:27 +02:00
Niels Dossche b9bb8d62ca Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix incorrect charset length in check_mb_eucjpms()
2024-03-22 11:32:23 +01:00
Niels Dossche 67ce1d859d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix incorrect charset length in check_mb_eucjpms()
2024-03-22 11:32:15 +01:00
Niels Dossche 8ffac997aa Fix incorrect charset length in check_mb_eucjpms()
Closes GH-13781.
2024-03-22 11:31:36 +01:00
Niels Dossche a8c927005e Skip validity and length calls when the byte cannot be part of a multibyte sequence
Almost every character set can be given a number N such that a multibyte
sequence starts with a byte higher than that number N. This allows us to
skip a lot of work. To ensure the correctness of this, a sanity check is
implemented that exhaustively tries every 4-byte sequence for every
character set and checks for consistency issues.

This finally gives:
  Time (mean ± σ):     120.2 ms ±   1.2 ms    [User: 116.9 ms, System: 2.8 ms]
  Range (min … max):   118.0 ms … 122.9 ms    24 runs
2024-03-07 20:27:18 +01:00
Niels Dossche 1571eed08f Replace dead overflow checks with assertions and avoid indirect call overhead
We allocate twice the input length, and every input character results in
either 1 or 2 output bytes, so we cannot overflow.

By using an enum, and a switch table (which will be efficiently compiled
into a jump table), we can avoid the pessimistic code generation of the
indirect calls.

With this I get the following runtime for the test script in GH-13466 on
my i7-4790, which is around 1.25x faster.
  Time (mean ± σ):     250.9 ms ±   1.6 ms    [User: 248.4 ms, System: 2.0 ms]
  Range (min … max):   248.9 ms … 254.4 ms    11 runs
2024-03-07 20:27:18 +01:00
Saki Takamachi e9c5f0504c Fixed handshake response charset. (#13470)
The character set ID included in the handshake data at the time of connection
actually only includes the lower 8 bits of the ID, so if  try to use this to specify
a character set, the corresponding character set may not exist.

In case of an invalid character set, the default character set is now used
without an error.

Fixes #13452
Closes #13470
2024-03-04 21:53:52 +09:00
Saki Takamachi 7466f9c99c Fixed handshake response charset. (#13470)
The character set ID included in the handshake data at the time of connection
actually only includes the lower 8 bits of the ID, so if  try to use this to specify
a character set, the corresponding character set may not exist.

In case of an invalid character set, the default character set is now used
without an error.

Fixes #13452
Closes #13470
2024-03-04 21:53:48 +09:00
Saki Takamachi 29a39eb782 Fixed handshake response charset. (#13470)
The character set ID included in the handshake data at the time of connection
actually only includes the lower 8 bits of the ID, so if  try to use this to specify
a character set, the corresponding character set may not exist.

In case of an invalid character set, the default character set is now used
without an error.

Fixes #13452
Closes #13470
2024-03-04 21:51:02 +09:00
Niels Dossche 5e7783e200 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed not to set CR_MALFORMED_PACKET to error if CR_SERVER_GONE_ERROR is already set
2024-02-10 14:05:26 +01:00
Niels Dossche ca60912c8f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed not to set CR_MALFORMED_PACKET to error if CR_SERVER_GONE_ERROR is already set
2024-02-10 14:05:19 +01:00
Saki Takamachi 199e48b567 Fixed not to set CR_MALFORMED_PACKET to error if CR_SERVER_GONE_ERROR is already set
Closes GH-11951.
2024-02-10 14:04:49 +01:00
Niels Dossche 31092c235d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13177: PHP 8.3.2: final private constructor not allowed when used in trait
  Fix GH-12107: When running a stored procedure (that returns a result set) twice, PHP crashes
2024-01-19 23:41:01 +01:00
Niels Dossche 87728105b9 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12107: When running a stored procedure (that returns a result set) twice, PHP crashes
2024-01-19 23:35:23 +01:00
Niels Dossche 0d21a8dcb5 Fix GH-12107: When running a stored procedure (that returns a result set) twice, PHP crashes
Closes GH-12771.
2024-01-19 23:34:12 +01:00
Cristian Rodríguez 927adfb1a6 Use a single version of mempcpy(3) (#12257)
While __php_mempcpy is only used by ext/standard/crypt_sha*, the
mempcpy "pattern" is used everywhere.

This commit removes __php_mempcpy, adds zend_mempcpy and transforms
open-coded parts into function calls.
2023-12-20 15:16:32 +00:00
Kamil Tekiela 550fd8a25e Update comment regarding MySQL user max length
The username can be up to 32 chars long as of MySQL 5.7.8
2023-12-10 17:30:08 +01:00
Niels Dossche fc8393b5f9 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12791: Possible dereference of NULL in MySQLnd debug code
2023-11-27 14:02:30 +01:00
Niels Dossche 3269aa95cb Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12791: Possible dereference of NULL in MySQLnd debug code
2023-11-27 14:02:19 +01:00
Niels Dossche 6a914cb7a5 Fix GH-12791: Possible dereference of NULL in MySQLnd debug code
Closes GH-12794.
2023-11-27 14:01:46 +01:00
Niels Dossche 1e7c64bd4d Merge branch 'PHP-8.3'
* PHP-8.3:
  Avoid using uninitialised struct
2023-11-25 20:08:34 +01:00