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

60063 Commits

Author SHA1 Message Date
Alex Dowad 9e1447dbf3 Rename KANA2HIRA and HIRA2KANA constants (for mb_convert_kana)
mb_convert_kana is able to convert fullwidth katakana to fullwidth
hiragana (and vice versa). The constants referring to these modes had
names like MBFL_FILT_TL_ZEN2HAN_KANA2HIRA.

The "ZEN2HAN" part of the name is misleading, since these modes do not
convert fullwidth (zenkaku) kana to halfwidth (hankaku). The converted
characters are fullwidth both before and after the conversion. So...
let's name the constants accordingly.
2021-09-06 13:16:23 +02:00
Alex Dowad c8e65c9d74 Remove COMPAT2 conversion modes for mb_convert_kana
mb_convert_kana has conversion modes selected using 'M'/'m', which
convert a few various punctuation and symbol characters between
'ordinary' and full-width forms. The constants which refer to these
modes have names ending with COMPAT1.

Internally, there are similar conversion modes with names ending in
COMPAT2. They are like COMPAT1 modes, but they operate on a smaller
set of characters. But... that is all just dead code, because there is
no way for user code to select the COMPAT2 modes.

I have no idea what the original author intended those COMPAT2 modes to
actually be used for. Guess it doesn't really matter, anyways. At this
point, it's just more food for the flames.
2021-09-06 13:16:23 +02:00
Alex Dowad d7eb442993 Add more tests for ISO-2022-JP-2004 text conversion 2021-09-06 13:16:23 +02:00
Alex Dowad 907d0c3248 Add more tests for UTF7-IMAP text conversion 2021-09-06 13:16:23 +02:00
Alex Dowad bf940a13ff Add another test for SJIS-Mobile text conversion 2021-09-06 13:16:23 +02:00
Alex Dowad 32df61c558 Add more tests for UTF-7 text conversion 2021-09-06 13:16:23 +02:00
Alex Dowad ae71bfdee7 Add more tests for UCS-4 text conversion 2021-09-06 13:16:23 +02:00
Alex Dowad fd0e0c7390 Add another test for UCS-2 text conversion 2021-09-06 13:16:23 +02:00
Alex Dowad edf2bd95d9 Add more tests for ISO-2022-JP and JIS7/8 text conversion 2021-09-06 13:16:23 +02:00
Alex Dowad 6a2dca3420 Add more tests for ISO-2022-JP-KDDI text conversion 2021-09-06 13:16:23 +02:00
Alex Dowad d2f5a8b328 Add more tests for SJIS-mac text conversion 2021-09-06 13:16:23 +02:00
Alex Dowad 0957f54eb1 Treat truncated escape sequences for CP5022{0,1,2} as error 2021-09-06 13:16:23 +02:00
Alex Dowad 64e379d81e Declare CP50222 flush function as 'static' 2021-09-06 13:16:23 +02:00
Alex Dowad a312620607 Remove redundant NULL checks in mbstring
Whoever originally wrote mbstring seems to have a deathly fear of NULL
pointers lurking behind every corner. A common pattern is that one
function will check if a pointer is NULL, then pass it to another
function, which will again check if it is NULL, then pass to yet another
function, which will yet again check if it is NULL... it's NULL checks
all the way down.

Remove all the NULL checks in places where pointers could not possibly
be NULL.
2021-09-06 13:16:23 +02:00
Alex Dowad 626f0fec54 Remove some dead code from mbstring
mbstring has a great deal of dead code. Some common types are:

- Default switch clauses which will never be taken
- If clauses intended to convert codepoints which were not present in
  a conversion table... but the codepoint in question *is* in the table,
  so the if clause is not needed.
- Bounds checks in places where it is not possible for a value to ever
  be out of bounds.
- Checks to see if an unmatched Unicode codepoint is in CP932 extension
  range 3... but every codepoint in range 3 is also in range 2, so no
  codepoint will ever be matched and converted by that code.
2021-09-06 13:16:23 +02:00
Máté Kocsis d824eaee33 Merge branch 'PHP-8.1'
* PHP-8.1:
  Add more specific array return type hints for various extensions - part 3
