Release 7x-2.12 (at issue submission time not available in the version field) causes a drupal_pre_render_link error. Message says
Notice: Undefined index #title at line 5770 ... drupal_pre_render_link
The odd thing was that the error didn't show up immediately. Some four hours after the update, the error occurred.
Apart from the error code, all non-link titles on rules actions (Loop, Conditional) disappeared.
Reverting to 7x-2..11 erased the error.
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | rules-error.PNG | 14.76 KB | arx-e |
| #6 | 3028444-6-markup-and-test.patch | 1.99 KB | tr |
| #6 | 3028444-6-test-only.patch | 1.44 KB | tr |
| #5 | 3028444-5-markup.patch | 562 bytes | tr |
Comments
Comment #2
Leiph commentedTypos in the versions fixed.
Comment #3
tr commentedYes, I can confirm. This issue started showing up in the logs on my test site on 18 Jan. The three Rules commits between then and the release can't possibly have caused this (one is documentation comments only, one is hook_uninstall() only, and one only affects rules debug messages shown when you have debugging turned on).
I'll have to spend some quality time with git bisect to see what caused this.
This causes a PHP notice in the logs coupled with some missing text only in the Rules Admin UI. As far as I can tell everything still works and nothing is visible to site users. So classifying this as "normal" for now.
Comment #4
tr commentedOK, the cause of this was the patch in #2993473: #type 'markup' removed, committed to Rules on 17 August 2018.
If you are having this problem, you can revert that patch. Here's how:
This will fix the problem, and it won't have any bad side-effects.
I'll investigate further and commit a proper fix.
I don't know why that patch would cause a problem because #type=>markup was removed from Drupal core 6 years ago, so #type=>markup use by contributed modules like Rules should be ignored. That was the whole point of the patch, to remove three lines of code that had been obsolete for 6 years. See the Drupal core change notice #type 'markup' removed for more information.
Comment #5
tr commentedOnly one line of that previous patch caused the problem. This new patch restores that one line and should fix any issues.
Please test.
Comment #6
tr commentedAnd here's a test case to verify this works and to ensure this doesn't inadvertently get broken in the future.
The first patch is just the test, without the fix. This test should FAIL, demonstrating the reported bug and showing that the test will detect this error.
The second patch is the test PLUS the fix from#5. This test should PASS, demonstrating the fix works.
Comment #8
tr commentedTesting results in #6 are as expected.
Would like confirmation from the community that this fixes the problem for you. @Leiph ?
Comment #9
tory-w commentedConfirming patch 6 works.
Along with the "drupal_pre_render_link error", it knocked out my "Conditionals" with Conditional Rules and this patch fixes that as well.
Comment #11
tr commentedThanks for confirming that @tory-w !
Committed the fix + test from #6 with a few added lines of comments.
Comment #12
bassplaya commentedI can confirm too.
Big thanks @TR!
Using version = "7.x-2.12", the patch "3028444-6-markup-and-test.patch" worked for me too and just like with @tory-w, the conditional titles reappeared.
Comment #13
Leiph commentedSorry for late reply, but nevertheless: Thanks @TR! /Leiph
Comment #14
sgdev commentedThanks @TR, cross posting that this has also been reported in the Rules Conditional issue queue.
Comment #15
parasolx commentedI also confirm that patch #6 solved problem in my production site.
Comment #16
philyPatch #6 is OK for me running Rules 7.x-2.12 and Drupal 7.64
Thanks
Comment #17
delacosta456 commentedhi
patch #6 OK for me too on Panopoly distro 7.x-1.60 based on D7,63
Many thanks
Comment #19
web226 commentedPatch #6 3028444-6-markup-and-test.patch Works for me too with Rules 7.x-2.12, Drupal 7.64 and PHP 7.2
Comment #20
kingandyJust for completeness I'll note that the problem was caused because at the point '#type' is set to 'markup', the element already has a '#type' ('link'). Not resetting the #type meant Drupal was still trying to render this element as a link.
An alternative to setting #type=>markup would be to unset the #type property, or redeclare the element entirely (
$content['label'] = array('#markup' => check_plain($content['label']['#title']));).Note however that #type=>markup is still part of the FAPI. Though it's optional, there's no harm in explicitly declaring it.
Comment #21
bluehead commented#6 solves the problem.
Comment #22
marco.b#6 worked for me.
The Text was at the top of a reaction rule config page:
> Notice: Undefined index: #title in /includes/common.inc on line 5775
Comment #23
arx-e commenteddeleted
Comment #24
arx-e commentedComment #25
tr commented@arx-e: Dude, you've been using Drupal for > 11 years, and you still don't understand how the issue queue works? #3 confirmed this as a bug. #4 provided a workaround. #10 showed that the fix was committed to Rules - that was almost 10 MONTHS ago. So use the latest -dev and clear your caches, or apply the patch in #6 and clear your caches. Regardless, this was already fixed and there are tests proving it was fixed.
Comment #26
arx-e commentedI am terribly sorry man! I had a development copy open in different tabs and I was testing in the wrong tab!!!
@TR I am using the latest dev and of course I have cleared all caches and I still see the error message in almost every page load when editing rules.I have tried the interim solutions just in case some other change had been introduced into the dev version after the commit.