Commit Graph

57888 Commits

Author SHA1 Message Date
Dmitry Stogov
da0ca53f39 Initialize EX(call)->func by single instruction 2020-12-29 13:20:10 +03:00
Dmitry Stogov
56fde2a381 Reuse value stored in %r0 instead of immediate operand 2020-12-29 13:18:56 +03:00
Christoph M. Becker
0e7bae6afa Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix ffi stubs
2020-12-28 19:05:32 +01:00
Christoph M. Becker
13f898b56a Fix ffi stubs
Closes GH-6543.
2020-12-28 19:04:47 +01:00
Máté Kocsis
74e39ce06c
Merge branch 'PHP-8.0' 2020-12-28 14:46:00 +01:00
Máté Kocsis
46a2c6a8d7
Fix return type of DateTimeImmutable::__set_state() 2020-12-28 14:45:13 +01:00
Máté Kocsis
9cec093b7f
Add support for generating methodsynopses from stubs
Closes GH-6367
2020-12-28 14:44:43 +01:00
Christoph M. Becker
45b638afe0 php_formatted_print() throws on failure
Closes GH-6542.
2020-12-27 22:40:25 +01:00
Christoph M. Becker
03251f29df Merge branch 'PHP-8.0'
* PHP-8.0:
  Replace sort() function calls with ksort() in basic ksort test
2020-12-27 18:32:29 +01:00
Christoph M. Becker
57430e6f1e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Replace sort() function calls with ksort() in basic ksort test
2020-12-27 18:32:03 +01:00
haszi
0db6f5267c Replace sort() function calls with ksort() in basic ksort test
Closes GH-6541.
2020-12-27 18:30:58 +01:00
Christoph M. Becker
bbae3dd7ff Merge branch 'PHP-8.0'
* PHP-8.0:
  DateTime*::getOffset() no longer returns false as of PHP 8.0.0
2020-12-26 15:13:56 +01:00
Christoph M. Becker
269936e680 DateTime*::getOffset() no longer returns false as of PHP 8.0.0
Cf. <https://github.com/php/doc-en/pull/282>.

Closes GH-6539.
2020-12-26 15:13:05 +01:00
Dmitry Stogov
14b5fff632 Merge branch 'PHP-8.0'
* PHP-8.0:
  Eliminate redundand comparison insructions
2020-12-24 16:59:27 +03:00
Dmitry Stogov
23bbff2b05 Eliminate redundand comparison insructions 2020-12-24 16:58:54 +03:00
Máté Kocsis
5638fafa66
Merge branch 'PHP-8.0' 2020-12-24 11:46:10 +01:00
Máté Kocsis
ab4c5976d7
Fix the signature of FFI::typeof() and FFI::memcmp() 2020-12-24 11:45:32 +01:00
Máté Kocsis
c1d766171b
Add a few other RETURN_THROWS() 2020-12-24 11:44:15 +01:00
Máté Kocsis
ed19cb6518
Fix the signature of FFI::sizeof() and FFI::alignof() 2020-12-24 11:39:09 +01:00
Christopher Jones
ec6f6dfcfc Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix PDO_OCI test
2020-12-24 17:48:53 +11:00
Christopher Jones
34aefa36f4 Fix PDO_OCI test 2020-12-24 17:48:39 +11:00
Christopher Jones
e387e4da0e Fix PDO_OCI build 2020-12-24 17:18:57 +11:00
George Peter Banyard
4935fbe90f Update hash for IMAP stubs after adding final qualifier 2020-12-23 21:56:31 +01:00
Ayesh Karunaratne
af68d4aae6 IMAP: Declare IMAPConnection class as final (stub+test)
Updates the `IMAPConnection` class stub to make sure it has the `final` flag, and adds a test to verify it.
2020-12-23 21:21:32 +01:00
Ayesh Karunaratne
7f1659afcb IMAP: Disallow direct new IMAPConnection() construct
Disallows constructing an `IMAPConnection` class directly with `new IMAPConnection` construct, by throwing an `Error` exception if attempted.
`imap_open` is still the only way to create `IMAPConnection` objects.
2020-12-23 21:21:32 +01:00
Christoph M. Becker
4050589302 Merge branch 'PHP-8.0'
* PHP-8.0:
  Add regression test for bug #76770
