Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#16920 closed defect (bug) (fixed)

PHP5-Port: Take out unnecessary compat functions from diverse files

Reported by: hakre's profile hakre Owned by: ryan's profile ryan
Milestone: 3.2 Priority: normal
Severity: normal Version: 3.1
Component: General Keywords: has-patch
Focuses: Cc:

Description

Now that we require PHP 5.2.4, let's take out anything in php other than compat.php that is no longer necessary. If you'd like to tackle this, please say so. Please also verify for certain that the functions you're removing are present in ALL PHP 5.2.4 installs.

Related: #16918, #16917

Attachments (9)

16920.patch (1.2 KB) - added by hakre 13 years ago.
class-http.php
16920.2.patch (2.2 KB) - added by hakre 13 years ago.
class-http.php - more replacements
16920.3.patch (1.3 KB) - added by hakre 13 years ago.
deprecate wp_clone()
16920.4.patch (3.3 KB) - added by hakre 13 years ago.
Follow-Up to: #11176
16920.5.patch (2.1 KB) - added by hakre 13 years ago.
setcookie() has httponly parameter now
16920.6.patch (869 bytes) - added by hakre 13 years ago.
E_RECOVERABLE_ERROR is available since PHP 5.2.0
16920.E_RECOVERABLE_ERROR.diff (2.5 KB) - added by duck_ 12 years ago.
get_gmt_from_date-php5.diff (1.7 KB) - added by technosailor 12 years ago.
get rid of php4 compat for get_gmt_from_date()/ with unit test
get_gmt_from_date-php5-unittest.php (707 bytes) - added by technosailor 12 years ago.
Unit test for get_gmt_from_date()

Download all attachments as: .zip

Change History (28)

@hakre
13 years ago

class-http.php

#1 @nacin
13 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

What is this? You literally copied #16918?

@hakre
13 years ago

class-http.php - more replacements

#2 @hakre
13 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Replying to nacin:

What is this? You literally copied #16918?

Mind the slight but important difference svp.

@hakre
13 years ago

deprecate wp_clone()

#3 @hakre
13 years ago

reg. wp_clone(): #16813

@hakre
13 years ago

Follow-Up to: #11176

@hakre
13 years ago

setcookie() has httponly parameter now

#4 @scribu
13 years ago

  • Milestone set to 3.2

@hakre
13 years ago

E_RECOVERABLE_ERROR is available since PHP 5.2.0

#5 @hakre
13 years ago

Version 0, edited 13 years ago by hakre (next)

#6 @hakre
13 years ago

Related: #16970

#7 @ryan
12 years ago

(In [17612]) Remove setcookie() back compat. Props hakre. see#16920

#8 @ryan
12 years ago

(In [17629]) E_RECOVERABLE_ERROR is always available in PHP 5.2+. Remove back compat code. Props hakre. see #16920

#9 @ryan
12 years ago

(In [17630]) Use stripos() instead of strpos( strtolower() ). Props hakre. see #16920

#10 @duck_
12 years ago

Three other instances of E_RECOVERABLE_ERROR checks. Patch attached.

#11 @nacin
12 years ago

(In [17632]) Remove more E_RECOVERABLE_ERROR checks. props duck_, see #16920.

#12 @ryan
12 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

#13 @ocean90
12 years ago

  • Cc dd32 added
  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

I have found two PHP4 compat codes:

  • get_gmt_from_date() - wp-includes/formatting.php
  • _unzip_file_ziparchive() - wp-admin/includes/file.php (dd32?)

#14 @dd32
12 years ago

_unzip_file_ziparchive() - wp-admin/includes/file.php (dd32?)

Not a compat function

_unzip_file_ziparchive() & _unzip_file_pclzip() are 2 different methods to extract zip files, The first is used when the PHP Zip extension is loaded (Which is not always the case) the 2nd is used in all other cases as it uses pure-PHP code to do the extraction. They're both "private workers" for unzip_file();

#15 follow-up: @dd32
12 years ago

Ignore that.. Turns out there was some PHP4 comapt in there: (thanks ocean90)

- $zopen = $z->open($file, /* ZIPARCHIVE::CHECKCONS */ 4);
+ $zopen = $z->open($file, ZIPARCHIVE::CHECKCONS);
Last edited 12 years ago by dd32 (previous) (diff)

@technosailor
12 years ago

get rid of php4 compat for get_gmt_from_date()/ with unit test

@technosailor
12 years ago

Unit test for get_gmt_from_date()

#16 in reply to: ↑ 15 @hakre
12 years ago

  • Keywords reporter-feedback has-patch added; needs-patch removed

Replying to dd32:

Ignore that.. Turns out there was some PHP4 comapt in there: (thanks ocean90)

- $zopen = $z->open($file, /* ZIPARCHIVE::CHECKCONS */ 4);
+ $zopen = $z->open($file, ZIPARCHIVE::CHECKCONS);

php ZIPARCHIVE constants are not automatically available, so not using the CONST does make still sense with PHP 5.2+.


I think this ticket should be still reopend because of technosailor's findings. Patch looks good to me.

#17 @hakre
12 years ago

  • Keywords reporter-feedback removed

#18 @ryan
12 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from reopened to closed

In [17920]:

Remove PHP5 back compat code from get_gmt_from_date. Props technosailor. fixes #16920

#19 @ryan
12 years ago

Of course that should say PHP4 instead of 5 in the commit message.

Note: See TracTickets for help on using tickets.