Skip to content

Commit

Permalink
Fix null/string concatenation error in hphp/test/run.php
Browse files Browse the repository at this point in the history
Summary:
My test runs are failing with errors like this: https://www.internalfb.com/intern/testinfra/diagnostics/5629499593789230.281474979307742.1625688677/

Text:

```
Failed to list tests.
STDOUT:{"args":"-m interp,jit","name":"hphp/test/server/debugger/tests/runTest1.php"}

STDERR:
Fatal error: Uncaught exception 'InvalidOperationException' with message 'Implicit null to string conversion for string concatenation/interpolation' in /data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/hphp/test/run.php:195
Stack trace:
#0 /data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/hphp/test/run.php(3661): success()
#1 /data/sandcastle/boxes/eden-trunk-hg-fbcode-fbsource/fbcode/hphp/test/run.php(3942): main()
#2 (): run_main()
#3 {main}
```

Following the stacktrace, we see that the error occurs here:

https://www.internalfb.com/code/fbsource/[4981de7c3ed6cbbcd309a95da5b0c924e7c00b7e][history]/fbcode/hphp/test/run.php?lines=194-197

One frame up:

https://www.internalfb.com/code/fbsource/[4981de7c3ed6cbbcd309a95da5b0c924e7c00b7e][history]/fbcode/hphp/test/run.php?lines=3661

And `list_tests()` is a void function:

https://www.internalfb.com/code/fbsource/[4981de7c3ed6cbbcd309a95da5b0c924e7c00b7e][history]/fbcode/hphp/test/run.php?lines=778-795

So if we can't insert nulls into strings, this is bound to fail every time.

Reviewed By: DavidSnider

Differential Revision: D29597205

fbshipit-source-id: 852ffccf2f337b6dc1cb0909b3a276d97eced04f
  • Loading branch information
jthemphill authored and facebook-github-bot committed Jul 8, 2021
1 parent d3382e0 commit e4bc12f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hphp/test/run.php
Expand Up @@ -192,6 +192,9 @@ function error($message) {
}

function success($message) {
if ($message is null) {
$message = "";
}
print "$message\n";
exit(0);
}
Expand Down

0 comments on commit e4bc12f

Please sign in to comment.