Warning array_flip(): Can only flip STRING and INTEGER values! - Error after update from EE3 to EE4

February 04, 2018 9:03am

Subscribe [2]
  • #1 / Feb 04, 2018 9:03am's avatar

    30 posts

    Trying to migrate site from EE3 to EE4.

    Getting this error after update ahead of page HTML - on all pages.

    array_flip(): Can only flip STRING and INTEGER values!
    ee/EllisLab/Addons/channel/, line 4245

    Am assuming it is Addon related somehow, but would value any insights about what / where.

    Wondering what happened to the promise from Ellis that EE3 - EE4 updates would not break EE3 addons…

  • #2 / Feb 05, 2018 2:21am

    Derek Jones's avatar

    Derek Jones

    7484 posts

    What addons do you have installed? Definitely haven’t seen that one, and a cursory glance looks like it would only be possible if an addon is overwriting template variables’ internals which would not be something ExpressionEngine could anticipate or prevent.

  • #3 / Feb 05, 2018 2:14pm's avatar

    30 posts


    Active add-ons are:

    AWS Products 4.1.0
    Category Construct 2.2.0
    CE Image 3.0.1
    Freeform Classic 6.0.0
    Freeform Lite 1.4.2
    Hop 404 Reporter 2.0.5
    Low Reorder 3.1.0
    Low Replace 3.0.0
    Low Search 5.2.0
    Low Seg2Cat 3.0.0
    Math 1.5.1
    Minimee 3.0.0
    Mo’ Variables 1.3.2
    Stash 3.0.6
    Streeng 1.10.0
    Switchee 3.0.0

    I’ll start removing them in turn to see if I can spot which the culprit is, but lack of a ‘disable option for add-ons in EE4 is a pain (you have to uninstall / reinstall)

    Seems this error pops up in drupal too -

    There, it seems to be a typing issue related to floats.

  • #4 / Feb 05, 2018 3:24pm

    Derek Jones's avatar

    Derek Jones

    7484 posts

    No need to uninstall, which also removes any content managed by those add-ons. Just head to Developer > Utilities > Debug Extensions, select all, Disable, submit. That will prevent any extensions from running, so the only add-on interaction would be visible from the tags in your template.

    > There, it seems to be a typing issue related to floats.

    Yeah, it’s a PHP no-no, but the array we are flipping are extracted template variables, which are strings. If disabling extensions doesn’t reveal it for you, let me know paste a code sample of a complete template that you’re seeing that error on.

  • #5 / Feb 05, 2018 7:43pm's avatar

    30 posts

    Hmm. Well that’s interesting - only seven of the 16 active addons appear in the debug list… they are:

    Low Reorder(2.3.0)
    Low Search(5.2.0)
    Low Seg2Cat(3.0.0)
    Mo' Variables(1.3.2)
    Rich Text Editor(1.0.1)

    Disabling those seven does not fix the problem. I’m surprised that the two solspace addons don’t show up - as both are explicitly the “EE4” versions, so presumably should be ‘well behaved’ ones.

    So it is back to uninstall / reinstall - but at least I’ve narrowed it down to nine.

    I’ll post back if I find out what is going on.

  • #6 / Feb 05, 2018 7:55pm

    Derek Jones's avatar

    Derek Jones

    7484 posts

    Only add-ons with extension components would show up in that list. Add-ons with extensions can interrupt and modify expected application behavior. So that narrows the issue down quite a bit. Rather than uninstalling add-ons, can you post a full template that you see this error on? It should be faster to create a reduction template to isolate the what’s triggering it, and then working from there.

  • #7 / Feb 05, 2018 8:05pm's avatar

    30 posts

    OK _ have been through the remaining addons and it would appear that the error is not caused by any of them (in so far as uninstalling each in turn does not cause problem to go away).

    So have tried a test page that calls the the base layout template without any active content (i.e. it just loads from the base layout template, with all layout variables set to nothing) and their are no php errors.

    Suggests that some intersection of layout content and EE4 itself is causing the problem.

    I’ll work through and see if I can isolate the content that is causing the problem…

  • #8 / Feb 05, 2018 8:09pm

    Derek Jones's avatar

    Derek Jones

    7484 posts

    So, happy to help here if you want to post a template that exhibits the problem. Third time I’ve asked now. 😉

  • #9 / Feb 05, 2018 9:32pm's avatar

    30 posts

    It seems the addon uninstall / reinstall process has somehow broken EE4 - now it is rejecting standard {layout="templates/_resources-cat-index"} type calls with a strange error:

    You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}.
    Parser State: Invalid Condition: Not enough operands for operator ” == “.
    In Template “templates/_resources-cat-index” on line 127

    Same code works just fine on donor EE3 site, and was working before - so reckon the DB is borked.

    So I’m going to dump the whole migration activity for now - which was just to find out what gremlins lurked in the process for this site, and it would seem plenty.

    I’ll wait until I have lots of time to spend and have another go then.

  • #10 / Feb 05, 2018 9:40pm

    Derek Jones's avatar

    Derek Jones

    7484 posts

    Uninstalling add-ons wouldn’t “break” ExpressionEngine, though uninstalling does destroy that addon’s data as I mentioned earlier, which could certainly introduce problems if those add-ons are expecting data where there is none. This is why I’ve recommended against that approach from the beginning and suggested a reduction template, and sharing the template with us so we can help and save you time. So what’s on that template at that line in the error message? Seriously, this is quite likely something very simple.

  • #11 / Feb 05, 2018 9:57pm's avatar

    30 posts

    The EE4 migration is on a MAMP installation so I can’t get you access to it.

    Have managed to restore an older version of the site from file backup, and tried turning off / on the addons that appear in the utilities thing and something along the way has got EE4 working again.

    The site uses layouts and layout variables - most pages bounce through two or three subsidiary templates to collect layout variable data before being rendered.

    So not quite sure what you want me to post.

    A simple template that just calls the final rendering template layout with no layout variables set does not throw the php errors, but it appears that all the normal pages (i.e. with real content) do. So my approach for a reduction template is to simply add back one layout variable at a time and see when it breaks again. But if there is some instance of the template you can describe that I can post let me know - I’ll do it tomorrow (3am here currently, so I better get to bed!).

  • #12 / Feb 05, 2018 10:00pm

    Derek Jones's avatar

    Derek Jones

    7484 posts

    Sure, don’t need access, just a look at the template. If multiple layouts or embeds are involved, you could post one complete copy as a Gist ( perhaps since it allows multiple files: the template and all parent layouts and partials called as a result.

    And yes, head to bed young man! Catch you tomorrow.

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

ExpressionEngine News!

#eecms, #events, #releases