@@ -552,7 +552,7 @@ void xx_parse_program(zval *return_value, char *program, size_t program_length,
552552 switch (scanner_status ) {
553553 case XX_SCANNER_RETCODE_ERR :
554554 case XX_SCANNER_RETCODE_IMPOSSIBLE :
555- if (error_msg && Z_TYPE_P (error_msg ) == IS_NULL ) {
555+ if (error_msg && Z_TYPE_P (error_msg ) != IS_ARRAY ) {
556556 error = emalloc (sizeof (char ) * 1024 );
557557 if (state -> cursor ) {
558558 snprintf (error , 1024 , "Scanner error: %d %s" , scanner_status , state -> cursor );
@@ -584,7 +584,6 @@ void xx_parse_program(zval *return_value, char *program, size_t program_length,
584584 status = FAILURE ;
585585 if (parser_status -> syntax_error && error_msg && Z_TYPE_P (error_msg ) != IS_ARRAY ) {
586586 array_init (error_msg );
587-
588587 add_assoc_string (error_msg , "type" , "error" );
589588 add_assoc_string (error_msg , "message" , parser_status -> syntax_error );
590589 add_assoc_string (error_msg , "file" , state -> active_file );
@@ -597,7 +596,7 @@ void xx_parse_program(zval *return_value, char *program, size_t program_length,
597596 }
598597 else if (error_msg && Z_TYPE_P (error_msg ) != IS_ARRAY ) {
599598 assert (Z_TYPE (parser_status -> ret ) == IS_ARRAY );
600- ZVAL_ZVAL (error_msg , & parser_status -> ret , 1 , 1 );
599+ ZVAL_COPY_VALUE (error_msg , & parser_status -> ret );
601600 }
602601 }
603602
0 commit comments