From 99fd2f725b15c7fa7730947091b37f0d381db4b5 Mon Sep 17 00:00:00 2001 From: eli Date: Tue, 19 Oct 2021 21:06:23 +0100 Subject: [PATCH] [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. --- src/Core/DB/DB.php | 2 +- src/Util/HTML.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/DB/DB.php b/src/Core/DB/DB.php index b5b5ccb3e5..813cf2492c 100644 --- a/src/Core/DB/DB.php +++ b/src/Core/DB/DB.php @@ -221,7 +221,7 @@ class DB $metadata = self::getClassMetadata(\get_class($owner)); $seqName = $metadata->getSequenceName($conn->getDatabasePlatform()); 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); }); if (!\is_null($extra)) { $extra($id); diff --git a/src/Util/HTML.php b/src/Util/HTML.php index c9b6d4c4a4..f0711db9c5 100644 --- a/src/Util/HTML.php +++ b/src/Util/HTML.php @@ -113,7 +113,7 @@ abstract class HTML $out .= "<{$tag}/>"; } else { $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); if ($is_tag) { if (!\in_array($tag, array_merge($options['allowed_tags'] ?? [], self::ALLOWED_TAGS))) {