The each() function is deprecated as of PHP 7.2.

ParagraphsItemEntity.inc contains one instance of each() that should be replaced.

CommentFileSizeAuthor
#2 deprecated_each-2951390-2.patch528 bytesjoegraduate

Comments

joegraduate created an issue. See original summary.

joegraduate’s picture

Status: Active » Needs review
StatusFileSize
new528 bytes
berdir’s picture

Looks good.

cobadger’s picture

Status: Needs review » Reviewed & tested by the community

The patch eliminated the php7 warning.

banoodle’s picture

Hi and thanks for the patch!

Can someone provide me with details on how to reproduce this warning? We're not seeing this warning (and we have all warnings/errors and logging enabled) and I would ideally like to reproduce the warning prior to patching.

I know I may sound overly cautious, but this is for a very complex and highly customized site (that I didn't create), so I'd like to be sure I'm scrutinizing the right part of the module's functionality so as to not introduce new problems. I looked at the one occurrence of each() in the code and I think it should get invoked when a paragraph is added to a node entity (but I'm not sure). I tried adding paragraphs and nested paragraphs to nodes and also to content types, comments and taxonomy terms, but nothing is generating a warning.

vinmassaro’s picture

Patch works, thanks!

joe_carvajal’s picture

The patch worked for me also.
I think it's ready to be merged.

Thank you!

joe_carvajal’s picture

@banoodle In my case, there are no nested paragraphs and the warning is being showed. There are just different kind of paragraphs added to a single node (to a multivalued paragraph field). The warning is showed on node save.

salvis’s picture

This is what I'm seeing:

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in ParagraphsItemEntity->fetchHostDetails() (line 299 of sites/all/modules/paragraphs/ParagraphsItemEntity.inc).

I'm getting this in the watchdog log from a node with a simple paragraph with an image in an Image field (and text). Actually I'm getting it from retrieving the image from the private file system path, not the node itself.

I applied #2 to 7.x-1.0-rc5 and it fixes the issue.

gbirch’s picture

FWIW, patch #2 solves problem for me too. PHP 7.2

salvis’s picture

What does it take to get this committed?

Chris Gillis’s picture

Priority: Normal » Major

Let's please commit this?

shaneonabike’s picture

Agreed can we push this to the latest dev it's clogging up log files and a fairly easy fix

altagrade’s picture

Patch in #2 worked for our use case too.

salvis’s picture

What gives, @Berdir?

anybody’s picture

Confirming RTBC. 7.2 is widely used and this message fills up logs. Thank you all!

kreynen’s picture

Just deployed this to production.

Judging by the fact that the latest stable release of the D7 branch was February 2017 and there are 19 patches at RTBC, is it safe to say the D7 branch needs additional maintainers?

I looked for a meta issues about this, but #2692035: Backport 8.x tests to 7.x was the closest issue I could find.

With only 5 months until PHP7.1 is stops receiving security update and is truly EOL, cleaning up some of these PHP7.2 issues and noise is going to impact more installs.

miro_dietiker’s picture

Status: Reviewed & tested by the community » Fixed

I committed this change to clean-up the queue. Thx all for pushing. :-)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

joseph.olstad’s picture

Hello @mirio_dietiker, a release is within reach, every issue is marked RTBC reviewed and tested, it's tee'd up, just need someone to drive it home so we can get a tagged release of paragraphs 7.x-1.0-rc6 or 7.x-1.0?
#3027981: Plan for Paragraphs 7.x-1.0

anybody’s picture

Re-Confirming #22 - a new tagged release containing this PHP7 fix before Drupal 7 EOL would be lovely :)

anybody’s picture

2 years later no tagged release fixing this... sad story. ;)

anybody’s picture

joseph.olstad’s picture

@Anybody, please add your comment to #3027981: Plan for Paragraphs 7.x-1.0