Commit df571a1a authored by Frederick Zhang's avatar Frederick Zhang

byte safe dict values

parent 34b65982
......@@ -320,7 +320,7 @@ zval * bdict::search(const std::string &needle, const long &mode, const std::str
std::string current_path = (path == "" ? "" : path + "/") + bitem::escape_key(str_index);
if (modek && str_index.find(needle) != std::string::npos) {
add_next_index_string(zv, current_path.c_str());
add_next_index_stringl(zv, current_path.c_str(), current_path.length());
}
if (class_name == "bdict") {
......@@ -331,10 +331,10 @@ zval * bdict::search(const std::string &needle, const long &mode, const std::str
zend_hash_append_strings(Z_ARRVAL_P(zv), Z_ARRVAL_P(next_result));
} else if (modev && class_name == "bstr") {
if ((zend_container::bstr_fetch_object(Z_OBJ_P(value)))->bstr_data->_value.find(needle) != std::string::npos)
add_next_index_string(zv, current_path.c_str());
add_next_index_stringl(zv, current_path.c_str(), current_path.length());
} else if (modev && bitem::is_ll(needle) && class_name == "bint") {
if ((zend_container::bint_fetch_object(Z_OBJ_P(value)))->bint_data->_value == std::stoll(needle))
add_next_index_string(zv, current_path.c_str());
add_next_index_stringl(zv, current_path.c_str(), current_path.length());
}
}
......
......@@ -350,10 +350,10 @@ zval * blist::search(const std::string &needle, const long &mode, const std::str
zend_hash_append_strings(Z_ARRVAL_P(zv), Z_ARRVAL_P(next_result));
} else if (modev && class_name == "bstr") {
if ((zend_container::bstr_fetch_object(Z_OBJ_P(value)))->bstr_data->_value.find(needle) != std::string::npos)
add_next_index_string(zv, current_path.c_str());
add_next_index_stringl(zv, current_path.c_str(), current_path.length());
} else if (modev && bitem::is_ll(needle) && class_name == "bint") {
if ((zend_container::bint_fetch_object(Z_OBJ_P(value)))->bint_data->_value == std::stoll(needle))
add_next_index_string(zv, current_path.c_str());
add_next_index_stringl(zv, current_path.c_str(), current_path.length());
}
}
......
......@@ -57,7 +57,7 @@ zval * bstr::to_array(const bool include_meta) const {
strcpy(_data_data, _value.c_str());
add_assoc_string(zv, _type, _type_data);
add_assoc_long(zv, _length, length());
add_assoc_string(zv, _data, _data_data);
add_assoc_stringl(zv, _data, _data_data, _value.length());
efree(_type);
efree(_type_data);
efree(_length);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment