We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

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

News and General

JCOGS Design's avatar
JCOGS Design
71 posts
7 years ago
JCOGS Design's avatar JCOGS Design

Trying to migrate site from EE3 to EE4.

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

Warning
array_flip(): Can only flip STRING and INTEGER values!

ee/EllisLab/Addons/channel/mod.channel.php, 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…

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

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.

       
JCOGS Design's avatar
JCOGS Design
71 posts
7 years ago
JCOGS Design's avatar JCOGS Design

Hi.

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 - https://medium.com/@bluetegu/php-warning-riddle-can-only-flip-string-and-integer-values-cc0486a9ea5f

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

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

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.

       
JCOGS Design's avatar
JCOGS Design
71 posts
7 years ago
JCOGS Design's avatar JCOGS Design

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)
Minimee(3.0.0)
Mo' Variables(1.3.2)
Rich Text Editor(1.0.1)
Stash(3.0.6)

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.

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

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.

       
JCOGS Design's avatar
JCOGS Design
71 posts
7 years ago
JCOGS Design's avatar JCOGS Design

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…

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

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

       
JCOGS Design's avatar
JCOGS Design
71 posts
7 years ago
JCOGS Design's avatar JCOGS Design

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:

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.

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

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.

       
JCOGS Design's avatar
JCOGS Design
71 posts
7 years ago
JCOGS Design's avatar JCOGS Design

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!).

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

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 (gist.github.com) 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.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.