1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Commit Graph

125614 Commits

Author SHA1 Message Date
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
Nikita Popov 99510ed009 Remove unnecessary argument from zend_throw_auto_init_*
This is now always "array", so inline it.
2021-09-06 11:46:20 +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
Derick Rethans d7edb808e9 Merge branch 'PHP-8.1' 2021-09-03 18:21:21 +01:00
Derick Rethans a6d50d21d9 Fixed typo 2021-09-03 18:21:10 +01:00
Tyson Andre 4c48fd22d7 Fix inconsistency in true/false/null constant resolution when opcache is not used (#7441)
Strangely, uses of eval and 'php -a' (or loading a file without opcache after a namespaced constant was declared)
will not treat non-FQ true/false/null as magic keywords, while compiled php required from a file would do that.

This may confuse people learning the language, and result in code loaded with
eval() behaving differently from the same snippet in a file loaded by require.

```
Interactive shell

php > define('foo\true', 'test');
php > namespace foo { var_dump(true); }
string(4) "test"
```

This will make the same session instead properly emit `bool(true);` like it
already would if running those statements in files when opcache was used.
2021-09-03 08:42:36 -04: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 1def88d0e3 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fully qualify ReturnTypeWillChange in deprecation message
2021-09-03 13:57:29 +02:00
Nikita Popov 3eeeeeb104 Fully qualify ReturnTypeWillChange in deprecation message
When adding the #[ReturnTypeWillChange] attribute in namespaced
code, you also need to use ReturnTypeWillChange, otherwise it
will be silently ignored and may result in confusion. Change the
deprecation message to suggest #[\ReturnTypeWillChange], which
will always work.

Closes GH-7454.
2021-09-03 13:57:23 +02:00
Nikita Popov 5cb6f467c4 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fully qualify ReturnTypeWillChange in deprecation message
2021-09-03 13:56:08 +02:00
Nikita Popov 6cc928c734 Fully qualify ReturnTypeWillChange in deprecation message
When adding the #[ReturnTypeWillChange] attribute in namespaced
code, you also need to use ReturnTypeWillChange, otherwise it
will be silently ignored and may result in confusion. Change the
deprecation message to suggest #[\ReturnTypeWillChange], which
will always work.

Closes GH-7454.
2021-09-03 13:55:20 +02:00
Nikita Popov 98d004c9bc Fix CLEAN sections 2021-09-03 12:36:02 +02:00
codinghuang 3021ce6e58 Clean ext/opcache/minilua 2021-09-03 12:22:23 +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 e16af8e84d Support generate lldb command in run-tests.php (#7451) 2021-09-03 09:38:07 +08: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 1d3365f98f Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix forgotten test
2021-09-02 17:45:12 +02:00
Máté Kocsis 805f2b9803 Fix forgotten test 2021-09-02 17:44:52 +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
Patrick Allaert d6d6491153 Preparing for 8.1.0RC2 2021-09-01 18:22:32 +02: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 449bb0577c Drop IS_CALLABLE_CHECK_SILENT flag
This flag was suppressing *some* but not all errors in
zend_is_callable(), and is no longer used. You can avoid errors
by omitting the error argument.
2021-09-01 16:13:39 +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