[wp-trac] [WordPress Trac] #38083: Regression: Change in File_Upload_Upgrader::__construct() in WP 4.6.1 (not in 4.6) broke working plugin

WordPress Trac noreply at wordpress.org
Sun Sep 18 01:18:21 UTC 2016


#38083: Regression: Change in File_Upload_Upgrader::__construct() in WP 4.6.1 (not
in 4.6) broke working plugin
-----------------------------+--------------------
 Reporter:  DavidAnderson    |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  4.6.2
Component:  Upgrade/Install  |     Version:  4.6.1
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+--------------------
Changes (by SergeyBiryukov):

 * component:  General => Upgrade/Install
 * milestone:  Awaiting Review => 4.6.2


Old description:

> This change - https://build.trac.wordpress.org/changeset/38466 in WP
> 4.6.1 broke my plugin - https://plugins.svn.wordpress.org/upload-larger-
> plugins/tags/1.4/ .
>
> I was using the upgrader_pre_download filter to over-ride the package
> (i.e. zip) that gets installed. However, the added check now makes that
> method impossible, because it applies a new consistency check. And
> specifically, realpath() returns false if the file in the parameter does
> not exist, causing the check to fail, and wp_die() to be called. If the
> two paths are compared without realpath() being called, the check would
> pass (i.e. the second string is indeed a substring of the first)... but
> because realpath() is introducing an implicit "file must exist"
> condition, it now fails.
>
> This renders the upgrader_pre_download filter useless for what I was
> doing, and I've had to go back to a much less elegant method used in the
> plugin before WP 3.7 to achieve the over-ride.
> https://plugins.svn.wordpress.org/upload-larger-plugins/tags/1.4.1/
>
> I don't know if this will have broken any other plugins.

New description:

 This change - [38525] in WP 4.6.1 broke my plugin -
 https://plugins.svn.wordpress.org/upload-larger-plugins/tags/1.4/ .

 I was using the upgrader_pre_download filter to over-ride the package
 (i.e. zip) that gets installed. However, the added check now makes that
 method impossible, because it applies a new consistency check. And
 specifically, realpath() returns false if the file in the parameter does
 not exist, causing the check to fail, and wp_die() to be called. If the
 two paths are compared without realpath() being called, the check would
 pass (i.e. the second string is indeed a substring of the first)... but
 because realpath() is introducing an implicit "file must exist" condition,
 it now fails.

 This renders the upgrader_pre_download filter useless for what I was
 doing, and I've had to go back to a much less elegant method used in the
 plugin before WP 3.7 to achieve the over-ride.
 https://plugins.svn.wordpress.org/upload-larger-plugins/tags/1.4.1/

 I don't know if this will have broken any other plugins.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38083#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list