Skip to content
forked from php/php-src

sync #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 792 commits into from
Nov 12, 2020
Merged

sync #8

merged 792 commits into from
Nov 12, 2020

Conversation

chopins
Copy link
Owner

@chopins chopins commented Nov 12, 2020

No description provided.

dstogov and others added 30 commits October 27, 2020 23:44
…nd ext/standard/tests/streams/bug60106.phpt)
* PHP-8.0:
  Fixed tracing JIT support for aliasses (Zend/tests/bug75420.13.phpt and ext/standard/tests/streams/bug60106.phpt)
* PHP-8.0:
  Fixed memory leak in Zend/tests/bug78999.phpt
Methods may not be set at the point where get_gc is called. Fixes
a segfault in Laravel.
* PHP-8.0:
  Don't force rebuild of symbol table, when populating $http_response_header variable by the HTTP stream wrapper
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.
* PHP-7.4:
  Fix bug #79375
* PHP-8.0:
  Fix bug #79375
Sync ext/mysqli/tests/mysqli_report.phpt with PHP-8.0/master, as
the current difference in indentation makes it hard to merge.
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.
* PHP-7.4:
  Handle mysqli errors in more cases
  Sync test with master
* PHP-8.0:
  Handle mysqli errors in more cases
  Sync test with master
* PHP-7.4:
  Fixed run-time binding of preloaded dynamically declared function
* PHP-8.0:
  Fixed run-time binding of preloaded dynamically declared function
Report errors in commit, rollback and autocommit handlers.
* PHP-7.4:
  Fixed bug #66528
* PHP-8.0:
  Fixed bug #66528
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] <#5120>

Closes GH-6366.
* PHP-7.4:
  Fix #79177: FFI doesn't handle well PHP exceptions within callback
* PHP-8.0:
  Fix #79177: FFI doesn't handle well PHP exceptions within callback
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:
#2131 (comment)
* PHP-7.4:
  Fixed bug #65825
* PHP-8.0:
  Fixed bug #65825
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.
* PHP-7.4:
  Retain QUIT_SEND connection state
* PHP-8.0:
  Retain QUIT_SEND connection state
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.
alexdowad and others added 29 commits November 11, 2020 11:18
…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.
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.
…depoints

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).
…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.
For consistency with UTF-16 and UCS-4.

Also, do some code cleanup.
- 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).
We can squeeze out a lot of duplicated code in this way.
* PHP-8.0:
  [Observer] Save opline before calling begin/end handlers
* PHP-8.0:
  [Observer+JIT] Save opline before calling begin/end handlers
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.
* PHP-8.0:
  Retain reference to share handle from curl handle
* PHP-8.0:
  Fix double free when socket_accept fails
* PHP-8.0:
  Stop on fake frame
  Fixed reference-counting propagation
* PHP-8.0:
  Fixed incorrect invariant guard motion
* PHP-7.4:
  Handle errors during next_result()
* PHP-8.0:
  Handle errors during next_result()
* PHP-8.0:
  Remove assertion
* PHP-8.0:
  Fixed incorrectly eliminated type store
@chopins chopins merged commit dd61db7 into chopins:master Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.