4

Solution was to save entries until the entries with "bad data" were saved over.

I wrote a quick tag to display all entries in a list from a particular channel. However, it threw a bunch of PHP warnings. This is the tag.

<ul>
{exp:channel:entries disable="categories|pagination|member_data" channel='member' dynamic='off'}
    <li><a href="{page_url}">{title}</a></li>
{/exp:channel:entries}
</ul>

In my first round of troubleshooting I found that if I limited the loop to a certain number (let's say 27) of entries the tag would render as expected. But if I'd change the limit to 28, the error would throw. I would assume that this means there is corrupt data in some entries... but not all?

I've since discovered that if I disabled custom fields the tag would render. Further troubleshooting led me to start disabling/uninstalling fieldtypes. After much of trial and error it seems that any fieldtype that has data stored in the database will cause the php warnings.

Now, what is odd (to me) is that if I declare a specific entry id's there is not an error. These entries include ones that are known to instigate the php errors.

entry_id="642|643|644|646|647|648"

There is definitely something awry in the database, I don't see anything that jumps out at me when I take a look at the sql, but I don't have the best mySQL skills.

Where do I look next?

The errors read as following:

A PHP Error was encountered Severity: Notice Message: Undefined index: Filename: channel/mod.channel.php Line Number: 4785
A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: channel/mod.channel.php Line Number: 4787
A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /***/system/codeigniter/system/core/Exceptions.php:170) Filename: core/Common.php Line Number: 412
Fatal error: ob_start() [ref.outcontrol]: Cannot use output buffering in output buffering display handlers in /***/system/codeigniter/system/core/Exceptions.php on line 166

System facts

  • updated to 2.5.5
  • Errors happen locally and on live servers
  • Have around a thousand entries, so saving each one isn't a great option

  • 2
    • What is the actually PHP error that's being thrown? Dec 28, 2012 at 20:59
    • Updated with errors. Note: I experimented with some parameters (search:member_description="IS_EMPTY") and got expected results, listing hundreds of entries. Dec 28, 2012 at 21:06

    1 Answer 1

    4

    Have a look at your 28th most recent entry in the Edit screen - chances are there's some bad data in one of your fields (or maybe data for a field that no longer exists). Re-save it and see if the error persists.

    7
    • I agree with Derek. It sounds like you've got some bad data. Someone may have tried to submit some executable code in the name field or something and its its causing issues. Your records aren't sorted, so I assume it's pulling in ascending order. I'd pull record 28 and see what's in it. Alternatively, you can sort in descending order to see how many records that gets you. Dec 28, 2012 at 21:23
    • Just for the record, the error is being thrown in the function trying to process custom data entry fields. I'm not certain what custom fields you have, but try pulling record 28 in the control panel (it may throw errors there as well). Dec 28, 2012 at 21:28
    • I deleted that entry and sure enough the 28th (next entry) appeared. However, it seems there are quite a few entries with this "bad data" as I am still getting the error on the full tag. Is there a way to find out what is causing it? I deleted all fields in the next entry that is causing the error but that did not work. Dec 28, 2012 at 21:31
    • Just noticed the above comments, I'll do some more digging, but I am sure I will get it sorted out now. let you know the result. Dec 28, 2012 at 21:32
    • For the bad data, it frequently depends on how the data was collected. If these were people registering for your website, using a form on your website, then unfortunately, you can have a lot of bad data. Spam bots to people who are paid to manually register new accounts, to see if the can add marketing links, bork your database or get into other mischief will happen. There is a plugin called 'Barricade' devot-ee.com/add-ons/barricade that will help you clean your members database, but that needs to happen regularly. Dec 28, 2012 at 23:09

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

    Not the answer you're looking for? Browse other questions tagged or ask your own question.