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

117990 Commits

Author SHA1 Message Date
Nikita Popov
bef4b2e4e9 Report object cast failures internally
Make cast_object return FAILURE for casts to int/float, rather than
throwing a notice and returning SUCCESS. Instead move the emission
of the notice to the code invoking cast_object. This will allow us
to customize the behavior per call-site.

This change is written to be NFC, and the code in
zend_std_compare_objects() should illustrate the current behavior
doesn't make a lot of sense.
2020-03-31 12:07:25 +02:00
Nikita Popov
78d3af4529 Make sure php_get_internal_encoding() returns non-empty
Even if default_charset is set to "", we should still return
"UTF-8" as the default value here. Setting default_charset to ""
suppresses the header emission, but shouldn't change anything
about our encoding defaults.
2020-03-31 11:06:15 +02:00
Nikita Popov
3ca08ee764 Make sure mbstring.internal_encoding deprecation is always thrown
It was not thrown if the setting was specified via -d at least.
2020-03-31 10:47:23 +02:00
Christoph M. Becker
47918bdd33 Merge branch 'PHP-7.4'
* PHP-7.4:
  Next is 7.3.18
2020-03-31 10:26:01 +02:00
Christoph M. Becker
b27a14529f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Next is 7.3.18
2020-03-31 10:24:15 +02:00
Christoph M. Becker
33226c3a17 Next is 7.3.18 2020-03-31 10:22:55 +02:00
Christoph M. Becker
12ca4fe65d Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79413: session_create_id() fails for active sessions
2020-03-31 08:41:08 +02:00
Christoph M. Becker
d533fa15e6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79413: session_create_id() fails for active sessions
2020-03-31 08:39:54 +02:00
Christoph M. Becker
b510250b8e Fix #79413: session_create_id() fails for active sessions
The comment on `PS_VALIDATE_SID_FUNC(files)` is very clear that the
function is supposed to return `SUCCESS` if the session already exists.
So to detect a collision, we have to check for `SUCCESS`, not
`FAILURE`.

We also fix the wrong condition in session_regenerate_id() as well.
2020-03-31 08:38:23 +02:00
George Peter Banyard
457380cae7 Drop wchar header check as always defined since C95 2020-03-31 00:14:56 +02:00
George Peter Banyard
aa47543cb4 Fix format for tm member objects as they are stored as integers
Closes GH-5326
2020-03-30 17:09:49 +02:00
Nikita Popov
fbe19a6eb7 Clarify that return throws 2020-03-30 16:27:38 +02:00
Nikita Popov
8a2ce27bba mb_detect_order(): Use proper array|string argument 2020-03-30 16:26:28 +02:00
Nikita Popov
500230fc85 Remove persistent arg from parse_encoding_array()
It is always zero.
2020-03-30 16:17:35 +02:00
Nikita Popov
b02b3539e7 mb_check_encoding(): Make var a proper array|string arg 2020-03-30 16:15:12 +02:00
Nikita Popov
50d07ff28c mb_detect_encoding(): Use proper array|string parameter
Needed to add support for nullabiltiy in some places.
2020-03-30 16:15:12 +02:00
Tyson Andre
47ddd95836 Do constant evaluation for str_contains in opcache
Both arguments must be strings.
str_contains deliberately does not emit a warning for an empty needle.

Closes GH-5324
2020-03-30 09:54:38 -04:00
Nikita Popov
bb6523693c mb_convert_variables(): Make $from an array|string argument 2020-03-30 15:51:04 +02:00
Nikita Popov
0d24422749 mb_convert_encoding(): Make $input a proper array|string arg 2020-03-30 15:41:55 +02:00
Nikita Popov
f24f6cbab9 mb_convert_encoding(): Make $from_encodings a proper array|string arg
Switching to FastZPP, as we don't support this in normal zpp.
2020-03-30 15:39:33 +02:00
Michael Voříšek
2c82b832f6 Add test to make sure that (self::class)::method() is not forwarding LSB
Related with Bug #79419.

Closes GH-5310.
2020-03-30 15:26:19 +02:00
Nikita Popov
7cea789cfc Parse mb_convert_encoding() encodings only once
Instead of re-parsing them for every converted value. Also reuse
the generic parse_array() helper.
2020-03-30 14:54:15 +02:00
Nikita Popov
cd5a29b820 Properly report unknown encoding in encoding lists
And clean up the related array and list parsing code.
2020-03-30 14:46:59 +02:00
Dmitry Stogov
44390beb42 cleanup 2020-03-30 14:27:01 +03:00
Nikita Popov
ed850f2723 Move encoding fetching outside php_mb_stripos() 2020-03-30 12:29:11 +02:00
Nikita Popov
295895342f Remove unnecessary NULL check
This is a required zpp parameter, it cannot be null.
2020-03-30 12:24:39 +02:00
Dmitry Stogov
4c9ee6a8ca Initialize variable numbers 2020-03-30 12:50:19 +03:00
Nikita Popov
44c70b881b Disable Symfony test on PHP 8
Symfony is currently has an expected incompatibility with PHP 8:

Fatal error: Declaration of Symfony\Component\HttpClient\Response\MockResponse::schedule(Symfony\Component\HttpClient\Response\MockResponse $response, array &$runningResponses): void must be compatible with Symfony\Component\HttpClient\Response\ResponseTrait::schedule(Symfony\Component\HttpClient\Response\ResponseTrait $response, array &$runningResponses): void in /home/vsts/work/1/s/symfony/src/Symfony/Component/HttpClient/Response/MockResponse.php on line 135

