Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#33432 closed defect (bug) (fixed)

PemFTP uses the ereg extension, which PHP7 removed

Reported by: dd32's profile dd32 Owned by: dd32's profile dd32
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Filesystem API Keywords:
Focuses: Cc:

Description

We include PemFTP which is a pure-php implementation of FTP for usage when the PHP FTP Extension is unavailable.

We should convert PemFTP from using the ereg set of functions, to using PCRE (preg_*), for both PHP7 compatibility and to remove the PHP Deprecated notices in PHP 5.3+.

It looks like the work done in the below GitHub repo is what's needed:
https://github.com/yama/PemFTP

I believe the PemFTP library is unmaintained upstream, and we already have a number of customisations.

Attachments (2)

33432.diff (3.2 KB) - added by enshrined 9 years ago.
ereg to preg
33432.2.diff (3.2 KB) - added by enshrined 9 years ago.
Added preg_quote

Download all attachments as: .zip

Change History (8)

@enshrined
9 years ago

ereg to preg

#1 @enshrined
9 years ago

The attached patch is based upon the changes made in the linked repo. Tests seem to pass with it but I couldn't find the specific tests to run on their own.

#2 @dd32
9 years ago

Looks like glob_regexp() probably needs a preg_quote(), some of the others may need it too if they've got data passed in.

As for tests, AFAIK there exist no tests for this section of code (either by us, or others), and due to the complexity of adding them, it's not going to be realistic to add them either.

@enshrined
9 years ago

Added preg_quote

#3 @enshrined
9 years ago

33432.2.diff has the preg_quote added.

I couldn't see anywhere else in the 3 changed files that has regex data passed in to a preg_ function so for now it's just that one added.

#4 @dd32
9 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 34281:

Updates: FTP/PemFTP Library: Remove the usage of deprecated regular expression functions (ereg replaced by PCRE).

Props enshrined, aaroncampbell
Fixes #16026, #33432

#5 @dd32
9 years ago

  • Keywords needs-patch removed

During testing I had to rewrite some of the expressions to match properly in PCRE, line-endings caused problems, it seems to be working for me though.

#6 @dd32
9 years ago

In 34282:

Updates: FTP: Add a missing PCRE modifer in [34281].

See #16026, #33432x

Note: See TracTickets for help on using tickets.