? Failure

User tests: Successful: Unsuccessful:

avatar HLeithner
HLeithner
5 Nov 2019

Pull Request for Issue #26995 .

Summary of Changes

Change _JEXEC check to JPATH_LIBRARIES for maximum b/c.
This library has already been deprecated since Joomla 3.6 and is removed in Joomla 4.0.

Testing Instructions

Code Review.

Expected result

Works

Actual result

Works

avatar HLeithner HLeithner - open - 5 Nov 2019
avatar HLeithner HLeithner - change - 5 Nov 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 5 Nov 2019
Category External Library Libraries
avatar mbabker
mbabker - comment - 5 Nov 2019

Just changing the defined check isn't really going to change much, my whole point was that none of the files should be using ANY of the Joomla application constants, which people seem to think is not an issue to introduce these Joomla-isms into paths that contain third party code. The fix I was suggesting looks like this:

diff --git a/libraries/phputf8/ord.php b/libraries/phputf8/ord.php
index c1410b2e14..9e37f14c34 100644
--- a/libraries/phputf8/ord.php
+++ b/libraries/phputf8/ord.php
@@ -1,17 +1,15 @@
 <?php
-defined('_JEXEC') or die;
-
 if (class_exists('JLog'))
 {
        JLog::add(
                sprintf(
                        'Using the phputf8 library through files located in %1$s is deprecated, load the files from %2$s instead.',
                        __DIR__,
-                       JPATH_LIBRARIES . '/vendor/joomla/string/src/phputf8'
+                       dirname(__DIR__) . '/vendor/joomla/string/src/phputf8'
                ),
                JLog::WARNING,
                'deprecated'
        );
 }
 
-require_once JPATH_LIBRARIES . '/vendor/joomla/string/src/phputf8/ord.php';
+require_once dirname(__DIR__) . '/vendor/joomla/string/src/phputf8/ord.php';

But since there seems to be an insistence on having the Joomla constants be a requirement to use these files, there is no point in changing the patch the JSST decided upon and this pull request can be closed.

If the proxy files are going to change any further at this point, the conditional logging can be removed since it is now expected that the Joomla application be bootstrapped, meaning the log class would always be present.

avatar HLeithner
HLeithner - comment - 5 Nov 2019

What you suggest is a b/c break.

avatar SharkyKZ
SharkyKZ - comment - 5 Nov 2019

How so?

avatar mbabker
mbabker - comment - 5 Nov 2019

Please demonstrate the B/C break then. Because I am truly clueless how on earth removing the dependency on Joomla's path constants to attempt to load a file counts as a break. Unless you're saying B/C is broken if someone has redefined the JPATH_LIBRARIES constant, which at this point we should just all assume is impossible because things in Joomla will break if you don't respect the out-of-the-box filesystem structure, at which point I just laugh if anyone seriously thinks Joomla actually supports redefining the paths.

avatar mbabker
mbabker - comment - 5 Nov 2019

Again, just close this PR. There is no benefit to this change as is. My apologies for wasting everyone's time, I will stop providing feedback on the work you all do in this repository (again).

avatar HLeithner
HLeithner - comment - 6 Nov 2019

The b/c is very theoretical, based on you comment that it's possible to load this files without the framework could lead to an alternative path and not to dirname(DIR) ....

This pr changes to minimum impact.

avatar SharkyKZ
SharkyKZ - comment - 6 Nov 2019

This would only be an issue if someone decided to move phputf8 and vendor directories into different root directories and are loading phputf8 library without the use of JPATH_LIBRARIES constant. A scenario we should not account for.

avatar HLeithner
HLeithner - comment - 6 Nov 2019

That's the reason I say "very theoretical".

avatar mbabker
mbabker - comment - 6 Nov 2019

Considering __DIR__ is relative to the file, and not magically different (like getcwd() is, or worse, JPATH_BASE and JPATH_THEMES are), the only hypothetical break comes in moving the files that the proxies are trying to load without updating the require statements. If you're going to consider THAT a possible B/C break, then by your argument once a file is in place in the filesystem it may never be moved (meaning all the namespacing work which removed a few hundred files is B/C breaking, doesn't matter there's the autoloading proxy in place because you've broken people's require statements).

avatar wilsonge wilsonge - change - 11 Nov 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-11-11 22:08:22
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 11 Nov 2019
avatar wilsonge
wilsonge - comment - 11 Nov 2019

I just don't think this is worth the pain. It's getting removed in J4 - I don't see the benefit to making the moved libraries theoretically able to be used by something that isn't part of core.

Add a Comment

Login with GitHub to post a comment