Support » Plugin: TablePress - Tables in WordPress made easy » PHP Warning with array keys

  • Resolved chuckingit

    (@chuckingit)


    Hi – i’ve been getting various php warnings in my error log file (see below) and thought i’d post here in case there is fix …

    i’m using latest version of WP but am also using TablePress on my blog which is part of Multisite Network … i’m not using the plugin on any of the other sites on the network (not yet that is) … i also imported the table from my previous WP-Table Reloaded table and all seemed to import fine … here again, WP-Table Reloaded was only being used on this one site on the network and with just this one table …

    thanks in advance for any pointers that can be shared … cordially, chuck scott

    from error log

    [20-Mar-2013 18:20:16] PHP Warning:  array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 531
    [20-Mar-2013 18:20:16] PHP Warning:  array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 532
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 534
    [20-Mar-2013 18:20:16] PHP Warning:  array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #1 is not an array in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 537
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 539
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 569
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 569
    [20-Mar-2013 18:20:16] PHP Warning:  array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 531
    [20-Mar-2013 18:20:16] PHP Warning:  array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 532
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 534
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 540
    [20-Mar-2013 18:20:16] PHP Warning:  array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 531
    [20-Mar-2013 18:20:16] PHP Warning:  array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 532
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 534
    [20-Mar-2013 18:20:16] PHP Warning:  array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #1 is not an array in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 537
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 539
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 569
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 569
    [20-Mar-2013 18:20:16] PHP Warning:  array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 531
    [20-Mar-2013 18:20:16] PHP Warning:  array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 532
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 534
    [20-Mar-2013 18:20:16] PHP Warning:  Invalid argument supplied for foreach() in /home/cooltea/public_html/wp-content/plugins/tablepress/controllers/controller-frontend.php on line 540

    http://wordpress.org/extend/plugins/tablepress/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi Chuck,

    thanks for your post, and sorry for the trouble!

    This should obviously not happen, and the only explanation I have, is that one of your tables is somehow corrupted.
    Could you go through the list of tables in the TablePress admin area and check if there’s a table with a name that starts with [ERROR]?
    That table is then broken, and we should then investigate what caused this.

    Regards,
    Tobias

    Thread Starter chuckingit

    (@chuckingit)

    Hi TobiasBG – thanks in advance for your help with this … i went in this AM and looked at my table … there is only one … so i exported it to see if error was anywhere in the table … it was not … but there are some extra double quotes that might be the issue and not sure if it is how i am importing it or how your code is handling html hrefs … details below …

    here is example of original table exported from TablePress … this snippet only shows first ten rows including the header:

    Domain Names,Domain Contact
    AvantiGroup.net,"<a href=""http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=100"" title=""This domain - AvantiGroup.net could be yours - click here to make an offer"">Contact Agent</a>"
    Avantigrp.com,"<a href=""http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=101"" title=""This domain - Avantigrp.com could be yours - click here to make an offer"">Contact Agent</a>"
    BcReports.com,"<a href=""http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=102"" title=""This domain - BcReports.com could be yours - click here to make an offer"">Contact Agent</a>"
    BizRSVP.com,"<a href=""http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=103"" title=""This domain - BizRSVP.com could be yours - click here to make an offer"">Contact Agent</a>"
    BizSafe.com,"<a href=""http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=104"" title=""This domain - BizSafe.com could be yours - click here to make an offer"">Contact Agent</a>"
    BohemianChic.com,"<a href=""http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=108"" title=""This domain - BohemianChic.com could be yours - click here to make an offer"">Contact Agent</a>"
    BrainLove.com,"<a href=""http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=110"" title=""This domain - BrainLove.com could be yours - click here to make an offer"">Contact Agent</a>"
    BusinessRSVP.com,"<a href=""http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=109"" title=""This domain - BusinessRSVP.com could be yours - click here to make an offer"">Contact Agent</a>"
    CandidCooking.com,"<a href=""http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=111"" title=""This domain - CandidCooking.com could be yours - click here to make an offer"">Contact Agent</a>"

    because the double quotes seem like they might be the issue, i thought that maybe this was due to table import from WP Table Reloaded so i created a new table …

    with the new table, i tried several import options and in each case got the same result upon table export … in all cases, after import the preview looked great thus gave me false security that all was well … it was only during file export and looking at the exported table locally did i see the double quotes …

    some of the import methods i tried included … first, “Manual Import with CSV” and that worked but export showed the extra quotes … then i tried “Manual Import with HTML” but this did not work in that i got an error message … then i tried import from file locally and ditto in that it worked but on export it showed extra quotes …

    here is how i constructed my initial table data ->

    Domain Names,Domain Contact
    AvantiGroup.net,<a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=100" title="This domain - AvantiGroup.net could be yours - click here to make an offer">Contact Agent</a>
    Avantigrp.com,<a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=101" title="This domain - Avantigrp.com could be yours - click here to make an offer">Contact Agent</a>
    BcReports.com,<a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=102" title="This domain - BcReports.com could be yours - click here to make an offer">Contact Agent</a>
    BizRSVP.com,<a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=103" title="This domain - BizRSVP.com could be yours - click here to make an offer">Contact Agent</a>
    BizSafe.com,<a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=104" title="This domain - BizSafe.com could be yours - click here to make an offer">Contact Agent</a>
    BohemianChic.com,<a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=108" title="This domain - BohemianChic.com could be yours - click here to make an offer">Contact Agent</a>
    BrainLove.com,<a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=110" title="This domain - BrainLove.com could be yours - click here to make an offer">Contact Agent</a>
    BusinessRSVP.com,<a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=109" title="This domain - BusinessRSVP.com could be yours - click here to make an offer">Contact Agent</a>
    CandidCooking.com,<a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=111" title="This domain - CandidCooking.com could be yours - click here to make an offer">Contact Agent</a>

    note the above is also only showing first ten rows …

    so then i figured maybe my html code in the second field was throwing off everything so i recreated the table in html as follows ->

    <table>
    <tr><td>Domain Names</td><td>Domain Contact</td></tr>
    <tr><td>AvantiGroup.net</td><td><a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=100" title="This domain - AvantiGroup.net could be yours - click here to make an offer">Contact Agent</a></td></tr>
    <tr><td>Avantigrp.com</td><td><a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=101" title="This domain - Avantigrp.com could be yours - click here to make an offer">Contact Agent</a></td></tr>
    <tr><td>BcReports.com</td><td><a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=102" title="This domain - BcReports.com could be yours - click here to make an offer">Contact Agent</a></td></tr>
    <tr><td>BizRSVP.com</td><td><a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=103" title="This domain - BizRSVP.com could be yours - click here to make an offer">Contact Agent</a></td></tr>
    <tr><td>BizSafe.com</td><td><a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=104" title="This domain - BizSafe.com could be yours - click here to make an offer">Contact Agent</a></td></tr>
    <tr><td>BohemianChic.com</td><td><a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=108" title="This domain - BohemianChic.com could be yours - click here to make an offer">Contact Agent</a></td></tr>
    <tr><td>BrainLove.com</td><td><a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=110" title="This domain - BrainLove.com could be yours - click here to make an offer">Contact Agent</a></td></tr>
    <tr><td>BusinessRSVP.com</td><td><a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=109" title="This domain - BusinessRSVP.com could be yours - click here to make an offer">Contact Agent</a></td></tr>
    <tr><td>CandidCooking.com</td><td><a href="http://cooltea.com/cgi-bin/start.cgi/avanti/stores/102-avantidomains/cart.html?id=111" title="This domain - CandidCooking.com could be yours - click here to make an offer">Contact Agent</a></td></tr>
    </table>

    and then imported this as html instead of csv … here again, preview looked fine but on export i got same double quotes …

    in the end, i suspect that i need to format my table somehow in order to play nice with your plugin ..??.. essentially this table is simple two columns with about 100 rows … the first column is a domain name, the second is a link to corresponding shopping cart …

    thanks again for any pointers you can share in this dept … cordially, chuck scott

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Chuck,

    thanks for this investigation!

    Don’t worry, your data is totally fine, and there’s no special format necessary. Also don’t worry about those double quotes in the CSV format. That’s a technical detail, namely the first of the two quotes “escapes” the second quote, so that that is not being used as a cell delimiter in the CSV file. So, your data is fine.

    The source for those messages in the error logs is that the “visibility” information of the table can not be read. It might be possible that the fix is as easy as saving the table again (which would then mean that this was just a temporary glitch somehow).
    So, please just save the table again and then check the error logs, if the issue still happens.
    If that is the case, I’d like to take a direct look at this on your site. Could you then please contact me via email (the address is in the main plugin file “tablepress.php”)?

    Regards,
    Tobias

    Thread Starter chuckingit

    (@chuckingit)

    Great – table resaved, i will keep an eye on error logs and am sending email now … thanks again :>) cheers – chuck scott

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Chuck,

    sounds good. Please keep me updated, if the error log messages persist.

    And thanks for the email, I’ve received it and will take a look shortly.

    Regards,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Warning with array keys’ is closed to new replies.