Hi,

We're working heavily with the Drupal Forms API, and we had the following PHP fatal error: Function name must be a string in ....

After a brief lookup in the code, I've actually found that it was caused by a $t variable being not initialized before use in form.inc, like the other references to this $t in the same form.inc.

The attachment is a patch that fixes the problem (declaring $t properly).

Thanks,

G.R.

Comments

Status: Needs review » Needs work

The last submitted patch, d7-form-inc-get_t.patch, failed testing.

guyr_at_evision.ca’s picture

Status: Needs work » Needs review

d7-form-inc-get_t.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, d7-form-inc-get_t.patch, failed testing.

guyr_at_evision.ca’s picture

StatusFileSize
new458 bytes
guyr_at_evision.ca’s picture

Status: Needs work » Needs review

d7-form-inc-get_t.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, d7-form-inc-get_t.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new480 bytes

Re-rolled the patch.

@guyr_at_evision.ca: patches need to be created with -p1, which is the default when using git diff.

berdir’s picture

Priority: Critical » Major
Issue tags: +Needs backport to D7

Also, this needs to be applied against 8.x first and is IMHO not critical according to http://drupal.org/node/45111.

catch’s picture

Version: 7.x-dev » 8.x-dev
dawehner’s picture

StatusFileSize
new1.02 KB

Here is a test for this issue.

dawehner’s picture

StatusFileSize
new1.49 KB

Here is the patch and the test.

catch’s picture

The test isn't failing. Is that because the test bot isn't reporting back fatal errors or because the test itself isn't catching this?

dawehner’s picture

Status: Needs review » Needs work

Mh indeed manual running of the test doesn't fail.

It seems to be related to :)

          // Form elements of type 'radios' throw all sorts of PHP notices
          // when you try to render them like this, so we ignore those for
          // testing the required marker.
          // @todo Fix this work-around (http://drupal.org/node/588438).
          $form_output = ($type == 'radios') ? '' : drupal_render($form);
Niklas Fiekas’s picture

Status: Needs work » Closed (duplicate)

#1475666: Rollback - PHP error because of typo in form.inc line 3025 is a duplicate of this. As of that we should not use get_t(). Closing this one because because the other one has (given that is true) a fix and a test.