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

57236 Commits

Author SHA1 Message Date
Nikita Popov dd008fd124 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix bug #72413: Segfault with get_result and PS cursors
2020-10-29 16:42:00 +01:00
Nikita Popov 8957260094 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #72413: Segfault with get_result and PS cursors
2020-10-29 16:41:09 +01:00
Dharman b5481defe6 Fix bug #72413: Segfault with get_result and PS cursors
We cannot simply switch to use_result here, because the fetch_row
methods in get_result mode and in use_result/store_result mode
are different: In one case it accepts a statement, in the other
a return value zval. Thus, doing a switch to use_result results
in a segfault when trying to fetch a row.

Actually supporting get_result with cursors would require adding
cursor support in mysqlnd_result, not just mysqlnd_ps. That would
be a significant amount of effort and, given the age of the issue,
does not appear to be particularly likely to happen soon.

As such, we simply generate an error when using get_result()
with cursors, which is much better than causing a segfault.
Instead, parameter binding needs to be used.
2020-10-29 16:34:08 +01:00
Nikita Popov 39532f9c52 Merge branch 'PHP-8.0'
* PHP-8.0:
  Handle errors during PDO row fetch
2020-10-29 14:18:22 +01:00
Nikita Popov 1a7bcd9892 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Handle errors during PDO row fetch
2020-10-29 14:18:04 +01:00
Nikita Popov 0044a81fbb Handle errors during PDO row fetch
The EOF flag also gets set on error, so we always end up ignoring
errors here.

However, we should only check errors for unbuffered results. For
buffered results, this function is guaranteed not to error, and
querying the errno may return an unrelated error.
2020-10-29 14:17:29 +01:00
Christoph M. Becker 278ee5837d Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix format specifier
2020-10-29 13:11:00 +01:00
Christoph M. Becker 489b5328c0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix format specifier
2020-10-29 13:10:32 +01:00
Christoph M. Becker dd97cb1665 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix format specifier
2020-10-29 13:09:19 +01:00
Christoph M. Becker ee3227af48 Fix format specifier
In this function, `i` is of type `size_t`.
2020-10-29 13:08:16 +01:00
Nikita Popov 60ab7a36c7 Merge branch 'PHP-8.0'
* PHP-8.0:
  Report gone away error in one more place
2020-10-29 12:47:32 +01:00
Nikita Popov ce7c2cc05d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Report gone away error in one more place
2020-10-29 12:47:22 +01:00
Nikita Popov 78b44ddeba Report gone away error in one more place 2020-10-29 12:46:55 +01:00
Christoph M. Becker 3d11a0feb0 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #44618: Fetching may rely on uninitialized data
2020-10-29 12:04:21 +01:00
Christoph M. Becker 9838eff68b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #44618: Fetching may rely on uninitialized data
2020-10-29 12:03:11 +01:00
Christoph M. Becker 133ac0151b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #44618: Fetching may rely on uninitialized data
2020-10-29 12:00:57 +01:00
Christoph M. Becker c21e901ba7 Fix #44618: Fetching may rely on uninitialized data
Unless `SQLGetData()` returns `SQL_SUCCESS` or `SQL_SUCCESS_WITH_INFO`,
the `StrLen_or_IndPtr` output argument is not guaranteed to be properly
set.  Thus we handle retrieval failure other than `SQL_ERROR` by
yielding `false` for those column values and raising a warning.

Closes GH-6281.
2020-10-29 11:59:12 +01:00
Nikita Popov 5e695343ec Merge branch 'PHP-8.0'
* PHP-8.0:
  Retain QUIT_SEND connection state
2020-10-29 10:40:10 +01:00
Nikita Popov d784c65cca Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Retain QUIT_SEND connection state
2020-10-29 10:39:58 +01:00
Nikita Popov 24537a73c0 Retain QUIT_SEND connection state
If the server goes away while reading a packet, don't go back into
the READY state. This will just cause broken pipe errors down the
line.
2020-10-29 10:36:03 +01:00
Nikita Popov f3c9597bc2 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #65825
2020-10-28 17:15:51 +01:00
Nikita Popov 246b8b20b2 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #65825
2020-10-28 17:15:42 +01:00
Nikita Popov a66d73db4b Fixed bug #65825
Set error_info when we fail to read a packet, instead of throwing
a warning. Additionally we also need to populate the right
error_info in rowp_read -- we'll later take the error from the
packet, not the connection.

No test case, as this is hard to reliably test. I'm using the
test case from:
https://github.com/php/php-src/pull/2131#issuecomment-538374838
2020-10-28 17:15:27 +01:00
Christoph M. Becker 92381864a5 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #79177: FFI doesn't handle well PHP exceptions within callback
2020-10-28 13:49:47 +01:00
Christoph M. Becker d07f6753a0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #79177: FFI doesn't handle well PHP exceptions within callback
2020-10-28 13:49:23 +01:00
Christoph M. Becker f547412cba Fix #79177: FFI doesn't handle well PHP exceptions within callback
We have to error on unhandled exceptions in FFI callbacks, to avoid
passing back undefined values.

This has been discussed and agreed upon in a previous PR[1].

[1] <https://github.com/php/php-src/pull/5120>

Closes GH-6366.
2020-10-28 13:34:56 +01:00
Nikita Popov bd555b6cca Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #66528
2020-10-28 12:18:26 +01:00
Nikita Popov 39be0df2ed Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #66528
2020-10-28 12:18:17 +01:00
Nikita Popov 68dcaa29d8 Fixed bug #66528
Report errors in commit, rollback and autocommit handlers.
2020-10-28 12:18:02 +01:00
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