DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • The Role of JavaScript in Front-End and Back-End Development
  • PHP Development in the Era of the Internet of Things (IoT)
  • Keep Your Application Secrets Secret
  • Evolution of the Quarkus Developer Experience

Trending

  • AI Speaks for the World... But Whose Humanity Does It Learn From?
  • Implementing Explainable AI in CRM Using Stream Processing
  • AI Agents: A New Era for Integration Professionals
  • Optimizing Serverless Computing with AWS Lambda Layers and CloudFormation
  1. DZone
  2. Coding
  3. Languages
  4. PHP 8.2.12 Release that Every Developer Must Know About

PHP 8.2.12 Release that Every Developer Must Know About

Discover the top 15 updates of the latest PHP 8.2.12 release. Learn about the issues resolved and how they will benefit in PHP web development.

By 
Sanjay Singhania user avatar
Sanjay Singhania
·
Nov. 27, 23 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
3.0K Views

Join the DZone community and get the full member experience.

Join For Free

PHP 8.2.12, released on 26 October 2023, is the latest bug fix update of the PHP 8.2 series. This release does not introduce new features but addresses issues in previous versions. These fixes range from core PHP functionalities to specific modules. Furthermore, PHP 8.2.12 is a PHP-supported release, which increases its significance. 

This article will provide a comprehensive outlook on all the issues and how they are addressed in this update. 

Core 

  • Fixed bug GH-12207 (Memory leak when using class and trait with doc block): Developers reported a memory leak when class and trait declared the same static property with documentation block. Memory leaks happen when a program improperly releases unused memory. Such scenarios lead to inefficient performance and potential slowdowns. The bug was fixed in the update 8.2.12 to prevent the wastage of memory resources in future cases. 
  • Fixed bug GH-12215 (Overwriting of module entry causes type errors in ext/dom): A bug related to the DOMDocument object was produced during dumping documentElement property of a newly created DOMDocument object. This resulted in errors that disrupted PHP scripts and XML’s combined operations. PHP 8.2.12 improved property handling in such cases to streamline processes and prevent unexpected errors while working with DOM elements. 
  • Fixed bug GH-12273 (__builtin_cpu_init Check): This technical issue emerged during the configuration check and testing of __builtin_cpu_init on FreeBSD. __builtin_cpu_init is a part of PHP internal operations that optimizes performance based on the capability of the CPU. The problem was fixed in the 8.2.12 update, enabling PHP to use CPU capabilities for performance optimization effectively. 
  • Fixed bug #80092 (ZTS + preload resulting in Segfault on shutdown): Segfault or segmentation fault refers to a major crash during which a program tries to access an invalid memory location. A segfault occurred while shutting down PHP during class preloading in Zend Thread Safety (ZTS) mode. In the PHP 8.2.12 update, the issue was resolved. The resolution ensures stable shutdowns even when ZTS is used with class preloading and maintains the stability of multi-threaded PHP applications. 

CLI (Command Line Interface)

The CLI section of the PHP 8.2.12 update ensures that one single Date header is present. The Date header is a standard header in HTTP communication that indicates the date and time of a message’s origination. This change resolves an error related to the HTTP response header when PHP developers run PHP scripts from the command line. 

A single Date header in the response maintains HTTP standard compliance and prevents confusion/errors due to multiple Date headers. Furthermore, this change ensures properly structured headers that adhere to standard practices.

CType

The PHP 8.2.12 update addresses a significant performance issue (bug GH-11997) with the ctype_alnum function in the CType section. The ctype_alnum function checks whether all characters in a string are alphanumeric. In a test case, the performance of ctype_alnum with preg_match was compared using regular expression matching. 

According to the test results, this function worked slower in the 8.1 and later versions of PHP compared to its earlier versions. The latest PHP update fixed the issue and ensured the ctype_alnum function performs better. Hence, it improves the efficiency of scripts relying on ctype_alnum for string validation. Applications that heavily use string validation will benefit from this fix since it will directly affect the execution speed and resource utilization.

