User tests: Successful: Unsuccessful:
Pull Request for Issue _autoload
was marked private.
Why _autoload
was ever marked private is highly questionable. Ever since the autoloader has been there, people have been filing issues because it is incompatible with third-party code that uses public functions.
My only assumption is _autoload
got marked private
by habit since in PHP 4 there was a preference to indicate methods private
or protected
with leading underscores and that resulted in any PHP 5 methods prefixed with underscores being explicitly marked private
or protected
.
In this instance, it seems like marking _autoload
as private
is the completely wrong thing to do. (it's also questionable why it even works in PHP facebook/hhvm#959 (comment) )
Explicitly mark _autoload
and as public._load
Review Travis CI HHVM tests, the JLoaderTest::testSetupWithoutPrefixes
failure is no longer listed.
Optional extended testing
Unsure about documentation changes
(possibly should add a note in the docblocks to explicitly state these methods need to be public
.)
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Libraries |
_load
is only used internally by _autoload
. For the compatibility issues the _autoload
method needs to be exposed but I can't come up with a valid reason _load
needs to be too.
IMHO If it stays private
then in the future we can easily rename or remove it without B/C issue.
I can change it if that's desired.
I was just looking over the PSR-4 example protected
seems more correct. The only methods in PSR-4 autoloader class example that were marked protected
were ones that returned file paths or implemented a required file with require $file
which would be like our include $path
.
So should it left as private
or changed to protected
?
Although this reasoning probably doesn't apply to import()
, load()
, or loadByPsr0()
(although I could be wrong)
Maybe it's out of scope for this, but any thoughts on include
vs include_once
in the context of the _load()
method here? I'm leaning towards it being more correct to be include_once
When _autoload()
is private then user can not run it manually and include
is enough.
Now it will be public and user can run it manually twice which generates error but IMHO the error should be visible and we should stay with include
only.
For me, you can move the method _load
to inside _autoload
and then you won't have any private method.
I have tested this item
Joomla works normal.
I added success test. Should I add approved review too? Which is corrected?
If you test thank just test via the tracker. If you review the code than review iirc :)
@csthomas as per @mbabker 's suggestion if you test you should not mark as approved review and vice versa. That way we get the full 4 reviews that are suggested, 2 testers and 2 reviewers who are a total of 4 different people.
I have tested this item
Milestone |
Added: |
||
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-10-25 17:35:06 |
Closed_By | ⇒ | rdeutz |
Labels |
Removed:
?
|
What is the reason for marking
_load
function as a public?