getting CRITICAL Uncaught TypeError: closedir(): Argument #1 ($dir_handle) must be of type resource or null, bool given in /home/superdarb/domains/doXXXXXssets.XXX/public_html/wp-admin/includes/file.php:168
Stack trace:
2022-04-28T22:26:02+00:00 CRITICAL Uncaught TypeError: closedir(): Argument #1 ($dir_handle) must be of type resource or null, bool given in /home/superdarb/domains/doXXXXXssets.XXX/public_html/wp-admin/includes/file.php:168
Stack trace:
#0 /home/superdarb/domains/doXXXXXssets.XXX/public_html/wp-admin/includes/file.php(168): closedir()
#1 /home/superdarb/domains/doXXXXXssets.XXX/public_html/wp-includes/functions.php(6198): list_files()
#2 /home/superdarb/domains/doXXXXXssets.XXX/public_html/wp-includes/class-wp-hook.php(286): wp_privacy_delete_old_export_files()
#3 /home/superdarb/domains/doXXXXXssets.XXX/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters()
#4 /home/superdarb/domains/doXXXXXssets.XXX/public_html/wp-includes/plugin.php(515): WP_Hook->do_action()
#5 /home/superdarb/domains/doXXXXXssets.XXX/public_html/wp-cron.php(126): do_action_ref_array()
#6 {main}
thrown in /home/superdarb/domains/doXXXXXssets.XXX/public_html/wp-admin/includes/file.php on line 168
168: @closedir( $dir );
6198: $export_files = list_files( $exports_dir, 100, array( 'index.html' ) );
286: $value = call_user_func_array( $the_['function'], $args );
310: $this->apply_filters( '', $args );
515: $wp_filter[ $tag ]->do_action( $args );
126: do_action_ref_array( $hook, $v['args'] );
168: @closedir( $dir );
Active plugins (10)
Classic Commerce by ClassicPress Research Team – 1.0.4
Classic SEO by ClassicPress – 2.0.1
Head Cleaner by Simone Fioravanti – 1.2.1
Disable Any Comment by Gieffe edizioni srl – 1.0.5
Ink Multi Vendor by InkThemes – 5.0
InkThemes Import Export by Krish PC – 1.1
LiteSpeed Cache by LiteSpeed Technologies – 4.6
NinjaFirewall (WP Edition) by The Ninja Technologies Network – 4.5.1
Ultimate Wordpress Auction Plugin by Nitesh Singh – 4.1.4
CC Compatibility for Woo Addons by Classic Commerce Research Team – 9999.1
PHP: 7.4.29
Classic Commerce version: 1.0.3
ClassicPress Version: 1.4.1
There are indeed changes to the @ at least in php
Also if some custom handler is set (which is theoretically possible to set server wide) it’d be thrown anyway, as I understand.
@darb are you running php 8 or perhaps setting an error handler?
I doubt it is the problem.
I’m looking at a code formatting changeset from WP, where the @ was removed, but I can’t tell if that was when the closedir was moved inside the if statement, where it should have always been.
This error likely isn’t hurting your site, since it is a cron run, but it shouldn’t happen either.
As per the recommendation of my web host, I turned off WP-Cron and runs an hourly cron job instead (which is a service provided by my web host). One result of this is that I am sent warning and error messages in email, even about some issues that would normally go unnoticed.
Since yesterday, I started getting the following email every hour, on each one of the CP sites I’m building:
/usr/local/bin/wp cron event run --due-now
--path=/home/public/www.arjayarana.xyz --quiet --no-color
completed at 2022-05-30 22:00:47 UTC after 4 seconds and produced the
following output:
Fatal error: Uncaught TypeError: closedir(): Argument #1 ($dir_handle) must
be of type resource or null, bool given in
/home/public/www.arjayarana.xyz/wp-admin/includes/file.php:168
Stack trace:
#0 /home/public/www.arjayarana.xyz/wp-admin/includes/file.php(168):
closedir(false)
#1 /home/public/www.arjayarana.xyz/wp-includes/functions.php(6198):
list_files('/home/public/ww...', 100, Array)
#2 /home/public/www.arjayarana.xyz/wp-includes/class-wp-hook.php(286):
wp_privacy_delete_old_export_files()
#3 /home/public/www.arjayarana.xyz/wp-includes/class-wp-hook.php(310):
WP_Hook->apply_filters('', Array)
#4 /home/public/www.arjayarana.xyz/wp-includes/plugin.php(515):
WP_Hook->do_action(Array)
#5
phar:///usr/local/bin/wp/vendor/wp-cli/cron-command/src/Cron_Event_Command.php(343):
do_action_ref_array('wp_privacy_dele...', Array)
#6
phar:///usr/local/bin/wp/vendor/wp-cli/cron-command/src/Cron_Event_Command.php(265):
Cron_Event_Command::run_event(Object(stdClass))
#7 [internal function]: Cron_Event_Command->run(Array, Array)
#8
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100):
call_user_func(Array, Array, Array)
#9 [internal function]:
WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#10
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491):
call_user_func(Object(Closure), Array, Array)
#11
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(417):
WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#12
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(440):
WP_CLI\Runner->run_command(Array, Array)
#13
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1237):
WP_CLI\Runner->run_command_and_exit()
#14
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28):
WP_CLI\Runner->start()
#15 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78):
WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#16 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(27):
WP_CLI\bootstrap()
#17 phar:///usr/local/bin/wp/php/boot-phar.php(11):
include('phar:///usr/loc...')
#18 /usr/local/bin/wp(4): include('phar:///usr/loc...')
#19 {main}
thrown in /home/public/www.arjayarana.xyz/wp-admin/includes/file.php on
line 168
/usr/local/bin/wp cron event run --due-now
--path=/home/public/www.arjayarana.xyz --quiet --no-color exited with
return code 255
I performed a recent upgrade to CP version 1.4.1, but based on the timing of the emails I got, this error started before I made the upgrade.
But as far as I can tell, by logging into the site and making a test post, “everything” is working fine.