Make WordPress Core

Opened 3 years ago

Last modified 6 weeks ago

#59917 new defect (bug)

On windows host using ftp, Undefined array key "islink"

Reported by: antonmo Owned by:
Priority: normal Milestone: Awaiting Review
Component: Filesystem API Version:
Severity: normal Keywords: reporter-feedback has-patch has-unit-tests
Cc: Focuses: administration

Description (last modified by sabernhardt)

Fresh install of wordpress 6.4.1
On windows host using ftp

steps to recreate:

  1. Going to "sitehealth" page gives critical warning ftp credentials are missing for updates.
  1. Google search suggested adding the following to the user added section of wp-config.php
    define('FTP_USER', 'USERNAME');
    define('FTP_PASS', 'PASSWORD');
    define('FTP_HOST', 'FTP.EXAMPLE.COM');
    
  2. After this, go back to site health page. It is giving the following warnings repeatedly:
    Warning: Undefined array key 3 in C:\...\wp-admin\includes\class-ftp.php on line 457
    
    Warning: Undefined array key "islink" in C:\...\wp-admin\includes\class-wp-filesystem-ftpsockets.php on line 695
    
    Warning: Undefined array key "perms" in C:\...\wp-admin\includes\class-wp-filesystem-ftpsockets.php on line 700
    
    Warning: Undefined array key "islink" in C:\...\wp-admin\includes\class-wp-filesystem-ftpsockets.php on line 695
    

Change History (10)

#1 @sabernhardt
3 years ago

  • Description modified (diff)

#2 @jorbin
3 years ago

  • Component Site Health → Filesystem API
  • Keywords needs-patch added
  • Milestone Awaiting Review → 6.5
  • Version 6.4

Thanks for opening your first ticket @antonmo!

Moving to 6.5 for visibility. I've removed the version since this code is from a few different versions but is all quite old. While seen on the site health screen, this is related to the filesystem API so updating the component.

#3 @swissspidy
3 years ago

  • Milestone 6.5 → 6.6

This ticket was mentioned in ​Slack in #core by oglekler. ​View the logs.


2 years ago

#5 @oglekler
2 years ago

  • Focuses administration added
  • Milestone 6.6 → 6.7

This ticket was discussed during bug scrub and due to possible complications with the Filesystem API decided to move this to the next milestone.

This bug also needs to be reproduced to the point what causes the Fatal Error to occure.

Ad props to @costdev

This ticket was mentioned in ​Slack in #core by chaion07. ​View the logs.


2 years ago

#7 follow-up: @chaion07
2 years ago

Thanks @antonmo for reporting this. We reviewed this Ticket during a recent bug-scrub session. Here's the summary of the feedback received:

  1. Can we please ask for more information, especially Windows OS version and FTP client?

Thank you.

Props to @khoipro

Cheers!

#8 in reply to: ↑ description @veryard
2 years ago

Hi @antonmo hope you're doing well, along with the above are you also able to provide the following:

  1. What version of PHP you were using
  2. Which guide you were following which told you to add those to your config
  3. Full stack trace of the errors if possible, please make sure no confidential details are shared here.

Thanks.

#9 in reply to: ↑ 7 @desrosj
2 years ago

  • Keywords reporter-feedback added
  • Milestone 6.7 → Awaiting Review
  1. Can we please ask for more information, especially Windows OS version and FTP client?

I don't think this has to do with a specific FTP client. I think that this has to do with WordPress being configured to use FTP, which is the default behavior when your server is not configured to allow direct file writes.

@antonmo are you still experiencing this issue with the latest version of WordPress (currently 6.6.2)? If so, could you prove the additional details requested by @veryard?

I'm moving this back to Awaiting Review until there's enough information to reliably reproduce and investigate.

This ticket was mentioned in ​PR #13985 on ​WordPress/wordpress-develop by ​@benitoalba.


6 weeks ago
#10

  • Keywords has-patch has-unit-tests added; needs-patch removed

FTP servers can answer SYST with 215 Windows_NT or 215 UNIX, without a Type: L8 suffix. ftp_base::systype() reads the fourth field unconditionally, which triggers an Undefined array key 3 warning.

Return null when the byte size is missing, preserving the existing return value without the warning. The new tests cover Windows and UNIX replies with and without a byte size, plus unsuccessful commands.

The islink and perms warnings reported in the same ticket are already guarded on trunk. This change addresses the remaining systype() warning.

Testing

Tested with PHP 8.3.33 and PHPUnit 9.6.36:

  • The two short-response cases fail with the warning before the fix. All six new cases pass after it: 12 assertions.
  • The filesystem group passes: 167 tests and 308 assertions, with 20 PHPUnit deprecation warnings from the existing OPcache tests.
  • A loopback FTP fixture returning 215 Windows_NT reproduces the warning before the fix. After it, connection, login, Windows detection, working-directory retrieval and quit succeed without warnings through ftp_pure.
  • WordPress coding standards pass for the test file. PHP compatibility and syntax checks pass for both changed files; git diff --check passes.

The loopback fixture covers the protocol response; the original Windows Site Health setup has not been tested.

Use of AI Tools

AI assistance: Yes. OpenAI Codex (GPT-6) researched the ticket, wrote the patch and tests, ran validation, and drafted this description. This draft is awaiting human review.

Note: See TracTickets for help on using tickets.