Error message in tests in local machine is

Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in Drupal\Core\Form\FormBuilder->doValidateForm() (line 1079 of core/lib/Drupal/Core/Form/FormBuilder.php).

You can reproduce this error also in the UI on text formats as well when enabling the unicorn editor.

Comments

swentel’s picture

StatusFileSize
new841 bytes

No fix, just a patch that makes the tests locally not fail.

xjm’s picture

The test has been broken since... #2205367: [HEAD BROKEN] PHP 5.4. ;)

xjm’s picture

By the way, my error message is funnier:

  call_user_func_array() expects parameter 1 to be a valid callback, class 'A
    list of HTML tags that can be used. JavaScript event attributes, JavaScript
    URLs, and CSS are always stripped.' not found
alexpott’s picture

This only occurs on PHP 5.4 - I'm on PHP 5.4.16 - but this does not occur in PHP 5.5.

It appears to be an object serialisation issue since if I change the #element_validate assignment to use get_class() like so

  $settings_form['#element_validate'][] = array(get_class($plugin), 'settingsFormValidate');

I get a more reasonable error message of:

    call_user_func_array() expects parameter 1 to be a valid callback,
    non-static method
    Drupal\editor_test\Plugin\Editor\UnicornEditor::settingsFormValidate()
    should not be called statically
alexpott’s picture

StatusFileSize
new1.25 KB

The patch attached fixes the issue for me. The issue seems to be with unserialising two instances of the same object.

wim leers’s picture

Does this mean we want to clone every object we invoke a Form API callback on? (Because all of those may get serialized.)

alexpott’s picture

No - the clone solution sucks - I was just posting the results so far of my investigation so maybe someone knows what's going on.

alexpott’s picture

Status: Active » Needs review
StatusFileSize
new1.4 KB

So we serialize the FilterPluginBag in the form which leads us to serializing the FilterPluginManager which means we serialize all sorts of other stuff. PHP 5.4 serialization does seem to be fragile but stopping this fixes this issue. Also offers a nice performance enhancement since the serialized form is much smaller.

Before

mysql> select length(value) from simpletest480873key_value_expire where name = 'form--BaLyxi46ixwojo7adHrLcThPK90G8r4sSNmfVl6D4s' and collection = 'form';
+---------------+
| length(value) |
+---------------+
|         48092 |
+---------------+

After

mysql> select length(value) from simpletest246321key_value_expire where name = 'form-ph-sBxFBf5zfy-PztVee8gC2pRdm8vUFyw_6i4c90C4' and collection = 'form';
+---------------+
| length(value) |
+---------------+
|         29331 |
+---------------+
1 row in set (0.00 sec)
alexpott’s picture

#2199795: Make the Settings class prevent serialization of actual settings is proposing the plugin bags need to be serialized using dependency serialization too

alexpott’s picture

wim leers’s picture

Title: EditorAdminTest fails on PHP 5.4 silently with unicorn editor » [PP-1] EditorAdminTest fails on PHP 5.4 silently with unicorn editor
Status: Needs review » Postponed
xjm’s picture

What is this postponed on? Can we put the issue in the summary?

wim leers’s picture

Title: [PP-1] EditorAdminTest fails on PHP 5.4 silently with unicorn editor » Let plugin bags use the DependencySerializationTrait (was: EditorAdminTest fails on PHP 5.4 silently with unicorn editor)
Component: editor.module » plugin system
Status: Postponed » Needs review
StatusFileSize
new871 bytes

It was postponed on #2208115: Add DependencySerializationTrait and #2199795: Make the Settings class prevent serialization of actual settings. The first of those is now committed, the second one isn't yet, and that's what this is postponed on.

With #2208115: Add DependencySerializationTrait committed, #8 can be rerolled to be much simpler. So I did that here.

But, looking at #2199795-9: Make the Settings class prevent serialization of actual settings, it looks like a different solution was chosen (I think because of comment 5 in that issue). If that's the case, then this issue can implement that solution. I think alexpott should decide what to do here; I'm not knowledgeable enough in this area.

Wim Leers queued 13: 2210873.13.patch for re-testing.

jhedstrom’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
sivaji_ganesh_jojodae’s picture

Status: Needs work » Needs review
StatusFileSize
new849 bytes

Patch #13 rerolled.

pwieck’s picture

Issue tags: -Needs reroll
mgifford’s picture

Status: Needs review » Needs work

Patch no longer applies.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

berdir’s picture

Status: Needs work » Closed (duplicate)

\Drupal\Core\Plugin\DefaultLazyPluginCollection uses DependencySerializationTrait already, I think this is not necessary, we don't want to add this trait to actual services.