1.2.935. PHP 8.1 Resources Turned Into Objects¶
Multiple PHP native functions now return objects, not resources. Any check on those values with is_resource() is now going to fail.
The affected functions are the following :
ldap_next_entry ()
pg_execute ()
<?php
$pspell = new pspell_new(en, , , ,
(PSPELL_FAST|PSPELL_RUN_TOGETHER));
var_dump(is_resource($pspell)); // true in PHP 8.0,
// false in PHP 8.1
?>
See also UPGRADING PHP 8.1.
1.2.935.1. Connex PHP features¶
1.2.935.1.1. Suggestions¶
Change the condition from is_resource() to instanceof
1.2.935.1.2. Specs¶
Short name |
Php/Php81RemovesResources |
Rulesets |
|
Exakat since |
2.2.0 |
Severity |
Major |
Time To Fix |
Quick (30 mins) |
Changed Behavior |
PHP 8.1 |
Precision |
Very high |
Available in |