[wp-trac] [WordPress Trac] #57500: Plugin update results in mixing files of old and new versions
WordPress Trac
noreply at wordpress.org
Sat Apr 29 19:01:53 UTC 2023
#57500: Plugin update results in mixing files of old and new versions
-------------------------------------------------+-------------------------
Reporter: Chouby | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Upgrade/Install | Version:
Severity: normal | Resolution:
Keywords: needs-testing needs-testing-info | Focuses:
reporter-feedback |
-------------------------------------------------+-------------------------
Comment (by afragen):
@barryhughes I can certainly reproduce your results. When I step through
in xDebug what I see happening is the "update" to v2.0 occurs but before
the new files are transferred the v1.0 `spl_autoload_register()` runs,
then the files switch and `Bar::bar()` is called, however, the newer
version of the `spl_autoload_register()` has not yet run. This is why the
error displays. Obviously the next pageload and hence the next run will be
correct.
I think the primary issue can best be described as the the old plugin
loading between the time it is removed and replaced with the new plugin.
I do think this might be a similar issue to @Chouby. As you suggest a more
robust autoloader would solve this issue. Essentially an autoloader must
be identical between the releases. The autoloader must load files in a
specific directory or by interpolating the `$class` and the file name. The
issue occurs when specific files are mentioned in the
`spl_autoload_register()`.
In the case of Polylang perhaps a transition from Composer's classmap
autoloader to PSR-0 might work. I believe that specifically naming the
files as occurs here, and loading them in the autoloader is the issue.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57500#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list