Jump to main content
University Computer Centre
Transition from PHP 7.4 to PHP 8.2
University Computer Centre 

Transition from PHP 7.4 to PHP 8.2

The PHP version on the central web servers will be upgraded from 7.4 to 8.2 at the end of October 2024. Please check your websites and web applications on the test server www-test.tu-chemnitz.de running PHP 8.2. (For your personal web pages you can test on https://www-user-test.hrz.tu-chemnitz.de/.) The test servers are only reachable from within the intranet.

News and changes for web authors

Discontinuation of the each() function

The function each() known from Perl is no longer supported. foreach loops should preferably be used as a replacement.

Changed interpretation of comments with #

PHP 8 introduces the expression #[Attribute] for attribute declarations. Comments that are introduced with # are still possible, but must not use these brackets. We recommend that you only use comments with // or /* ... */.

Discontinuation of array element access with curly brackets

As of PHP 8, square brackets must be used to access an array element, $arr{'element'} is no longer possible. This must be replaced accordingly by $arr['element'].

Change to class definitions

The constructor can no longer be named like the class, but should have the protected name __construct.

Changes to date/time functions

It is no longer possible to call mktime() or gmmktime() without parameters. Only the time() function can still be called without parameters to obtain the current timestamp. For complex operations, we recommend using the DateTime class.

Changes to LDAP functions

The functions ldap_sort(), ldap_control_paged_result(), and ldap_control_paged_result_response() have been removed.

Changes to localisation functions

The call of setlocale() is mandatory since PHP 8, otherwise the default (locale “C”) is used. String functions such as strtolower() or stripos() now generally use the ASCII format; the multibyte string variants must be used for localised applications.

Changes to PostgreSQL functions

The pg_connect() function requires a connection string; multiple parameters are no longer supported. However, we recommend using the PDO class for database operations anyway.

Changes to processing of URLs

The central configuration of the web server previously allowed non-existent paths to be mapped to a website. This was possible with a rewrite rule, for example. As part of the update, AcceptPathInfo On is now also required in the relevant .htaccess. If the configuration is missing, the web server will otherwise throw an HTTP 404 error.

Other discontinued functions and constants

These functions and constants, among others, no longer exist since PHP 8: money_format(), restore_include_path(), get_magic_quotes_gpc(), get_magic_quotes_runtime(), fgetss(), and FILTER_SANITIZE_MAGIC_QUOTES.

For development and troubleshooting: Insight into the error logs of the server www-test.tu-chemnitz.de respectively of the server www-user-test.hrz.tu-chemnitz.de (for your own IP address)

Documentation