@@ -1506,13 +1506,20 @@ PHP_FUNCTION(error_get_last)
1506
1506
ZEND_PARSE_PARAMETERS_NONE ();
1507
1507
1508
1508
if (PG (last_error_message )) {
1509
+ zval tmp ;
1509
1510
array_init (return_value );
1510
- add_assoc_long_ex (return_value , "type" , sizeof ("type" )- 1 , PG (last_error_type ));
1511
- add_assoc_str_ex (return_value , "message" , sizeof ("message" )- 1 ,
1512
- zend_string_copy (PG (last_error_message )));
1513
- add_assoc_str_ex (return_value , "file" , sizeof ("file" )- 1 ,
1514
- zend_string_copy (PG (last_error_file )));
1515
- add_assoc_long_ex (return_value , "line" , sizeof ("line" )- 1 , PG (last_error_lineno ));
1511
+
1512
+ ZVAL_LONG (& tmp , PG (last_error_type ));
1513
+ zend_hash_update (Z_ARR_P (return_value ), ZSTR_KNOWN (ZEND_STR_TYPE ), & tmp );
1514
+
1515
+ ZVAL_STR_COPY (& tmp , PG (last_error_message ));
1516
+ zend_hash_update (Z_ARR_P (return_value ), ZSTR_KNOWN (ZEND_STR_MESSAGE ), & tmp );
1517
+
1518
+ ZVAL_STR_COPY (& tmp , PG (last_error_file ));
1519
+ zend_hash_update (Z_ARR_P (return_value ), ZSTR_KNOWN (ZEND_STR_FILE ), & tmp );
1520
+
1521
+ ZVAL_LONG (& tmp , PG (last_error_lineno ));
1522
+ zend_hash_update (Z_ARR_P (return_value ), ZSTR_KNOWN (ZEND_STR_LINE ), & tmp );
1516
1523
}
1517
1524
}
1518
1525
/* }}} */
0 commit comments