diff --git a/.travis.yml b/.travis.yml index d5edd686a..cc0860ca4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ php: - 7.2 - 7.3 - 7.4 + - 8.0snapshot env: - PHP_BIN=php diff --git a/readme.md b/readme.md index 938324787..93868db2c 100644 --- a/readme.md +++ b/readme.md @@ -41,8 +41,8 @@ composer require tracy/tracy Alternatively, you can download the whole package or [tracy.phar](https://github.com/nette/tester/releases) file. | Tracy | PHP | compatible with browsers -|-----------|---------------|---------- -| Tracy 2.6 | PHP 7.1 – 7.4 | Chrome 49+, Firefox 45+, MS Edge 14+, Safari 10+ and iOS Safari 10.2+ +|-----------|-----------------|---------- +| Tracy 2.6 | PHP 7.1 – 8.0 | Chrome 49+, Firefox 45+, MS Edge 14+, Safari 10+ and iOS Safari 10.2+ | Tracy 2.5 | PHP 5.4.4 – 7.3 | Chrome 49+, Firefox 45+, MS Edge 12+, Safari 10+ and iOS Safari 10.2+ | Tracy 2.4 | PHP 5.4.4 – 7.2 | Chrome 29+, Firefox 28+, IE 11+ (except AJAX), MS Edge 12+, Safari 9+ and iOS Safari 9.2+ diff --git a/src/Tracy/Helpers.php b/src/Tracy/Helpers.php index a3eff6eb5..2f352085e 100644 --- a/src/Tracy/Helpers.php +++ b/src/Tracy/Helpers.php @@ -166,7 +166,7 @@ public static function getSource(): string . $_SERVER['REQUEST_URI']; } else { return 'CLI (PID: ' . getmypid() . ')' - . ': ' . implode(' ', array_map([self::class, 'escapeArg'], $_SERVER['argv'])); + . (isset($_SERVER['argv']) ? ': ' . implode(' ', array_map([self::class, 'escapeArg'], $_SERVER['argv'])) : ''); } } @@ -188,7 +188,7 @@ public static function improveException(\Throwable $e): void $message .= ", did you mean $hint()?"; $replace = ["$m[2](", "$hint("]; - } elseif (preg_match('#^Undefined variable: (\w+)#', $message, $m) && !empty($e->context)) { + } elseif (preg_match('#^Undefined variable:? \$?(\w+)#', $message, $m) && !empty($e->context)) { $hint = self::getSuggestion(array_keys($e->context), $m[1]); $message = "Undefined variable $$m[1], did you mean $$hint?"; $replace = ["$$m[1]", "$$hint"]; @@ -200,7 +200,7 @@ public static function improveException(\Throwable $e): void $message .= ", did you mean $$hint?"; $replace = ["->$m[2]", "->$hint"]; - } elseif (preg_match('#^Access to undeclared static property: ([\w\\\\]+)::\$(\w+)#', $message, $m)) { + } elseif (preg_match('#^Access to undeclared static property:? ([\w\\\\]+)::\$(\w+)#', $message, $m)) { $rc = new \ReflectionClass($m[1]); $items = array_intersect($rc->getProperties(\ReflectionProperty::IS_PUBLIC), $rc->getProperties(\ReflectionProperty::IS_STATIC)); $hint = self::getSuggestion($items, $m[2]); @@ -223,7 +223,7 @@ public static function improveException(\Throwable $e): void /** @internal */ public static function improveError(string $message, array $context = []): string { - if (preg_match('#^Undefined variable: (\w+)#', $message, $m) && $context) { + if (preg_match('#^Undefined variable:? \$?(\w+)#', $message, $m) && $context) { $hint = self::getSuggestion(array_keys($context), $m[1]); return $hint ? "Undefined variable $$m[1], did you mean $$hint?" : $message; diff --git a/tests/Tracy/Debugger.autoloading.phpt b/tests/Tracy/Debugger.autoloading.phpt index 7298172cc..95aa082b0 100644 --- a/tests/Tracy/Debugger.autoloading.phpt +++ b/tests/Tracy/Debugger.autoloading.phpt @@ -3,6 +3,7 @@ /** * Test: Tracy\Debugger autoloading. * @outputMatch %A%: Declaration of B::test(%a?%) should be compatible %a% A::test() in %A% + * @phpVersion < 8 */ declare(strict_types=1); diff --git a/tests/Tracy/Debugger.exception.html.phpt b/tests/Tracy/Debugger.exception.html.phpt index f175fac98..206a140f2 100644 --- a/tests/Tracy/Debugger.exception.html.phpt +++ b/tests/Tracy/Debugger.exception.html.phpt @@ -44,5 +44,5 @@ function third($arg1) define('MY_CONST', 123); -echo @$undefined; +@hex2bin('a'); // E_WARNING first(10, 'any string'); diff --git a/tests/Tracy/Debugger.logSeverity.E_NOTICE.development.phpt b/tests/Tracy/Debugger.logSeverity.E_NOTICE.development.phpt index 0292154a7..6210ea30d 100644 --- a/tests/Tracy/Debugger.logSeverity.E_NOTICE.development.phpt +++ b/tests/Tracy/Debugger.logSeverity.E_NOTICE.development.phpt @@ -17,7 +17,7 @@ require __DIR__ . '/../bootstrap.php'; Debugger::enable(Debugger::DEVELOPMENT, getTempDir()); Debugger::$logSeverity = E_NOTICE; -$variable = $missingVariable; +$variable = &pi(); Assert::count(0, glob(getTempDir() . '/exception*.html')); Assert::count(0, glob(getTempDir() . '/error.log')); diff --git a/tests/Tracy/Debugger.logSeverity.E_NOTICE.phpt b/tests/Tracy/Debugger.logSeverity.E_NOTICE.phpt index 95376619c..26b058141 100644 --- a/tests/Tracy/Debugger.logSeverity.E_NOTICE.phpt +++ b/tests/Tracy/Debugger.logSeverity.E_NOTICE.phpt @@ -17,9 +17,9 @@ require __DIR__ . '/../bootstrap.php'; Debugger::enable(Debugger::PRODUCTION, getTempDir()); Debugger::$logSeverity = E_NOTICE; -$variable = $missingVariable; +$variable = &pi(); -Assert::same('Undefined variable: missingVariable', error_get_last()['message']); +Assert::same('Only variables should be assigned by reference', error_get_last()['message']); Assert::count(1, glob(getTempDir() . '/exception*.html')); Assert::count(1, glob(getTempDir() . '/error.log')); diff --git a/tests/Tracy/Debugger.logging.warnings.phpt b/tests/Tracy/Debugger.logging.warnings.phpt index 6e7f42283..bb2e60861 100644 --- a/tests/Tracy/Debugger.logging.warnings.phpt +++ b/tests/Tracy/Debugger.logging.warnings.phpt @@ -24,7 +24,7 @@ Debugger::enable(Debugger::PRODUCTION, $logDirectory, 'admin@example.com'); // throw error -$a++; +hex2bin('a'); // E_WARNING -Assert::match('%a%PHP Notice: Undefined variable: a in %a%', file_get_contents($logDirectory . '/error.log')); +Assert::match('%a%PHP Warning: hex2bin(): Hexadecimal input string must have an even length in %a%', file_get_contents($logDirectory . '/error.log')); Assert::true(is_file($logDirectory . '/email-sent')); diff --git a/tests/Tracy/Debugger.scream.phpt b/tests/Tracy/Debugger.scream.phpt index 025c02fe5..27c4b1676 100644 --- a/tests/Tracy/Debugger.scream.phpt +++ b/tests/Tracy/Debugger.scream.phpt @@ -19,7 +19,6 @@ header('Content-Type: text/plain; charset=utf-8'); Debugger::enable(); -@mktime(); // E_DEPRECATED -@$x++; // E_NOTICE -@min(1); // E_WARNING +@$x = &pi(); // E_NOTICE +@hex2bin('a'); // E_WARNING @require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING (not working) diff --git a/tests/Tracy/Debugger.shut-up.warnings.phpt b/tests/Tracy/Debugger.shut-up.warnings.phpt index 291d63943..868092a67 100644 --- a/tests/Tracy/Debugger.shut-up.warnings.phpt +++ b/tests/Tracy/Debugger.shut-up.warnings.phpt @@ -18,7 +18,6 @@ header('Content-Type: text/plain; charset=utf-8'); Debugger::enable(); -@mktime(); // E_DEPRECATED -@$x++; // E_NOTICE -@min(1); // E_WARNING +@$x = &pi(); // E_NOTICE +@hex2bin('a'); // E_WARNING @require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING diff --git a/tests/Tracy/Debugger.strict.console.phpt b/tests/Tracy/Debugger.strict.console.phpt index 2bf1f17e0..3fdef5d86 100644 --- a/tests/Tracy/Debugger.strict.console.phpt +++ b/tests/Tracy/Debugger.strict.console.phpt @@ -36,7 +36,7 @@ function second($arg1, $arg2) function third($arg1) { - $x++; + $x = &pi(); } diff --git a/tests/Tracy/Debugger.strict.html.phpt b/tests/Tracy/Debugger.strict.html.phpt index fbe5552bf..1e77f05fc 100644 --- a/tests/Tracy/Debugger.strict.html.phpt +++ b/tests/Tracy/Debugger.strict.html.phpt @@ -40,7 +40,7 @@ function second($arg1, $arg2) function third($arg1) { - $x++; + $x = &pi(); } diff --git a/tests/Tracy/Debugger.warnings.console.phpt b/tests/Tracy/Debugger.warnings.console.phpt index 594239083..66a31b3af 100644 --- a/tests/Tracy/Debugger.warnings.console.phpt +++ b/tests/Tracy/Debugger.warnings.console.phpt @@ -34,20 +34,17 @@ function second($arg1, $arg2) function third($arg1) { - mktime(); // E_DEPRECATED - $x++; // E_NOTICE - min(1); // E_WARNING + $x = &pi(); // E_NOTICE + hex2bin('a'); // E_WARNING require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING } first(10, 'any string'); Assert::match(" -Deprecated: mktime(): You should be using the time() function instead in %a% on line %d% +Notice: Only variables should be assigned by reference in %a% on line %d% -Notice: Undefined variable: x in %a% on line %d% - -Warning: %a% in %a% on line %d% +Warning: hex2bin(): Hexadecimal input string must have an even length in %a% on line %d% Warning: Unsupported declare 'foo' in %a% on line %d% ", ob_get_clean()); diff --git a/tests/Tracy/Debugger.warnings.html.phpt b/tests/Tracy/Debugger.warnings.html.phpt index 91ebf8c99..dd0bd6c83 100644 --- a/tests/Tracy/Debugger.warnings.html.phpt +++ b/tests/Tracy/Debugger.warnings.html.phpt @@ -36,15 +36,11 @@ Warning: Unsupported declare \'foo\' in %a% on line %d%%A%', $output); Assert::match('%A%
1%a% | -PHP Deprecated: mktime(): You should be using the time() function instead in %a%:%d% |
+ PHP Notice: Only variables should be assigned by reference in %a%:%d% |
1%a% | -PHP Notice: Undefined variable: x in %a%:%d% |
-|
1%a% | -PHP Warning: %a% in %a%:%d% |
+ PHP Warning: hex2bin(): Hexadecimal input string must have an even length in %a%:%d% |
"The my error" (%d%)
256 +@@ -99,23 +99,7 @@ - - - $error_%a% 256
-+%A% diff --git a/tests/Tracy/expected/Debugger.exception.html.expect b/tests/Tracy/expected/Debugger.exception.html.expect index a2405120e..f4595aa21 100644 --- a/tests/Tracy/expected/Debugger.exception.html.expect +++ b/tests/Tracy/expected/Debugger.exception.html.expect @@ -117,7 +117,7 @@Variables
- -----
-- $user "root" (4) -
-- $pass "*****" (5) -
-Last muted error
-- - -Notice: Undefined variable: undefined
+Warning: hex2bin(): Hexadecimal input string must have an even length
%a%Debugger.exception.html.phpt:%d%
%A%diff --git a/tests/Tracy/expected/Debugger.scream.expect b/tests/Tracy/expected/Debugger.scream.expect index db3de6c92..58b6fc9f3 100644 --- a/tests/Tracy/expected/Debugger.scream.expect +++ b/tests/Tracy/expected/Debugger.scream.expect @@ -1,6 +1,4 @@ -Deprecated: mktime(): You should be using the time() function instead in %a% on line %d% +Notice: Only variables should be assigned by reference in %a% on line %d% -Notice: Undefined variable: x in %a% on line %d% - -Warning: %a% in %a% on line %d% +Warning: hex2bin(): Hexadecimal input string must have an even length in %a% on line %d% diff --git a/tests/Tracy/expected/Debugger.strict.console.expect b/tests/Tracy/expected/Debugger.strict.console.expect index 67d8f4c52..9cdc3836a 100644 --- a/tests/Tracy/expected/Debugger.strict.console.expect +++ b/tests/Tracy/expected/Debugger.strict.console.expect @@ -1,6 +1,6 @@ -ErrorException: Undefined variable: x in %a% +ErrorException: Only variables should be assigned by reference in %a% Stack trace: -#0 %a%: Tracy\Debugger::errorHandler(8, '%a%', '%a%', %a%, Array) +#0 %a%: Tracy\Debugger::errorHandler(8, '%a%', '%a%', %a%) #1 %a%: third(Array) #2 %a%: second(true, false) #3 %a%: first(10, 'any string') diff --git a/tests/Tracy/expected/Debugger.strict.html.expect b/tests/Tracy/expected/Debugger.strict.html.expect index 98fcf498f..a98636888 100644 --- a/tests/Tracy/expected/Debugger.strict.html.expect +++ b/tests/Tracy/expected/Debugger.strict.html.expect @@ -5,7 +5,7 @@ -Notice: Undefined variable: x +Notice: Only variables should be assigned by reference %A% @@ -19,7 +19,7 @@@@ -106,20 +106,7 @@Notice
-Undefined variable: x +
Only variables should be assigned by reference search►
-- +%A%Variables
- -----
-%A?% - $arg1 -