1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 03:03:26 +02:00
Commit Graph

121883 Commits

Author SHA1 Message Date
Christoph M. Becker 1e0610fe24 Merge branch 'PHP-8.0'
* PHP-8.0:
  Strip trailing line breaks and periods from Windows error messages
2020-11-12 16:43:57 +01:00
Christoph M. Becker a08a2b48b4 Strip trailing line breaks and periods from Windows error messages
PHP error messages should not contain line breaks, so we remove these
from the Windows specific error messages.  We also remove trailing
periods for the same reason.

Closes GH-6423.
2020-11-12 16:42:28 +01:00
Nikita Popov be29853353 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't assume libmysqlclient library name
2020-11-12 15:12:57 +01:00
Nikita Popov 34dd032e4e Don't assume libmysqlclient library name
By simply dropping the additional checks, in line with the general
guideline of trusting the output of config scripts (this should
be migrated to pkg-config though).

Also drop the code for manually adding -z if mysql_config does not
-- that's not our problem.
2020-11-12 15:11:56 +01:00
Nikita Popov 4d24a6928f Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix memory leak when user filter onCreate returns false
2020-11-12 12:18:49 +01:00
Nikita Popov 2875d0f920 Fix memory leak when user filter onCreate returns false 2020-11-12 12:18:33 +01:00
Nikita Popov aa70770115 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix memory leak with bcsqrt on number 0<X<1
2020-11-12 11:38:23 +01:00
Nikita Popov 3d2819e491 Fix memory leak with bcsqrt on number 0<X<1 2020-11-12 11:37:54 +01:00
Nikita Popov 4e6ea169ae Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix reflection getDefaultValue() with user arg info
2020-11-12 11:02:50 +01:00
Nikita Popov d033d5c07a Fix reflection getDefaultValue() with user arg info
The default value is part of the op_array in that case, but we have
no way to access it. Fail gracefully.
2020-11-12 11:02:04 +01:00
Dmitry Stogov d54e197bae Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed incorrectly eliminated type store
2020-11-11 20:14:40 +03:00
Dmitry Stogov 9acebe14df Fixed incorrectly eliminated type store 2020-11-11 20:13:58 +03:00
Dmitry Stogov 9f13c8feb1 Merge branch 'PHP-8.0'
* PHP-8.0:
  Remove assertion
2020-11-11 18:34:30 +03:00
Dmitry Stogov 03e7854381 Remove assertion 2020-11-11 18:34:16 +03:00
Nikita Popov fe73616db6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Handle errors during next_result()
2020-11-11 16:03:32 +01:00
Nikita Popov d776c31a34 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Handle errors during next_result()
2020-11-11 16:03:10 +01:00
Nikita Popov eda7492604 Handle errors during next_result() 2020-11-11 16:02:52 +01:00
Dmitry Stogov fa355615a4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed incorrect invariant guard motion
2020-11-11 17:35:14 +03:00
Dmitry Stogov 2d2d42b268 Fixed incorrect invariant guard motion 2020-11-11 17:34:46 +03:00
Dmitry Stogov aa84e2c364 Merge branch 'PHP-8.0'
* PHP-8.0:
  Stop on fake frame
  Fixed reference-counting propagation
2020-11-11 14:55:08 +03:00
Dmitry Stogov de359c00b4 Stop on fake frame 2020-11-11 14:54:54 +03:00
Dmitry Stogov a0de82ad75 Fixed reference-counting propagation 2020-11-11 14:54:00 +03:00
Nikita Popov 01de00073f Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix double free when socket_accept fails
2020-11-11 12:48:44 +01:00
Nikita Popov 800cf5a20f Fix double free when socket_accept fails 2020-11-11 12:48:25 +01:00
Nikita Popov d637f0dd3e Merge branch 'PHP-8.0'
* PHP-8.0:
  Retain reference to share handle from curl handle
2020-11-11 11:56:39 +01:00
Nikita Popov b4a2a9662b Retain reference to share handle from curl handle
Not keeping a reference will not result in use after free, because
curl protects against it, but it will result in a memory leak,
because curl_share_cleanup() will fail. We should make sure that
the share handle object stays alive as long as the curl handles
use it.
2020-11-11 11:56:03 +01:00
Dmitry Stogov 329d38c3e1 Merge branch 'PHP-8.0'
* PHP-8.0:
  [Observer+JIT] Save opline before calling begin/end handlers
2020-11-11 13:51:07 +03:00
Dmitry Stogov 11c4821ba9 [Observer+JIT] Save opline before calling begin/end handlers 2020-11-11 13:50:53 +03:00
Dmitry Stogov a15d215f75 Merge branch 'PHP-8.0'
* PHP-8.0:
  [Observer] Save opline before calling begin/end handlers
2020-11-11 13:07:12 +03:00
Dmitry Stogov 855d8fa68f [Observer] Save opline before calling begin/end handlers 2020-11-11 13:06:55 +03:00
Alex Dowad e169ad3b61 Consolidate all single-byte encodings in one source file
We can squeeze out a lot of duplicated code in this way.
2020-11-11 11:18:59 +02:00
Alex Dowad 17d82b6886 Enhance mbstring support for UCS-2 text
- For consistency with UTF-16, UTF-32, and UCS-4, strip leading byte
  order marks.
- Treat it as an error if string is truncated (i.e. has an odd number
  of bytes).
2020-11-11 11:18:59 +02:00
Alex Dowad 6dd75478d5 Leading BOM is stripped for UTF-32
For consistency with UTF-16 and UCS-4.

Also, do some code cleanup.
2020-11-11 11:18:59 +02:00
Alex Dowad 1cf12c02f0 Add test suite for SJIS-mac encoding 2020-11-11 11:18:58 +02:00
Alex Dowad fbdcab953d Unicode -> SJIS-mac conversion doesn't reject valid codepoints after a bad transcoding hint
To give the background on this issue, here is an excerpt from JAPANESE.txt,
from the Unicode Consortium:

    Apple has defined a block of 32 corporate characters as "transcoding
    hints." These are used in combination with standard Unicode characters
    to force them to be treated in a special way for mapping to other
    encodings; they have no other effect. Sixteen of these transcoding
    hints are "grouping hints" - they indicate that the next 2-4 Unicode
    characters should be treated as a single entity for transcoding. The
    other sixteen transcoding hints are "variant tags" - they are like
    combining characters, and can follow a standard Unicode (or a sequence
    consisting of a base character and other combining characters) to
    cause it to be treated in a special way for transcoding. These always
    terminate a combining-character sequence.

    The transcoding coding hints used in this mapping table are:

    0xF860  group next 2 characters as a single entity for transcoding
    0xF861  group next 3 characters as a single entity for transcoding
    0xF862  group next 4 characters as a single entity for transcoding
    0xF87A  variant tag for "negative" (i.e. black & white reversed)
    0xF87E  variant tag for vertical form
    0xF87F  variant tag for other alternate form

    For example, the Apple addition character 0x85AB is Roman numeral
    thirteen. There is no single Unicode for this (although there are
    standard Unicodes for Roman numerals 1-12). Using the grouping hint
    0xF862 in combination with standard Unicodes, we can map this as
    0xF862+0x0058+0x0049+0x0049+0x0049 (i.e. X + I + I + I).

Our SJIS-mac conversion code actually recognizes some special sequences
which start with an Apple 'transcoding hint'. However, if a transcoding
hint is misplaced and is not followed by one of the expected sequences,
we can just emit one error marker for the bad transcoding hint and then
process the following codepoint as normal.
2020-11-11 11:18:58 +02:00
Alex Dowad b27a34c5a9 SJIS-mac encoding conversion: Stop the carnage of innocent Unicode codepoints
When converting Unicode to MacJapanese, some special sequences of Unicode
codepoints are collapsed into a single SJIS character. When the implementation
sees a codepoint which *might* begin such a sequence, it is cached and examined
again after the next codepoint arrives.

If it turns out that it wasn't one of the 'special' sequences, then a 'fallback'
conversion table is consulted to convert the cached codepoint. Then we re-enter
the regular conversion code to convert the immediately following codepoint.
BUT, local variables need to be reinitialized properly when doing this!

Because the locals weren't reinitialized, the sad result was that some codepoints
would get chopped up into bit salad and emitted as something totally bogus
(which might not even be valid SJIS-mac text at all).
2020-11-11 11:18:58 +02:00
Alex Dowad 7f0e86b2dc Convert Unicode halfwidth Yen sign to MacJapanese halfwidth Yen sign
Since 1993, Unicode has had a specific codepoint for a fullwidth Yen sign.
Likewise, MacJapanese has separate kuten codes for halfwidth and fullwidth
Yen signs. But mbstring mapped _both_ Yen sign codepoints to the
MacJapanese fullwidth Yen sign.

It's probably more appropriate to map the 'ordinary' Yen sign to the
MacJapanese halfwidth Yen sign. Besides, this means that the conversion
between Unicode and MacJapanese is closer to being lossless and reversible.
2020-11-11 11:18:58 +02:00
Alex Dowad 4c39cd3d1d SJIS-mac encoding conversion: handle invalid (or truncated) 2nd byte for Kanji correctly
Also, don't accept 1st bytes above 0xED, since none of the possible 2-byte
sequences starting with 0xEE and above are actually mapped to any character.
2020-11-11 11:18:58 +02:00
Alex Dowad d40f9cf735 Add test suite for SJIS-2004 encoding 2020-11-11 11:18:58 +02:00
Alex Dowad eda73a5f6f Don't mangle non-Japanese chars which appear after a 'combining' kana in SJIS-2004
Unicode has 'combining' characters which join with another following character.
Japanese hiragana and katakana with the 'two dots' voice mark can be represented
in this way, with one Unicode character for the 'base' kana and another one which
adds the voice mark.

In SJIS-2004, however, there are dedicated characters for voiced and unvoiced
kana. So some special checks are done to identify sequences of Unicode characters
which need to be 'collapsed' into a single SJIS-2004 character.

If a kana is immediately followed by some other unrelated character, like a
Cyrillic letter, then the cached kana should be output 'as is' and we
proceed with encoding the unrelated character. When doing this, though,
we need to re-initialize local variables, or else the unrelated character
will be mangled in some cases.
2020-11-11 11:18:58 +02:00
Alex Dowad 2f98bd8844 SJIS-2004 encoding conversion: handle invalid (or truncated) 2nd byte for Kanji correctly
If the 2nd byte of a 2-byte character is invalid, then mb_substitute_character()
should be respected. Instead, what mbstring was doing was 'swallowing' the
first byte, then emitting the 2nd byte as if it was an ASCII character.

Likewise, if the 2nd byte is missing, instead of just keeping quiet, report an
illegal character as specified by mb_substitute_character().
2020-11-11 11:18:58 +02:00
Alex Dowad a5827c2d35 Fix broken binary search function in mbstring
This faulty binary search would never reject values at the very high
end of the range being searched, even if they were not actually in
the table.

Among other things, this meant that some Unicode codepoints which do
not correspond to any character in JIS X 0213 would be converted to
bogus Shift-JIS-2004 values rather than being rejected.
2020-11-11 11:18:58 +02:00
Alex Dowad b05ad5112a Don't redundantly flush mbstring filters multiple times
Each flush function in a chain of mbstring conversion filters always
calls the next flush function in the chain. So it is not necessary to
explicitly flush the second filter in a chain. (Due to this bug, in many
cases, flush functions were actually being called three times.)
2020-11-11 11:18:58 +02:00
Alex Dowad d1d50c2b7a Test EUC-JP and Shift-JIS more thoroughly
Previously, the unit tests for these text encodings covered all mappings
from legacy -> Unicode, and all _reversible_ mappings from Unicode -> legacy.
However, we should also test the few Unicode -> legacy mappings which
are not reversible.
2020-11-11 11:18:58 +02:00
Nikita Popov 1562d76a84 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix community job
2020-11-11 09:28:44 +01:00
Nikita Popov 1aff51d421 Fix community job
Made a mistake while merging...
2020-11-11 09:28:20 +01:00
Derick Rethans 71f035e6f3 Merge branch 'PHP-8.0' 2020-11-10 17:58:50 +00:00
Derick Rethans 9b627c6c27 Merge branch 'PHP-7.4' into PHP-8.0 2020-11-10 17:58:38 +00:00
Derick Rethans c1f8dd4a33 PHP-7.4 is now for 7.4.14 2020-11-10 17:58:21 +00:00
Gabriel Caruso 822e1660c7 Update NEWS for 8.0.0 2020-11-10 11:02:35 +00:00