phpbenchmarks / benchmark-kit

phpbenchmarks.com kit to add your benchmark.
http://www.phpbenchmarks.com
30 stars 4 forks source link

Fix statistic opcache check #142

Closed Tantrisse closed 4 years ago

Tantrisse commented 4 years ago

Hi ! A quick PR to fix an error in the statistics generation and validation.

First commit fix the template for the statistics.php file. When op_cache is disabled, the function opcache_get_status return false which can't be used in the following array_key_exists resulting (in my case) in an error and no statistics.json file generation. I tried to keep the fix readable (no nested ternary) and php 5.x compliant.

The second commit fix the validate:benchmark:statistics command which fail to valid the Json format with the new preload key added. I don't really know why (and didn't searched long) but if the key preload is present but not in the list of configureRequiredOption it throw an error The option "preload" does not exist. Defined options are: "code", "memory". Anyway, I fixed it by adding the preload key as mandatory and added the type validation which can be int or null if preload / op_cache is disabled.

Let me know ! :)

steevanb commented 4 years ago

Thanks for the fix, well done!