Title: fclose() and unlink() errors
Last modified: August 21, 2018

---

# fclose() and unlink() errors

 *  Resolved [egycode](https://wordpress.org/support/users/egycode/)
 * (@egycode)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/)
 * Hello,
 * Thank you for the great and free plugin! I had these error on error log file 
   these are the stack trace log for the php errors
 * [21-Aug-2018 02:20:23 UTC] Exception: fclose() expects parameter 1 to be resource,
   boolean given ON ظwp-admin/admin-ajax.php in /wp-content/themes/reviewpro/functions.
   php:112
    Stack trace: #1 /wp-content/plugins/updraftplus/admin.php(1377): fclose(
   false) #2 /wp-content/plugins/updraftplus/admin.php(1193): UpdraftPlus_Admin-
   >do_updraft_download_backup(0, ‘db’, ‘1534816811’, ”, false, ”) #3 /wp-includes/
   class-wp-hook.php(286): UpdraftPlus_Admin->updraft_download_backup(”) #4 /wp-
   includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array) #5 /wp-includes/
   plugin.php(453): WP_Hook->do_action(Array) #6 /wp-admin/admin-ajax.php(100): 
   do_action(‘wp_ajax_updraft…’) #7 {main} [21-Aug-2018 02:20:23 UTC] Exception:
   unlink(): No such file or directory ON /wp-admin/admin-ajax.php in /wp-content/
   themes/reviewpro/functions.php:112 Stack trace: #1 /wp-content/plugins/updraftplus/
   admin.php(1378): unlink(”) #2 /wp-content/plugins/updraftplus/admin.php(1193):
   UpdraftPlus_Admin->do_updraft_download_backup(0, ‘db’, ‘1534816811’, ”, false,”)#
   3 /wp-includes/class-wp-hook.php(286): UpdraftPlus_Admin->updraft_download_backup(”)#
   4 /wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array) #5 /wp-
   includes/plugin.php(453): WP_Hook->do_action(Array) #6 /wp-admin/admin-ajax.php(
   100): do_action(‘wp_ajax_updraft…’) #7 {main}
 * Please fix these issues!
    -  This topic was modified 8 years, 1 month ago by [egycode](https://wordpress.org/support/users/egycode/).

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

 *  Plugin Author [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10611343)
 * > wp-admin/admin-ajax.php in /wp-content/themes/reviewpro/functions.php
 * This error, and the other one, are generated, according to the message you’re
   seeing, in the ‘reviewpro’ theme, not in UpdraftPlus.
 *  Thread Starter [egycode](https://wordpress.org/support/users/egycode/)
 * (@egycode)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10616112)
 * Thank you for your reply!
 * I use a php function that handle php errors which is located in theme functions.
   php file and it return the requested url in the error log as reference for me
   to investigate the error and I already removed the line from stack trace
 * And its obvious in the trace that its related to the updraft plugin!
 * /wp-content/plugins/updraftplus/admin.php(1377): fclose(false)
 *  /wp-content/plugins/updraftplus/admin.php(1378): unlink(”)
 * Also I got this error today after doing automatic backup to google drive!
 * [23-Aug-2018 02:24:42 UTC] PHP Notice: Undefined index: others in /wp-content/
   plugins/updraftplus/backup.php on line 664
 * Couldn’t log a stack trace by the custom php function that handle php errors 
   in functions.php file!
    -  This reply was modified 8 years ago by [egycode](https://wordpress.org/support/users/egycode/).
 *  Plugin Contributor [DNutbourne](https://wordpress.org/support/users/dnutbourne/)
 * (@dnutbourne)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10618398)
 * Hi,
 * What version of UpdraftPlus is currently installed on the site?
 *  Thread Starter [egycode](https://wordpress.org/support/users/egycode/)
 * (@egycode)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10618805)
 * Latest version.
 *  Thread Starter [egycode](https://wordpress.org/support/users/egycode/)
 * (@egycode)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10621574)
 * new error in the log today!
 * [24-Aug-2018 03:47:21 UTC] Backtrace from warning ‘constant(): Couldn’t find 
   constant DOING_CRON’ at /wp-content/plugins/updraftplus/class-updraftplus.php
   2712: /wp-admin/admin-ajax.php 100 calling do_action() –> /wp-includes/plugin.
   php 453 calling do_action() –> /wp-includes/class-wp-hook.php 310 calling apply_filters()–
   > /wp-includes/class-wp-hook.php 286 calling updraft_ajax_handler() –> /wp-content/
   plugins/updraftplus/admin.php 1431 calling backupnow() –> /wp-content/plugins/
   updraftplus/includes/class-commands.php 117 calling request_backupnow() –> /wp-
   content/plugins/updraftplus/admin.php 2066 calling do_action() –> /wp-includes/
   plugin.php 453 calling do_action() –> /wp-includes/class-wp-hook.php 310 calling
   apply_filters() –> /wp-includes/class-wp-hook.php 286 calling backupnow_database()–
   > /wp-content/plugins/updraftplus/class-updraftplus.php 2692 calling boot_backup()–
   > /wp-content/plugins/updraftplus/class-updraftplus.php 2933 calling get_semaphore_lock()–
   > /wp-content/plugins/updraftplus/class-updraftplus.php 2712 calling constant()
 *  Plugin Contributor [DNutbourne](https://wordpress.org/support/users/dnutbourne/)
 * (@dnutbourne)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10621971)
 * Hi,
 * It appears that the errors highlighted in your log are from functions where error
   reporting has been suppressed via the [‘@’ error control operator](http://php.net/manual/en/language.operators.errorcontrol.php).
   
   These are situations where a non-fatal error may be expected, but can safely 
   be ignored.
 * However, your custom error handler does not appear to support this. Your error
   handler should check that `error_reporting() === 0`, and abort if so (See [http://php.net/set_error_handler ](http://php.net/set_error_handler)
   for more details).
 *  Plugin Author [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10622056)
 * This is to say… in your custom handler, you are logging events whose type PHP
   is advising you are set to be ignored.
 * In [http://php.net/set_error_handler](http://php.net/set_error_handler), look
   at the paragraph beginning ‘It is important to remember that’; in particular 
   the info about the @ operator.
 *  Thread Starter [egycode](https://wordpress.org/support/users/egycode/)
 * (@egycode)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10622484)
 * Thank you both, [@dnutbourne](https://wordpress.org/support/users/dnutbourne/)
   and [@davidanderson](https://wordpress.org/support/users/davidanderson/)
 * I commented the case switch statement code in the function to log all error types!
   My bad!
 * But I think this error is a different situation, though
 * [23-Aug-2018 02:24:42 UTC] PHP Notice: Undefined index: others in /wp-content/
   plugins/updraftplus/backup.php on line 664
 *  Thread Starter [egycode](https://wordpress.org/support/users/egycode/)
 * (@egycode)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10622533)
 * By investigating the last error, i found it related to the prune_retained_backups
   function and it seem to occur every day when the backup is being created and 
   uploaded to google drive, the index others may be associated with the folder 
   others and it is triggered while deleting the retained backup from the remote
   server on gooole drive!
 * I reviewed the backup files on my google drive account and i found that backups
   created on 22nd of this month didn’t prune, I set the retain version to only 
   1, so from my understanding it should retain the backup created on 23rd and delete
   the backup created on 22nd? or I’m wrong!
 *  Plugin Contributor [DNutbourne](https://wordpress.org/support/users/dnutbourne/)
 * (@dnutbourne)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10632962)
 * Hi,
 * Apologies for the delay.
 * Please could you send us a copy of the latest backup log where this issue occurs?
   
   The contents will be too long to post here directly, but you can use an online
   service such as Pastebin, and post the link here.
 * Best Wishes,
    David N
 *  Thread Starter [egycode](https://wordpress.org/support/users/egycode/)
 * (@egycode)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10634171)
 * Sorry, the log file has been deleted and this error didn’t occur in the last 
   days! maybe it happen only if you try to create a specific backup like others
   folder after an automatic backup already created, the plugin will delete the 
   most recent same backup part (others folder) from the last full backup on remote
   storage! Is this implemented in your code?
 * Have a nice day!
 *  Plugin Author [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10638197)
 * > [23-Aug-2018 02:24:42 UTC] PHP Notice: Undefined index: others in /wp-content/
   > plugins/updraftplus/backup.php on line 664
 * There is indeed a gremlin there. It’s only affect is to cause a misleading log
   line in limited circumstances. Fixed now for our next release. Thanks for the
   report!
 *  Thread Starter [egycode](https://wordpress.org/support/users/egycode/)
 * (@egycode)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10675341)
 * > There is indeed a gremlin there. It’s only affect is to cause a misleading 
   > log line in limited circumstances. Fixed now for our next release. Thanks for
   > the report!
 * Sorry for the late reply, I was busy.. the error related to the index occurred
   again
 * [08-Sep-2018 02:10:06 UTC] PHP Notice: Undefined index: others in /wp-content/
   plugins/updraftplus/backup.php on line 664
 * Thanks.
    -  This reply was modified 8 years ago by [egycode](https://wordpress.org/support/users/egycode/).
 *  Plugin Author [David Anderson / Team Updraft](https://wordpress.org/support/users/davidanderson/)
 * (@davidanderson)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10685110)
 * Hi,
 * As I say, it’s fixed in the next release. Which was just made available, a few
   minutes ago.
 * David
 *  Thread Starter [egycode](https://wordpress.org/support/users/egycode/)
 * (@egycode)
 * [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10686303)
 * Sorry, I didn’t look at the date, I thought this was fixed in the last release
   as I didn’t see this thread long time ago..

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

 The topic ‘fclose() and unlink() errors’ is closed to new replies.

 * ![](https://ps.w.org/updraftplus/assets/icon-256x256.jpg?rev=1686200)
 * [UpdraftPlus: WP Backup & Migration Plugin](https://wordpress.org/plugins/updraftplus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/updraftplus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/updraftplus/)
 * [Active Topics](https://wordpress.org/support/plugin/updraftplus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/updraftplus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/updraftplus/reviews/)

 * 15 replies
 * 3 participants
 * Last reply from: [egycode](https://wordpress.org/support/users/egycode/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/fclose-and-unlink-errors/#post-10686303)
 * Status: resolved