Skip to content
New issue

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

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

Already on GitHub? # to your account

PHP Warning: array_merge() #242

Closed
eurobank opened this issue May 22, 2020 · 7 comments
Closed

PHP Warning: array_merge() #242

eurobank opened this issue May 22, 2020 · 7 comments
Labels

Comments

@eurobank
Copy link

eurobank commented May 22, 2020

Describe the bug

From debug log

[22-May-2020 02:18:08 America/Los_Angeles] PHP Warning: array_merge(): Argument # 2 is not an array in /home/public_html/oc-includes/osclass/utils.php on line 1678

To Reproduce

I think some plugin is doing a cleanup of files, removing files from directories or something like that. Not sure if this could come from a plugin?

Osclass 3.9 and PHP 7.2.x

@eurobank eurobank added the bug label May 22, 2020
@navjottomer
Copy link
Member

This won't be fixed, we are introducing new functions for the same functionality. This function will be deprecated.

@eurobank
Copy link
Author

eurobank commented May 22, 2020

Do you know if this breaks something or it is mostly harmless? I mean can we leave it be like this?

@navjottomer
Copy link
Member

It is mostly harmless. It will be deprecated with a new function and a warning will trigger in logs if someone use this function.

@eurobank
Copy link
Author

Well it is not harmless at all, in two plugins the files/directories can't be removed.

So both plugins are useless and since their dev is MIA, there is no way to fix that.

@navjottomer
Copy link
Member

replace existing rglob function with this code and your plugin will work, I will provide a better alternative in new FileSystem Class

function rglob($pattern, $flags = 0, $path = '')
{
    if (!$path && ($dir = dirname($pattern)) !== '.') {
        if ($dir === '\\' || $dir === '/') {
            $dir = '';
        }
        return rglob(basename($pattern), $flags, $dir . '/');
    }
    $paths = glob($path . '*', GLOB_ONLYDIR | GLOB_NOSORT);
    $files = glob($path . $pattern, $flags);
    foreach ($paths as $p) {
        $files = array_merge($files, rglob($pattern, $flags, $p . '/'));
    }
    return $files;
}

navjottomer added a commit that referenced this issue Jul 18, 2020
@eurobank
Copy link
Author

Will do and update here, thanks

@eurobank
Copy link
Author

Thanks @navjottomer god bless you man!

I have no idea what we would do without your 3.9 work.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants