Warning: Invalid argument error

Home Forums Support Warning: Invalid argument error

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #136813
    Kat

    Hello
    Hope you may be able to advise what this error message means – this has appeared on the home page after moving the website from the test directory to the public_html folder:

    Warning: Invalid argument supplied for foreach() in /home/diamondp/public_html/wp-content/plugins/gp-premium/addons/generate-sections/functions/generate-sections.php on line 151

    Thanks
    Kitka

    #136843
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    What version of GP Premium are you using?

    How did you migrate the site to the new directory? I suggest giving the Duplicator plugin a try – it moves everything over seamlessly and should stop weird errors like this from happening.

    Let me know 🙂

    #136850
    Kat

    Thanks. The GP version is Version: 1.3.13

    I placed a copy of all WordPress files in the public_html folder, copied the wp-content folder over and made a copy of the database but did a find-and-replace to edit out the path to the test directory. I have moved dozens of WordPress sites in this way.

    Kitka

    #136851
    Tom
    Lead Developer
    Lead Developer

    Doing a copy and paste in the DB can work but can also cause issues (I’ve dealt with them first hand).

    Can you try using Duplicator so we can see if it was the migration process that caused the issue?

    Basically that error is saying there should be sections but it can’t find any in the DB.

    #136853
    Kat

    Is this the plugin you refer to?

    https://wordpress.org/plugins/duplicator/

    Kitka

    #136985
    Tom
    Lead Developer
    Lead Developer

    That’s the one! It may be worth trying just to see if it was the migration process that caused the issue.

    Let me know 🙂

    #227643
    Elizalde

    Hi Tom,

    This is very unfortunate for me because I am not able to execute the duplicator plugin because it always say “error in processing”. It has an issue in Godaddy. I have been trying to backup my site and tried to restore it to a localhost linux server and to another Godaddy account but unfortunately, the sections are broken and I am seeing a message saying “Warning: Invalid argument supplied for foreach() in /home/XXXXX/public_html/XXXXX/wp-content/plugins/gp-premium/sections/functions/generate-sections.php on line 197”. I have tried using the method of Kitka and as what she said, I’ve also tried this method a lot of times already and it always work. Duplicator has issues in Godaddy and now I’m paranoid about not having a working backup.

    Thanks in advance!

    #227644
    Elizalde

    I’ve also got this another warning message in the same page i’ve posted above. “Warning: Invalid argument supplied for foreach() in /home/XXXXX/public_html/XXXXX/wp-content/plugins/gp-premium/sections/functions/templates/template.php on line 40”

    Hoping you could help me sort this out.

    #227721
    Tom
    Lead Developer
    Lead Developer

    Sections are saved as a serialized table in the database. When people do a search/replace for their URL in the database, it breaks serialized tables (not just Sections, but any serialized tables).

    That’s why plugins like BackupBuddy, Duplicator, Updraft Plus etc.. are so useful, as they take care of issues like this for you.

    Those warnings are happening because the page thinks it should have sections, but those sections no longer exist in the database, most likely due to search and replacing of URLs.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.