THRIFT-5754: Fix PHP 8.1 deprecates passing null to non-nullable internal function parameters
diff --git a/lib/php/src/TStringUtils.php b/lib/php/src/TStringUtils.php
index 894baf8..544211b 100644
--- a/lib/php/src/TStringUtils.php
+++ b/lib/php/src/TStringUtils.php
@@ -12,15 +12,15 @@
     {
         // specifying a null $length would return an empty string
         if ($length === null) {
-            return substr($str, $start);
+            return substr((string) $str, $start);
         }
 
-        return substr($str, $start, $length);
+        return substr((string) $str, $start, $length);
     }
 
     public function strlen($str)
     {
-        return strlen($str);
+        return strlen((string) $str);
     }
 }
 
@@ -39,12 +39,12 @@
             $length = $this->strlen($str) - $start;
         }
 
-        return mb_substr($str, $start, $length, '8bit');
+        return mb_substr((string) $str, $start, $length, '8bit');
     }
 
     public function strlen($str)
     {
-        return mb_strlen($str, '8bit');
+        return mb_strlen((string) $str, '8bit');
     }
 }