Opened 8 months ago
Closed 5 weeks ago
#63201 closed defect (bug) (fixed)
FTPext Stub
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Filesystem API | Keywords: | dev-feedback has-patch commit |
| Focuses: | docs | Cc: |
Description
Healthiness stub for FTPext
Change History (10)
This ticket was mentioned in PR #8622 on WordPress/wordpress-develop by @SirLouen.
8 months ago
#1
- Keywords has-patch added
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
8 months ago
#3
@
8 months ago
- Version trunk deleted
"to fix a disturbing type error" could you please add some details about the type error reported?
#4
@
8 months ago
@audrasjb as It's just a stubs issue
This file was updated some months ago, according to the new PHP 8.1 standard, to use FTP/Connection, instead of resource.
But someone forgot to update the docs $link type when they introduce the update.
So when you use any type of code parser with anything over PHP 8.1, you will see the code plagued with typing errors like: $this->link is not a resource but a FTP/Connection
I've kept resource for anything below PHP 8.1 compatibility (and because the current $link instantiation is still using the resource mode).
You can check the errors with any parser that use the wordpress stubs, intellisense, phpstan...
#6
@
3 months ago
https://www.php.net/manual/en/function.ftp-ssl-connect.php
Returns an FTP\Connection instance on success, or false on failure.
ftp_ssl_connect returns false on ftp connection failure so $link can also be false.
To handle that case we can think of adding
/** @var FTP\Connection|resource|false */
A simple patch to fix a disturbing type error for stubs