Skip to content

PHP 8.0: only call libxml_disable_entity_loader() in PHP < 8#78

Merged
ocean90 merged 1 commit intomasterfrom
feature/php-8.0-libxml-disable-entity-loader
Sep 14, 2020
Merged

PHP 8.0: only call libxml_disable_entity_loader() in PHP < 8#78
ocean90 merged 1 commit intomasterfrom
feature/php-8.0-libxml-disable-entity-loader

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 12, 2020

As per the PHP 8.0 changelog:

libxml_disable_entity_loader() has been deprecated. As libxml 2.9.0 is now
required, external entity loading is guaranteed to be disabled by default,
and this function is no longer needed to protect against XXE attacks.

Source: https://github.com/php/php-src/blob/71bfa5344ab207072f4cd25745d7023096338385/UPGRADING#L808-L811

Calling the function conditionally will prevent deprecation warnings.

And while the PHP_VERSION_ID constant was introduced in PHP 5.2.7, no additional condition is needed to check for its existance as the condition won't be executed when the libxml_disable_entity_loader() function exists check fails and as libxml_disable_entity_loader() was introduced in PHP 5.2.11, this means, we're good.

As per the PHP 8.0 changelog:

> `libxml_disable_entity_loader()` has been deprecated. As libxml 2.9.0 is now
> required, external entity loading is guaranteed to be disabled by default,
> and this function is no longer needed to protect against XXE attacks.

Source: https://github.com/php/php-src/blob/71bfa5344ab207072f4cd25745d7023096338385/UPGRADING#L808-L811

Calling the function conditionally will prevent deprecation warnings.

And while the `PHP_VERSION_ID` constant was introduced in PHP 5.2.7, no additional condition is needed to check for its existance as the condition won't be executed when the `libxml_disable_entity_loader()` function exists check fails and as `libxml_disable_entity_loader()` was introduced in PHP 5.2.11, this means, we're good.
@jrfnl jrfnl added this to the 0.8.0 milestone Aug 12, 2020
@ocean90 ocean90 merged commit b4b1194 into master Sep 14, 2020
@jrfnl jrfnl deleted the feature/php-8.0-libxml-disable-entity-loader branch September 14, 2020 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants