CommentFileSizeAuthor
#2 bootstrap-2633892-2.patch765 bytespjcdawkins

Comments

pjcdawkins created an issue. See original summary.

pjcdawkins’s picture

Status: Active » Needs review
StatusFileSize
new765 bytes

markhalliwell’s picture

Status: Needs review » Fixed

I actually just ended up removing the conditional since it's not really needed (it will return the complete form if there are no array parents). Still gave ya credit though, thanks!

pjcdawkins’s picture

Then you should remove the comment too. And I think your commit doesn't fix this: the point is that you need to make a temporary variable to pass as the first argument to Element::create(), because it is treated as a reference.

  • markcarver committed 2482a97 on 8.x-3.x
    Issue #2633892 by pjcdawkins: Error: Cannot pass parameter 1 by...
markhalliwell’s picture

I'm not seeing this error. What version of PHP are you running?

Functions that return by reference (like NestedArray::getValue does) can be used as a parameter for a function/method that is expecting a referenced variable:

From http://php.net/manual/en/language.references.return.php:

To pass the returned reference to another function expecting a reference you can use this syntax:

function &collector() {
  static $collection = array();
  return $collection;
}
array_push(collector(), 'foo');

I've fixed the comment.

markhalliwell’s picture

FWIW I think you're confused as to why the error occurred before: it was a ternary expression (which doesn't return by reference).

Status: Fixed » Closed (fixed)

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