@@ -1715,6 +1715,18 @@ ZEND_FUNCTION(get_defined_constants)
17151715}
17161716/* }}} */
17171717
1718+ static bool backtrace_is_arg_sensitive (const zend_execute_data * call , uint32_t offset )
1719+ {
1720+ zend_attribute * attribute = zend_get_parameter_attribute_str (
1721+ call -> func -> common .attributes ,
1722+ "sensitiveparameter" ,
1723+ sizeof ("sensitiveparameter" ) - 1 ,
1724+ offset
1725+ );
1726+
1727+ return attribute != NULL ;
1728+ }
1729+
17181730static void debug_backtrace_get_args (zend_execute_data * call , zval * arg_array ) /* {{{ */
17191731{
17201732 uint32_t num_args = ZEND_CALL_NUM_ARGS (call );
@@ -1738,14 +1750,7 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array) /
17381750 zend_string * arg_name = call -> func -> op_array .vars [i ];
17391751 zval original_arg ;
17401752 zval * arg = zend_hash_find_ex_ind (call -> symbol_table , arg_name , 1 );
1741- zend_attribute * attribute = zend_get_parameter_attribute_str (
1742- call -> func -> common .attributes ,
1743- "sensitiveparameter" ,
1744- sizeof ("sensitiveparameter" ) - 1 ,
1745- i
1746- );
1747-
1748- bool is_sensitive = attribute != NULL ;
1753+ bool is_sensitive = backtrace_is_arg_sensitive (call , i );
17491754
17501755 if (arg ) {
17511756 ZVAL_DEREF (arg );
@@ -1770,13 +1775,7 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array) /
17701775 } else {
17711776 while (i < first_extra_arg ) {
17721777 zval original_arg ;
1773- zend_attribute * attribute = zend_get_parameter_attribute_str (
1774- call -> func -> common .attributes ,
1775- "sensitiveparameter" ,
1776- sizeof ("sensitiveparameter" ) - 1 ,
1777- i
1778- );
1779- bool is_sensitive = attribute != NULL ;
1778+ bool is_sensitive = backtrace_is_arg_sensitive (call , i );
17801779
17811780 if (EXPECTED (Z_TYPE_INFO_P (p ) != IS_UNDEF )) {
17821781 zval * arg = p ;
@@ -1809,13 +1808,7 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array) /
18091808 bool is_sensitive = 0 ;
18101809
18111810 if (i < call -> func -> common .num_args || call -> func -> common .fn_flags & ZEND_ACC_VARIADIC ) {
1812- zend_attribute * attribute = zend_get_parameter_attribute_str (
1813- call -> func -> common .attributes ,
1814- "sensitiveparameter" ,
1815- sizeof ("sensitiveparameter" ) - 1 ,
1816- MIN (i , call -> func -> common .num_args )
1817- );
1818- is_sensitive = attribute != NULL ;
1811+ is_sensitive = backtrace_is_arg_sensitive (call , MIN (i , call -> func -> common .num_args ));
18191812 }
18201813
18211814 if (EXPECTED (Z_TYPE_INFO_P (p ) != IS_UNDEF )) {
@@ -1852,13 +1845,7 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array) /
18521845
18531846 ZEND_ASSERT (call -> func -> common .fn_flags & ZEND_ACC_VARIADIC );
18541847
1855- zend_attribute * attribute = zend_get_parameter_attribute_str (
1856- call -> func -> common .attributes ,
1857- "sensitiveparameter" ,
1858- sizeof ("sensitiveparameter" ) - 1 ,
1859- call -> func -> common .num_args
1860- );
1861- bool is_sensitive = attribute != NULL ;
1848+ bool is_sensitive = backtrace_is_arg_sensitive (call , call -> func -> common .num_args );
18621849
18631850 SEPARATE_ARRAY (arg_array );
18641851 ZEND_HASH_MAP_FOREACH_STR_KEY_VAL (call -> extra_named_params , name , arg ) {
0 commit comments