forked from GNUsocial/gnu-social
[Core][Util] Hotfix: In App\Core\DB\DB persistWithSameId, casting the id to an int. In App\Util\HTML html, tag is now evaluated beforehand, making sure it's a string.
This commit is contained in:
parent
f78cfed41a
commit
99fd2f725b
@ -221,7 +221,7 @@ class DB
|
|||||||
$metadata = self::getClassMetadata(\get_class($owner));
|
$metadata = self::getClassMetadata(\get_class($owner));
|
||||||
$seqName = $metadata->getSequenceName($conn->getDatabasePlatform());
|
$seqName = $metadata->getSequenceName($conn->getDatabasePlatform());
|
||||||
self::persist($owner);
|
self::persist($owner);
|
||||||
$id = $conn->lastInsertId($seqName);
|
$id = (int ) $conn->lastInsertId($seqName);
|
||||||
F\map(\is_array($others) ? $others : [$others], function ($o) use ($id) { $o->setId($id); self::persist($o); });
|
F\map(\is_array($others) ? $others : [$others], function ($o) use ($id) { $o->setId($id); self::persist($o); });
|
||||||
if (!\is_null($extra)) {
|
if (!\is_null($extra)) {
|
||||||
$extra($id);
|
$extra($id);
|
||||||
|
@ -113,7 +113,7 @@ abstract class HTML
|
|||||||
$out .= "<{$tag}/>";
|
$out .= "<{$tag}/>";
|
||||||
} else {
|
} else {
|
||||||
$attrs = isset($contents['attrs']) ? self::attr(array_shift($contents), $options) : '';
|
$attrs = isset($contents['attrs']) ? self::attr(array_shift($contents), $options) : '';
|
||||||
$is_tag = preg_match('/[A-Za-z][A-Za-z0-9]*/', $tag);
|
$is_tag = is_string($tag) && preg_match('/[A-Za-z][A-Za-z0-9]*/', $tag);
|
||||||
$inner = self::html($contents, $options, $indent + 1);
|
$inner = self::html($contents, $options, $indent + 1);
|
||||||
if ($is_tag) {
|
if ($is_tag) {
|
||||||
if (!\in_array($tag, array_merge($options['allowed_tags'] ?? [], self::ALLOWED_TAGS))) {
|
if (!\in_array($tag, array_merge($options['allowed_tags'] ?? [], self::ALLOWED_TAGS))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user