php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64694
Patch yaml.array-key.patch revision 2013-04-23 00:01 UTC by me at fixxxer dot me

Patch yaml.array-key.patch for yaml Bug #64694

Patch version 2013-04-23 00:01 UTC

Return to Bug #64694 | Download this patch
Patch Revisions:

Developer: me@fixxxer.me

diff --git a/parse.c b/parse.c
index 2b9956f..7519084 100644
--- a/parse.c
+++ b/parse.c
@@ -418,6 +418,13 @@ static zval *handle_mapping(parser_state_t *state TSRMLS_DC)
 		key_str = convert_to_char(key TSRMLS_CC);
 		zval_ptr_dtor(&key);
 
+		if (NULL == key_str) {
+			zval_ptr_dtor(&retval);
+			yaml_event_delete(&src_event);
+			yaml_event_delete(&key_event);
+			return NULL;
+		}
+
 		value = get_next_element(state TSRMLS_CC);
 
 		if (NULL == value) {
@@ -429,7 +436,7 @@ static zval *handle_mapping(parser_state_t *state TSRMLS_DC)
 		}
 
 		/* check for '<<' and handle merge */
-		if (IS_NOT_QUOTED_OR_TAG_IS(key_event, YAML_MERGE_TAG) && 
+		if (IS_NOT_QUOTED_OR_TAG_IS(key_event, YAML_MERGE_TAG) &&
 				STR_EQ("<<", key_str)) {
 			/* zend_hash_merge */
 			/*
@@ -964,16 +971,7 @@ static char *convert_to_char(zval *zv TSRMLS_DC)
 		break;
 
 	default:
-		{
-			php_serialize_data_t var_hash;
-			smart_str buf = { 0 };
-
-			PHP_VAR_SERIALIZE_INIT(var_hash);
-			php_var_serialize(&buf, &zv, &var_hash TSRMLS_CC);
-			PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
-			str = buf.c;
-		}
+		str = NULL;
 		break;
 	}
 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC