• Resolved Brian Henry

    (@brianhenryie)


    When I deactivated this plugin (v5.7.14) it deactivated all other plugins on the site. WordPress printed the message for each:

    The plugin plugin-name/plugin-name.php has been deactivated due to an error: The plugin does not have a valid header.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Hey @brianhenryie

    Our plugin cannot deactivates other plugins.

    Please provide your site URL and we will check the issue.

    Regards,
    Stanimir

    Thread Starter Brian Henry

    (@brianhenryie)

    OK, I’ve a support ticket open with SiteGround for an issue: “failed to open stream: Too many open files”. I’m working to get more information for support now (trying to get a debug backtrace).

    It was certainly the page load when I clicked deactivate on SiteGround Optimizer when all the plugins deactivated. We’ve activated/deactivated other plugins without issue since then. My guess right now is deactivate function runs early on WordPress load (I presume – makes sense) and the clearing of the cache by you resulted in too many file handles being used before any plugins were loaded. Then as WordPress tried to load the active plugins, and each returned an error rather than the file, it proceeded to disable each.

    PHP Warning: fopen(/home/customer/www/domain.com/public_html/wp-content/plugins/woocommerce/woocommerce.php): failed to open stream: Too many open files in /home/customer/www/domain.com/public_html/wp-includes/functions.php on line 6109

    This also leads me to believe the issue is unrelated to any plugins I have installed.

    I think WordPress could mitigate against this by doing a test fopen on a known file before loading plugins. I might open an issue when I understand more.

    You could mitigate against it by finishing your deactivate code with a check on a known file and run die() if you encounter an error.

    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    This has nothing to do with our plugin. We do not disable other plugins in ANY case. Please, contact a develoepr or the hosting support if you need further assistance.

    Thread Starter Brian Henry

    (@brianhenryie)

    > We do not disable other plugins in ANY case.

    You don’t mean to. But you definitely do.

    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    I don’t want to get further into this argument but we most certainly do not. Please, contact the hosting support to get additional assistance on this problem.

    Thread Starter Brian Henry

    (@brianhenryie)

    Add this to the beginning of your deactivator:

    $fopen_error_handler = function ( $errno, $errstr, $errfile, $errline ) {
    	if ( false !== strpos( $errstr, "failed to open stream: Too many open files" ) ) {
    		die();
    	}
    	return false;
    };
    set_error_handler( $fopen_error_handler, E_ALL );

    And add this to its end:

    restore_error_handler();

    And YOU can help users avoid the issues your plugin is documented as causing.

    “we didn’t design the car to do that, it was the road’s fault. We don’t need to add seatbelts.”

    • This reply was modified 3 years, 9 months ago by Brian Henry.
    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    We are definitely not adding this to our code. We can’t add checks for every other plugin that causes critical errors. That’s one of the reasons for the existence of critical errors, to stop the execution of a badly written code.

    Again, I would recommend consulting a developer to get help with your plugin throwing errors and causing others to malfunction. Much easier than asking every other plugin out there to ignore the bad code.

    If you want to learn more about the actual problem, please check out this link:
    https://stackoverflow.com/questions/14748499/fatal-error-too-many-open-files

    Thread Starter Brian Henry

    (@brianhenryie)

    An error handler surrounding your own code, as suggested above, only checks for errors that occur while your own code is executing.

    It would be but hubris to leave it out, knowing now what problems can occur.

    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    I will not add unnecessary checks and bloat to million+ users just because of a fatal error thrown by a piece of bad code. That would be hubris. If you have any other comments please provide POC that we are actualy causing any issue, otherwise I consider this thread as closed.

    Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Marking as resolved

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘NIGHTMARE: Disables ALL other plugins on deactivatioin’ is closed to new replies.