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

57207 Commits

Author SHA1 Message Date
Nikita Popov
67598afbdb Merge branch 'PHP-8.0'
* PHP-8.0:
  Handle mysqli errors in more cases
  Sync test with master
2020-10-28 11:37:54 +01:00
Nikita Popov
d928c58281 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Handle mysqli errors in more cases
  Sync test with master
2020-10-28 11:37:37 +01:00
Dharman
990bb34891 Handle mysqli errors in more cases
Report errors autocommit, commit, rollback and mysqli_stmt_attr_set.

Additionally, copy the error from conn to stmt when preparing fails,
so these errors are also handled by mysqli_stmt_prepare.

Closes GH-6157.
2020-10-28 11:33:50 +01:00
Nikita Popov
fe55fe1f54 Sync test with master
Sync ext/mysqli/tests/mysqli_report.phpt with PHP-8.0/master, as
the current difference in indentation makes it hard to merge.
2020-10-28 11:30:22 +01:00
Nikita Popov
dc03e621b8 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix bug #79375
2020-10-28 11:04:41 +01:00
Nikita Popov
793bf12f8c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #79375
2020-10-28 11:04:32 +01:00
Dharman
b03776adb5 Fix bug #79375
Make sure deadlock errors are properly propagated and reports in
a number of places in mysqli and PDO MySQL.

This also fixes a memory and a segfault that can occur under these
conditions.
2020-10-28 11:01:47 +01:00
Dmitry Stogov
94fd97eea3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't force rebuild of symbol table, when populating $http_response_header variable by the HTTP stream wrapper
2020-10-28 12:59:42 +03:00
Dmitry Stogov
2693f799be Don't force rebuild of symbol table, when populating $http_response_header variable by the HTTP stream wrapper 2020-10-28 12:59:00 +03:00
Nikita Popov
ab0ec3f24a Check for null dbh methods in get_gc
Methods may not be set at the point where get_gc is called. Fixes
a segfault in Laravel.
2020-10-28 10:44:13 +01:00
Dmitry Stogov
a49200a031 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed memory leak in Zend/tests/bug78999.phpt
2020-10-28 10:47:56 +03:00
Dmitry Stogov
47a56208f0 Fixed memory leak in Zend/tests/bug78999.phpt 2020-10-28 10:47:23 +03:00
Dmitry Stogov
a73b2ddc30 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed tracing JIT support for aliasses (Zend/tests/bug75420.13.phpt and ext/standard/tests/streams/bug60106.phpt)
2020-10-27 23:45:32 +03:00
Dmitry Stogov
e6b51ccc58 Fixed tracing JIT support for aliasses (Zend/tests/bug75420.13.phpt and ext/standard/tests/streams/bug60106.phpt) 2020-10-27 23:44:29 +03:00
Dmitry Stogov
1f1dbd7f48 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed support for named parameters (Zend/tests/named_params/references.phpt)
  Update NEWS for 8.0.0RC4
  Update NEWS for PHP 8.0.0RC3
2020-10-27 16:36:58 +03:00
Dmitry Stogov
43e493884c Fixed support for named parameters (Zend/tests/named_params/references.phpt) 2020-10-27 16:35:24 +03:00
Nikita Popov
5b46bdef92 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't throw for out of bounds offsets in strspn()
2020-10-27 11:42:18 +01:00
Nikita Popov
d776d25a8e Don't throw for out of bounds offsets in strspn()
Make strspn($str1, $str2, $offset, $length) behaviorally
equivalent to strspn(substr($str1, $offset, $length), $str2)
by not throwing for out of bounds offset.

