From 8c07c856a2a6c7b4cc5052dbda43853548315d58 Mon Sep 17 00:00:00 2001 From: Scott Lipsig Date: Tue, 17 Mar 2015 10:57:45 -0700 Subject: [PATCH] Suppress E_NOTICE error on string comparison Slower comparison, but functional and the speed hit should not be significant in any reasonable use case. More readable than most potential substitutes. Addresses "PHP Notice: Uninitialized string offset: 0 in /my/path/testmore/testmore.php on line 122" --- testmore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testmore.php b/testmore.php index 0651360..c06d8dd 100644 --- a/testmore.php +++ b/testmore.php @@ -119,7 +119,7 @@ function ok($pass, $test_name = '') $test_name = "- $test_name"; } - if ($test_name[0] != '#' and isset($_testmore_todo) and count($_testmore_todo)) { + if (substr($test_name, 0, 1) != '#' and isset($_testmore_todo) and count($_testmore_todo)) { $msg = array_pop( array_values( $_testmore_todo ) ); $test_name .= " # TODO $msg"; }