Commit Graph

112503 Commits

Author SHA1 Message Date
Vincent
05c00a832c Fix bug #78192 PDO SQLite SegFault when reuse statement after schema has changed
Reset stmt->columns when column count changed on new execution of prepared statement
2019-06-28 12:36:02 +02:00
Nikita Popov
8be051015e Add support for proc_open() with a command array
In this case the progarm will be executed directly, without a shell.
On Linux the arguments are passed directly to execvp and no escaping
is necessary. On Windows we construct a command string using escaping
with the default Windows command-line argument parsing method described
at https://docs.microsoft.com/en-us/cpp/cpp/parsing-cpp-command-line-arguments.

Apart from avoiding the issue of argument escaping, passing an array
and bypassing shell has the advantage of allowing proper signal
delivery to the opened process (rather than the shell).
2019-06-28 11:09:55 +02:00
Dmitry Stogov
143f4e3b5c Reduce overhead 2019-06-28 12:03:01 +03:00
Joe Watkins
68485f8ab4
implement tsrm_is_shutdown API 2019-06-28 10:27:19 +02:00
Christoph M. Becker
bc0db8ce45 Use the portable zend_strndup() instead of strndup() 2019-06-28 10:23:38 +02:00
Dmitry Stogov
ba8033feb0 Fixed use-after-free 2019-06-28 10:43:56 +03:00
Nikita Popov
f365d0e00e Fix mysqlnd memory leak
The actual leak is observed in ext/pdo_mysql/tests/bug_74376.phpt.
The persistent connection leaks because a refcount decrement on a
result is missed. The refcount decrement is missed because
free_result_contents is used, rather than free_result.

Looking at other uses of free_result_contents, it looks like they
could also suffer from this problem. Apart from one case,
free_result_contents is always used to release the result entirely
(I've adjusted the one differing case to only free meta), so I'm
moving most of the logic from free_result into free_result_contents.
The only difference is now that free_result will skip_result first.
2019-06-28 09:18:32 +02:00
Nikita Popov
a78adce5cb Free ZTS lock in opcache
For some reason this only shows up as a leak when using phpdbg.
2019-06-28 09:18:14 +02:00
Nikita Popov
8c4d199851 Fix init_file leak in phpdbg 2019-06-28 09:17:26 +02:00
Nikita Popov
b195412bf3 run-tests: Don't pass --INI-- settings to --SKIPIF--
If we're testing ini settings that cause startup failures, we'll
never get to that SKIPIF block...

Also change settings2param to return a value instead of modifying
(to a different type no less!) in place.
2019-06-28 09:17:09 +02:00
Nikita Popov
70fa4715a4 Fix custom heap free
This seems to be designed around the use-case where the custom
allocator is a wrapper around ZMM.
2019-06-28 09:13:45 +02:00
Sara Golemon
27f1f3ed1a Bugfix #78208 Needs rehash with an unknown algo should always return true. 2019-06-27 19:26:03 -04:00
Peter Kokot
35b6a9f75a Catch up with some recent changes [ci skip]
- Mention mysqli::stat()
- Mention removal of HAVE_* for always defined extensions
- Mention removed symbols defined during the build
2019-06-28 00:29:50 +02:00
Peter Kokot
638c21765c Remove HAVE_STRCOLL check
The strcoll function is defined in the C89 standard and should be
on today's systems always available via the <string.h> header.

https://port70.net/~nsz/c/c89/c89-draft.html#4.11.4.3

- Remove also SKIPIF strcoll check in test
2019-06-28 00:05:55 +02:00
Peter Kokot
033cafacbd Sync HAVE_HASH, HAVE_HASH_EXT, PHAR_HASH_OK symbols
The hash extension is always available since PHP-7.4. The symbol
HAVE_HASH_EXT is kept for BC reasons and removed in PHP-8.0.

This patch also removes the PHAR_HASH_OK since it is no longer
relevant.
2019-06-27 23:25:33 +02:00
Nikita Popov
08027e85fa Remove posix_getlogin_basic.phpt test
The premise of this test (that the getlogin user has to be the same
as the geteuid user) is incorrect.
2019-06-27 16:15:13 +02:00
Nikita Popov
40d6147dd0 Fix opcache blacklist leak
Don't recompute (and leak) the regex for every glob element, only
do this once at the end.
2019-06-27 16:11:58 +02:00
Nikita Popov
c3132781ec Fix phpdbg shutdown order
In particular, make sure that everything using zmm is released
before zmm is shut down. phpdbg currently gets away with this,
because either a) its custom handlers are used and no auto-free
happens or b) the system allocator is used and no auto-free happens.
With the tracking allocator for asan this no longer works.
2019-06-27 14:20:51 +02:00
Nikita Popov
2149ed7072 Don't use zmm for PHPDBG_G(exec)
Uses system allocator when backing up settings ... let's avoid
unnecessary confusion.
2019-06-27 14:20:30 +02:00
Nikita Popov
78375aa52f Fix persistent XML memory leaks in SOAP
SOAP uses a horrible bailout based error handling approach -- avoid
leaking persistent XML memory by catching bailouts in a number of
places.
2019-06-27 14:20:10 +02:00
Nikita Popov
cfeda978df Add tracked allocator mode
In this case we will use the system allocator, but still remember
all allocations and free them the same way that Zend MM does. This
allows us to accurately model leak behavior.

