@@ -183,13 +183,24 @@ const ddog_CharSlice PHP_OPCACHE_ENABLE = DDOG_CHARSLICE_C("php.opcache.enable")
183183// Fetches certain opcache tags and adds them with the pattern of php.opcache.*.
184184static void dd_crasht_add_opcache_inis (ddog_Vec_Tag * tags ) {
185185#if PHP_VERSION_ID >= 80000
186- // We'll push php.opcache.enabled:0 whenever we detect we're disabled.
187-
188186 bool loaded = zend_get_extension ("Zend OPcache" );
189187 if (UNEXPECTED (!loaded )) {
190188 goto opcache_disabled ;
191189 }
192190
191+ // The CLI SAPI has an additional configuration for being enabled. This is
192+ // INI_SYSTEM so we can check it here.
193+ bool is_cli_sapi = strcmp ("cli" , sapi_module .name ) == 0 ;
194+ if (is_cli_sapi ) {
195+ ddog_CharSlice tag = DDOG_CHARSLICE_C ("php.opcache.enable_cli" );
196+ zend_string * value = dd_crasht_find_ini_by_tag (tag );
197+ if (EXPECTED (value )) {
198+ bool is_enabled = zend_ini_parse_bool (value );
199+ ddog_CharSlice val = is_enabled ? ONE : ZERO ;
200+ dd_crasht_push_tag (tags , tag , val );
201+ }
202+ }
203+
193204 // opcache.jit_buffer_size is INI_SYSTEM, so we can check it now. If it's
194205 // zero, then JIT won't operate.
195206 {
@@ -209,25 +220,6 @@ static void dd_crasht_add_opcache_inis(ddog_Vec_Tag *tags) {
209220 ? dd_zend_string_to_CharSlice (value )
210221 : ZERO ;
211222 dd_crasht_push_tag (tags , tag , val );
212- if (UNEXPECTED (!is_positive )) {
213- goto opcache_disabled ;
214- }
215- }
216- }
217-
218- // The CLI SAPI has an additional configuration for being enabled. This is
219- // INI_SYSTEM so we can check it here.
220- bool is_cli_sapi = strcmp ("cli" , sapi_module .name ) == 0 ;
221- if (is_cli_sapi ) {
222- ddog_CharSlice tag = DDOG_CHARSLICE_C ("php.opcache.enable_cli" );
223- zend_string * value = dd_crasht_find_ini_by_tag (tag );
224- if (EXPECTED (value )) {
225- bool is_enabled = zend_ini_parse_bool (value );
226- ddog_CharSlice val = is_enabled ? ONE : ZERO ;
227- dd_crasht_push_tag (tags , tag , val );
228- if (UNEXPECTED (!is_enabled )) {
229- goto opcache_disabled ;
230- }
231223 }
232224 }
233225
0 commit comments