Skip to content

Commit 45873cc

Browse files
committed
Merge remote-tracking branch 'origin/master' into attributes_v2_rfc
2 parents 9dec3f9 + b452d59 commit 45873cc

File tree

833 files changed

+13918
-23114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

833 files changed

+13918
-23114
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ jobs:
7474
arch: amd64
7575
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
7676
arch: arm64
77+
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 S390X=1
78+
arch: s390x
7779

7880
before_script:
7981
- ccache --version
@@ -89,7 +91,9 @@ before_script:
8991

9092
# Run PHPs run-tests.php
9193
script:
92-
- ./sapi/cli/php run-tests.php -P -d extension=`pwd`/modules/zend_test.so $(if [ $ENABLE_DEBUG == 0 ]; then echo "-d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M -d zend_extension=`pwd`/modules/opcache.so"; fi) -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --show-slow 1000 --set-timeout 120 -j$(nproc)
94+
# ARM64 CI reports nproc=32, which is excessive.
95+
- if [ -z "$ARM64" ]; then export JOBS=$(nproc); else export JOBS=16; fi
96+
- ./sapi/cli/php run-tests.php -P -d extension=`pwd`/modules/zend_test.so $(if [ $ENABLE_DEBUG == 0 ]; then echo "-d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M -d zend_extension=`pwd`/modules/opcache.so"; fi) -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --show-slow 1000 --set-timeout 120 -j$JOBS
9397
- sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");'
9498

9599
after_success:

NEWS

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ PHP NEWS
2020
(cmb)
2121
. Fixed bug #79368 ("Unexpected end of file" is not an acceptable error
2222
message). (Alex Dowad)
23+
. Fixed bug #36365 (scandir duplicates file name at every 65535th file).
24+
(cmb)
25+
. Use SSE2 instructions do locale independent strtolower. (Laruence)
26+
. Fixed bug #79521 (Check __set_state structure). (carusogabriel)
27+
. Fixed bug #79467 (data:// wrappers are writable). (cmb)
28+
29+
- BZ2:
30+
. Fixed bug #71263 (fread() does not report bzip2.decompress errors). (cmb)
2331

2432
- CURL:
2533
. Bumped required libcurl version to 7.29.0. (cmb)
@@ -33,6 +41,13 @@ PHP NEWS
3341
. Add property DOMXPath::$registerNodeNamespaces and constructor argument
3442
that allow global flag to configure query() or evaluate() calls.
3543

44+
- Enchant:
45+
. Add LIBENCHANT_VERSION macro
46+
. Deprecate enchant_broker_set_dict_path, enchant_broker_get_dict_path
47+
enchant_dict_add_to_personal and enchant_dict_is_in_session
48+
. Add enchant_dict_add and enchant_dict_is_added functions
49+
. Use libenchant-2 when available
50+
3651
- FPM:
3752
. Fixed bug #64865 (Search for .user.ini files from script dir up to
3853
CONTEXT_DOCUMENT_ROOT). (Will Bender)
@@ -78,6 +93,7 @@ PHP NEWS
7893
. Don't ignore invalid escape sequences. (sjon)
7994

8095
- PDO:
96+
. Changed default PDO error mode to exceptions. (AllenJB)
8197
. Fixed bug #77849 (Disable cloning of PDO handle/connection objects).
8298
(camporter)
8399

@@ -165,4 +181,7 @@ PHP NEWS
165181
. Add ZipArchive::isCompressionMethodSupported() and
166182
ZipArchive::isEncryptionMethodSupported() method (libzip 1.7.0). (Remi)
167183

184+
- Zlib:
185+
. Fixed bug #71417 (fread() does not report zlib.inflate errors). (cmb)
186+
168187
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>

