PHP
PHP is an open source general-purpose server-side scripting language originally designed for Web development to produce dynamic Web pages. It is one of the first developed server-side scripting languages to be embedded into an HTML source document rather than calling an external file to process data. The code is interpreted by a Web server with a PHP processor module which generates the resulting Web page. It also has evolved to include a command-line interface capability and can be used in standalone graphical applications.
If you are new to PHP and want to get some idea of how it works, try the introductory tutorial.
After that, check out the online manual.
What’s New
PHP 8.4 is a major update of the PHP language. It contains many new features, such as property hooks, asymmetric visibility, an updated DOM API, performance improvements, bug fixes, and general cleanup.
This release marks the latest minor release of the PHP language.
PHP 8.4 comes with numerous improvements and new features such as:
- Property Hooks
- Asymmetric Property Visibility
- Lazy Objects
- PDO driver-specific subclasses
- BCMath object type
- And much much more…
BcMath:
- [RFC] Add bcfloor, bcceil and bcround to BCMath.
- Improve performance.
- Adjust bcround()’s $mode parameter to only accept the RoundingMode enum.
- Fixed LONG_MAX in BCMath ext.
- Fixed bcdiv() div by one.
- [RFC] Support object types in BCMath.
- bcpow() performance improvement.
- ext/bcmath: Check for scale overflow.
- [RFC] ext/bcmath: Added bcdivmod.
- Fix GH-15968 (Avoid converting objects to strings in operator calculations).
- Fixed bug GH-16265 (Added early return case when result is 0) (Saki Takamachi).
- Fixed bug GH-16262 (Fixed a bug where size_t underflows) (Saki Takamachi).
- Fixed GH-16236 (Fixed a bug in BcMath\Number::pow() and bcpow() when raising negative powers of 0) (Saki Takamachi).
Core:
- Added zend_call_stack_get implementation for NetBSD, DragonFlyBSD, Solaris and Haiku.
- Enabled ifunc checks on FreeBSD from the 12.x releases.
- Changed the type of PHP_DEBUG and PHP_ZTS constants to bool.
- Fixed bug GH-13142 (Undefined variable name is shortened when contains \0).
- Fixed bug GH-13178 (Iterator positions incorrect when converting packed array to hashed).
- Fixed zend fiber build for solaris default mode (32 bits).
- Fixed zend call stack size for macOs/arm64.
- Added support for Zend Max Execution Timers on FreeBSD.
- Ensure fiber stack is not backed by THP.
- Implement GH-13609 (Dump wrapped object in WeakReference class).
- Added sparc64 arch assembly support for zend fiber.
- Fixed GH-13581 no space available for TLS on NetBSD.
- Added fiber Sys-V loongarch64 support.
- Adjusted closure names to include the parent function’s name.
- Improve randomness of uploaded file names and files created by tempnam().
- Added gc and shutdown callbacks to zend_mm custom handlers.
- Fixed bug GH-14650 (Compute the size of pages before allocating memory).
- Fixed bug GH-11928 (The –enable-re2c-cgoto doesn’t add the -g flag).
- Added the #[\Deprecated] attribute.
- Fixed GH-11389 (Allow suspending fibers in destructors).
- Fixed bug GH-14801 (Fix build for armv7).
- Implemented property hooks RFC.
- Fix GH-14978 (The xmlreader extension phpize build).
- Throw Error exception when encountering recursion during comparison, rather than fatal error.
- Added missing cstddef include for C++ builds.
- Updated build system scripts config.guess to 2024-07-27 and config.sub to 2024-05-27.
- Fixed bug GH-15240 (Infinite recursion in trait hook).
- Fixed bug GH-15140 (Missing variance check for abstract set with asymmetric type).
- Fixed bug GH-15181 (Disabled output handler is flushed again).
- Passing E_USER_ERROR to trigger_error() is now deprecated.
- Fixed bug GH-15292 (Dynamic AVX detection is broken for MSVC).
- Using “_” as a class name is now deprecated.
- Exiting a namespace now clears seen symbols.
- The exit (and die) language constructs now behave more like a function. They can be passed liked callables, are affected by the strict_types declare statement, and now perform the usual type coercions instead of casting any non-integer value to a string. As such, passing invalid types to exit/die may now result in a TypeError being thrown.
- Fixed bug GH-15438 (Hooks on constructor promoted properties without visibility are ignored).
- Fixed bug GH-15419 (Missing readonly+hook incompatibility check for readonly classes).
- Fixed bug GH-15187 (Various hooked object iterator issues).
- Fixed bug GH-15456 (Crash in get_class_vars() on virtual properties).
- Fixed bug GH-15501 (Windows HAVE_
_H macros defined to 1 or undefined). - Implemented asymmetric visibility for properties.
- Fixed bug GH-15644 (Asymmetric visibility doesn’t work with hooks).
- Implemented lazy objects RFC.
- Fixed bug GH-15686 (Building shared iconv with external iconv library).
- Fixed missing error when adding asymmetric visibility to unilateral virtual property.
- Fixed bug GH-15693 (Unnecessary include in main.c bloats binary).
- Fixed bug GH-15731 (AllowDynamicProperties validation should error on enums).
- Fixed bug GH-16040 (Use-after-free of object released in hook).
- Fixed bug GH-16026 (Reuse of dtor fiber during shutdown).
- Fixed bug GH-15999 (zend_std_write_property() assertion failure with lazy objects).
- Fixed bug GH-15960 (Foreach edge cases with lazy objects).
- Fixed bug GH-16185 (Various hooked object iterator issues).
- Fixed bug OSS-Fuzz #371445205 (Heap-use-after-free in attr_free).
- Fixed missing error when adding asymmetric visibility to static properties.
- Fixed bug OSS-Fuzz #71407 (Null-dereference WRITE in zend_lazy_object_clone).
- Fixed bug GH-16574 (Incorrect error “undefined method” messages).
- Fixed bug GH-16577 (EG(strtod_state).freelist leaks with opcache.preload).
- Fixed bug GH-16615 (Assertion failure in zend_std_read_property).
- Fixed bug GH-16342 (Added ReflectionProperty::isLazy()).
- Fixed bug GH-16725 (Incorrect access check for non-hooked props in hooked object iterator).
Curl:
- Deprecated the CURLOPT_BINARYTRANSFER constant.
- Bumped required libcurl version to 7.61.0.
- Added feature_list key to the curl_version() return value.
- Added constants CURL_HTTP_VERSION_3 (libcurl 7.66) and CURL_HTTP_VERSION_3ONLY (libcurl 7.88) as options for CURLOPT_HTTP_VERSION (Ayesh Karunaratne)
- Added CURLOPT_TCP_KEEPCNT to set the number of probes to send before dropping the connection.
- Added CURLOPT_PREREQFUNCTION Curl option to set a custom callback after the connection is established, but before the request is performed.
- Added CURLOPT_SERVER_RESPONSE_TIMEOUT, which was formerly known as CURLOPT_FTP_RESPONSE_TIMEOUT.
- The CURLOPT_DNS_USE_GLOBAL_CACHE option is now silently ignored.
- Added CURLOPT_DEBUGFUNCTION as a Curl option.
- Fixed bug GH-16359 (crash with curl_setopt* CURLOPT_WRITEFUNCTION without null callback).
- Fixed bug GH-16723 (CURLMOPT_PUSHFUNCTION issues).
Date:
- Added DateTime[Immutable]::createFromTimestamp.
- Added DateTime[Immutable]::[get|set]Microsecond.
- Constants SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, and SUNFUNCS_RET_DOUBLE are now deprecated.
- Fixed bug GH-13773 (DatePeriod not taking into account microseconds for end date).
DBA:
- Passing null or false to dba_key_split() is deprecated.
Debugging:
- Fixed bug GH-15923 (GDB: Python Exception
: exceptions must derive from BaseException).
DOM:
- Added DOMNode::compareDocumentPosition().
- Implement #53655 (Improve speed of DOMNode::C14N() on large XML documents).
- Fix cloning attribute with namespace disappearing namespace.
- Implement DOM HTML5 parsing and serialization RFC.
- Fix DOMElement->prefix with empty string creates bogus prefix.
- Handle OOM more consistently.
- Implemented “Improve callbacks in ext/dom and ext/xsl” RFC.
- Added DOMXPath::quote() static method.
- Implemented opt-in ext/dom spec compliance RFC.
- Fixed bug #79701 (getElementById does not correctly work with duplicate definitions).
- Implemented “New ext-dom features in PHP 8.4” RFC.
- Fixed GH-14698 (segfault on DOM node dereference).
- Improve support for template elements.
- Fix trampoline leak in xpath callables.
- Throw instead of silently failing when creating a too long text node in (DOM)ParentNode and (DOM)ChildNode.
- Fixed bug GH-15192 (Segmentation fault in dom extension (html5_serializer)).
- Deprecated DOM_PHP_ERR constant.
- Removed DOMImplementation::getFeature().
- Fixed bug GH-15331 (Element::$substitutedNodeValue test failed).
- Fixed bug GH-15570 (Segmentation fault (access null pointer) in ext/dom/html5_serializer.c).
- Fixed bug GH-13988 (Storing DOMElement consume 4 times more memory in PHP 8.1 than in PHP 8.0).
- Fix XML serializer errata: xmlns=”” serialization should be allowed.
- Fixed bug GH-15910 (Assertion failure in ext/dom/element.c).
- Fix unsetting DOM properties.
- Fixed bug GH-16190 (Using reflection to call Dom\Node::__construct causes assertion failure).
- Fix edge-case in DOM parsing decoding.
- Fixed bug GH-16465 (Heap buffer overflow in DOMNode->getElementByTagName).
- Fixed bug GH-16594 (Assertion failure in DOM -> before).
Read the complete release notes here.