1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 23:48:14 +02:00
Commit Graph

121714 Commits

Author SHA1 Message Date
Alex Dowad e6d17cfe44 Fix mbstring support for CP1254 encoding
One funny thing: while the original author used Unicode 0xFFFD (generic
replacement character) for invalid bytes in CP1251 and CP1252, for CP1254
they used 0xFFFE, which is not a valid Unicode codepoint at all, but is a
reversed byte-order mark. Probably this was by mistake.

Anyways,

- Fixed identify filter, which was completely wrong.
- Don't convert Unicode 0xFFFE to a random (but valid) CP1254 byte.
- When converting CP1254 to CP1254, don't pass invalid bytes through silently.
2020-11-02 21:31:05 +02:00
Alex Dowad eb4151e89e Add test suite for CP1251 encoding 2020-11-02 21:31:05 +02:00
Alex Dowad 44bd5804b0 Fix mbstring support for CP1251 encoding
- Identify filter was as wrong as wrong can be.
- Invalid CP1251 byte 0x98 was converted to Unicode 0xFFFD (generic
  replacement character), rather than respecting `mb_substitute_character`.
- Unicode 0xFFFD was converted to some random CP1251 byte.
- When converting CP1251 to CP1251, don't pass invalid bytes through silently.
2020-11-02 21:31:05 +02:00
Alex Dowad b18b9c9ef6 Test cases for mbstring encodings are less repetitive 2020-11-02 21:31:05 +02:00
Christoph M. Becker a1dcbb2c8a Merge branch 'PHP-8.0'
* PHP-8.0:
  [ci skip] Fix small typo
2020-11-02 18:11:52 +01:00
Chris Brown 94938e4ee7 [ci skip] Fix small typo
`as` -> `was`

Closes GH-6394.
2020-11-02 18:11:13 +01:00
Nikita Popov d5dff02e72 Merge branch 'PHP-8.0'
* PHP-8.0:
  Rename opcache.jit_max_loops_unroll to opcache.jit_max_loop_unrolls
2020-11-02 12:25:28 +01:00
Nikita Popov 0571f09424 Rename opcache.jit_max_loops_unroll to opcache.jit_max_loop_unrolls 2020-11-02 12:25:21 +01:00
Christoph M. Becker 4fa02d5089 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #70461: disable md5 code when it is not supported in net-snmp
2020-11-02 11:42:26 +01:00
Christoph M. Becker 6fc2cab254 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #70461: disable md5 code when it is not supported in net-snmp
2020-11-02 11:41:37 +01:00
Christoph M. Becker 0123f75b5d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #70461: disable md5 code when it is not supported in net-snmp
2020-11-02 11:39:42 +01:00
Christoph M. Becker 9690ded288 Fix #70461: disable md5 code when it is not supported in net-snmp
Patch contributed by Alexander Bergmann.

Closes GH-6389.
2020-11-02 11:36:26 +01:00
Nikita Popov bcdb54d476 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix tests for MariaDB
2020-11-02 09:59:45 +01:00
Dharman cf38a6f51f Fix tests for MariaDB
Closes GH-6390.
2020-11-02 09:58:46 +01:00
Anatol Belski 0659d4459e hash: murmur: Fix GCC support version for no_sanitize
While AddressSanitizer is supported as of 4.8, the no_sanitize attribute
appears in 8.0.

Signed-off-by: Anatol Belski <ab@php.net>
2020-11-01 21:47:39 +01:00
Anatol Belski 58e71efe7c hash: murmur: Suppress sanitize warnings under GCC
Signed-off-by: Anatol Belski <ab@php.net>
2020-11-01 21:22:03 +01:00
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