Skip to content

Commit fa71c87

Browse files
committed
Fix incorrect exception check in php_var_export()
1 parent bff681c commit fa71c87

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/standard/var.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,9 @@ PHPAPI zend_result php_var_export_ex(zval *struc, int level, smart_str *buf) /*
661661
PHPAPI void php_var_export(zval *struc, int level) /* {{{ */
662662
{
663663
smart_str buf = {0};
664-
php_var_export_ex(struc, level, &buf);
664+
zend_result result = php_var_export_ex(struc, level, &buf);
665665
smart_str_0(&buf);
666-
if (EG(exception)) {
666+
if (result == SUCCESS) {
667667
PHPWRITE(ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));
668668
}
669669
smart_str_free(&buf);
@@ -683,10 +683,10 @@ PHP_FUNCTION(var_export)
683683
Z_PARAM_BOOL(return_output)
684684
ZEND_PARSE_PARAMETERS_END();
685685

686-
php_var_export_ex(var, 1, &buf);
686+
zend_result result = php_var_export_ex(var, 1, &buf);
687687
smart_str_0 (&buf);
688688

689-
if (EG(exception)) {
689+
if (result == FAILURE) {
690690
smart_str_free(&buf);
691691
} else if (return_output) {
692692
RETURN_STR(smart_str_extract(&buf));

0 commit comments

Comments
 (0)