Enabled using USE_ZEND_ALLOC=0 USE_TRACKED_ALLOC=1.
2019-06-27 14:19:48 +02:00
Christoph M. Becker
218c18530a Show actual enchant version if possible
As of libenchant 1.6.0 there is enchant_get_version()[1], so we use it,
if available, to show the actual enchant version in the PHP info.  We
also drop the fake ENCHANT_VERSION_STRING altogether, but stick with
showing version 1.5.x if at least HAVE_ENCHANT_BROKER_SET_PARAM is
defined.

Future scope: we may consider requiring enchant 1.6.0 (or later), since
this has been released in April 2010, and likely is available
everywhere.

[1] <https://www.abisource.com/projects/enchant/>
2019-06-27 13:04:49 +02:00
Dmitry Stogov
e7446c1b2d Separate common code abd eliminate useless checks 2019-06-27 13:11:08 +03:00
Dmitry Stogov
a58964be82 Inline hot path 2019-06-27 11:27:53 +03:00
Nikita Popov
2f0f895284 Fix persistent connection leak in mysqli 2019-06-27 09:45:32 +02:00
Nikita Popov
6bebe833a2 Fix use-after-free in stream freeing during shutdown
Streams will be freed in an unpredictable order during shutdown.
Ignore explicit calls to php_stream_close() entirely to avoid
use-after-free -- instead let the stream resource destructor
deal with it. We have to account for a few special cases:

 * Enclosed streams should be freed, as the resource destructor
   will forward to the enclosing stream.
 * Stream cookies also directly free streams, because we delegate
   to the cookie destruction if one exists.
 * Mysqlnd also directly frees streams, because it explicitly
   removes stream resources (because mysqlnd!)
2019-06-27 09:45:23 +02:00
Peter Kokot
2079b09854 Clean headers checks
Some headers were checked multiple times in the main configure.ac file
and in the bundled extensions or SAPIs themselves. Also many of these
checks are then used accross other extensions or SAPIs so a central
configure.ac makes most sense for these checks.
2019-06-27 02:45:09 +02:00
Dmitry Stogov
83b99527df Avoid double checks on early binding 2019-06-27 02:13:06 +03:00
Peter Kokot
798fed3b0d Remove warnings for bison and re2c checks
This patch removes warnings when lexer and parser files are already
generated. For example, when downloading a PHP release. Realistically,
it is not so trivial to rebuild lexer and parser files without removing
them first. And considering that tarballs don't have cleaning tools
such as Git, this would require manual removali.

