PHP 8.3 enters the Alpha 1 version and these are the proposed changes

php

PHP is a programming language that allows web development or dynamic web applications.

Few days ago the news was released that the first alpha version of the new branch of the programming language PHP 8.3 Planned enhancements have been revealed, such as the new json_validate() function, as well as additions to the recently added Randomizer class, stack overflow detection, and more.

For those of you who are unaware of PHP (PHP recursive acronym: Hypertext Preprocessor), let me tell you that it is quite a popular, open source, server-side interpreted, and general-purpose programming language that is especially suited for web development, as it can be embedded in HTML.

What are the main innovations that PHP 8.3 introduces?

With the release of this version of PHP 8.3 for Alpha 1 testing Among the features planned for its implementation, for example, the json_validate() function to quickly check if a string is in JSON format without performing decoding operations, since previously a JSON string consisted of a specified data format and if it required validation of a JSON string, the function was required json_decode().

Another of the changes that stands out are the improvements in error handling, as well as in stack overflow detection with the two new directives zend.max_allowed_stack_size and zend.reserved_stack_size which were added to the ini file to define the maximum allowed and reserved heap size. It is mentioned that the benefit of this feature is that segmentation faults induced by stack overflow will no longer generate segmentation faults, which makes debugging much easier.

About the operation, it is mentioned that the program will crash when it approaches the exhaustion of the stack, when the stack fills up more than the difference between the values ​​of zend.max_allowed_stack_size and zend.reserved_stack_size (Execution will stop without taking the situation to a segmentation fault.) By default, the value of zend.max_allowed_stack_size is set to 0 (0: the size is determined automatically, you can set -1 to disable the limit).

In addition to this, it is also highlighted thatNew methods have been added to the Randomizer class, which provides a high-level API for generating pseudorandom numbers and sequences. in this update Some small additions are integrated: getBytesFromString to generate a string of a given size using random characters present in another string; getFloat and nextFloat to generate a random floating point number within the specified range.

It also highlights the date/time exception handling improvements, since previously PHP was just limited to issuing a warning or error when something went wrong in the handling of dates and times, but now, added separate exception generation DateMalformedIntervalStringException, DateInvalidOperationException, DateRangeError in case there are problems in date and time operations.

Of the other changes that stand out:

  • Added the ability to extract constants using the dynamic class syntax.
  • function was added getBytesFromString() can be used to generate a string of the desired length from bytes of a randomly chosen string
  • Improved handling of errors that occur when parsing serialized data in the function unserialize(). In case of problems, unserialize() will now return E_WARNING instead of E_NOTICE.
  • Was added getfloat() which returns a float between $min y $max
  • function was added nextfloat().
  • Added new POSIX functions posix_sysconf(), posix_pathconf(), posix_fpathconf(), and posix_eaccess().
  • When using FFI, C functions that have a void return type now return null instead of returning FFI\CData:void
    posix_getrlimit() now takes an optional $res parameter to allow getting a single resource limit.
  • gc_status() has four new fields: running, protected, fully buffer_size.
  • class_alias() now supports creating an alias of an inner class.
  • mysqli_poll() now raises ValueError when read or error arguments are passed.
  • array_pad() now you are only limited by the maximum number of elements an array can have. Previously, it was only possible to add a maximum of 1048576 items at a time.
  • New functions posix: posix_sysconf(), posix_pathconf(), posix_fpathconf() and posix_eaccess()
  • Run proc_get_status() multiple times will now always return the correct value on posix systems.

Finally if you are interested in knowing more about it, you can check the details In the following link.

It is worth mentioning that the release of the stable version of PHP 8.3 is scheduled for November 23.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.