Follow-up to #2407361: Move usages of drupal_html_id() to Html::getUniqueId()

See the later comments for the status, which is caused by a conflicting class import.

Suggested commit message:

Issue #2446259 by neclimdul, ircmaxell, tim.plunkett, cilefen, nlisgo, Crell: Rename \Drupal\Core\Render\Element\Html to avoid namespace clash with \Drupal\Component\Utility\Html in render elements.

Comments

Status: Needs review » Needs work

The last submitted patch, move_usages_of-2407361-42.patch, failed testing.

miro_dietiker’s picture

My latest head with latest drush si, PHP 5.4.30 failed with:
PHP Fatal error: Cannot use Drupal\Component\Utility\Html as Html because the name is already in use in /usr/local/var/www/d8.dev/www/core/lib/Drupal/Core/Render/Element/Link.php on line 11

Works again after applying the patch.

tim.plunkett’s picture

Status: Needs work » Needs review
Issue tags: -@deprecated, -Novice, -#DCM2015
StatusFileSize
new733 bytes

I don't understand how this is a bug, but either way, let's just do this.

Credit should also go to neclimdul for spending a lot of time on this in IRC

nlisgo’s picture

Patch #3 works for me.

nlisgo’s picture

RTBC+

tim.plunkett’s picture

This is the bug:

http://3v4l.org/PCmhc


namespace A {
    class Foo {
    }
}
namespace A {
    use B\Foo;
    class Bar {
        function __construct() { 
            new Foo();
        }
    }
}
namespace B {
    class Foo {
    }
}
Fatal error: Cannot use B\Foo as Foo because the name is already in use in /in/PCmhc on line 8

Process exited with code 255.

I would expect this to work, especially if each namespace were split across three files.

cilefen’s picture

Status: Needs review » Reviewed & tested by the community

This works fine for me.

tim.plunkett’s picture

Title: Broken HEAD from Move usages of drupal_html_id() to Html::getUniqueId() » [HEAD BROKEN] Rename \Drupal\Core\Render\Element\Html to avoid namespace clash with \Drupal\Component\Utility\Html in render elements.
Issue summary: View changes

ircmaxell confirmed this is a bug in all versions of PHP.
http://lxr.php.net/xref/PHP_5_5/Zend/zend_compile.c#7039

I'm guessing the testbots use opcache, because that's the only way they'd pass:

The reason it works with opcache is that opcache removes the symbol table at compile time. So there is never a conflict

ircmaxell said he'd file a PHP7 bug report tomorrow.

In the interest of getting this committed, I'm taking #5 as an RTBC.

Added suggested commit message to summary.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

The patch was reverted.