1
0
mirror of https://github.com/php/php-src.git synced 2026-04-14 19:41:05 +02:00
Commit Graph

121698 Commits

Author SHA1 Message Date
Jakub Zelenka
c3a6debc08 Bump minimal OpenSSL version to 1.0.2 2020-11-01 20:10:37 +00:00
Anatol Belski
347a3f8736 UPGRADING: Add murmurhash note [ci skip]
Signed-off-by: Anatol Belski <ab@php.net>
2020-10-31 19:19:00 +01:00
Anatol Belski
5e162093d8 NEWS: Add murmurhash info [ci skip]
Signed-off-by: Anatol Belski <ab@php.net>
2020-10-31 19:16:24 +01:00
Anatol Belski
72e91e9fc8 hash: Add MurmurHash3 with streaming support
The implementation is based on the upstream PMurHash. The following
variants are implemented

- murmur3a, 32-bit hash
- murmur3c, 128-bit hash for x86
- murmur3f, 128-bit hash for x64

The custom seed support is not targeted by this implementation. It will
need a major change to the API, so then custom arguments can be passed
through `hash_init`. For now, the starting hash is always zero.

Fixes bug #68109, closes #6059

Signed-off-by: Anatol Belski <ab@php.net>
Co-Developed-by: Michael Wallner <mike@php.net>
Signed-off-by: Michael Wallner <mike@php.net>
2020-10-31 16:44:18 +01:00
Alex Dowad
831abe2d90 Add test suite for CP1252 encoding
Also remove a bogus test (bug62545.phpt) which wrongly assumed that all invalid
characters in CP1251 and CP1252 should map to Unicode 0xFFFD (REPLACEMENT
CHARACTER).

mbstring has an interface to specify what invalid characters should be
replaced with; it's called `mb_substitute_character`. If a user wants to see
the Unicode 'replacement character', they can specify that using
`mb_substitute_character`. But if they specify something else, we should
follow that.
2020-10-30 22:13:27 +02:00
Alex Dowad
b5ff87ca71 Fix mbstring support for CP1252 encoding
It's a bit surprising how much was broken here.

- Identify filter was utterly and completely wrong.
- Instead of handling invalid CP1252 bytes as specified by
  `mb_substitute_character`, it would convert them to Unicode 0xFFFD
  (generic replacement character).
- When converting ISO-8859-1 to CP1252, invalid ISO-8859-1 bytes would
  be passed through silently.
- Unicode codepoints from 0x80-0x9F were converted to CP1252 bytes 0x80-0x9F,
  which is wrong.
- Unicode codepoint 0xFFFD was converted to CP1252 0x9F, which is very wrong.

Also clean up some unneeded code, and make the conversion table consistent with
others by using zero as a 'invalid' marker, rather than 0xFFFD.
2020-10-30 22:13:27 +02:00
Alex Dowad
2ce15d9c8d Merge branch 'PHP-8.0' 2020-10-30 22:12:00 +02:00
Alex Dowad
526c624dc4 Fix test added in d44235acae 2020-10-30 22:11:27 +02:00
Alex Dowad
e2dc80b4e4 Merge branch 'PHP-8.0' 2020-10-30 22:07:41 +02:00
Alex Dowad
d44235acae Convert numeric string array keys to integers correctly in JITted code
While fixing bugs in mbstring, one of my new test cases failed with a strange
error message stating: 'Warning: Undefined array key 1...', when clearly the
array key had been set properly.

GDB'd that sucker and found that JIT'd PHP code was calling directly into
`zend_hash_add_new` (which was not converting the numeric string key to an
integer properly). But where was that code coming from? I examined the disasm,
looked up symbols to figure out where call instructions were going, then grepped
the codebase for those function names. It soon became clear that the disasm I
was looking at was compiled from `zend_jit_fetch_dim_w_helper`.
2020-10-30 22:07:08 +02:00
Nikita Popov
1b3b430f47 Add --repeat testing mode
This testing mode executes the test multiple times in the same
process (but in different requests). It is primarily intended to
catch tracing JIT bugs, but also catches state leaks across
requests.

Closes GH-6365.
2020-10-30 17:29:33 +01:00
Nikita Popov
ada2a55e07 Merge branch 'PHP-8.0'
* PHP-8.0:
  FIxed bug #80299
2020-10-30 17:24:02 +01:00
Nikita Popov
904c1b6589 FIxed bug #80299
The must_wrap was leaking across iterations.
2020-10-30 17:23:18 +01:00
Nikita Popov
3e2b127e63 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix SSA integrity violation for type inference in dead code
2020-10-30 15:52:59 +01:00
Nikita Popov
5958137dc5 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix SSA integrity violation for type inference in dead code
2020-10-30 15:52:46 +01:00
Nikita Popov
83738281eb Fix SSA integrity violation for type inference in dead code
The foreach body can never be executed and thus may contain empty
types. We should still uphold our SSA integrity invariants in that
case.
2020-10-30 15:52:10 +01:00
Christoph M. Becker
fdbfb416e3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix bug79177.phpt wrt. JIT
2020-10-30 15:50:17 +01:00
Christoph M. Becker
72d9d9b88f Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug79177.phpt wrt. JIT
2020-10-30 15:49:48 +01:00
Christoph M. Becker
0427dcb913 Fix bug79177.phpt wrt. JIT
JIT ignores that the `zend_write` callback is overwritten, so we define
our own callback and caller.

We also fix the "inconsistent DLL binding" warnings on Windows, by
introducing `PHP_ZEND_TEST_API`.

Closes GH-6391.
2020-10-30 15:47:18 +01:00
Nikita Popov
b32a48f16b Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix signed integer overflow
2020-10-30 12:39:47 +01:00
Nikita Popov
085e16c301 Fix signed integer overflow
Fixes oss-fuzz #26763.
2020-10-30 12:38:27 +01:00
Nikita Popov
da4d5e9480 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80290
2020-10-30 11:13:44 +01:00
Nikita Popov
3bd3651bcc Fixed bug #80290
Dropping the dtor arg args[3] rather than using STR_COPY: Since
PHP 8, we no longer support separation in call_user_function(),
so we also don't need to worry about things like arguments being
replaced with references.
2020-10-30 11:13:35 +01:00
Dmitry Stogov
fab8ef62ff Merge branch 'PHP-8.0'
* PHP-8.0:
  Create TSSA loops for recursive call/return traces and move invariant type guards out of loops.
2020-10-30 13:10:08 +03:00
Dmitry Stogov
b133183e35 Create TSSA loops for recursive call/return traces and move invariant type guards out of loops. 2020-10-30 13:08:31 +03:00
divinity76
6c71d3476b Use constant size string in hash bench.php
I don't like the previous behaviour where the bytes to hash change
every time the code changes, that may make it difficult to compare
hash() performance changes over time.

Use a fixed number instead, and allow passing an override for a
different length.

Closes GH-6386.

[ci skip]
2020-10-30 09:54:48 +01:00
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
4273ec8551 Merge branch 'PHP-8.0'
* PHP-8.0:
  [ci skip] Fix NEWS order
2020-10-29 12:16:41 +01:00
Christoph M. Becker
9fdbc2a14a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  [ci skip] Fix NEWS order
2020-10-29 12:16:20 +01:00
Christoph M. Becker
bd6850a282 [ci skip] Fix NEWS order 2020-10-29 12:15:31 +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