2828#include "zend_extensions.h"
2929#include "standard/php_math.h"
3030#include "ext/standard/info.h"
31-
32- #if PHP_VERSION_ID < 70100
3331#include "standard/php_rand.h"
34- #endif
3532
3633/**
3734 * True globals for storing the original zend_execute_ex and
@@ -146,11 +143,12 @@ static zend_string *span_id_from_options(HashTable *options)
146143 return NULL ;
147144 }
148145
149- if (val = zend_hash_str_find (options , "spanId" , strlen ("spanId" ))) {
150- return Z_STR_P (val );
151- } else {
146+ val = zend_hash_str_find (options , "spanId" , strlen ("spanId" ));
147+ if (val == NULL ) {
152148 return NULL ;
153149 }
150+
151+ return Z_STR_P (val );
154152}
155153
156154static opencensus_trace_span_t * span_from_options (zval * options )
@@ -162,7 +160,8 @@ static opencensus_trace_span_t *span_from_options(zval *options)
162160 return NULL ;
163161 }
164162
165- if (span_id = span_id_from_options (Z_ARR_P (options ))) {
163+ span_id = span_id_from_options (Z_ARR_P (options ));
164+ if (span_id != NULL ) {
166165 span = (opencensus_trace_span_t * )zend_hash_find_ptr (OPENCENSUS_TRACE_G (spans ), span_id );
167166 }
168167
@@ -365,7 +364,6 @@ static void opencensus_trace_execute_callback(opencensus_trace_span_t *span, zen
365364 opencensus_trace_span_apply_span_options (span , & callback_result );
366365 }
367366 ZVAL_DESTRUCTOR (& callback_result );
368- zend_string_release (callback_name );
369367 } else if (Z_TYPE_P (span_options ) == IS_ARRAY ) {
370368 opencensus_trace_span_apply_span_options (span , span_options );
371369 }
0 commit comments