fuel/core

is_resource check doesn't seem to work in PHP 8.1+ on FTP connections

glOOmyART opened this issue · 3 comments

i'm trying to move my app to PHP 8.2/8.3 so i use the 1.9 dev version.
i use FTP extensively in one of the modules.
when i switched from PHP 7.4 to PHP 8.2 i noticed that FTP connections don't work anymore.
when i set debug to true it always threw the "Invalid Connection" exception.
i quickly tested with standard php and it connected just fine and i could list files etc.
i searched around the web an came accross this -> https://core.trac.wordpress.org/ticket/51057
when i changed line 167 in core/classes/ftp.php from

if ( ! is_resource($this->_conn_id))

to

if ( ! $this->_conn_id)

the ftp connection worked again as it did before

Thanks for letting me know, it's been a while since I've used FTP.

I'll put it on the todo list, the problem is probably that PHP is moving away from generic resources and to distinct classes.

yay, the first bug report that is actually a bug and not me not knowing how to program :)

while you're at it, i also got a deprecation warning for dynamic variable assignment in the same class for the $this->_ssl_mode variable which is not declared in the class
in PHP 9 this will result in an exception

the devs seem very determined to harden the language

Which is a good thing.

I've already bumped into that deprecation message, but don't seem to be able to get your original exception, so far I have no issues...