Woocommerce plugin - Warning: Invalid argument supplied for foreach() - wordpress

When I was in Hostgator server, it wasn't showing any warning. But when I tried to move the files to my friend's Godaddy Linux server, and when I accessed the site, am seeing the following warning at the top of the page.
Warning: Invalid argument supplied for foreach() in
/wp-content/plugins/woocommerce/includes/class-wc-post-types.php on
line 169
I have the WP-DEBUG constant in wp-config file set to FALSE.
Also, tried adding a php.ini file with the following contents:
display_errors = Off
expose_php = Off
But not getting resolved. Any reason why it happens in Godaddy?
EDIT
Even updated the Woocommerce plugin to the latest version. But still no use.

this mostly caused by PHP version so try to check which version of PHP you are using.

Related

Can't enter in my wordpress localhost, getting errors because of custom plugin

I uploaded custom plugin in my wordpress localhost,
after I activated it I've got an error:
Fatal error: Cannot redeclare true_plugins_activate() (previously declared in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php:7406) in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php on line 7465
Fatal error: Uncaught Error: Call to undefined function wp_kses_normalize_entities() in /Applications/MAMP/htdocs/wordpress/wp-includes/formatting.php:4333 Stack trace: #0 /Applications/MAMP/htdocs/wordpress/wp-includes/class-wp-fatal-error-handler.php(190): esc_url('https://wordpre...') #1 /Applications/MAMP/htdocs/wordpress/wp-includes/class-wp-fatal-error-handler.php(147): WP_Fatal_Error_Handler->display_default_error_template(Array, false) #2 /Applications/MAMP/htdocs/wordpress/wp-includes/class-wp-fatal-error-handler.php(52): WP_Fatal_Error_Handler->display_error_template(Array, false) #3 [internal function]: WP_Fatal_Error_Handler->handle() #4 {main} thrown in /Applications/MAMP/htdocs/wordpress/wp-includes/formatting.php on line 4333
Then I deleted this plugin, but anyway I can't enter because of this errors.
I tried to rename plugins folder to plugins_old, plugins.deactivate and etc., but nothing.
Also I entered inside phpmyadmin in options and active_plugins and replace everything with this a:0:{}, but nothing changed.
Can you help me, please?
So we discussed the issue somewhat in the question comments (this is the most important note for context)
Whatever happened here is a reflection of a corrupted WordPress install, not a plugin (even if this was the trigger). People have got these errors when upgrading WordPress or PHP [...] [but] I don't think that [true_plugins_activate] function should even be there once.
Someone also had this problem due to installing a plugin called "Monitization", which was malware.
So I'll say what I'd do in this situation.
I would open the functions.php file (in the folder wp-includes) in a text editor, search for "true_plugins_activate" and look inside the contents for any PHP files I didn't recognise. This would only give me information as to whether something unfamiliar (like malware in the plugin with a different name) was involved, but it's clear you know which plugin caused this.
Then, I would reinstall the wordpress files that are corrupted. I would find the version of WordPress that I had installed, then I would download the zip file from https://wordpress.org/download/releases/, extract it, then first copy the two files that show in the error, replacing the originals in wp-includes. I would check if this fixes the problem. Even if it does, I would most likely copy over all the other files. (I might move any plugins or themes I had installed to a separate location, so that they don't get overwritten.)
If I was feeling very investigative, before copying, I would do a diff check of my entire WordPress installation with the WordPress download to see exactly what files were different and how. There are many programs that can do this.
You said that everything was fine after removing both "true_plugins_activate"s, but I would not come to this conclusion so fast, because there was another error in the log that affected a totally different file, wp-includes/formatting.php. I would definitely reinstall multiple or all WordPress files after this.

Wordpress failed update plugins after core upgrade in a new server

