fix PHP 8.0 error: count(): Argument #1 ($value) must be of type Countable|array, string given

This commit is contained in:
Ralf Becker 2021-10-04 13:02:34 +02:00
parent 1cd5755ae4
commit ac7faf6036

View File

@ -811,6 +811,7 @@ abstract class Merge
*/
public function &merge_string($_content,$ids,&$err,$mimetype,array $fix=null,$charset=null)
{
$ids = empty($ids) ? [] : (array)$ids;
$matches = null;
if ($mimetype == 'application/xml' &&
preg_match('/'.preg_quote('<?mso-application progid="', '/').'([^"]+)'.preg_quote('"?>', '/').'/',substr($_content,0,200),$matches))
@ -941,7 +942,7 @@ abstract class Merge
if ($contentrepeat) $content = $contentrepeat; //content to repeat
if ($lableprint) $content = $Labelrepeat;
// generate replacements; if exeption is thrown, catch it set error message and return false
// generate replacements; if exception is thrown, catch it set error message and return false
try
{
if(!($replacements = $this->get_replacements($id,$content)))