2020-12-23 16:47:32 +01:00
Semen Dubina
959d3c9636 Add regression test for bug #76770
Closes GH-3514.
2020-12-23 16:47:08 +01:00
Christoph M. Becker
89d4b6b790 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80384: limit read buffer size
2020-12-23 13:53:19 +01:00
Christoph M. Becker
7d9ddd61ec Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80384: limit read buffer size
2020-12-23 13:52:45 +01:00
Adam Seitz
70dfbe0068 Fix #80384: limit read buffer size
In the case of a stream with no filters, php_stream_fill_read_buffer
only reads stream->chunk_size into the read buffer. If the stream has
filters attached, it could unnecessarily buffer a large amount of data.

With this change, php_stream_fill_read_buffer only proceeds until either
the requested size or stream->chunk_size is available in the read buffer.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-6444.
2020-12-23 13:49:56 +01:00
Nikita Popov
438b025a28 Support native types in PDO SQLite
Return integers and floats as native types if possible. As usual,
the old behavior can be restored by enabling ATTR_STRINGIFY_FETCHES.

Fixes bug #38334.
2020-12-23 11:25:31 +01:00
Ayesh Karunaratne
012439b78e FTP: Disallow direct FTPConnection construction
Similar to other resource to object migrations, `FTPConnection` class is not allowed to be constructed with `new FTPConnection`.
Related to b4503fbf88.

Closes GH-6533.
2020-12-23 09:54:38 +01:00
George Peter Banyard
c6a8f201b1 EXPECTF imap_errors() test's authentication error 2020-12-22 23:14:11 +01:00
George Peter Banyard
7606994356 Make imap_errors() test no hang
Instead of attempting to connect with an invalid password, connect as an anonymous user.
As this is disabled in our Dovecot configuration, this generates an error, and fails fast.
2020-12-22 19:55:30 +01:00
George Peter Banyard
a80a029896 Optimize Dovecot configuration for IMAP tests
Closes GH-6531
2020-12-22 19:55:30 +01:00
Nikita Popov
caa710037e Rewrite PDO result binding
Instead of requiring the type to be determined in advance by the
describer function and then requiring get_col to return a buffer
of appropriate type, allow get_col to return an arbitrary zval.
See UPGRADING.INTERNALS for a more detailed description of the
change.

This makes the result fetching simpler, more efficient and more
flexible. The general possibility already existed via the special
PDO_PARAM_ZVAL type, but the usage was very inconvenient and/or
inefficient. Now it's possible to easily implement behavior like
"return int if it fits, otherwise string" and to avoid any kind
of complex management of temporary buffers.

This also fixes bug #40913 (our second highest voted bug of all
time, for some reason). PARAM_LOB result bindings will now
consistently return a stream resource, independently of the used
database driver.

I've tried my best to update all PDO drivers for this change, but
some of the changes may be broken, as I cannot test or even build
some of these drivers (in particular PDO dblib and PDO oci).
Fixes are appreciated -- a working CI setup would be even more
appreciated ;)
2020-12-22 15:56:34 +01:00
Nikita Popov
57d69b5137 Don't use explicitly nullable column in bug_73234.phpt
Firebird doesn't support this. It is nullable by default.

The test still fails, but now for a legitimate reason...
2020-12-22 10:34:54 +01:00
Nikita Popov
b4ffe54174 Add CONFLICTS file for PDO firebird tests 2020-12-22 10:31:35 +01:00
Nikita Popov
381624818b Fix bug_69356.phpt for firebird
Firebird does not support selecting without a table. Use the same
code we use elsewhere, which adds "FROM DUAL" or "FROM RDS$DATABASE"
as necessary.
2020-12-22 10:26:07 +01:00
Nikita Popov
9294074c09 PDO Firebird: Use recreate table
Firebird does not have "if exists", and the switch to exception
error mode broke the suppressed exec calls.

Firebird does have a "recreate table" command that effective
perform a "drop table if exists" beforehand.
2020-12-22 10:20:41 +01:00
Nikita Popov
a9253b0e22 Suppress zend_signals warnings if pdo_firebird loaded 2020-12-22 10:20:41 +01:00
George Peter Banyard
383779e502 Convert IMAP resource to object
Closes GH-6418
2020-12-22 03:06:35 +01:00
Nikita Popov
cc23fcfca6 PDO Firebird: Fix uninitialized var warning 2020-12-21 21:47:00 +01:00
Nikita Popov
737195c3ae PDO: Honor ATTR_STRINGIFY_FETCHES for booleans
Of the important PDO drivers, this affects only PDO PgSQL, as
both MySQL and SQLite do not return native boolean types.
2020-12-21 15:32:32 +01:00
Derick Rethans
5a3c1f61d4 Merge branch 'PHP-8.0' into master 2020-12-21 10:32:17 +00:00
Derick Rethans
288332077f Fixed bug #80376 (last day of the month causes runway cpu usage) 2020-12-21 10:31:41 +00:00
Derick Rethans
b043759cb4 Fixed bug #80376 (last day of the month causes runway cpu usage) 2020-12-21 10:30:40 +00:00
Nikita Popov
442fa318a0 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix bug #80537
2020-12-21 10:23:42 +01:00
Nikita Popov
27e250880b Fix bug #80537
This is an unavoidable breaking change to both the type and
parameter name.

