Skip to content

Commit d665142

Browse files
authored
Escape the role attribute of namespaced classes (#9952)
1 parent da47547 commit d665142

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

build/gen_stub.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,7 @@ public function getMethodSynopsisElement(array $funcMap, array $aliasMap, DOMDoc
14901490
if ($this->isMethod()) {
14911491
assert($this->name instanceof MethodName);
14921492
$role = $doc->createAttribute("role");
1493-
$role->value = $this->name->className->__toString();
1493+
$role->value = addslashes($this->name->className->__toString());
14941494
$methodSynopsis->appendChild($role);
14951495
}
14961496

@@ -2763,12 +2763,13 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, itera
27632763
$classSynopsis->appendChild($classSynopsisInfo);
27642764

27652765
$classReference = self::getClassSynopsisReference($this->name);
2766+
$escapedName = addslashes($this->name->__toString());
27662767

27672768
if ($this->hasConstructor()) {
27682769
$classSynopsis->appendChild(new DOMText("\n "));
27692770
$includeElement = $this->createIncludeElement(
27702771
$doc,
2771-
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='$this->name'])"
2772+
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='$escapedName'])"
27722773
);
27732774
$classSynopsis->appendChild($includeElement);
27742775
}
@@ -2777,7 +2778,7 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, itera
27772778
$classSynopsis->appendChild(new DOMText("\n "));
27782779
$includeElement = $this->createIncludeElement(
27792780
$doc,
2780-
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='$this->name'])"
2781+
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='$escapedName'])"
27812782
);
27822783
$classSynopsis->appendChild($includeElement);
27832784
}
@@ -2786,7 +2787,7 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, itera
27862787
$classSynopsis->appendChild(new DOMText("\n "));
27872788
$includeElement = $this->createIncludeElement(
27882789
$doc,
2789-
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:destructorsynopsis[@role='$this->name'])"
2790+
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:destructorsynopsis[@role='$escapedName'])"
27902791
);
27912792
$classSynopsis->appendChild($includeElement);
27922793
}
@@ -2801,9 +2802,10 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, itera
28012802
foreach ($parentsWithInheritedMethods as $parent) {
28022803
$classSynopsis->appendChild(new DOMText("\n "));
28032804
$parentReference = self::getClassSynopsisReference($parent);
2805+
$escapedParentName = addslashes($parent->__toString());
28042806
$includeElement = $this->createIncludeElement(
28052807
$doc,
2806-
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$parentReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='$parent')])"
2808+
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$parentReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='$escapedParentName')])"
28072809
);
28082810
$classSynopsis->appendChild($includeElement);
28092811
}

0 commit comments

Comments
 (0)