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.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 2267341-15.patch | 2.73 KB | tr |
| #14 | 2267341-14.patch | 3.03 KB | tr |
| #12 | 2267341-12.patch | 2.39 KB | tr |
| #10 | 2267341-10.patch | 2.43 KB | tr |
| #10 | 2267341-10-test-only.patch | 1.79 KB | tr |
Comments
Comment #1
maijs commentedA patch against 7.x-2.x is attached.
Comment #2
maijs commentedComment #3
maijs commentedComment #4
sgabe commentedPatch works for me, thanks!
Comment #5
fruitsalad commentedHello 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.
Comment #6
toddtomlinson commentedI applied the patch and still receive the error.
Comment #7
tr commentedIt 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.
Comment #8
tr commentedClosed:
#2693959: Unsupported operand types in form.inc on line 2759 when adding a rule if there are no content types
and
#2263599: Fatal error when trying to create node-related rule without existent node types
as duplicates.
Comment #9
tr commentedComment #10
tr commentedOkay, 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.
Comment #12
tr commentedTests 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.
Comment #14
tr commentedIgnore 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.
Comment #15
tr commentedRe-rolled patch against current HEAD.
Comment #17
tr commentedCommitted.