The assertion that was supposed to prevent this was overly lax
and accepted any object type for string parameters.
2020-12-21 10:21:50 +01:00
Christopher Jones
4c5e47d113 Merge branch 'PHP-8.0'
* PHP-8.0:
  Description typo
2020-12-21 15:47:06 +11:00
Christopher Jones
d6731d69bd Description typo 2020-12-21 15:46:26 +11:00
Christopher Jones
9af1ad7a95 Merge branch 'PHP-8.0'
* PHP-8.0:
  Bundle PECL OCI8 3.0.1
2020-12-21 15:38:35 +11:00
Christopher Jones
74959b47cd Bundle PECL OCI8 3.0.1 2020-12-21 15:15:16 +11:00
Christoph M. Becker
78bdbfc24a Merge branch 'PHP-8.0'
* PHP-8.0:
  Revert "DateTime:: and DateTimeImmutable::getTimestamp() may return false"
2020-12-20 23:07:34 +01:00
Christoph M. Becker
32c6c29d79 Revert "DateTime:: and DateTimeImmutable::getTimestamp() may return false"
This reverts commit b67c232189.
2020-12-20 23:07:02 +01:00
Christoph M. Becker
dccaaa956a Merge branch 'PHP-8.0'
* PHP-8.0:
  DateTime:: and DateTimeImmutable::getTimestamp() may return false
2020-12-20 19:32:36 +01:00
Christoph M. Becker
b67c232189 DateTime:: and DateTimeImmutable::getTimestamp() may return false 2020-12-20 19:32:12 +01:00
Christoph M. Becker
b85f0d1cd0 Convert file_info resources to objects
Besides our general desire to get rid of the legacy resource types,
this is particularly appealing for fileinfo, because there are already
respective objects.

Closes GH-5987.
2020-12-20 18:19:22 +01:00
Christoph M. Becker
54c866106e Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix ext/date stubs
2020-12-20 18:14:40 +01:00
Christoph M. Becker
3c68f43251 Fix ext/date stubs
Closes GH-6523.
2020-12-20 18:14:20 +01:00
Nikita Popov
c7cccc1c9a Fix leak 2020-12-18 21:48:21 +01:00
Nikita Popov
7904a087ec Back memory stream by a zend_string
This allows reusing an existing zend_string inside a memory stream
without reallocating. For non-readonly streams, the string will
only get separated on write.
2020-12-18 17:07:07 +01:00
Nikita Popov
fd36b089cf Remove unused pdo_pgsql_column member 2020-12-18 15:50:59 +01:00
Nikita Popov
7a5cc7aa67 Add basic libmysqlclient CI job
This tests that mysqli and pdo_mysql build against libmysqlclient,
and that tests pass for pdo_mysql. mysqli has too many test failures.

This is not an officially supported configuration.
2020-12-18 12:52:54 +01:00
Nikita Popov
037512cfce Move fetch_all implementation out of mysqlnd
There doesn't seem to be any compelling reason to implement this
in mysqlnd rather than mysqli. It's just a loop over fetch_into.

This makes the function available under libmysqlclient as well,
and thus fixes bug #79372.
2020-12-18 12:27:30 +01:00
Nikita Popov
be93e5a120 Make mysqli_stmt_next_result available under libmysql
The libmysqlclient version we require supports mysql_stmt_next_result.
2020-12-18 11:32:41 +01:00
Nikita Popov
b88a493aaa PDO MySQL: Make test libmysql compatible 2020-12-18 11:28:15 +01:00
Nikita Popov
9718e5987f Merge branch 'PHP-8.0'
* PHP-8.0:
  PDO MySQL: Handle boolean parameter binding with libmysql
2020-12-18 11:02:36 +01:00
Nikita Popov
51f57e7b81 PDO MySQL: Handle boolean parameter binding with libmysql
Previously boolean parameters were simply silently ignored...
2020-12-18 11:01:26 +01:00
Nikita Popov
4ceea869ee Merge branch 'PHP-8.0'
* PHP-8.0:
  MySQLnd: Support cursors in store/get result
