endclothing / prometheus_client_php

Prometheus instrumentation library for PHP applications
https://prometheus.io/docs/concepts/metric_types/
Apache License 2.0
150 stars 79 forks source link

fix passing null as 3rd argument to str_replace #72

Closed crevillo closed 1 year ago

crevillo commented 1 year ago

This is one of the forks we needed to create to make it work with php8. After the execution of end to end test, looking to kibana we can see lot of entries like app.CRITICAL: Uncaught PHP Exception TypeError: "str_replace(): Argument #3 ($subject) must be of type array|string, null given" at /www/vendor/endclothing/prometheus_client_php/src/Prometheus/RenderTextFormat.php line 59

Error only happens in php8. This pr tries to fix

crevillo commented 1 year ago

sorry, i was trying to do the pr to one of our forks.