@@ -272,6 +272,8 @@ ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op);
272272ZEND_API double ZEND_FASTCALL zval_get_double_func (zval * op );
273273ZEND_API zend_string * ZEND_FASTCALL zval_get_string_func (zval * op );
274274ZEND_API zend_string * ZEND_FASTCALL zval_try_get_string_func (zval * op );
275+ ZEND_API zend_string * ZEND_FASTCALL zval_get_string_noempbool_func (zval * op );
276+ ZEND_API zend_string * ZEND_FASTCALL zval_try_get_string_noempbool_func (zval * op );
275277
276278static zend_always_inline zend_long zval_get_long (zval * op ) {
277279 return EXPECTED (Z_TYPE_P (op ) == IS_LONG ) ? Z_LVAL_P (op ) : zval_get_long_func (op );
@@ -282,6 +284,9 @@ static zend_always_inline double zval_get_double(zval *op) {
282284static zend_always_inline zend_string * zval_get_string (zval * op ) {
283285 return EXPECTED (Z_TYPE_P (op ) == IS_STRING ) ? zend_string_copy (Z_STR_P (op )) : zval_get_string_func (op );
284286}
287+ static zend_always_inline zend_string * zval_get_string_noempbool (zval * op ) {
288+ return EXPECTED (Z_TYPE_P (op ) == IS_STRING ) ? zend_string_copy (Z_STR_P (op )) : zval_get_string_noempbool_func (op );
289+ }
285290
286291static zend_always_inline zend_string * zval_get_tmp_string (zval * op , zend_string * * tmp ) {
287292 if (EXPECTED (Z_TYPE_P (op ) == IS_STRING )) {
@@ -291,6 +296,14 @@ static zend_always_inline zend_string *zval_get_tmp_string(zval *op, zend_string
291296 return * tmp = zval_get_string_func (op );
292297 }
293298}
299+ static zend_always_inline zend_string * zval_get_tmp_string_noempbool (zval * op , zend_string * * tmp ) {
300+ if (EXPECTED (Z_TYPE_P (op ) == IS_STRING )) {
301+ * tmp = NULL ;
302+ return Z_STR_P (op );
303+ } else {
304+ return * tmp = zval_get_string_noempbool_func (op );
305+ }
306+ }
294307static zend_always_inline void zend_tmp_string_release (zend_string * tmp ) {
295308 if (UNEXPECTED (tmp )) {
296309 zend_string_release_ex (tmp , 0 );
@@ -307,6 +320,16 @@ static zend_always_inline zend_string *zval_try_get_string(zval *op) {
307320 return zval_try_get_string_func (op );
308321 }
309322}
323+ /* Like zval_get_string, but returns NULL if the conversion fails with an exception. */
324+ static zend_always_inline zend_string * zval_try_get_string_noempbool (zval * op ) {
325+ if (EXPECTED (Z_TYPE_P (op ) == IS_STRING )) {
326+ zend_string * ret = zend_string_copy (Z_STR_P (op ));
327+ ZEND_ASSUME (ret != NULL );
328+ return ret ;
329+ } else {
330+ return zval_try_get_string_noempbool_func (op );
331+ }
332+ }
310333
311334/* Like zval_get_tmp_string, but returns NULL if the conversion fails with an exception. */
312335static zend_always_inline zend_string * zval_try_get_tmp_string (zval * op , zend_string * * tmp ) {
@@ -319,6 +342,17 @@ static zend_always_inline zend_string *zval_try_get_tmp_string(zval *op, zend_st
319342 return * tmp = zval_try_get_string_func (op );
320343 }
321344}
345+ /* Like zval_get_tmp_string, but returns NULL if the conversion fails with an exception. */
346+ static zend_always_inline zend_string * zval_try_get_tmp_string_noempbool (zval * op , zend_string * * tmp ) {
347+ if (EXPECTED (Z_TYPE_P (op ) == IS_STRING )) {
348+ zend_string * ret = Z_STR_P (op );
349+ * tmp = NULL ;
350+ ZEND_ASSUME (ret != NULL );
351+ return ret ;
352+ } else {
353+ return * tmp = zval_try_get_string_noempbool_func (op );
354+ }
355+ }
322356
323357/* Like convert_to_string(), but returns whether the conversion succeeded and does not modify the
324358 * zval in-place if it fails. */
0 commit comments