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 eebc939ff2
commit 8084758d76

View File

@ -786,6 +786,7 @@ abstract class Merge
*/ */
public function &merge_string($_content,$ids,&$err,$mimetype,array $fix=null,$charset=null) public function &merge_string($_content,$ids,&$err,$mimetype,array $fix=null,$charset=null)
{ {
$ids = empty($ids) ? [] : (array)$ids;
$matches = null; $matches = null;
if ($mimetype == 'application/xml' && if ($mimetype == 'application/xml' &&
preg_match('/'.preg_quote('<?mso-application progid="', '/').'([^"]+)'.preg_quote('"?>', '/').'/',substr($_content,0,200),$matches)) preg_match('/'.preg_quote('<?mso-application progid="', '/').'([^"]+)'.preg_quote('"?>', '/').'/',substr($_content,0,200),$matches))
@ -916,7 +917,7 @@ abstract class Merge
if ($contentrepeat) $content = $contentrepeat; //content to repeat if ($contentrepeat) $content = $contentrepeat; //content to repeat
if ($lableprint) $content = $Labelrepeat; 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 try
{ {
if(!($replacements = $this->get_replacements($id,$content))) if(!($replacements = $this->get_replacements($id,$content)))