DOM (Document Object Model)

  • Restoring the Old Namespace Reconciliation Behavior: Namespace helps differentiate duplicate elements in XML files. This DOM update seems to revert to the previous namespace handling method in PHP’s DOM extension to improve compatibility with XML standards and XML document handling in PHP applications. 
  • Fixed bug GH-8996 (Serialization of DOMNode on PHP ^8.1): Developers faced an issue while serializing DOMNode objects in PHP 8.1 and above. Serialization translates data formats and object structures into reconstructable, storable, and transmittable formats. In a test case, a custom class implemented __sleep and __wakeup serialization methods to extend DOMDocument.  

The expected result was the error-free serialization and deserialization of the object since the necessary methods for serialization were implemented. However, it stopped the serialization and resulted in a fatal error. The PHP 8.2.12 update addressed this bug, ensuring serialization and deserialization of the objects extending DOMNode without issues. Hence, it will help developers to save and restore complex XML structures efficiently for applications that need it.

Fileinfo

Update 8.2.12 fixed the GH-11891 bug. Due to this bug, the function incorrectly returned text/xml instead of image/svg+xml while determining the MIME type of SVG files using the fileinfo extension. Since the MIME type helps to determine a file’s nature, this issue resulted in improper handling and management of SVG files in PHP applications. PHP 8.2.12 resolved this issue, leading to the correct identification of SVG files as image/svg+xml.

Filter

The PHP 8.2.12 update involves fixing an issue using FILTER_REQUIRE_SCALAR and FILTER_CALLBACK. In PHP, FILTER_REQUIRE_SCALAR ensures scalar value filtration, while FILTER_CALLBACK helps to apply a custom function to the value. This update ensures that both these filters properly work together. Hence, this update results in accurate and flexible sanitization and validation and enhances the reliability of custom filtering logic in PHP. 

Hash

The PHP 8.2.12 update fixed the GH-12186 bug, an issue that showed a segmentation fault when copying or cloning a finalized HashContext. HashContext refers to a function that helps to create hash digests out of data, while a finalized HashContext means a completed hash process. The update will help to prevent such segmentation faults and ensure stable functionality of hash functions. 

Intl (Internationalization)

  • Fixed Bug GH-12243 (Segmentation Fault on IntlDateFormatter::construct): While setting a negative value for the datatype parameter to create an IntlDateFormatter object outside the expected range, PHP showed a segfault. The latest PHP update fixed this issue, allowing stable IntlDateFormatter object creation with unconventional parameter values.
  • Fixed Bug GH-12282 (IntlDateFormatter::construct does not throw an exception on an invalid locale): When setting invalid local values, the IntlDateFormatter returns a weak number rather than an exception. The latest PHP update fixed the issue, ensuring that IntlDateFormatter shows an error when an invalid locale is used. 

MySQLnd

The latest PHP update fixed GH-12297, a 'mysqlnd.so' library-related startup warning issue during the compilation of MySQL extension from the source. This issue stated, "PHP Startup: Invalid library (maybe not a PHP library) 'mysqlnd.so'.” This statement indicates a problem with how PHP integrated and recognized “'mysqlnd.so' (the MySQL Native Driver library). The latest update ensured correct recognition and warning-free loading of the 'mysqlnd.so' library at PHP startup. 

Opcache

  • Fixed opcache_invalidate() on deleted file: opcache_invalidate() is a function that invalidates cached scripts, ensuring they are properly reloaded and recompiled when it is called. However, the issue deleted the scenario where the script was invalidated. The PHP 8.2.12 update resolved this issue, ensuring Opache properly handles such situations and an efficient caching mechanism. 
  • Fixed bug GH-12380 (Access to private array property in child class and incorrectly referencing the property of parent class while using JIT compilation): When a developer tried to access private array properties inside a closure in a child class, the  PHP's Just-In-Time (JIT) compilation feature showed an error. Closures refer to anonymous functions assigned to a variable, which allow you to access private properties only in defined classes. Due to the bug, the closure incorrectly accessed the private property from the parent class. When demonstrated using a class hierarchy, the closure was accessing a private array property of the child class, but it was referring to the parent’s property. The latest PHP update ensured that closes within a class access the class’s private property accurately, even when using JIT compilation. Hence, this fix ensures that the integrity of object-oriented programming (OOP) is maintained. 

