Gerard Roche [Tue, 12 May 2020 09:07:18 +0000 (10:07 +0100)]
run-tests: remove use of FILE_BINARY constant
The FILE_BINARY (and FILE_TEXT) constants are not really valid or useful
constants. It looks like they were added in 5.2.7 and have "no effect,
and are only available for forward compatibility."
* PHP-7.4:
Fix #78876: Long variables cause OOM and temp files are not cleaned
Fix #78875: Long filenames cause OOM and temp files are not cleaned
Update NEWS for 7.2.31
Update CREDITS for PHP 7.2.30
Update NEWS for PHP 7.2.30
* PHP-7.3:
Fix #78876: Long variables cause OOM and temp files are not cleaned
Fix #78875: Long filenames cause OOM and temp files are not cleaned
Update NEWS for 7.2.31
Update CREDITS for PHP 7.2.30
Update NEWS for PHP 7.2.30
* PHP-7.2:
Fix #78876: Long variables cause OOM and temp files are not cleaned
Fix #78875: Long filenames cause OOM and temp files are not cleaned
Update NEWS for 7.2.31
Update CREDITS for PHP 7.2.30
Update NEWS for PHP 7.2.30
Fix #78875: Long filenames cause OOM and temp files are not cleaned
We must not cast `size_t` to `int` (unless the `size_t` value is
guaranteed to be less than or equal to `INT_MAX`). In this case we can
declare `array_len` as `size_t` in the first place.
These APIs have been superseded by ReflectionParameter::getType()
since PHP 7.0. Types introduced since that time are not available
through the old APIs, and their behavior is getting increasingly
confusing. This is how they interact with PHP 8 union types:
* isArray() will return true if the type is array or ?array,
but not any other union type
* Same for isCallable().
* getClass() will return a class for T|int etc, as long as the
union only contains a single type. T1|T2 will return null.
This behavior is not particularly reasonable or useful, and will
get more confusing as new type system extensions are added.
We must not attempt to access arbitrary union members when retrieving
debug info, because that may not be valid. Therefore we do no longer
dereference pointer types inside of unions, but report their address as
string in `%p` format instead.
array_column() reimplements array key handling in a way that does
not match standard array key behavior in PHP. Avoid this by making
use of the standard API.
Of course, there is a minor backwards compatibilty break here,
e.g. people could be relying on objects getting cast to string
instead of throwing.
Nikita Popov [Thu, 31 Oct 2019 10:27:53 +0000 (11:27 +0100)]
Reapply "Remove configure checks for supported instruction sets"
I reverted this previously for 7.4 because of bug #78769. Relanding
it now for master, because I still believe that this change is
right, and if it causes complications, those indicate a bug elsewhere.
---
These were checking whether the instruction set is supported by
the host CPU, however they were only used to condition on whether
this instruction set is targeted at all. It would still use dynamic
dispatch (e.g. based on ifunc resolvers) to select the actual
implementation. Whether the target is guaranteed to support the
instruction set without dispatch is determined based on pre-defined
macros like __SSE2__.
This removes the configure-time builtin cpu checks to remove
confusion. Additionally this allows targeting an architecture that
is newer than the host architecture.
Commit aaa1f90[1] dropped support for the custom `I` specifier, so we
must no longer use it for `ZEND_ADDR_FMT`; otherwise there are
segfaults when printing memory leaks, and maybe elsewhere.
Alex Dowad [Sun, 10 May 2020 12:57:12 +0000 (14:57 +0200)]
Don't check directory atime in lstat_stat_variation10.phpt test
This is a funny one. I discovered that lstat_stat_variation10.phpt was failing every
now and again when the PHP test suite was run on my dev PC. The output from the failing
test showed that the atime (access time) of the directory created in the test was changing
between these lines:
Could is_dir() be accessing the directory and changing the atime? strace showed that is_dir
was only issuing a single stat() syscall. Could stat() change the atime? No, no, that would
just be perverse. Nobody would be stupid enough to implement the kernel in that way.
Checked the kernel source, found that the function called when atime needs to be updated
appears to be touch_atime(). Broke out the BCC kernel tracing tools and ran this one
while running the flaky test case in a loop:
Inspecting the results showed that something called "git_thread" was occcasionally updating
the atime on the directory in question!! What on earth...???
The PID shown by trace revealed that this was a background thread for Sublime Text 3.
Sublime now has git integration and shows when there are untracked or modified files. It
seems that it uses a background thread to regularly scan the project directory and look
for new and modified files. This was causing the atime to change.
Even though other developers may not be running ST3, there are any number of reasons why
a background process might recurse through various directories and could cause the atime
to change unexpectedly. Therefore, update the test case so it doesn't fail in such cases.
Nikita Popov [Sat, 9 May 2020 09:53:39 +0000 (11:53 +0200)]
Fix bug68996.phpt test
The function name gets printed here now, with illegal chars
substituted in the arg. This slipped through previously, because
the test only runs under USE_ZEND_ALLOC=0. We remove that check
as well, because the test behaves the same regardless of which
allocator is used, even if the original bug only reproduces under
USE_ZEND_ALLOC=0.
Máté Kocsis [Sat, 29 Feb 2020 21:47:04 +0000 (22:47 +0100)]
Make float to string casts locale-independent
From now on, float to string casting will always behave locale-independently.
RFC: https://wiki.php.net/rfc/locale_independent_float_to_string
Closes GH-5224
Co-authored-by: George Peter Banyard <girgias@php.net>
Nikita Popov [Thu, 7 May 2020 16:50:42 +0000 (18:50 +0200)]
Ensure ctype_string is NULL for C locale
We already document that this is the case, but currently it's only
true if setlocale() has not been called. Make sure ctype_string is
always NULL, even with an explicit "C" locale call, so we can
more efficiently check whether we are in the "C" locale.
Nikita Popov [Thu, 7 May 2020 16:36:48 +0000 (18:36 +0200)]
Remove redundant htmlentities() tests
Test 04 and 15 are the same as 02 and 03, just for different
encodings. They don't add value, but their execution depends
on available locales, so they're easy to miss...
Nikita Popov [Thu, 7 May 2020 13:18:52 +0000 (15:18 +0200)]
Don't respect mbstring.internal_encoding in htmlentities()
htmlentities() has nothing to do with mbstring and should not
depend on its ini settings. It should only respect the global
default_charset and internal_encoding settings. This is exactly
why they were introduced...
Nikita Popov [Thu, 7 May 2020 13:46:08 +0000 (15:46 +0200)]
Add quiet parameter to internal HTML entities API
In some places, we need to make sure that no warnings are thrown
due to unknown encoding. The error reporting code tried to avoid
this by determining a "safe charset", but this introduces subtle
discrepancies in which charset is picked (normally
internal_encoding takes precedence). Avoid this by suppressing
the warning in the first place.
While here, use the fallback logic to print error messages with
substitution characters more consistently, to avoid skipping
parts of the error message entirely.
Nikita Popov [Thu, 7 May 2020 08:45:49 +0000 (10:45 +0200)]
Only allow "pass" as input/output encoding
"pass" is not a real encoding, it just means "don't perform any
conversion". Using it as an internal encoding or passing it to
any of the mbstring() function will not work (and on master commonly
assert).
Nikita Popov [Thu, 7 May 2020 08:15:57 +0000 (10:15 +0200)]
Return false from failed mb_convert_variables()
If we fail to detect the encoding return false, just like
mb_convert_encoding() does, and the implementation here clearly
intended. Previously the "pass" pseudo-incoding was returned.