I moved a WordPress site from a cpanel server to plesk server. Then, i upgraded manualy the site from 3.5.1 version to 4.8.3. Afterwards i tried to upgrade plugins (fancy box) as well as to intall new plugins (contact form 7).
The issue i have is that i get the following error message "Update Failed: Download failed. Destination directory for file streaming does not exist or is not writable.".
In the server's log file i can see few warning like the following one
mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(/home/dentist/domains/dentist.com.gr/public_html/newsite/wp-content/uploads//easy-fancybox.1.6.2-Vlaovu.tmp) is not within the allowed path(s): (/var/www/vhosts/ggeorgiou.gr/ggeorgiou.work/:/tmp/) in /var/www/vhosts/ggeorgiou.gr/ggeorgiou.work/wd/dentist.com.gr/wp-includes/functions.php on line 2085, referer: http://www.ggeorgiou.work/wd/dentist.com.gr/wp-admin/plugins.php
Finally, note that in "Settings --> Media" menu in "
Store uploads in this folder" field i have put the following path of the current server: "/var/www/vhosts/ggeorgiou.gr/ggeorgiou.work/wd/dentist.com.gr/wp-content/uploads".
Any idea please what is wrong about?
Thank you
From what you posted, your exact error message is "open_basedir restriction in effect". You can read more about how to solve it here How can I relax PHP's open_basedir restriction?
Also,
Assuming you have a backup of the previous version, I would start by restoring that.
Secondly, there are many versions between 3.5.1 and 4.8.3. It is advisable to upgrade in increments of one version at a time. It is long but safer.

Wordpress error after upgrade "cannot redeclare" + "eval()'d"

Getting this error after a forced wordpress upload (I was working in the database when at one point of time I got an alert - while on the backend, with only one option to upgrade to the newer available version):
Fatal error: Cannot redeclare _421736532() (previously declared in /home/user/domains/mydomain.com/public_html/wp-content/themes/twentyelevenmodified/header.php(68) : eval()'d code:1) in /home/user/domains/mydomain.com/public_html/wp-content/themes/twentyelevenmodified/header.php(68) : eval()'d code on line 1
The above is when I try mydomain.com
When I try mydomain.com/wp-admin/, I am redirected to wp-login.php and getting the following error:
Fatal error: Cannot redeclare _421736532() (previously declared in /home/user/domains/mydomain.com/public_html/wp-login.php(80) : eval()'d code:1) in /home/user/domains/mydomain.com/public_html/wp-login.php(80) : eval()'d code on line 1
Pulling my hair out trying different things since 5 hours now. Any help will be appreciated.
EDIT: After testing, I found that the function.php file is correctly calling function twentyeleven_header_style() and the problem is coming just after calling this function. So it's the next function call that is causing the problem. If I could know what is the next function !!!
Wordpress doesn't use functions with those names. Deactivate your plugins or rename the plugins folder.
If that doesn't work then it's probably coming from your theme. Rename your theme folder so wordpress will revert to the default (assuming the default theme exists).
It sounds like you purchased a theme or plugin with obfuscated code and it's using eval() to run it and probably making a call home.
After much research, I found that the site in question was hacked. More than 100 files were corrupted with codes. I cleaned them all and now things are functioning.
For others facing the same problem, download the whole files to your computer and look for eval codes (can be easily recognized).

TimThumb error: Could not get a lock for writing

I am using a nivo slider for a wordpress theme... just out of the blues the slider broke. You can see it here www.habitude.ca
When i copy the img url to the browser I get the following error.
A TimThumb error has occured
The following error(s) occured:
Could not get a lock for writing.
Query String : src=http://habitude.ca/wp-content/uploads/2012/07/rock_bottom1.jpg&h=316&w=980
TimThumb version : 2.8
Any help would be greatly appreciated.
This error means some sort of directory permissions issue on the cache directory so make sure your php script can write to the cache directory.

TimThumb images not showing - On inspection error is shown

Wondering if you can help me. I have installed a theme that comes with TimThumb.
However when I set the featured image, and view the blog, the images doesn't load, when I right click and click view image in a new tab I get the following error message:
A TimThumb error has occured
The following error(s) occured:
Could note create the index.html file.
Could note create cache clean timestamp file.
Query String : src=http://demo.webempire.net.au/shi/wordpress/wp-content/uploads/2012/01/menora2_kitchen011.jpg&w=144&h=94
TimThumb version : 2.8.3
Any suggestions/help would be appreciated.
I ran into this issue.
define ('FILE_CACHE_DIRECTORY', '');
was set in timthumb-config.php . This gave me these errors:
touch() [<a href='function.touch'>function.touch</a>]: Utime failed: Permission denied in timthumb/timthumb.php on line 469
in timthumb/error-log.
Commenting out the line in timthumb-config.php set timthumb.php to use ./cache as the cache folder instead of the system tmp folder, and fixed avoided the permission issues.
The problem was that another user already had a timthumb_cacheLastCleanTime.touch in /tmp
Wiping didn't work but changing the permissions to 777 did. Via filezilla.

Resources