TSRM/tsrm_win32.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -613,14 +613,16 @@ TSRM_API int shmget(key_t key, size_t size, int flags)
613613
{/*{{{*/
614614
shm_pair *shm;
615615
char shm_segment[26], shm_info[29];
616-
HANDLE shm_handle, info_handle;
616+
HANDLE shm_handle = NULL, info_handle = NULL;
617617
BOOL created = FALSE;
618618

619-
snprintf(shm_segment, sizeof(shm_segment), "TSRM_SHM_SEGMENT:%d", key);
620-
snprintf(shm_info, sizeof(shm_info), "TSRM_SHM_DESCRIPTOR:%d", key);
619+
if (key != IPC_PRIVATE) {
620+
snprintf(shm_segment, sizeof(shm_segment), "TSRM_SHM_SEGMENT:%d", key);
621+
snprintf(shm_info, sizeof(shm_info), "TSRM_SHM_DESCRIPTOR:%d", key);
621622

622-
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
623-
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
623+
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
624+
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
625+
}
624626

625627
if (!shm_handle && !info_handle) {
626628
if (flags & IPC_CREAT) {
@@ -631,8 +633,8 @@ TSRM_API int shmget(key_t key, size_t size, int flags)
631633
DWORD high = 0;
632634
DWORD low = size;
633635
#endif
634-
shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, high, low, shm_segment);
635-
info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), shm_info);
636+
shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, high, low, key == IPC_PRIVATE ? NULL : shm_segment);
637+
info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), key == IPC_PRIVATE ? NULL : shm_info);
636638
created = TRUE;
637639
}
638640
if (!shm_handle || !info_handle) {

UPGRADING

Lines changed: 88 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,19 @@ PHP 8.0 UPGRADE NOTES
178178
}
179179

180180
RFC: https://wiki.php.net/rfc/abstract_trait_method_validation
181+
. Disabled functions are now treated exactly like non-existent functions.
182+
Calling a disabled function will report it as unknown, and redefining a
183+
disabled function is now possible.
184+
. data: stream wrappers are no longer writable, which matches the documented
185+
behavior.
186+
. The arithmetic and bitwise operators
187+
+, -, *, /, **, %, <<, >>, &, |, ^, ~, ++, --
188+
will now consistently throw a TypeError when one of the operands is an
189+
array, resource or non-overloaded object. The only exception to this is the
190+
array + array merge operation, which remains supported.
191+
RFC: https://wiki.php.net/rfc/arithmetic_operator_type_checks
192+
. Float to string casting will now always behave locale-independently.
193+
RFC: https://wiki.php.net/rfc/locale_independent_float_to_string
181194

182195
- COM:
183196
. Removed the ability to import case-insensitive constants from type
@@ -192,7 +205,7 @@ PHP 8.0 UPGRADE NOTES
192205
- dom:
193206
. Remove unimplemented classes from ext/dom that had no behavior and contained
194207
test data. These classes have also been removed in the latest version of DOM
195-
standard:
208+
standard:
196209

197210
* DOMNameList
198211
* DomImplementationList
@@ -287,6 +300,10 @@ PHP 8.0 UPGRADE NOTES
287300
now ignored.
288301

289302
- PDO:
303+
. The default error handling mode has been changed from "silent" to
304+
"exceptions". See https://www.php.net/manual/en/pdo.error-handling.php
305+
for details of behavior changes and how to explicitly set this attribute.
306+
RFC: https://wiki.php.net/rfc/pdo_default_errmode
290307
. The method PDOStatement::setFetchMode() now accepts the following signature:
291308

292309
PDOStatement::setFetchMode($mode, $classname, $params)
@@ -325,6 +342,9 @@ PHP 8.0 UPGRADE NOTES
325342
ReflectionParameter::getDefaultValue()
326343
ReflectionParameter::isDefaultValueConstant()
327344
ReflectionParameter::getDefaultValueConstantName()
345+
. ReflectionMethod::isConstructor() and ReflectionMethod::isDestructor() now
346+
also return true for `__construct` and `__destruct` in methods of interfaces.
347+
Previously, this would only be true in methods of classes and traits.
328348

329349
- Socket:
330350
. The deprecated AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES
@@ -388,6 +408,20 @@ PHP 8.0 UPGRADE NOTES
388408
using serialize_precision rather than precision. In a default configuration,
389409
this means that floating-point numbers are now printed with full accuracy
390410
by these debugging functions.
411+
. If the array returned by __sleep() contains non-existing properties, these
412+
are now silently ignored. Previously, such properties would have been
413+
serialized as if they had the value NULL.
414+
. The default locale on startup is now always "C". No locales are inherited
415+
from the environment by default. Previously, LC_ALL was set to "C", while
416+
LC_CTYPE was inherited from the environment. However, some functions did not
417+
respect the inherited locale without an explicit setlocale() call. An
418+
explicit setlocale() call is now always required if you wish to change any
419+
locale component from the default.
420+
421+
- Sysvsem:
422+
. sem_get() will now return an SysvSemaphore object rather than a resource.
423+
Return value checks using is_resource() should be replaced with checks
424+
for `false`.
391425