Related also to https://bugs.gentoo.org/593278
2019-06-27 00:59:59 +02:00
Peter Kokot
4ff44a9161 Fix concurrent testing of bug 61964
When tests are run concurrently using the -j option there might be a
change of failure and writing to the same directory from both tests.

Use test filenames for generated temp dirs
2019-06-27 00:27:10 +02:00
Peter Kokot
a29bf46b68 Fix posix_errno test without PCNTL dep
When PCNTL extension is not enabled, the SIGKILL constant is also not
available.
2019-06-27 00:24:37 +02:00
Peter Kokot
6ef2f04a75 Remove unused HAVE_DATE and HAVE_SPL symbols
These two are never defined anymore since PHP 7.4 and can be
considered to have always available date and hash extensions.
2019-06-26 23:30:58 +02:00
Peter Kokot
cc4134c04e Remove HAVE_STRTOD and strtod check
There is no need to check for the strtod function. It is part of C89
standard which PHP-7.4+ supports.

http://port70.net/~nsz/c/c89/c89-draft.html#4.10.1.4
2019-06-26 23:10:55 +02:00
Peter Kokot
537844cb1d Set Computer English language for credits sorting
This makes the script a bit more portable when used on systems with
different LC_ALL and LANG settings.
2019-06-26 22:35:55 +02:00
Christoph M. Becker
81a403211e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Remove stream_socket_sendto.phpt
2019-06-26 17:02:08 +02:00
Christoph M. Becker
801ab18ea7 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Remove stream_socket_sendto.phpt
2019-06-26 17:01:29 +02:00
Nikita Popov
7d28a24c66 Remove stream_socket_sendto.phpt
Fails for me locally due to different number of warnings with
different messages. Rather than adding more wildcards I'm dropping
this test entirely, as it doesn't seem to test anything particularly
useful.

(cherry picked from commit 84333cad67)
2019-06-26 16:58:37 +02:00
Dmitry Stogov
36b7021e2c Private methods don't have to be duplicated 2019-06-26 13:27:13 +03:00
Nikita Popov
788a68900d Fix xml doc leak in soap 2019-06-26 11:43:11 +02:00
Nikita Popov
80958d0f90 Use ldap_destroy instead of ldap_unbind_ext 2019-06-26 11:43:11 +02:00
Nikita Popov
698dd32b03 Fix fpm limit_extensions leak
The logic here is somewhat ugly because the worker pool structure
gets freed early, so we need to explicitly transfer ownership.
2019-06-26 11:40:39 +02:00
Dmitry Stogov
f7faa62c43 Reorder conditions to minimize number of checks on fast path 2019-06-26 01:00:31 +03:00
Dmitry Stogov
6288fc19dd Remove always true/false conditions, remove dead conde and simplify code. 2019-06-26 00:32:22 +03:00
Dmitry Stogov
215b5a7db8 Replace previosly checked conditions by ZEND_ASSERT() 2019-06-25 18:26:56 +03:00
Dmitry Stogov
f09d41ffc0 Fixed variance check for abstract constructor during erlay binding 2019-06-25 17:43:46 +03:00
Dmitry Stogov
ccbc121cb1 Cleanup 2019-06-25 16:37:42 +03:00
Nikita Popov
0f3ca15bb7 FFI: Perform bitfield operations byte-wise
Otherwise we may perform reads/writes outside the allocation, as
already happens in 032.phpt.
2019-06-25 14:28:58 +02:00
Nikita Popov
42b22d3a94 Fix out of bounds write in phpdbg
It seems that this code has a peculiar interpretation of "len",
where it actually points to the last character, not one past it.
So we need +1 here for that extra char and another +1 for the
terminating null byte.
2019-06-25 14:28:58 +02:00
Nikita Popov
8757f30cc7 Fix CURLINFO_COOKIELIST leak 2019-06-25 14:28:58 +02:00
Nikita Popov
8277acefbd Fix leak on sqlite3 open error
sqlite3_open creates the database object even if the operation
fails.
2019-06-25 14:28:58 +02:00