1
0
mirror of https://github.com/php/php-src.git synced 2026-04-01 13:12:16 +02:00
Commit Graph

57015 Commits

Author SHA1 Message Date
Nikita Popov
7b9519a792 Fix inconsistency in PDO transaction state
This addresses an issue introduced by #4996 and reported in
https://bugs.php.net/bug.php?id=80260.

Now that PDO::inTransaction() reports the real transaction state
of the connection, there may be a mismatch with PDOs internal
transaction state (in_tcx). This is compounded by the fact that
MySQL performs implicit commits for DDL queries.

This patch fixes the issue by making beginTransaction/commit/rollBack
work on the real transaction state provided by the driver as well
(or falling back to in_tcx if the driver does not support it).

This does mean that writing something like

    $pdo->beginTransaction();
    $pdo->exec('CREATE DATABASE ...');
    $pdo->rollBack(); // <- illegal

will now result in an error, because the CREATE DATABASE already
committed the transaction. I believe this behavior is both correct
and desired -- otherwise, there is no indication that the code did
not behave correctly and the rollBack() was effectively ignored.
However, this is also a BC break.

Closes GH-6355.
2020-10-26 17:01:18 +01:00
Nikita Popov
6d3695a217 Deny serialization of finfo objects
The resulting objects were already unusable, make it error out
earlier.
2020-10-26 16:54:30 +01:00
Nikita Popov
70388cc0ed Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Deny cloning of fileinfo objects
2020-10-26 16:52:14 +01:00
Nikita Popov
9353f11bd2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Deny cloning of fileinfo objects
2020-10-26 16:50:48 +01:00
Nikita Popov
7817fc07e1 Deny cloning of fileinfo objects
Using a cloned finfo object will crash.
2020-10-26 16:50:20 +01:00
Dharman
7e6b840778 Consistent error handling in mysqli_poll
This error condition should not actually be reachable, but change
it to be consistent with the other ones.

Also fix a memory leak.

Closes GH-6340.
2020-10-26 16:25:25 +01:00
Christoph M. Becker
be6d72b3a4 Revert "Fix out-of-bounds write"
This reverts commit bf6873a18e.

CVE-2020-26159 is bogus; the "bug" was apparently a false positive
reported by Coverity, and the "fix" apparently wrong, see
<https://github.com/kkos/oniguruma/issues/221>.

Closes GH-6357.
2020-10-26 15:40:12 +01:00
Dmitry Stogov
0fa154ad8d Fixed incorrect register allocation in ext/gd/tests/imagecopyresampled_variation1.phpt 2020-10-26 15:56:37 +03:00
Christoph M. Becker
e71036ce03 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80268: loadHTML() truncates at NUL bytes
2020-10-26 13:15:03 +01:00
Christoph M. Becker
7bc1c0cca8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80268: loadHTML() truncates at NUL bytes
2020-10-26 13:09:30 +01:00
Christoph M. Becker
6d2bc72530 Fix #80268: loadHTML() truncates at NUL bytes
libxml2 has no particular issues parsing HTML strings with NUL bytes;
these just cause truncation of the current text content, but parsing
continues generally.  Since `::loadHTMLFile()` already supports NUL
bytes, `::loadHTML()` should as well.

Note that this is different from XML, which does not allow any NUL
bytes.

Closes GH-6368.
2020-10-26 13:08:05 +01:00
Christoph M. Becker
2da00fadc8 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #62474: com_event_sink crashes on certain arguments
2020-10-26 11:55:29 +01:00
Christoph M. Becker
f9ba2ca136 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #62474: com_event_sink crashes on certain arguments
2020-10-26 11:54:45 +01:00
Christoph M. Becker
7424bfc7ac Fix #62474: com_event_sink crashes on certain arguments
We have to make sure that the variant is of type `VT_DISPATCH` before
we access it as such.

Closes GH-6372.
2020-10-26 11:48:57 +01:00
Christoph M. Becker
b678df5dc8 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80280: ADD_EXTENSION_DEP() fails for ext/standard and ext/date
2020-10-26 11:06:10 +01:00
Christoph M. Becker
8b59e4e897 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80280: ADD_EXTENSION_DEP() fails for ext/standard and ext/date
2020-10-26 11:05:22 +01:00
Christoph M. Becker
2be27074b6 Fix #80280: ADD_EXTENSION_DEP() fails for ext/standard and ext/date
`ADD_EXTENSION_DEP()` relies on the `PHP_<extname>` config variables to
be set to `"yes"`, and since the standard and date extension are always
enabled, we define the respective variables uncoditionally.

Closes GH-6383.
2020-10-26 11:03:05 +01:00
Nikita Popov
0535872b7c Use separate directory in dit_004.phpt
Make sure the directory is not modified while we're iterating it,
which may give unstable results.
2020-10-26 09:26:18 +01:00
Nikita Popov
7f462c97f9 Revert "Make ReflectionUnionType final"
This reverts commit ef6adb4e27.

