• Resolved rmast

    (@rmast)


    This function on the bottom of another-mailchimp-widget.php seems not to be programmed as such a spl_autoload ought to.

    The buffered_autoloader function conflicted with Woocommerce. Some spl_autoload classes registered by Woocomerce were appended with .class.php by your code and reported not to be found on the server on the bottom of my live website.

    This is your code:

    public function buffered_autoloader( $class ) {
    try {
    set_include_path( get_include_path() . PATH_SEPARATOR . realpath( $this::get_plugin_dir() . ‘/lib/’ ) );
    spl_autoload( $class, ‘.class.php’ );
    ini_restore(‘include_path’);
    } catch ( Exception $e ) {
    $message = $e->getMessage();

    return $message;
    }
    }

    Examples for the simple way this code should look:
    https://stackoverflow.com/questions/7651509/what-is-autoloading-how-do-you-use-spl-autoload-autoload-and-spl-autoload-re
    or
    https://syframework.alwaysdata.net/spl-autoload-register

    I guess you encountered an issue with these simple examples while spl_autoload expects filenames with only lowercase and dashes for classes as written here:
    https://wordpress.stackexchange.com/questions/158703/should-i-use-spl-autoload-register-in-my-plugin

    Apart from the warning that appeared from this issue the subscription also encountered an unspecified error and there was no log or debug option to show what went wrong. It would be nice if the plugin would retrieve a list of audiences from Mailchimp to let you choose instead of just type the List ID.

    • This topic was modified 5 years, 11 months ago by rmast.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support dimned

    (@dimned)

    Hi @rmast,
    Thank you for your request however we were not able to replicate it. Could you please specify the steps to replicate the issue? Screenshots and examples are appreciated.

    I think I have a similar problem with the plugin on WP 5.5.3 with WC 4.7.1 under PHP 7.4

    There’s a ton of those Warnings in the log:

    PHP Warning: spl_autoload(): open_basedir restriction in effect. File(actionscheduler_optionlock.class.php) is not within the allowed path(s): ([...]) in /web/wp-content/plugins/another-mailchimp-widget/another-mailchimp-widget.php on line 165

    Looks like the WooComerce class is conflicting there. Is there a way to resolve this?

    Plugin Support dimned

    (@dimned)

    Hi @skinperforator,
    Could you try to deactivate all plugins except Another MailChimp Widget and see if the warning is gone? Then activate them one by one to find what exactly causes it.
    Also, you can try to switch the theme to see if the warning is gone.

    Hi @dimned,
    that’s not so easy, because it’s on a live website.
    Judging from the error messages and the files mentioned in there, I’m quite sure it’s a conflict with WooCommerce because i.e. “actionscheduler_optionlock.classs.php” is a file from that plugin.
    Isn’t what rmast wrote above a clue for the solution? Sounds like the function could be written differently to not cause such a problem?

    Plugin Support dimned

    (@dimned)

    Hi @skinperforator,
    I’ve tested the plugin with WooCommerce and could not replicate the issue locally. I’ve forwarded this case to our developers. We will notify you if we have any news.

    Morgan Hvidt

    (@morganhvidt)

    Same errors on my side. I’m using EDD + Wordops (Nginx) + FastCGI

    
    PHP Warning: spl_autoload(): open_basedir restriction in effect. File(actionscheduler_optionlock.class.php) is not within the allowed path(s): ([...]) in /wp-content/plugins/another-mailchimp-widget/another-mailchimp-widget.php on line 165
    
    Plugin Support dimned

    (@dimned)

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘spl_autoload_register function faulty’ is closed to new replies.