2021-09-06 12:27:57 +02:00
Máté Kocsis 6a47831e6e Add more specific array return type hints for various extensions - part 3 (#7467) 2021-09-06 12:27:28 +02:00
Máté Kocsis 26354488b6 Merge branch 'PHP-8.1'
* PHP-8.0:
  Fix the return type of ftp_raw()
2021-09-06 10:30:12 +02:00
Máté Kocsis a55c6384dc Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix the return type of ftp_raw()
2021-09-06 10:29:24 +02:00
Máté Kocsis 4b3206d6c1 Fix the return type of ftp_raw() (#7466) 2021-09-06 10:26:01 +02:00
Máté Kocsis 47f430dbdb Merge branch 'PHP-8.1' 2021-09-04 17:59:21 +02:00
Máté Kocsis d670d9335c Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix default value of $flags in idn_to_ascii() and idn_to_utf8()
2021-09-04 17:57:23 +02:00
Máté Kocsis d5aed7b0e3 Fix default value of $flags in idn_to_ascii() and idn_to_utf8() 2021-09-04 16:42:28 +02:00
Nikita Popov 218fd03532 Fix some more CLEANUP sections 2021-09-03 14:10:40 +02:00
Nikita Popov 481cdeab31 Fix file clash in gd tests 2021-09-03 13:59:13 +02:00
Nikita Popov 98d004c9bc Fix CLEAN sections 2021-09-03 12:36:02 +02:00
Nikita Popov 7a411564f0 Fix some more CLEAN sections 2021-09-03 11:18:19 +02:00
Nikita Popov 2ab4482d34 Fix some broken or unnecessary CLEAN sections 2021-09-03 10:52:30 +02:00
Kamil Tekiela 400c6055b1 Remove mysqli_close that prevented CLEAN from running properly 2021-09-03 10:43:10 +02:00
twosee 0ac60d6055 Micro optimizations for xp_ssl.c (#7447)
If certfile/private_key points to a file that doesn't exist, it throw a warning and return failure now.
Also fixed sni_server tests.

Co-authored-by: Nikita Popov <nikita.ppv@googlemail.com>
2021-09-03 09:37:42 +08:00
Christoph M. Becker abe05b1854 Merge branch 'PHP-8.1'
* PHP-8.1:
  Use --EXTENSIONS-- section for new test
2021-09-02 23:49:24 +02:00
Christoph M. Becker cb5a4ed920 Use --EXTENSIONS-- section for new test 2021-09-02 23:49:05 +02:00
Christoph M. Becker 7c2381e5ee Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix #81407: shmop_open won't attach and causes php to crash
2021-09-02 23:21:39 +02:00
Christoph M. Becker 404bed1a69 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81407: shmop_open won't attach and causes php to crash
2021-09-02 23:21:22 +02:00
Christoph M. Becker 58ad403cec Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81407: shmop_open won't attach and causes php to crash
2021-09-02 23:18:53 +02:00
Christoph M. Becker f3d24af74f Fix #81407: shmop_open won't attach and causes php to crash
We need to allocate buffers for the file mapping names which are large
enough for all potential keys (`key_t` is defined as `int` on Windows).

Regarding the test: it's probably never a good idea to use hard-coded
keys (should always use `ftok()` instead), but to reliably reproduce
this Windows specific issue we need to, and it shouldn't be an issue on
that OS.

Closes GH-7448.
2021-09-02 23:16:48 +02:00
Máté Kocsis bc7f0b3c4f Merge branch 'PHP-8.1'
PHP-8.1:
  * Revert unintended tentative return type change
2021-09-02 17:06:35 +02:00
Máté Kocsis 194f1f095f Revert unintended tentative return type change
I accidentally made the return type of all Reflection*::getAttributes() methods tentative, even though they have already been declared natively.
2021-09-02 17:06:19 +02:00
Máté Kocsis b6ecdd4a02 Merge branch 'PHP-8.1'
* PHP-8.1:
  Properly escape the default value of string properties and enum cases
2021-09-02 16:53:46 +02:00
Máté Kocsis 4483ecf5a9 Properly escape the default value of string properties and enum cases 2021-09-02 16:53:31 +02:00
Nikita Popov 2ffa70b97c Slightly clean up is_callable implementation
And adjust an error message to line up with the error message
used for $callable() in zend_execute.c.
2021-09-02 10:37:13 +02:00
Dmitry Stogov f3c5d1a568 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed bug #81409 (Incorrect JIT code for ADD with a reference to array)
  Preparing for 8.1.0RC2
2021-09-02 11:17:32 +03:00
Dmitry Stogov cbc925e510 Fixed bug #81409 (Incorrect JIT code for ADD with a reference to array) 2021-09-02 11:13:27 +03:00
Dmitry Stogov 3d7a7dc276 Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fixed call to zend_free_compiled_variables()
2021-09-01 19:11:31 +03:00
Dmitry Stogov 66f8866a62 JIT: Fixed call to zend_free_compiled_variables() 2021-09-01 19:10:54 +03:00
Nikita Popov 6b8d4151cf Remove leftover zval_ptr_dtor
This should have been dropped as part of
a8254ed576.
2021-09-01 16:59:35 +02:00
Nikita Popov 00f7b0d6e7 Don't unnecessary fetch error in is_callable()
As we just end up freeing it afterwards, avoid populating it in
the first place.
2021-09-01 16:58:46 +02:00
Nikita Popov e41f7e5989 Simplify handler invocation in xsltprocessor 2021-09-01 16:40:50 +02:00
Nikita Popov a8254ed576 Simplify unserialize_callback_func handling 2021-09-01 16:33:22 +02:00
Nikita Popov 485d3acfe6 Make zend_call_function() failure handling consistent
This API had rather peculiar behavior in case the provided function
is not callable. For some types of failures, it would silently
return FAILURE (e.g. a function does not exist), while for others
(e.g. a class does not exist) it would generate a warning. Depending
on what the calling code does, this can either result in silent
failure or duplicate errors.

This commit switches the contract such that zend_call_function()
always (*) succeeds, though that success might be in the form of
throwing an exception. Calling a non-callable will now consistently
throw an exception.

There are some rare callers that do want to ignore missing methods,
for legacy APIs that are specific with optional methods. For these
use cases a new zend_call_method_if_exists() API is provided.

Calling code generally does not need to explicitly check for and
report zend_call_function() failures -- it can rely on
zend_call_function() having already done so. However, existing
code that does check for failure should continue to work fine.

(*) The only exception to this is if EG(active) being false during
late engine shutdown. This is not relevant to most code, but code
running in destructors and similar may need to be aware of the
possibility.
2021-09-01 16:09:23 +02:00