PCRE (Perl Compatible Regular Expressions)

The latest PHP 8.2.12 bug addressed the bug GH-11956. In this issue, a regex (regular expression) pattern - preg_match( '/<(\w+)[\s\w\-]+ id="S44_i89ew">/', '<br><div id="S44_i89ew">', $matches ) gave different results when PCRE JIT was enabled and disabled. The issue was traced back to the PCRE library and was resolved when the library was updated to a newer version.

SimpleXML

  • Fixed bug GH-12170 (Failure to use XPath with comments in SimpleXML): When using XPath in SimpleXML for finding comment nodes, XPath returned an empty tray instead of the comment. The latest PHP update ensured that XPath accurately locates and returns comment nodes in XML files. This ensures efficient XML parsing and manipulation.
  • Fixed bug GH-12223 (Elements with entity reference resulted in an infinite loop): When using var_dump or print_r  on SimpleXML elements with entity reference, the system delivered an infinite loop. This infinite loop could have resulted in the hanging or crashing of scripts. The PHP update ensured stable and reliable output from debugging and printing SimpleXML elements with entity reference. 
  • Fixed bug GH-12167 (Failure to get processing instruction contents in SimpleXML): When obtaining content related to processing instructions from a SimpleXML object, PHP returned an empty string rather than processing instruction content. The latest PHP update ensured processing instruction content could be derived from SimpleXML objects. This ensured enhanced specialized XML data handling and processing. 
  • Fixed bug GH-12169 (Failure to receive comments content in SimpleXML): When SimpleXML tried to obtain the content of comment nodes, this bug returned an empty string rather than a comment content. PHP 8.2.12 enabled developers to derive correct comment content from SimpleXML objects, effectively parsing and processing comments in XML documents. 

Streams

The bug GH-12190 delivered the result "Invalid IP Address: 0" error when the stream_context_create function was used with the 'bindto' option set to '0:0' in PHP. The bindto option lets systems choose IP addresses and ports during network requests. However, it did not work as expected. PHP 8.2.12 resolved this issue and allowed using '0:0' for the 'bindto' option in stream contexts. This results in flexible and proper functionality when specifying network settings that can benefit PHP development projects involving network operations.

XML 

  • Fixed the return type of stub of xml_parse_into_struct(): The xml_parse_into_struct() function parses XML data into an associative array. The XML update ensured that the behavior and documentation of the function reflect the type of value it returns. This ensures clear and consistent handling of XML data. 
  • Fixed the memory leak caused when calling xml_parse_into_struct() twice: Earlier, when calling xml_parse_into_struct() was called more than once, it resulted in a memory leak. During a memory leak, the system consumes more memory than required. The latest update ensured proper memory management and release, resulting in performance-optimized and reliable PHP applications.  

XSL

When using the XSLTProcessor::transformToDoc method with SimpleXML objects, developers did not get the expected type of value. The transformToDoc method helps to transform XML documents using XSL stylesheets. The PHP 8.2.12 update resolved this issue and ensured that the method returns the appropriate type of value. This will result in smooth and error-free XML transformations. 

Conclusion

The PHP 8.2.12 release has addressed several PHP vulnerabilities and issues, including core, CLI, CType, and others, improving its efficiency and reliability. PHP diligently addresses rising issues so that developers worldwide can build robust and performance-optimized PHP applications. 

In the upcoming months, PHP will release new updates to address emerging issues that developers may face, ensuring a reliable environment to work in. So stay tuned to learn about new PHP updates. 

Command-line interface PHP dev

Opinions expressed by DZone contributors are their own.

Related

  • The Role of JavaScript in Front-End and Back-End Development
  • PHP Development in the Era of the Internet of Things (IoT)
  • Keep Your Application Secrets Secret
  • Evolution of the Quarkus Developer Experience

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!