2020-12-18 10:20:55 +01:00
Nikita Popov
ab84623108 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  MySQLnd: Support cursors in store/get result
2020-12-18 10:20:13 +01:00
Nikita Popov
bc166844e3 MySQLnd: Support cursors in store/get result
This fixes two related issues:

1. When a PS with cursor is used in store_result/get_result,
   perform a COM_FETCH with maximum number of rows rather than
   silently switching to an unbuffered result set (in the case of
   store_result) or erroring (in the case of get_result).
   In the future, we might want to make get_result unbuffered for
   PS with cursors, as using cursors with buffered result sets
   doesn't really make sense. Unlike store_result, get_result
   isn't very explicit about what kind of result set is desired.
2. If the client did not request a cursor, but the server reports
   that a cursor exists, ignore this and treat the PS as if it
   has no cursor (i.e. to not use COM_FETCH). It appears to be a
   server side bug that a cursor used inside an SP will be reported
   to the client, even though the client cannot use the cursor.

Fixes bug #64638, bug #72862, bug #77935.

Closes GH-6518.
2020-12-18 10:19:13 +01:00
Nikita Popov
73533c7dc9 PDO MySQL: Use correct type when setting INT_AND_FLOAT_NATIVE
mysqlnd expects this to be an unsigned int, not a bool.
2020-12-17 18:50:24 +01:00
Levi Morrison
710f3985c5 Skip invalid file descriptor test on Mac 2020-12-17 09:11:10 -07:00
Nikita Popov
108d1e9a50 MySQLnd: Remove mnd_malloc/free etc.
There were only two uses of non-zmm allocation functions left,
which really did not need to use the system allocator. Remove
them, and remove the system allocator based APIs.
2020-12-17 17:01:09 +01:00
Nikita Popov
8898c1e75c MySQLnd: Fix potential leak when reading cursor
Perform the same checkpointing twe do in other row reading
functions.
2020-12-17 16:14:17 +01:00
Nikita Popov
1144b85b82 MySQLnd: Avoid some reallocations in PS decoder 2020-12-17 14:41:47 +01:00
hgsgtk
003d9ba125 Fix typo 'pices' in strings/join_basic.phpt
Closes GH-6519.
2020-12-17 14:19:05 +01:00
Nikita Popov
c18b1aea28 PDO MySQL: Use native types for results
Previously, PDO MySQL only fetched data as native int/float if
native prepared statements were used. This patch updates PDO to
have the same behavior for emulated prepared statements, and thus
removes the largest remaining discrepancy between these two modes.

Note that PDO already has a ATTR_STRINGIFY_FETCHES option to control
whether native types are desired or not. The previous output can
be restored by enabling this option.

Most of the tests make use of that option, because this allows the
tests to work under libmysqlclient as well, which currently always
returns string results (independently of whether native or emulated
PS are used).
2020-12-17 10:54:34 +01:00
Nikita Popov
33e904915e MySQLnd: Clean up and optimize mysqlnd result set handling
This is a larger overhaul of the mysqlnd result set infrastructure:

 * Drop support for two different types of buffered results sets
   ("c" and "zval"). Possibly these made sense at some earlier
   time, but now (with minor adjustments) one option is strictly
   worse than the other. Buffered result sets already buffer the
   full row packets, from which zvals can be decoded. The "zval"
   style additionally also buffered the decoded zvals. As result
   sets, even buffered ones, are generally only traversed once,
   this just ends up wasting memory. Now, a potentially useful
   variation here would be to buffer the decoded zvals instead of
   the row packets, but that's not what the code was doing.
 * To make it really strictly better, pre-allocate the zval row
   buffer and reuse it for all rows. Previously the "c" style always
   allocated a new buffer for each row.
 * The fetch_row API now provides a populated zval[]. The task of
   populating an array is deferred to fetch_row_into, which also
   avoids duplicating this code in multiple places. The fetch_row_c
   API is also implemented on top of fetch_row now, rather than
   duplicating large parts of the code.
 * The row fetching code for prepared statements and normal result
   sets has been mostly merged. These already used the same
   infrastructure, but prepared statements used separate row
   fetching functions that were nearly the same as the normal ones.
   This requires passing the stmt into the result set, rather than
   just a flag. The only part that remains separate is reading of
   unbuffered results in the presence of PS cursors.
2020-12-17 10:15:02 +01:00
Nikita Popov
890e4caf0b Drop support for max_length in mysqli_fetch_fields()
Retain the field, but always populate it with zero. This was
already the case for PS without length updating.

