The SafeMarkup::placeholder() function was removed from Drupal core on August 19th: #2549395: SafeMarkup methods are removed.
The SafeMarkup class has changed and an update is needed.

This breaks the Revision Overview page due to a fatal PHP error:
Fatal error: Call to undefined method Drupal\Component\Utility\SafeMarkup::placeholder() in /Users/chris.hamper/Sites/devdesktop/8.0.x/modules/contrib/diff/src/Form/RevisionOverviewForm.php on line 183

Also the update of the SafeMarkup class breaks NodeRevisionController
Notice: Array to string conversion in Drupal\Component\Utility\SafeMarkup::set() (line 77 of core/lib/Drupal/Component/Utility/SafeMarkup.php).

We also should fix the test failing because of #507488: Convert page elements (local tasks, actions) into blocks and have green tests again =).

Comments

hampercm created an issue. See original summary.

hampercm’s picture

Assigned: hampercm » Unassigned
Status: Active » Needs review
StatusFileSize
new686 bytes

This patch replaces the call to the removed function with its suggested alternative.

Status: Needs review » Needs work

The last submitted patch, 2: 2557979-2.patch, failed testing.

hampercm’s picture

Test failed due to #2549907: Fix schema langcode error. Once that patch is committed, this will pass automated tests.

Status: Needs work » Needs review

lhangea queued 2: 2557979-2.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 2: 2557979-2.patch, failed testing.

giancarlosotelo’s picture

Status: Needs work » Needs review
StatusFileSize
new2.36 KB
new3.21 KB

Tested locally and patch solved the problem but now with latest core changes tests are still failing.

#507488: Convert page elements (local tasks, actions) into blocks We must include blocks in tests and also there was a problem with SafeMarkup::set() but it will be removed soon #2554889: Remove SafeMarkup::set() from the codebase so we should extend this patch after it gets committed.

For now I am uploading a patch with fixes for those changes instead of creating another issue(fixes are related in some way) and I hope a maintainer will look over this and #2549907: Fix schema langcode error soon.

giancarlosotelo’s picture

Title: SafeMarkup::placeholder() has been removed, breaking RevisionOverviewForm » SafeMarkup::placeholder() has been removed, SafeMarkup class has changed, update needed
Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 7: 2557979-7.patch, failed testing.

lhangea’s picture

hampercm and giancarlosotelo thanks for your work. These days I can look over some of the issues from the queue and update the 8.0.x branch accordingly.

juanse254’s picture

+++ b/src/Controller/NodeRevisionController.php
@@ -110,7 +110,9 @@ class NodeRevisionController extends EntityComparisonBase {
+                $field_diff_column['data']['#markup'] = SafeMarkup::set($field_diff_column['data']['#markup']);

I think we should avoid using SafeMarkup::set()

The rest looks good to me, tested locally and is passing.

EDIT:

+++ b/src/Controller/NodeRevisionController.php
@@ -110,7 +110,9 @@ class NodeRevisionController extends EntityComparisonBase {
         foreach ($field_diff_rows as &$field_diff_row) {
           foreach ($field_diff_row as &$field_diff_column) {
             if (is_array($field_diff_column)) {
-              $field_diff_column['data'] = SafeMarkup::set($field_diff_column['data']);
+              if (isset($field_diff_column['data']['#markup'])) {
+                $field_diff_column['data']['#markup'] = SafeMarkup::set($field_diff_column['data']['#markup']);
+              }
             }
             else {

I think we can drop this whole thing.

Status: Needs work » Needs review

juanse254 queued 7: 2557979-7.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 7: 2557979-7.patch, failed testing.

juanse254’s picture

Status: Needs work » Needs review
StatusFileSize
new5.47 KB
new2.93 KB

This will merge this two issues #2563017: SafeMarkup::set() removed from core with this one and should solve both.

Status: Needs review » Needs work

The last submitted patch, 14: SafeMarkup_Placeholder-2557979-14.patch, failed testing.

  • lhangea committed 7f8f95b on 8.x-1.x authored by juanse254
    Issue #2557979 by giancarlosotelo, juanse254, hampercm: SafeMarkup::...
lhangea’s picture

Status: Needs work » Fixed

I know the test is postponed because of the previous fail we had in HEAD so I just went ahead and committed this change. Tests pass locally the module seems to work OK.

Status: Fixed » Needs work

The last submitted patch, 14: SafeMarkup_Placeholder-2557979-14.patch, failed testing.

lhangea’s picture

Status: Needs work » Fixed

Back to fixed, the patch is already applied.

Status: Fixed » Closed (fixed)

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