Import PHP errors
Posted: 22 July 2012 08:49 PM   [ Ignore ]
Wallflower
Rank
Total Posts:  4
Joined  2012-07-12

Hi,

When trying to import a generated json file, I get “No data” error from EE. I put some early exits in the code to try to narrow down the problem, and I get this php warning:

A PHP Error was encountered
    Severity
Warning
    Message
Invalid argument supplied for foreach()
    
Filenamelibraries/Package_installer.php
    Line Number
879 

That one error I could fix by changing from foreach ($data->$type as $package) to foreach ($data[$type] as $package), but then I just get other similar errors. I tried a regex replace on all things $xxx->$yyy areas to $xxx[$yyy], but that didn’t work either.

Any ideas?

Also my versions:
EE: 2.5.2
field editor: 1.0.3
php: 5.1.6

Profile
 
 
Posted: 24 July 2012 11:47 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  10256
Joined  2008-09-29

Our documentation says that vs. 5.1.6+ of PHP is required, but the function json_decode that we’re using is a 5.2+ function. It’s odd that you’re not getting a fatal error though. Normally something like

Call to undefined function json_encode() 

 

would output if you don’t have JSON PECL extension installed in PHP. Still… assuming that the version is NOT the problem, that leaves us with wondering why there’s no data type.

Can you post your json file (zipped) here so I can take a look.

 Signature 

We’re moving away from the forums, though not entirely and not immediately. Lack of support lately is coincidental to that. Unfortunately we’ve had a bad month with it, but we do not forsee that we will have any continued problems with support through our portal going forward, or on forums while we’re still transitioning. We will send out a newsletter and make additional notifications through twitter and other outlets over the coming weeks.

Moving forward; things returning to normal.

Profile
 
 
Posted: 24 July 2012 08:50 PM   [ Ignore ]   [ # 2 ]
Wallflower
Rank
Total Posts:  4
Joined  2012-07-12

Ah, I see why. Like you said, php < 5.2 doesn’t natively include the json functions, but I see that EE automatically includes json_services library, which adds those functions for you. The difference is that php’s native encode/decode default to object format, whereas ee’s encode/decode is associative array only. So $xxx->$yyy is fine when using php version >= 5.2, but when < 5.2, you’d have use $xxx[$yyy].

It’s not critical for us right now, but it’d be nice to have when dealing with older servers!

Profile
 
 
Posted: 25 July 2012 03:24 PM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  10256
Joined  2008-09-29

We usually try to keep our versions in sync with EE’s requirements.  I’ll have to discuss this with Rob to get his opinion on this particular issue.

 Signature 

We’re moving away from the forums, though not entirely and not immediately. Lack of support lately is coincidental to that. Unfortunately we’ve had a bad month with it, but we do not forsee that we will have any continued problems with support through our portal going forward, or on forums while we’re still transitioning. We will send out a newsletter and make additional notifications through twitter and other outlets over the coming weeks.

Moving forward; things returning to normal.

Profile