392426
- tidy:
393427
. The $use_include_path parameter, which was not used internally, has been
@@ -453,11 +487,21 @@ PHP 8.0 UPGRADE NOTES
453487
defines a __toString() method.
454488
RFC: https://wiki.php.net/rfc/stringable
455489
. Traits can now define abstract private methods.
490+
RFC: https://wiki.php.net/rfc/abstract_trait_method_validation
491+
. `throw` can now be used as an expression.
492+
RFC: https://wiki.php.net/rfc/throw_expression
493+
. An optional trailing comma is now allowed in parameter lists.
494+
RFC: https://wiki.php.net/rfc/trailing_comma_in_parameter_list
456495

457496
- Date:
458497
. Added DateTime::createFromInterface() and
459498
DateTimeImmutable::createFromInterface().
460499

500+
- Enchant:
501+
. enchant_dict_add()
502+
. enchant_dict_is_added()
503+
. LIBENCHANT_VERSION macro
504+
461505
- dom:
462506
. Introduce DOMParentNode and DOMChildNode with new traversal and manipulation APIs
463507
RFC: https://wiki.php.net/rfc/dom_living_standard_api
@@ -484,11 +528,27 @@ PHP 8.0 UPGRADE NOTES
484528
4. Deprecated Functionality
485529
========================================
486530

531+
- Core:
532+
. Calling get_defined_functions() with $exclude_disabled explicitly set to
533+
false is deprecated. get_defined_functions() will never include disabled
534+
functions.
535+
536+
- Enchant:
537+
. enchant_broker_set_dict_path and enchant_broker_get_dict_path
538+
not available in libenchant < 1.5 nor in libenchant-2
539+
. enchant_dict_add_to_personal, use enchant_dict_add instead
540+
. enchant_dict_is_in_session, use enchant_dict_is_added instead
541+
487542
- Zip:
488543
. Using empty file as ZipArchive is deprecated. Libzip 1.6.0
489544
do not accept empty files as valid zip archives any longer.
490545
Existing workaround will be removed in next version.
491546

547+
- Reflection:
548+
. ReflectionFunction::isDisabled() is deprecated, as it is no longer possible
549+
to create a ReflectionFunction for a disabled function. This method now
550+
always returns false.
551+
492552
========================================
493553
5. Changed Functions
494554
========================================
@@ -500,7 +560,7 @@ PHP 8.0 UPGRADE NOTES
500560
. comp_method
501561
. comp_flags
502562
. env_method
503-
. enc_pasword
563+
. enc_password
504564
. ZipArchive::addEmptyDir, ZipArchive::addFile and aZipArchive::addFromString
505565
methods have a new "flags" argument. This allow to manage name encoding
506566
(ZipArchive::FL_ENC_*) and entry replacement (ZipArchive::FL_OVERWRITE)
@@ -522,12 +582,23 @@ PHP 8.0 UPGRADE NOTES
522582
PR: https://github.com/php/php-src/pull/4797
523583

524584
- Standard:
525-
. Added str_contains($haystack, $needle) function, which checks whether
526-
$haystack contains $needle as a sub-string. It is equivalent to writing
527-
strpos($haystack, $needle) !== false.
585+
. Added
586+
587+
str_contains(string $haystack, string $needle): bool
588+
str_starts_with(string $haystack, string $needle): bool
589+
str_ends_with(string $haystack, string $needle): bool
590+
591+
functions, which check whether $haystack contains, starts with or ends with
592+
$needle.
593+
RFC: https://wiki.php.net/rfc/str_contains
594+
RFC: https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions
528595
. Added fdiv() function, which performs a floating-point division under
529596
IEEE 754 semantics. Division by zero is considered well-defined and
530597
will return one of Inf, -Inf or NaN.
598+
. Added get_debug_type() function, which returns a type useful for error
599+
messages. Unlike gettype(), it uses canonical type names, returns class
600+
names for objects, and indicates the resource type for resources.
601+
RFC: https://wiki.php.net/rfc/get_debug_type
531602

532603
- Zip:
533604
. ZipArchive::setMtimeName and ZipArchive::setMtimeIndex to set the
@@ -561,6 +632,11 @@ PHP 8.0 UPGRADE NOTES
561632
- CURL:
562633
. The CURL extension now requires at least libcurl 7.29.0.
563634

635+
- Enchant:
636+
. The enchant extension now uses libenchant-2 by default when available.
637+
libenchant version 1 is still supported but is deprecated and could
638+
be removed in the future.
639+
564640
- GD:
565641
. The $num_points parameter of imagepolygon(), imageopenpolygon() and
566642
imagefilledpolygon() is now optional, i.e. these functions may be called
@@ -572,6 +648,10 @@ PHP 8.0 UPGRADE NOTES
572648
- MBString:
573649
. The Unicode data tables have been updated to version 13.0.0.
574650