Per Ondrej's comment, this is already being used by BetterReflection
adaptors, ugh.
2020-10-26 08:51:06 +01:00
Máté Kocsis
ef6adb4e27 Make ReflectionUnionType final
Closes GH-6384
2020-10-25 20:14:07 +01:00
Christoph M. Becker
5609701389 Define config var PHP_JSON
Otherwise, `ADD_EXTENSION_DEP('foo', 'json')` fails, even though the
JSON extension is available.
2020-10-24 15:36:05 +02:00
George Peter Banyard
158d308197 Throw Value/TypeError for invalid $bodies in imap_mail_compose()
Small drive by refactoring to use HashTables

Closes GH-6371
2020-10-23 20:47:35 +01:00
Máté Kocsis
47bbfe1fc0 Require stubs to declare return types for magic methods when possible
Closes GH-6376
2020-10-23 16:33:16 +02:00
Javier Eguiluz
c64dcda5e5 Fixed some typos
Closes GH-6373.

[ci skip]
2020-10-23 09:34:09 +02:00
Dmitry Stogov
0f8518f875 Fixed register allocation 2020-10-22 23:16:41 +03:00
Dmitry Stogov
838d8d0ba0 Fixed reference-counter inference 2020-10-22 23:15:39 +03:00
Dmitry Stogov
5626dcdb9d Missed warning 2020-10-22 23:15:15 +03:00
George Peter Banyard
ba27866aec Fix bug 76618
Apply patch which was attached to the bug in July 2018
2020-10-22 17:05:29 +01:00
George Peter Banyard
d5e2431884 Fix bug 76618
Apply patch which was attached to the bug in July 2018
2020-10-22 17:05:07 +01:00
George Peter Banyard
12a09183b3 Fix bug 76618
Apply patch which was attached to the bug in July 2018
2020-10-22 17:01:48 +01:00
Dmitry Stogov
20cbb233c4 Checj type guards before loading values into CPU registers 2020-10-22 18:23:49 +03:00
Dmitry Stogov
30cf0a04bf Avoid register allocation for ASSIGN into aliased variable (it might be indirectly changed into IS_REFERENCE) 2020-10-22 18:22:36 +03:00
George Peter Banyard
8b265fb602 Fix segfaults after conversion from zval to zend_string params 2020-10-22 15:50:01 +01:00
Nikita Popov
6de6f2a4e9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Don't crash on uninitialized tidy object
2020-10-22 16:05:57 +02:00
Nikita Popov
85d9a1ca6e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Don't crash on uninitialized tidy object
2020-10-22 16:05:34 +02:00
Nikita Popov
d4bf0799b8 Don't crash on uninitialized tidy object
"Uninitialized" here means that the object was created ordinarily
-- no constructor skipping involved. Most tidy methods seem to
handle this fine, but these three need to be guarded.
2020-10-22 16:04:22 +02:00
Nikita Popov
bfe7a1168a Properly validate ArrayObject::asort() argument 2020-10-22 15:20:43 +02:00
Máté Kocsis
4fb5ccf00c Fix parameter name of pspell_config_save_repl()
Closes GH-6369.
2020-10-22 14:54:43 +02:00
Nikita Popov
97dd0eb98d Fix stub for dba_key_split()
This is an extremely weird function, but the behavior seems to be
intentional, and is quite clearly documented.

So we adjust the stub to also accept false|null as arguments. I
believe the implementation already correctly matches union type
semantics.
2020-10-22 14:50:52 +02:00
Nikita Popov
db5979dfe2 Make highlight_string() accept string in zpp
To satisfy the type declaration.
2020-10-22 14:31:42 +02:00
Nikita Popov
c23eefb1ad Don't leak pcntl last_error across requests 2020-10-22 14:21:22 +02:00
Nikita Popov
aa0d886cbc Don't leak json error_code across requests 2020-10-22 12:42:09 +02:00
Nikita Popov
41b8cdd2e0 Don't leak pcre error_code across requests 2020-10-22 11:20:02 +02:00
Derick Rethans
5eb6f593ee Updated to version 2020.4 (2020d) 2020-10-22 10:12:27 +01:00
Derick Rethans
4ea01bdc67 Updated to version 2020.4 (2020d) 2020-10-22 10:12:26 +01:00
Derick Rethans
d4200ba6cf Updated to version 2020.4 (2020d) 2020-10-22 10:12:24 +01:00
Nikita Popov
dd3639341d Don't allow properties on GdImage
Just like all the other former resources... we missed this case.
2020-10-22 10:34:14 +02:00
Nikita Popov
ac87880add Update bcmath.scale when calling bcscale()
We should keep the value of bcmath.scale and the internal
bc_precision global synchronized.

Probably more important than the ability to retrieve bcmath.scale
via ini_get(), this also makes sure that the set scale does not
leak into the next request, as it currently does.
2020-10-21 17:06:48 +02:00
Dmitry Stogov
cb6f9a6568 More accurate live range construction 2020-10-21 16:05:13 +03:00
Dmitry Stogov
9efb258fc1 Eliminate useless mov(s) 2020-10-21 16:03:28 +03:00