Bug #73238 [Opn]: Function called from call_user_func() emits additional errors with newer PHPs

From: Date: Mon, 10 Oct 2016 22:10:51 +0000
Subject: Bug #73238 [Opn]: Function called from call_user_func() emits additional errors with newer PHPs
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204582@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73238&edit=1

 ID:                 73238
 Updated by:         yohgaki@php.net
 Reported by:        yohgaki@php.net
 Summary:            Function called from call_user_func() emits
                     additional errors with newer PHPs
 Status:             Open
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Irrelevant
 PHP Version:        7.0.11
 Block user comment: N
 Private report:     N

 New Comment:

More test code
https://3v4l.org/TZaVe (array)
https://3v4l.org/WMMQa (string)
https://3v4l.org/OEOA1 (return value check)

Removing error from call_user_func('foo', $value), when $value is object, is preferred.
foo() could be.

function foo(&$value) {
  if (is_string($value)) {
      $value = 'update $value';
  } else if (is_object($value)) {
      $value->some_var = 'add some_var';
  } else {
      trigger_error('You should pass string or object');
  }
}


Previous Comments:
------------------------------------------------------------------------
[2016-10-04 01:10:04] yohgaki@php.net

Description:
------------
As you can see, newer PHPs have additional errors with call_user_func().

https://3v4l.org/oBnkT

Warning: Parameter 1 to foo() expected to be a reference, value given in /in/oBnkT on line 10

Warning: Parameter 1 to foo() expected to be a reference, value given in /in/oBnkT on line 11


I found this errors from Wordpress installation.
https://wordpress.org/support/topic/wp-4-6-1-got-error-with-php-7-1/



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73238&edit=1


Thread (6 messages)

« previous php.bugs (#204582) next »