PHP7 causes error notice:

Notice: Only variables should be passed by reference auto_entitylabel_set_title() /auto_entitylabel.module 283 line).

Comments

nitrocad created an issue. See original summary.

nitrocad’s picture

It's very annoying, could this be solution?

/auto_entitylabel.module 282

 + $clone = clone $entity;
  - drupal_alter('auto_entitylabel_title', $titles, clone $entity);
 + drupal_alter('auto_entitylabel_title', $titles, $clone);
beumont’s picture

I have the same problem and cannot find any solution for this. I am using PHP 7

beumont’s picture

Tested:

/auto_entitylabel.module 282

+ $clone = clone $entity;
- drupal_alter('auto_entitylabel_title', $titles, clone $entity);
+ drupal_alter('auto_entitylabel_title', $titles, $clone);

Works!

zhouhana’s picture

Status: Active » Needs review
StatusFileSize
new586 bytes

Works for me as well. I made a patch out of nitrocad's solution. (If I did this wrong, be nice, it's my first patch in years.)

zhouhana’s picture

So I have this change committed in a separate issue branch in my local auto_entitylabel git repo, but I can't push. I get the error "fatal: unable to access 'https://git.drupal.org/project/auto_entitylabel.git/': The requested URL returned error: 403". Is this because I'm not a maintainer of the module? Should I let someone else push the change? Please excuse a patch newbie.

atiba’s picture

I've tried zhouhana's patch and I can confirm it works with PHP7. No notices anymore.

plazik’s picture

Title: PHP 7 error Notice » Only variables should be passed by reference auto_entitylabel_set_title()
Status: Needs review » Reviewed & tested by the community
Issue tags: -php7, -error, -notice

Path from #5 works for me too.

alesr’s picture

This issue usually happens when you update PHP or deal with its error and exception handling settings.
http://php.net/manual/en/migration70.incompatible.php

Many fatal and recoverable fatal errors have been converted to exceptions in PHP 7.

So you may now end up with this notice:

Only variables should be passed by reference auto_entitylabel_set_title()

Here's a rerolled patch from #5 to lose the hunks on applying.
RTBC without a doubt.

bmango’s picture

Patch from #9 fixed the error for me. Thank you

geraldito’s picture

Patch from #9 works for me too on PHP 7.0.16

giorgosk’s picture

#9 applies and works please commit

nwom’s picture

#9 worked great. Thank you!

renatog’s picture

Issue tags: +ciandt-contrib

Hi people.

Works Good. Thanks everyone.

  • renatog committed 3c65ee0 on 7.x-1.x authored by alesr
    Issue #2763941 by zhouhana, alesr, nitrocad, beumont, atiba, renatog,...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Commited in dev branch: 7.x-1.x.

Thank you very much.

Good Work and Good Week.

Regards.

Status: Fixed » Closed (fixed)

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