651+
- MySQLi / PDO MySQL:
652+
. When mysqlnd is not used (which is the default and recommended option),
653+
the minimum supported libmysqlclient version is now 5.1.
654+
575655
========================================
576656
10. New Global Constants
577657
========================================
@@ -601,6 +681,9 @@ PHP 8.0 UPGRADE NOTES
601681
13. Other Changes
602682
========================================
603683

684+
- EBCDIC targets are no longer supported, though it's unlikely that they were
685+
still working in the first place.
686+
604687
========================================
605688
14. Performance Improvements
606689
========================================

Zend/tests/005.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var_dump(strcasecmp("01", "01"));
1313

1414
echo "Done\n";
1515
?>
16-
--EXPECTF--
16+
--EXPECT--
1717
int(0)
1818
int(-3)
1919
int(-1)

Zend/tests/add_003.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@ var_dump($c);
2020
echo "Done\n";
2121
?>
2222
--EXPECTF--
23-
Notice: Object of class stdClass could not be converted to number in %sadd_003.php on line %d
24-
2523
Exception: Unsupported operand types: object + array
2624

27-
Notice: Object of class stdClass could not be converted to number in %s on line %d
28-
2925
Fatal error: Uncaught TypeError: Unsupported operand types: object + array in %s:%d
3026
Stack trace:
3127
#0 {main}

Zend/tests/bug27669.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dy
1010
$y[0] = 'hello';
1111
A::{$y[0]}();
1212
?>
13-
--EXPECTF--
13+
--EXPECT--
1414
Hello World

Zend/tests/bug51827.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ register_shutdown_function('ABC');
1313
register_shutdown_function('exploDe');
1414

1515
?>
16-
--EXPECTF--
16+
--EXPECT--
1717
int(1)
1818

1919
Fatal error: Uncaught ArgumentCountError: explode() expects at least 2 parameters, 0 given in [no active file]:0

Zend/tests/bug54305.phpt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@ class TestClass {
99
abstract class AbstractClass {
1010
}
1111
$methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs');
12-
echo $methodWithArgs++;
13-
?>
14-
--EXPECTF--
15-
Method [ <user> public method methodWithArgs ] {
16-
@@ %sbug54305.php %d - %d
17-
18-
- Parameters [2] {
19-
Parameter #0 [ <required> $a ]
20-
Parameter #1 [ <required> $b ]
21-
}
12+
try {
13+
echo $methodWithArgs++;
14+
} catch (TypeError $e) {
15+
echo $e->getMessage(), "\n";
2216
}
17+
?>
18+
--EXPECT--
19+
Cannot increment object

Zend/tests/bug61025.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ echo $b->__invoke();
2020

2121
?>
2222
--EXPECTF--
23-
Warning: The magic method __invoke() must have public visibility and cannot be static in %sbug61025.php on line %d
23+
Warning: The magic method InvokeAble::__invoke() cannot be static in %sbug61025.php on line %d
2424

25-
Warning: The magic method __invoke() must have public visibility and cannot be static in %sbug61025.php on line %d
25+
Warning: The magic method Bar::__invoke() must have public visibility in %sbug61025.php on line %d
2626
Bar
2727
Fatal error: Uncaught Error: Call to private method Bar::__invoke() from context '' in %sbug61025.php:%d
2828
Stack trace:

Zend/tests/bug63206.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ set_error_handler(function() {
2222
$triggerNotice1++;
2323
$triggerNotice2++;
2424
?>
25-
--EXPECTF--
25+
--EXPECT--
2626
Second handler
2727
Internal handler
2828
Second handler

Zend/tests/bug63206_1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ restore_error_handler();
2222

2323
$triggerNotice++;
2424
?>
25-
--EXPECTF--
25+
--EXPECT--
2626
Second handler

Zend/tests/bug63206_2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ restore_exception_handler();
2222

2323
throw new Exception();
2424
?>
25-
--EXPECTF--
25+
--EXPECT--
2626
Second handler

Zend/tests/bug65322.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ eval('class A { private function __invoke() { } }');
1919

2020
?>
2121
--EXPECTF--
22-
string(76) "The magic method __invoke() must have public visibility and cannot be static"
22+
string(%d) "The magic method A::__invoke() must have public visibility"
2323
string(%d) "%s(%d) : eval()'d code"
2424
string(1) "X"

0 commit comments

Comments
 (0)