File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ zval * bstr::to_array(const bool include_meta) const {
5353 char *_type_data = estrdup (" bstr" );
5454 char *_length = estrdup (" _length" );
5555 char *_data = estrdup (" _data" );
56- char *_data_data = zend_container::get_cstring (_value);
56+ char *_data_data = (char *)emalloc (_value.length () + 1 );
57+ strcpy (_data_data, _value.c_str ());
5758 add_assoc_string (zv, _type, _type_data);
5859 add_assoc_long (zv, _length, length ());
5960 add_assoc_string (zv, _data, _data_data);
@@ -63,9 +64,10 @@ zval * bstr::to_array(const bool include_meta) const {
6364 efree (_data);
6465 efree (_data_data);
6566 } else {
66- char *tmp = zend_container::get_cstring (_value);
67- ZVAL_STRING (zv, tmp);
68- efree (tmp);
67+ char *_data_data = (char *)emalloc (_value.length () + 1 );
68+ strcpy (_data_data, _value.c_str ());
69+ ZVAL_STRING (zv, _data_data);
70+ efree (_data_data);
6971 }
7072 return zv;
7173}
Original file line number Diff line number Diff line change @@ -54,11 +54,6 @@ class zend_container {
5454 ZVAL_OBJ (new_object, Z_OBJ_P (object)->handlers ->clone_obj (object));
5555 return Z_OBJ_P (new_object);
5656 }
57- static char * get_cstring (std::string cppstring) {
58- char *result = (char *)emalloc (cppstring.length () + 1 );
59- strcpy (result, cppstring.c_str ());
60- return result;
61- }
6257};
6358
6459#endif
You can’t perform that action at this time.
0 commit comments