There have been two reports that this change cause issues,
including bug #80285.
2020-10-27 11:42:01 +01:00
Máté Kocsis
543bcd88aa Merge branch 'PHP-8.0' 2020-10-27 11:28:48 +01:00
Máté Kocsis
76e4bf3068 Parameter type and name fixes in ext/standard
Closes GH-6382
2020-10-27 11:27:25 +01:00
Dmitry Stogov
b961b7f0b5 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed support for typed references
2020-10-27 12:59:53 +03:00
Dmitry Stogov
45e2b9a7dd Fixed support for typed references 2020-10-27 12:59:35 +03:00
Nikita Popov
2e097098f4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Skip bug46024.phpt under asan
2020-10-27 10:35:54 +01:00
Nikita Popov
682357c5b4 Skip bug46024.phpt under asan
There is a legitimate leak here, but I don't think it's worthwhile
to fix it. It involves a process terminated while printing phpinfo.
2020-10-27 10:35:12 +01:00
Alex Dowad
e26234a044 UTF-32 conversion treats truncated characters as illegal 2020-10-27 10:19:01 +02:00
Alex Dowad
7047e5d2c4 Add identify filter for UTF-32{,BE,LE} 2020-10-27 10:19:01 +02:00
Alex Dowad
d8895cd054 Improve error handling for UTF-16{,BE,LE}
Catch various errors such as the first part of a surrogate pair not being
followed by a proper second part, the first part of a surrogate pair appearing
at the end of a string, the second part of a surrogate pair appearing out
of place, and so on.
2020-10-27 10:19:01 +02:00
Alex Dowad
d9ddeb6e85 UTF-16 text conversion handles truncated characters as illegal
This broke one old test (Zend/tests/multibyte_encoding_003.phpt), which used
a PHP script encoded as UTF-16. The problem was that to terminate the test
script, we need the text: "\n--EXPECT--". Out of that text, the terminating
newline (0x0A byte) becomes part of the resulting test script; but a bare
0x0A byte with no 0x00 is not valid UTF-16.

Since we now treat truncated UTF-16 characters as erroneous, an extra '?' is
appended to the output as an 'illegal character' marker.

Really, if we are running PHP scripts which are treated as encoded in UTF-16
or some other arbitrary text encoding (not ASCII), and the script is not
actually a valid string in that encoding, inserting '?' characters into the
code which the PHP interpreter runs is a bad thing to do. In such cases, the
script shouldn't be treated as UTF-16 (or whatever) at all.

I wonder if mbstring's encoding detection is being used in 'non-strict' mode?
2020-10-27 10:19:00 +02:00
Dmitry Stogov
9bfb158872 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed tracing JIT for tests/classes/unset_properties.phpt
2020-10-27 10:31:09 +03:00
Dmitry Stogov
b8a6717da6 Fixed tracing JIT for tests/classes/unset_properties.phpt 2020-10-27 10:30:38 +03:00
Dmitry Stogov
990bac4efc Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed memory leak
2020-10-27 01:20:46 +03:00
Dmitry Stogov
a17cec446a Fixed memory leak 2020-10-27 01:20:22 +03:00
Sammy Kaye Powers
6cd0ec70b5 Merge branch 'PHP-8.0'
* PHP-8.0:
  Add missing observer tests
2020-10-26 15:15:45 -07:00
Sammy Kaye Powers
4a6932c076 Add missing observer tests
Closes GH-6378
2020-10-26 15:15:17 -07:00
Dmitry Stogov
9fd5851551 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed register allocation
  Fixed MAY_BE_INDIRECT inference.
2020-10-26 21:49:14 +03:00
Dmitry Stogov
ba525a68d9 Fixed register allocation 2020-10-26 21:48:47 +03:00
Dmitry Stogov
b7df636589 Fixed MAY_BE_INDIRECT inference. 2020-10-26 21:48:13 +03:00
Dmitry Stogov
f663546b2a Merge branch 'PHP-8.0'
* PHP-8.0:
  Better JIT support for aliases
2020-10-26 19:05:23 +03:00
Dmitry Stogov
9d3cc223b2 Better JIT support for aliases 2020-10-26 19:05:08 +03:00
Nikita Popov
18d373e8c3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix inconsistency in PDO transaction state
2020-10-26 17:01:25 +01:00
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
94b0204da6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Deny serialization of finfo objects
2020-10-26 16:54:58 +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
4485f10330 Merge branch 'PHP-8.0'
* PHP-8.0:
  Deny cloning of fileinfo objects
2020-10-26 16:52:22 +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
Nikita Popov
3489e98333 Merge branch 'PHP-8.0'
* PHP-8.0:
  Consistent error handling in mysqli_poll
2020-10-26 16:25:31 +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