GoSuccess
Forum Replies Created
-
@bruandet I have the same problem on all my websites. This is my analysis, which may help you reproduce and fix the error:
◉ Error Message
PHP Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(/var/www/.../wp-content/session): Failed to open directory: No such file or directory in /var/www/.../wp-content/plugins/ninjafirewall/lib/class-helpers.php:29◉ The Problem
The
NFWSESSION_DIRconstant is defined inconsistently in two different files:1. In
ninjafirewall.php(line 71) (incorrect):define('NFWSESSION_DIR', NFW_LOG_DIR .'/session');Since
NFW_LOG_DIR=WP_CONTENT_DIR, this resolves to:wp-content/session❌2. In
lib/firewall.php(line 89) (correct):define('NFWSESSION_DIR', "{$nfw_['log_dir']}/session" );Since
$nfw_['log_dir']=wp-content/nfwlog, this resolves to:wp-content/nfwlog/session✅3. Additional inconsistency in
lib/class-nfw-session.php(line 46):self::$session_dir = NFW_LOG_DIR .'/sessions'; // Note: 'sessions' with 's'This fallback would resolve to:
wp-content/sessions(yet another different path!)◉ How the Bug Manifests
- When the firewall is active: The
firewall.phpscript runs first and correctly definesNFWSESSION_DIRaswp-content/nfwlog/session. Session files are created in the correct location. - When the cron job runs: The garbage collector (
nfwgccron) is triggered via WP-CLI or WordPress cron. In this context,ninjafirewall.phploads first (without the firewall), and definesNFWSESSION_DIRincorrectly aswp-content/session. - The crash: The garbage collector in
lib/utils.php(line 633) calls:
$list = NinjaFirewall_helpers::nfw_glob( NFWSESSION_DIR, '^sess_', true, true );This attempts to iterate over
wp-content/session/which doesn’t exist, causing theDirectoryIteratorto throw anUnexpectedValueException.◉ Fix
Primary Fix (ninjafirewall.php, line 71)
Change:
define('NFWSESSION_DIR', NFW_LOG_DIR .'/session');To:
define('NFWSESSION_DIR', NFW_LOG_DIR .'/nfwlog/session');Secondary Fix (lib/class-nfw-session.php, line 46)
For consistency, also change:
self::$session_dir = NFW_LOG_DIR .'/sessions';To:
self::$session_dir = NFW_LOG_DIR .'/nfwlog/session';Defensive Fix (lib/class-helpers.php, line 27)
As an additional safeguard, add a directory existence check in the
nfw_glob()function:public static function nfw_glob( $directory, $regex, $pathname = false, $sortname = true ) { $list = []; // Add this check to prevent crashes if directory doesn't exist if ( ! is_dir( $directory ) ) { return $list; } foreach ( new DirectoryIterator( $directory ) as $finfo ) { // ... rest of the function } }The same defensive check should be added to the
nfw_glob_recursive()function in the same file.◉ Steps to Reproduce
- Install NinjaFirewall 4.8.1
- Enable the firewall (this creates sessions in the correct directory)
- Wait for the garbage collector cron to run, or trigger it manually via WP-CLI:
wp cron event run nfwgccron- Observe the fatal error in the PHP error log
Forum: Plugins
In reply to: [XML Cache] Please add category paginationBut the slash did not appear.
As already mentioned, we will fix the slash in a later update, because technically it makes no difference in this case.
Forum: Plugins
In reply to: [XML Cache] Please add category paginationNew update (1.2.1) is online, which should fix the “Undefined variable $numpage” error. Let me know if it works for you.
Forum: Plugins
In reply to: [XML Cache] Please add category paginationCan you tell me which PHP and WP version you are using and are custom post types used?
We are aware of the missing slash. Technically, it makes no difference in this case, but we will correct this in another update.
Forum: Plugins
In reply to: [XML Cache] Please add category paginationHi @ikiterder,
I am pleased to inform you that we have just released a new version: 1.2.0
The new version supports paginated …
- categories
- Tag pages
- blog page
- frontpage
We are still working on paginated archives.
I hope the new version will help you. 🙂
Forum: Plugins
In reply to: [XML Cache] Please add category paginationHi @ikiterder,
thank you for your request! 🙂
Paginated categories is not easy to implement. But we are working on it. The same applies to the implementation of paginated archives. However, I can’t give you an ETA at the moment.
XML Cache already supports paginated posts and pages.
Forum: Plugins
In reply to: [XML Cache] Paginated Archives/Tags/Categories?Hi @shirtguy72,
as of version 1.1.0, XML Cache supports paginated posts and pages.
Forum: Plugins
In reply to: [XML Cache] Paginated Archives/Tags/Categories?Hi @shirtguy72,
sorry for the delay in replying. Did not receive a notification.
XML Cache does not support paginated pages at the moment. We would love to offer this feature in the future. But we still have to check if and how we can implement it.
I can’t give you an ETA on this yet, but it’s definitely something we’re looking into and will implement if possible.
Thanks for your contribution!
- When the firewall is active: The