Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spl_autoload_unregister's behavior is inconsistent when called with inaccessible function. #2060

Closed
chalet16 opened this issue Mar 13, 2014 · 6 comments

Comments

@chalet16
Copy link
Contributor

This bug has caused one of joomlacms tests to fail.

Code:

<?php
class Class1 {
        public static function setup() {
                spl_autoload_register(array('Class1','_autoload'));
        }
        private static function _autoload() {
        }
}
Class1::setup();
print_r(spl_autoload_functions());
spl_autoload_unregister(array('Class1','_autoload'));
print_r(spl_autoload_functions());

Expected Result:

Array
(
    [0] => Array
        (
            [0] => Class1
            [1] => _autoload
        )

)
Array
(
)

Actual Result:

Array
(
    [0] => Array
        (
            [0] => Class1
            [1] => _autoload
        )

)
Array
(
    [0] => Array
        (
            [0] => Class1
            [1] => _autoload
        )

)
@chalet16
Copy link
Contributor Author

I will fix this.

@scannell
Copy link
Contributor

scannell commented Apr 2, 2014

Thanks for reporting this.

@ptarjan ptarjan added this to the Lockdown milestone May 12, 2014
@LiraNuna LiraNuna assigned LiraNuna and unassigned LiraNuna May 13, 2014
@LiraNuna
Copy link
Contributor

The issue comes from a different in the implementation of vm_decode_function. It is not a part of the spl implementation.

The issue arises because vm_decode_function refuses to find the function in the "wrong" scope (because the static method is private).

cc @markw65

@JoelMarcey JoelMarcey self-assigned this Nov 3, 2014
@fredemmott fredemmott removed this from the Lockdown milestone Nov 3, 2014
@chalet16 chalet16 removed this from the Lockdown milestone Nov 3, 2014
@photodude
Copy link
Contributor

photodude commented Oct 17, 2016

@photodude
Copy link
Contributor

@chalet16 Although this is still an issue for hhvm, Joomla CMS has changed the _autoload() function from private to public for joomla 3.7+ which resolved the related testing error.

@lexidor lexidor mentioned this issue Sep 21, 2019
@lexidor
Copy link
Collaborator

lexidor commented May 14, 2020

I am going over old issues on this repository, to see which ones apply to the current versions of hhvm.

The \spl_autoload_unregister() function has been removed from the newest versions of hhvm.
It appears this issue was fixed by changing the framework code back in 2016.
I don't think anyone is affected by this issue today.
If this is the case, please open a new issue.

@lexidor lexidor closed this as completed May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants