• Resolved Victor Font

    (@vfontj)


    Both Code Snippets free and Code Snippets Pro is broken on multiple sites. When I attempt to edit a snippet, clicking the save button produces a 404 file not found error.

    After these errors occur, I have to reboot Apache because the sites will crash with memory allocation errors.

    I cannot use Code Snippets on any of my production sites because of these issues. Here’s a video to demonstrate what’s happening:

    https://victorfont.s3.amazonaws.com/code-snippets-issue.mp4

    The PHP error log is loaded with Code Snippet Errors, these are the ones that are repeated often.

    [02-Aug-2022 09:53:50 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 28672 bytes) in /public_html/wp-content/plugins/code-snippets-pro/php/front-end/class-frontend.php on line 159

    [02-Aug-2022 10:05:25 UTC] PHP Deprecated: Return type of FS_Key_Value_Storage::offsetExists($k) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /public_html/wp-content/plugins/code-snippets-pro/vendor/freemius/wordpress-sdk/includes/managers/class-fs-key-value-storage.php on line 309

    • This topic was modified 2 years, 3 months ago by Victor Font.
    • This topic was modified 2 years, 3 months ago by Victor Font.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    It looks like you might need to bump the maximum memory size on your server. The amount of code you’re saving as a snippet is more than the current limit can handle.

    Thread Starter Victor Font

    (@vfontj)

    The snippet in the video is one of your samples on a freshly loaded plugin. Out of the box, the plugin is not saving snippets on either of the two sites on which it’s installed. Nevertheless, bumping up memory is one of the first things I tried. This is a dedicated server. Both sites are running the latest versions of Apache 2.4, PHP 8.1, and PHP-FPM.

    Thread Starter Victor Font

    (@vfontj)

    As an FYI, I changed the memory limit on one of the sites to unlimited, then to 512M. The plugin will not save snippets with either memory limit set. It will not work on these sites.

    I’ve been using Code Snippets for a long time on many sites. I recommend it to my clients and install it on every site I work on. There’s something definitely wrong.

    Plugin Author Shea Bunge

    (@bungeshea)

    Very strange. I appreciate the thorough investigating.

    Does the 404 page happen whenever you save any snippet, even an empty one? What does the URL in the address bar look like?

    Thread Starter Victor Font

    (@vfontj)

    An empty snippet saved the first time, then the 404 error.

    <domain>/wp-admin/admin.php?page=edit-snippet&id=6

    I’ve resaved permalinks, tested with PHP versions 7.4, 8.0, and 8.1.

    All caching is deactivated.

    I’ve rebuilt .htaccess from scratch.

    Deactivated PHP-FPM, reactivated PHP-FPM.

    I’ve even gone so far as to add rules to the WordFence firewall. Nothing is working to fix this.

    Thread Starter Victor Font

    (@vfontj)

    I found the problem! The Apache mod_security module was applying too much security. I disabled mod security and everything worked fine. A recent update to the OWASP? ModSecurity CRS broke WordPress. I’ll work with cPanel support to find out how to fix it.

    Thread Starter Victor Font

    (@vfontj)

    FYI, the exact rule in the OWASP? ModSecurity CRS that broke Code Snippets is rules/REQUEST-949-BLOCKING-EVALUATION.conf. Deactivate this rule and Code Snippets works fine.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘File Not Found When Saving Snippets’ is closed to new replies.