From cea137671fd0eba07d33c619156225428092e708 Mon Sep 17 00:00:00 2001
From: Enrico <bolduz@users.noreply.github.com>
Date: Fri, 14 Feb 2020 11:47:31 +0100
Subject: [PATCH] Fix #176: syntax error on line 12387 (invalid usage of array
 index)

Fix a syntax error issue when accessing an index of a casted variable
---
 tcpdf.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tcpdf.php b/tcpdf.php
index be32cae..8b7d812 100644
--- a/tcpdf.php
+++ b/tcpdf.php
@@ -12384,7 +12384,8 @@ class TCPDF {
 			$x = $this->w;
 		}
 		$fixed = false;
-		if ((string)$page && (((string)$page)[0] == '*')) {
+		$pageAsString = (string) $page;
+		if ($pageAsString && $pageAsString[0] == '*') {
 			$page = intval(substr($page, 1));
 			// this page number will not be changed when moving/add/deleting pages
 			$fixed = true;