Disable the job until this is fixed.
2020-03-30 10:58:33 +02:00
Nikita Popov
f9e4c71506 Merge branch 'PHP-7.4'
* PHP-7.4:
  Don't check directory nlink in stat tests
2020-03-30 10:54:34 +02:00
Nikita Popov
b9b49cfb7b Don't check directory nlink in stat tests
It seems like on many filesystems nlink for directories is the
number of subdirectories (plus two, due to . and ..). However,
this is not a POSIX requirement, and some filesystems don't
implement it this way. This seems to be the case for whatever is
used on the Travis AArch64 builders now.
2020-03-30 10:54:03 +02:00
Nikita Popov
a34480ec82 SCCP: Optimize strpos with empty needle
This is no longer special cases in PHP 8.
2020-03-30 10:37:22 +02:00
Christoph M. Becker
6b6f0d63f3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #74940: DateTimeZone loose comparison always true
2020-03-30 09:18:20 +02:00
Christoph M. Becker
a2f8c78183 Fix #74940: DateTimeZone loose comparison always true
Since `DateTimeZone` does not implement a `compare_objects` handler,
nor has any properties, two `DateTimeZone` instances always compare as
being equal, even if they designate totally different timezones.  Even
worse, after calling `var_dump()` on these objects, the actual
comparison may yield a correct result.

We therefore introduce a `compare_objects` handlers, which prevents
different behavior before/after `var_dump()`, and which allows us to
clearly define the intended semantics.
2020-03-30 09:03:40 +02:00
Christoph M. Becker
2a1d7bd802 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79427: Integer Overflow in shmop_open()
2020-03-30 08:58:45 +02:00
Christoph M. Becker
6f8045c47f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79427: Integer Overflow in shmop_open()
2020-03-30 08:57:49 +02:00
Christoph M. Becker
a681b12820 Fix #79427: Integer Overflow in shmop_open()
If `shm.shm_segsz > ZEND_LONG_MAX` the assignment to `shmop->size` a
few lines below would overflow, so we catch that early and bail out if
necessary.
2020-03-30 08:56:49 +02:00
Jakub Zelenka
477efe935b Merge branch 'PHP-7.4' 2020-03-29 20:21:24 +01:00
Andre Nathan
0b4e80b8c1 Allow numeric [UG]ID in FPM listen.{owner,group} 2020-03-29 20:20:01 +01:00
Remi Collet
5fa17fbf94 Merge branch 'PHP-7.4'
* PHP-7.4:
  NEWS
  Fix #79424 ext/zip: don't use gl_pathc after call to globfree
2020-03-29 14:24:12 +02:00
Remi Collet
d66a063e0f NEWS 2020-03-29 14:23:28 +02:00
Remi Collet
2292ef93d5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79424 ext/zip: don't use gl_pathc after call to globfree
2020-03-29 14:23:03 +02:00
Max Rees
04920645f1 Fix #79424 ext/zip: don't use gl_pathc after call to globfree
This breaks on Linux with the musl libc, since it zeroes out gl_pathc during
globfree.
2020-03-29 14:22:31 +02:00
Dmitry Stogov
099ffc2169 BIND_GLOBAL and BIND_STATIC don't use value of the first operand 2020-03-27 15:20:21 +03:00
Christoph M. Becker
9e77d5a9da Fix #76999: mb_regex_set_options() return current options
When setting new options, `mb_regex_set_options()` is supposed to
return the *previous* options.
2020-03-27 10:34:16 +01:00
Dmitry Stogov
150df5b17c Removed useless variable 2020-03-27 12:24:15 +03:00
Christoph M. Becker
b0b593504d Merge branch 'PHP-7.4'
* PHP-7.4:
  Add missing 'skip' to bug79332.phpt skip message
2020-03-26 23:17:37 +01:00
Christoph M. Becker
cc0c5b9343 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing 'skip' to bug79332.phpt skip message
2020-03-26 23:15:55 +01:00
Lukas Berger
7f9b534e3a Add missing 'skip' to bug79332.phpt skip message
The skip message must start with the word 'skip', otherwise the test will not be skipped.

*Before:*
Running selected tests.
TEST 1/1 [ext/com_dotnet/tests/bug79332.phpt]
========DIFF========
001+ Fatal error: Uncaught Error: Class 'COMPersistHelper' not found in /srv/php/ext/com_dotnet/tests/bug79332.php:2
001- A com_exception has been thrown
002+ Stack trace:
003+ #0 {main}
004+   thrown in /srv/php/ext/com_dotnet/tests/bug79332.php on line 2
========DONE========
FAIL Bug #79332 (php_istreams are never freed) [ext/com_dotnet/tests/bug79332.phpt]

*After:*
Running selected tests.
SKIP Bug #79332 (php_istreams are never freed) [ext/com_dotnet/tests/bug79332.phpt] reason: com_dotnet extension not available
2020-03-26 23:14:10 +01:00
Nikita Popov
e8e09b60b4 Remove rand_r implementation
We already use our own mt13397 implementation nowadays, so we no
longer need this shim.
2020-03-26 11:49:27 +01:00
Nikita Popov
97cb81ead5 Remove HAVE_REALPATH checks
We do not actually use realpath(), but a custom implementation.
Make sure the realpath() function is always available.

Closes GH-5290.
2020-03-26 11:46:00 +01:00