ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Safecracker PHP error: "Illegal Offset Type"

March 25, 2011 1:34am

Subscribe [7]
  • #31 / Apr 06, 2011 8:41pm

    benek

    189 posts

    This got me excited for a moment, but unfortunately does fix the issue for me.

    I thought it did at first. I tried editing some of the details in SC and I was not getting the errors. Then I realized that the “similar artists” relationship fields in the CP were left blank for that entry. As soon as I made a selection on one or more of those and saved the entry in the CP the problem came back. Now trying to edit in SC creates the PHP errors again.

    It also looks like when I edit the entry in SC it resets or clears what was selected in those relationship fields. I do not have those fields available in SC. I want them only visible to admin. But I’m guessing having them not included is somehow returning a value of 0 or null instead of skipping over them. I previous had them included as a test and that didn’t fix the issue, so not sure what’s going on there.

    Anyway, in my case the problem is exactly the same as it had been, but I’m glad this sounds like a lead. Removing the relationship fields from the entries entirely isn’t an option for me, so what else can we do to get SC to play nice with related entry fields? Has anyone else reported problems with SC and relationship fields?

    Also, I’m still noticing on my main “Band Details” SC form that the data doesn’t save at all, except for the categories which save just fine. All other parts of that SC form have no effect at all. Does this also have to do with the relationship fields or is there something else going on here?

    I haven’t even tried creating a new user and new entry yet. That’s something I was going to test once the edit option was working.

    I’m eagerly anticipating some more assistance on this.

  • #32 / Apr 07, 2011 1:23pm

    Lisa Wess

    20502 posts

    Thanks for the follow-up, benek.  I’ll make sure that the team continues to look at this for you.

  • #33 / Apr 07, 2011 5:26pm

    Greg Aker

    6022 posts

    Hi benek,

    I spent a few hours on this for you today, and it seems that the last bit jamming you up was some ‘bad’ relationships in the relationship table.  I went ahead and cleared them out.  Between that and the fix Robin gave you (is that still applied), I think you should be good to go. 

    Can you please verify?

    Thanks,

    -greg

  • #34 / Apr 07, 2011 8:53pm

    benek

    189 posts

    Greg, I really appreciate your time on this.

    I hate to say it but I don’t see any improvement at all. Here’s what I’m doing:

    1) In CP make sure there is at least one “similar artist” selected on the entry “Test Band One”.
    2) In a different browser log in to “band admin” as member “Test Band One”.
    3) Click on “Band Details” and edit info.
    4) Save changes.

    What happens here is still same as before. No info will save except for the categories (genre).

    Alternatively

    1) In CP make sure there is at least one “similar artist” selected on the entry “Test Band One”.
    2) In a different browser log in to “band admin” as “Test Band One”.
    3) Click on “Photos”, “Video”, “Audio” or “Testimonials” and edit info.
    4) Save changes.

    In this case I still get the PHP errors when viewing the entry page by admin, but the edits do get saved.

    I also notice on the first test I did the “Similar Artists” area was returning a string of gobbledygook text. I had to re-save the entry in CP to get that to display properly. On the second test I did (edit photos) I’m pretty sure those similar artists related entries fields got reset to null and I had to reselect values in CP and re-save to get them showing up.

    So I still have two issues going on:

    1) Band Details form will not save any info (except categories/genre), but as of now does not return the PHP error.

    2) All other band admin SC forms save properly, but cause PHP error on the entry page when viewed by admin.

    Are both issues still a problem with the relationship fields?

  • #35 / Apr 08, 2011 11:22am

    Lisa Wess

    20502 posts

    Hi, benek - thanks for the update.  I’ll make sure the dev team is aware of the ongoing issues.

  • #36 / Apr 08, 2011 11:26am

    Greg Aker

    6022 posts

    Hi benek,

    Thanks for the update.  I’m reproducing your issues locally now, so will update you when I have a fix!

    Thanks,

    -greg

  • #37 / Apr 08, 2011 12:55pm

    Greg Aker

    6022 posts

    Hi benek,

    I think the last issue boiled down to this in the template, which was throwing a MySQL error:

    <label for="band-price">Price</label>
    <div class="radioGroup">
        {options:band-price}
        <input type="radio" name="band-price[]" value="{option_value}" {checked}> {option_name}
    
        {/options:band-price}
    </div>

    And changing it to:

    <label for="band-price">Price</label>
    <div class="radioGroup">
        {options:band-price}
        <input type="radio" name="band-price" value="{option_value}" {checked}> {option_name}
    
        {/options:band-price}
    </div>

    We submitted the form via SafeCracker, viewed on the front end and received no errors.  Then added in the relationship in the admin control panel, still no errors. 

    Can you please check to see if that does it?  If not, hit us with a URL where you’re seeing the error, as I’m not finding any at this point.

    Thanks!

    -greg

  • #38 / Apr 08, 2011 7:58pm

    benek

    189 posts

    Greg,

    That has fixed the issue with the Band Details page not saving. Thanks for spotting that!

    However, I’m still getting the PHP errors. I will explain how to reproduce:

    1) Go to http://weddingbands.co.nz/user and log in with the “Test Band One” account
    2) Click on “Band Details”
    3) Edit any of the info
    4) Save Changes
    5) In a different browser login to CP as any super admin
    6) View this page http://weddingbands.co.nz/band/test-band-one
    7) There will be the PHP error on top repeated twice

    The only way to remove the PHP from showing at the top of the page is to re-save the entry in CP.

    I’m also noticing that in the process of saving the SC form the similar artists relationship fields are being erased. If you save the form and then re-save in CP, the next time you save the SC form it may not produce the PHP errors because the relationship fields are now empty. But as soon as you reselect a relationship and re-save in CP, the next edit in SC will bring back the errors.

    So there’s still something going wrong with the relationship fields it seems.

  • #39 / Apr 08, 2011 8:03pm

    Greg Aker

    6022 posts

    ah okay.  It looks like there were still two “bad” relationships in your exp_relationships table.  I deleted those, so give it one more try.  I think we’re close!

    -greg

  • #40 / Apr 08, 2011 8:10pm

    benek

    189 posts

    Still no dice.

    I’m getting more clues to what’s going on though.

    If I got into CP and set only one related field it produces only one error. If I select three is produces three PHP errors.

    Is it possible these “bad” entries are being created every time the SC form is saved (as long as they had values previous to editing in SC)?

    That’s why each time I re-test it brings back the problem.

  • #41 / Apr 09, 2011 11:04am

    Greg Salt

    3988 posts

    Hi benek,

    Thanks for the update and thank you for your patience whilst we continue to investigate this.

    Cheers

    Greg

  • #42 / Apr 11, 2011 12:34pm

    Greg Aker

    6022 posts

    Hi benek,

    Okay, I think we have it knocked out now.  Can you please double check?

    We were missing an ‘if’ on line 446:

    if ($this->query->num_rows() != 0)
        {
            $this->categories = array($this->query->row('entry_id')  => $reldata['categories']);
    
            if (isset($reldata['category_fields']))
            {
                $this->catfields = array($this->query->row('entry_id') => $reldata['category_fields']);
            }                            
        }

     

    Thanks!

    -greg

  • #43 / Apr 11, 2011 1:21pm

    Sean G

    8 posts

    Seems to have fixed the problem for me!

    (I’m also using related entries on the pages where this error occurs).

    I’ll be keeping an eye on it and post here if anything else comes up.

    Thanks for the hard work, Greg!

    Sean

  • #44 / Apr 11, 2011 5:32pm

    Sue Crocker

    26054 posts

    Yeah for Greg! We can keep this open a bit longer..

  • #45 / Apr 11, 2011 5:58pm

    benek

    189 posts

    I’ll have a chance to test in a few hours. I’m stoked if this is finally solved!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases