I have a clean Drupal installation (7.28 using "minimal" profile) therefore no node content types are defined.

The problem

When I want to create a new rule that acts on Node events (After saving new content, After deleting content, etc.), an Ajax error is thrown:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /rules/drupal/system/ajax
StatusText: OK
ResponseText: 
Fatal error:  Unsupported operand types in /Sites/rules/drupal/includes/form.inc on line 2672

Upon submitting the form the following error is thrown:
Fatal error: Unsupported operand types in /Sites/rules/drupal/includes/form.inc on line 2672.

The problem lies in buildFrom() method of RulesEventHandlerEntityBundle class in includes/rules.event.inc file where select form element is created but #options attribute is set only if there are node bundles defined.

Solution

Have the form element of type "select" have empty #options attribute by default.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maijs’s picture

maijs’s picture

Status: Active » Needs work
maijs’s picture

Status: Needs work » Needs review
sgabe’s picture

Patch works for me, thanks!

fruitsalad’s picture

Hello all,

I get the same error, except Path is "/system/ajax" and Status is "parsererror". I also tried to create a rule that acts on creating a specific node type.

After applying the patch the error continues.

toddtomlinson’s picture

I applied the patch and still receive the error.

TR’s picture

Priority: Normal » Minor

It would be helpful to have a test case for this ...

I can't tell if #5 and #6 are really seeing the same problem as the original poster, but I doubt it - this issue is NOT about any appearance of "An AJAX HTTP error occurred.", it is a specific fringe use-case when the minimal profile is installed and there are no content types (not even Article or Page!). The fix is pretty simple and as far as I can tell it has to work with this specific use-case.

TR’s picture

Issue tags: +Needs tests
TR’s picture

Okay, here's a test-only patch that demonstrates and reproduces the error described by the original poster. This patch should FAIL because of the bug.

Also, here's a patch with the same test but also with the fix posted in #1. This patch should PASS because the fix solves the problem.

The last submitted patch, 10: 2267341-10-test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

TR’s picture

Tests results in #10 are as expected - the test-only patch adds tests to demonstrate the problem in the current -dev, and the other patch fixes the problem and proves the fix with the new tests.

And here's #10, the complete patch with tests, with some added comments. This is the version I would like to commit.

Status: Needs review » Needs work

The last submitted patch, 12: 2267341-12.patch, failed testing. View results

TR’s picture

Status: Needs work » Needs review
FileSize
3.03 KB

Ignore the patch in #12 - that's a test-only patch, I forgot to include the fix.

HERE is the patch I would like to commit, which is the test (with added comments) PLUS the fix.

TR’s picture

Re-rolled patch against current HEAD.

  • TR committed 8c33972 on 7.x-2.x
    Issue #2267341 by TR, maijs: Unsupported operand types error is thrown...
TR’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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