max_length has nothing lost in the field metadata -- it is a
property of the specific result set, and requires scanning the
whole result set to compute. PHP itself never uses max_length
with mysqlnd, it is only exposed in the raw mysqli API.

Keeping it for just that purpose is not worthwhile given the costs
involved. People who actually need this for some reason can easily
calculate it themselves, while making it obvious that the
calculation requires a full result set scan.
2020-12-17 10:01:02 +01:00
Christoph M. Becker
58d459f1ef Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80521: Parameters with underscores no longer recognized
2020-12-16 20:06:01 +01:00
Christoph M. Becker
1860ef22eb Fix #80521: Parameters with underscores no longer recognized
We have to use the proper value for the bitmask.
2020-12-16 20:04:52 +01:00
Nikita Popov
bc4140d7a8 Merge branch 'PHP-8.0'
* PHP-8.0:
  Detect overlarge step for character range()
2020-12-16 17:02:20 +01:00
Nikita Popov
c56701690a Detect overlarge step for character range()
This was done for int and float ranges, but not char ranges.

Fixes oss-fuzz #28666.
2020-12-16 17:01:15 +01:00
Nikita Popov
52435f94a3 Merge branch 'PHP-8.0'
* PHP-8.0:
  PDO MySQL: Use mysqlnd column names
2020-12-16 15:18:43 +01:00
Nikita Popov
205d209de9 PDO MySQL: Use mysqlnd column names
mysqlnd already creates interned zend_strings for us, so let's
make use of them.

This also required updating the PDO case changing code to work
with potentially shared strings. For the lowercasing, use the
optimized zend_string_tolower() implementation.
2020-12-16 15:17:13 +01:00
Nikita Popov
1c29db19d4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #67983
2020-12-16 10:54:36 +01:00
Nikita Popov
1a66d64717 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #67983
2020-12-16 10:53:48 +01:00
Nikita Popov
315f3f8dc9 Fixed bug #67983
We need to check the BIT case first, otherwise it will get skipped
in INT_AND_FLOAT_NATIVE mode.
2020-12-16 10:52:27 +01:00
Nikita Popov
cfe2b36a6d Fix ATTR_ORACLE_NULLS with PARAM_ZVAL
PARAM_ZVAL with a STR result should be treated the same way as
PARAM_STR in this regard.
2020-12-15 17:12:46 +01:00
Nikita Popov
806465892e MySQLnd: Drop free_result_internal
Merge it into free_result. There is a large number of different
free_* functions for result sets, let's avoid having one more.
Only difference is that it does not increment stats, and that
seems like a bug as free_stmt_result is still freeing a result.
2020-12-15 12:35:58 +01:00
Dmitry Stogov
6c05b33e84 Merge branch 'PHP-8.0'
* PHP-8.0:
  Optimize out result value of ASSIGN, ASSIGN_OP and INC/DEC opcodes, if possible.
2020-12-15 14:34:21 +03:00
Dmitry Stogov
de78786566 Optimize out result value of ASSIGN, ASSIGN_OP and INC/DEC opcodes, if possible. 2020-12-15 14:30:58 +03:00
Nikita Popov
6bda0c14f5 MySQLnd: Simplify management of zval row buffer
Something odd was being done here, with the row packet having a
flag for whether it should allocate the zval buffer, which would
then get moved into the result set.

Keep the management of this buffer purely at the result set level.
This also allows us to easily reuse the same buffer for all results,
rather than allocating a new one for each fetch.
2020-12-15 12:00:05 +01:00
Christoph M. Becker
6b37cdda66 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #77322: PharData::addEmptyDir('/') Possible integer overflow
2020-12-15 11:46:46 +01:00
Christoph M. Becker
c2fbab392c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #77322: PharData::addEmptyDir('/') Possible integer overflow
2020-12-15 11:46:28 +01:00
Christoph M. Becker
a53d67ceac Fix #77322: PharData::addEmptyDir('/') Possible integer overflow
`phar_path_check()` already strips a leading slash, so we must not
attempt to strip the trailing slash from an now empty directory name.

Closes GH-6508.
2020-12-15 11:44:53 +01:00
Nikita Popov
362c29241d Remove mysqlnd_extension enum
ext/mysql is no longer supported, drop handling for it from
mysqlnd.
2020-12-15 10:55:53 +01:00
Nikita Popov
be4f73f328 MySQLnd: Remove unused fetch_field_data method
This method is not used, and is implemented in a very dubious
way.
2020-12-15 10:47:39 +01:00