diff --git a/sapi/fpm/tests/bug64539-status-json-encoding.phpt b/sapi/fpm/tests/bug64539-status-json-encoding.phpt index 7daa43ab75b13..f5c856c11c8a5 100644 --- a/sapi/fpm/tests/bug64539-status-json-encoding.phpt +++ b/sapi/fpm/tests/bug64539-status-json-encoding.phpt @@ -1,6 +1,5 @@ --TEST-- FPM: bug64539 - status json format escaping ---XFAIL-- --SKIPIF-- @@ -33,8 +32,7 @@ $responses = $tester ['query' => 'a=b"c'], ['uri' => '/status', 'query' => 'full&json', 'delay' => 100000], ]); -$data = json_decode($responses[1]->getBody('application/json'), true); -var_dump(explode('?', $data['processes'][0]['request uri'])[1]); +$responses[1]->expectJsonBodyPatternForStatusProcessField('request uri', '\?a=b"c$'); $tester->terminate(); $tester->expectLogTerminatingNotices(); $tester->close(); @@ -42,7 +40,6 @@ $tester->close(); ?> Done --EXPECT-- -string(5) "a=b"c" Done --CLEAN-- getBody('application/json'); + $data = json_decode($rawData, true); + if (empty($data['processes']) || !is_array($data['processes'])) { + $this->error( + "The body data is not a valid status json containing processes field '$rawData'" + ); + } + foreach ($data['processes'] as $process) { + if (preg_match('/' . $pattern . '/', $process[$fieldName]) !== false) { + return $this; + } + } + + $this->error( + "No field $fieldName matched pattern $pattern for any process in status data '$rawData'" + ); + + return $this; + } + /** * @return Response */