#if ZEND_DEBUG
#define CHECK_ZVAL_STRING(str) \
- if ((str)->val[(str)->len] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", (str)->val); }
+ if (ZSTR_VAL(str)[ZSTR_LEN(str)] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", ZSTR_VAL(str)); }
#define CHECK_ZVAL_STRING_REL(str) \
- if ((str)->val[(str)->len] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", (str)->val ZEND_FILE_LINE_RELAY_CC); }
+ if (ZSTR_VAL(str)[ZSTR_LEN(str)] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", ZSTR_VAL(str) ZEND_FILE_LINE_RELAY_CC); }
#else
#define CHECK_ZVAL_STRING(z)
#define CHECK_ZVAL_STRING_REL(z)
Z_PARAM_PROLOGUE(separate); \
if (UNEXPECTED(!zend_parse_arg_object(_arg, &dest, _ce, check_null))) { \
if (_ce) { \
- _error = (_ce)->name->val; \
+ _error = ZSTR_VAL((_ce)->name); \
error_code = ZPP_ERROR_WRONG_CLASS; \
break; \
} else { \
_zend_handle_numeric_str(key, length, &idx)
#define ZEND_HANDLE_NUMERIC(key, idx) \
- ZEND_HANDLE_NUMERIC_STR((key)->val, (key)->len, idx)
+ ZEND_HANDLE_NUMERIC_STR(ZSTR_VAL(key), ZSTR_LEN(key), idx)
static zend_always_inline zval *zend_hash_find_ind(const HashTable *ht, zend_string *key)
zend_string_hash_val(key);
}
p->key = key;
- p->h = key->h;
+ p->h = ZSTR_H(key);
nIndex = (uint32_t)p->h | ht->nTableMask;
Z_NEXT(p->val) = HT_HASH(ht, nIndex);
HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
zend_string_hash_val(key);
}
p->key = key;
- p->h = key->h;
+ p->h = ZSTR_H(key);
nIndex = (uint32_t)p->h | ht->nTableMask;
Z_NEXT(p->val) = HT_HASH(ht, nIndex);
HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
zend_string_hash_val(key);
}
p->key = key;
- p->h = key->h;
+ p->h = ZSTR_H(key);
nIndex = (uint32_t)p->h | ht->nTableMask;
Z_NEXT(p->val) = HT_HASH(ht, nIndex);
HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
if (UNEXPECTED(!str->s)) {
goto do_smart_str_realloc;
} else {
- len += str->s->len;
+ len += ZSTR_LEN(str->s);
if (UNEXPECTED(len >= str->a)) {
do_smart_str_realloc:
if (persistent) {
static zend_always_inline void smart_str_0(smart_str *str) {
if (str->s) {
- str->s->val[str->s->len] = '\0';
+ ZSTR_VAL(str->s)[ZSTR_LEN(str->s)] = '\0';
}
}
static zend_always_inline void smart_str_appendc_ex(smart_str *dest, char ch, zend_bool persistent) {
size_t new_len = smart_str_alloc(dest, 1, persistent);
- dest->s->val[new_len - 1] = ch;
- dest->s->len = new_len;
+ ZSTR_VAL(dest->s)[new_len - 1] = ch;
+ ZSTR_LEN(dest->s) = new_len;
}
static zend_always_inline void smart_str_appendl_ex(smart_str *dest, const char *str, size_t len, zend_bool persistent) {
size_t new_len = smart_str_alloc(dest, len, persistent);
- memcpy(dest->s->val + dest->s->len, str, len);
- dest->s->len = new_len;
+ memcpy(ZSTR_VAL(dest->s) + ZSTR_LEN(dest->s), str, len);
+ ZSTR_LEN(dest->s) = new_len;
}
static zend_always_inline void smart_str_append_ex(smart_str *dest, const zend_string *src, zend_bool persistent) {
- smart_str_appendl_ex(dest, src->val, src->len, persistent);
+ smart_str_appendl_ex(dest, ZSTR_VAL(src), ZSTR_LEN(src), persistent);
}
static zend_always_inline void smart_str_append_smart_str_ex(smart_str *dest, const smart_str *src, zend_bool persistent) {
- if (src->s && src->s->len) {
+ if (src->s && ZSTR_LEN(src->s)) {
smart_str_append_ex(dest, src->s, persistent);
}
}
/* Shortcuts */
-#define ZSTR_VAL(zstr) zend_string_get_val(zstr)
+#define ZSTR_VAL(zstr) (zstr)->val
#define ZSTR_LEN(zstr) (zstr)->len
+#define ZSTR_H(zstr) (zstr)->h
#define ZSTR_HASH(zstr) zend_string_hash_val(zstr)
/* Compatibility macros */
GC_REFCOUNT(str) = 1; \
GC_TYPE_INFO(str) = IS_STRING; \
zend_string_forget_hash_val(str); \
- zend_string_set_len(str, _len); \
+ ZSTR_LEN(str) = _len; \
} while (0)
#define ZSTR_ALLOCA_INIT(str, s, len, use_heap) do { \
/*---*/
-static zend_always_inline char * zend_string_get_val(zend_string *s)
-{
- return s->val;
-}
-
-static zend_always_inline void zend_string_set_len(zend_string *s, size_t len)
-{
- s->len = len;
-}
-
static zend_always_inline zend_ulong zend_string_hash_val(zend_string *s)
{
- if (!s->h) {
- s->h = zend_hash_func(ZSTR_VAL(s), ZSTR_LEN(s));
+ if (!ZSTR_H(s)) {
+ ZSTR_H(s) = zend_hash_func(ZSTR_VAL(s), ZSTR_LEN(s));
}
- return s->h;
+ return ZSTR_H(s);
}
static zend_always_inline void zend_string_forget_hash_val(zend_string *s)
{
- s->h = 0;
+ ZSTR_H(s) = 0;
}
static zend_always_inline uint32_t zend_string_refcount(const zend_string *s)
GC_INFO(ret) = 0;
#endif
zend_string_forget_hash_val(ret);
- zend_string_set_len(ret, len);
+ ZSTR_LEN(ret) = len;
return ret;
}
GC_INFO(ret) = 0;
#endif
zend_string_forget_hash_val(ret);
- zend_string_set_len(ret, (n * m) + l);
+ ZSTR_LEN(ret) = (n * m) + l;
return ret;
}
if (!ZSTR_IS_INTERNED(s)) {
if (EXPECTED(GC_REFCOUNT(s) == 1)) {
ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
- zend_string_set_len(ret, len);
+ ZSTR_LEN(ret) = len;
zend_string_forget_hash_val(ret);
return ret;
} else {
if (!ZSTR_IS_INTERNED(s)) {
if (EXPECTED(GC_REFCOUNT(s) == 1)) {
ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
- zend_string_set_len(ret, len);
+ ZSTR_LEN(ret) = len;
zend_string_forget_hash_val(ret);
return ret;
} else {
if (!ZSTR_IS_INTERNED(s)) {
if (EXPECTED(GC_REFCOUNT(s) == 1)) {
ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
- zend_string_set_len(ret, len);
+ ZSTR_LEN(ret) = len;
zend_string_forget_hash_val(ret);
return ret;
} else {
if (!ZSTR_IS_INTERNED(s)) {
if (GC_REFCOUNT(s) == 1) {
ret = (zend_string *)safe_perealloc(s, n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent);
- zend_string_set_len(ret, (n * m) + l);
+ ZSTR_LEN(ret) = (n * m) + l;
zend_string_forget_hash_val(ret);
return ret;
} else {
}
}
for (i = 0; i <= opline->extended_value; i++) {
- len += rope[i]->len;
+ len += ZSTR_LEN(rope[i]);
}
ret = EX_VAR(opline->result.var);
ZVAL_STR(ret, zend_string_alloc(len, 0));
target = Z_STRVAL_P(ret);
for (i = 0; i <= opline->extended_value; i++) {
- memcpy(target, rope[i]->val, rope[i]->len);
- target += rope[i]->len;
+ memcpy(target, ZSTR_VAL(rope[i]), ZSTR_LEN(rope[i]));
+ target += ZSTR_LEN(rope[i]);
zend_string_release(rope[i]);
}
*target = '\0';
}
}
for (i = 0; i <= opline->extended_value; i++) {
- len += rope[i]->len;
+ len += ZSTR_LEN(rope[i]);
}
ret = EX_VAR(opline->result.var);
ZVAL_STR(ret, zend_string_alloc(len, 0));
target = Z_STRVAL_P(ret);
for (i = 0; i <= opline->extended_value; i++) {
- memcpy(target, rope[i]->val, rope[i]->len);
- target += rope[i]->len;
+ memcpy(target, ZSTR_VAL(rope[i]), ZSTR_LEN(rope[i]));
+ target += ZSTR_LEN(rope[i]);
zend_string_release(rope[i]);
}
*target = '\0';
}
}
for (i = 0; i <= opline->extended_value; i++) {
- len += rope[i]->len;
+ len += ZSTR_LEN(rope[i]);
}
ret = EX_VAR(opline->result.var);
ZVAL_STR(ret, zend_string_alloc(len, 0));
target = Z_STRVAL_P(ret);
for (i = 0; i <= opline->extended_value; i++) {
- memcpy(target, rope[i]->val, rope[i]->len);
- target += rope[i]->len;
+ memcpy(target, ZSTR_VAL(rope[i]), ZSTR_LEN(rope[i]));
+ target += ZSTR_LEN(rope[i]);
zend_string_release(rope[i]);
}
*target = '\0';
}
}
for (i = 0; i <= opline->extended_value; i++) {
- len += rope[i]->len;
+ len += ZSTR_LEN(rope[i]);
}
ret = EX_VAR(opline->result.var);
ZVAL_STR(ret, zend_string_alloc(len, 0));
target = Z_STRVAL_P(ret);
for (i = 0; i <= opline->extended_value; i++) {
- memcpy(target, rope[i]->val, rope[i]->len);
- target += rope[i]->len;
+ memcpy(target, ZSTR_VAL(rope[i]), ZSTR_LEN(rope[i]));
+ target += ZSTR_LEN(rope[i]);
zend_string_release(rope[i]);
}
*target = '\0';
if (str == NULL) bc_out_of_memory();
/* The negative sign if needed. */
- sptr = str->val;
+ sptr = ZSTR_VAL(str);
if (signch) *sptr++ = '-';
/* Load the whole number. */
/* Terminate the string and return it! */
*sptr = '\0';
- str->len = sptr - (char *)str->val;
+ ZSTR_LEN(str) = sptr - (char *)ZSTR_VAL(str);
return str;
}
* failed.
*/
if (opened_path && !bz_file && mode[0] == 'w') {
- VCWD_UNLINK((*opened_path)->val);
+ VCWD_UNLINK(ZSTR_VAL(*opened_path));
}
}
RETURN_FALSE;
}
data = zend_string_alloc(len, 0);
- data->len = php_stream_read(stream, data->val, data->len);
- data->val[data->len] = '\0';
+ ZSTR_LEN(data) = php_stream_read(stream, ZSTR_VAL(data), ZSTR_LEN(data));
+ ZSTR_VAL(data)[ZSTR_LEN(data)] = '\0';
RETURN_NEW_STR(data);
}
work_factor = zwork_factor;
}
- error = BZ2_bzBuffToBuffCompress(dest->val, &dest_len, source, source_len, block_size, 0, work_factor);
+ error = BZ2_bzBuffToBuffCompress(ZSTR_VAL(dest), &dest_len, source, source_len, block_size, 0, work_factor);
if (error != BZ_OK) {
zend_string_free(dest);
RETURN_LONG(error);
} else {
/* Copy the buffer, we have perhaps allocate a lot more than we need,
so we erealloc() the buffer to the proper size */
- dest->len = dest_len;
- dest->val[dest->len] = '\0';
+ ZSTR_LEN(dest) = dest_len;
+ ZSTR_VAL(dest)[ZSTR_LEN(dest)] = '\0';
RETURN_NEW_STR(dest);
}
}
#endif
{
zend_string *str = zval_get_string(zvalue);
- int ret = php_curl_option_str(ch, option, str->val, str->len, 0);
+ int ret = php_curl_option_str(ch, option, ZSTR_VAL(str), ZSTR_LEN(str), 0);
zend_string_release(str);
return ret;
}
error = curl_easy_setopt(ch->cp, option, NULL);
} else {
zend_string *str = zval_get_string(zvalue);
- int ret = php_curl_option_str(ch, option, str->val, str->len, 0);
+ int ret = php_curl_option_str(ch, option, ZSTR_VAL(str), ZSTR_LEN(str), 0);
zend_string_release(str);
return ret;
}
case CURLOPT_PRIVATE:
{
zend_string *str = zval_get_string(zvalue);
- int ret = php_curl_option_str(ch, option, str->val, str->len, 1);
+ int ret = php_curl_option_str(ch, option, ZSTR_VAL(str), ZSTR_LEN(str), 1);
zend_string_release(str);
return ret;
}
case CURLOPT_URL:
{
zend_string *str = zval_get_string(zvalue);
- int ret = php_curl_option_url(ch, str->val, str->len);
+ int ret = php_curl_option_url(ch, ZSTR_VAL(str), ZSTR_LEN(str));
zend_string_release(str);
return ret;
}
ZEND_HASH_FOREACH_VAL(ph, current) {
val = zval_get_string(current);
- slist = curl_slist_append(slist, val->val);
+ slist = curl_slist_append(slist, ZSTR_VAL(val));
zend_string_release(val);
if (!slist) {
php_error_docref(NULL, E_WARNING, "Could not build curl_slist");
prop = zend_read_property(curl_CURLFile_class, current, "name", sizeof("name")-1, 0, &rv);
if (Z_TYPE_P(prop) != IS_STRING) {
- php_error_docref(NULL, E_WARNING, "Invalid filename for key %s", string_key->val);
+ php_error_docref(NULL, E_WARNING, "Invalid filename for key %s", ZSTR_VAL(string_key));
} else {
postval = Z_STR_P(prop);
- if (php_check_open_basedir(postval->val)) {
+ if (php_check_open_basedir(ZSTR_VAL(postval))) {
return 1;
}
filename = Z_STRVAL_P(prop);
}
form_error = curl_formadd(&first, &last,
- CURLFORM_COPYNAME, string_key->val,
- CURLFORM_NAMELENGTH, string_key->len,
- CURLFORM_FILENAME, filename ? filename : postval->val,
+ CURLFORM_COPYNAME, ZSTR_VAL(string_key),
+ CURLFORM_NAMELENGTH, ZSTR_LEN(string_key),
+ CURLFORM_FILENAME, filename ? filename : ZSTR_VAL(postval),
CURLFORM_CONTENTTYPE, type ? type : "application/octet-stream",
- CURLFORM_FILE, postval->val,
+ CURLFORM_FILE, ZSTR_VAL(postval),
CURLFORM_END);
if (form_error != CURL_FORMADD_OK) {
/* Not nice to convert between enums but we only have place for one error type */
* must be explicitly cast to long in curl_formadd
* use since curl needs a long not an int. */
form_error = curl_formadd(&first, &last,
- CURLFORM_COPYNAME, string_key->val,
- CURLFORM_NAMELENGTH, string_key->len,
- CURLFORM_COPYCONTENTS, postval->val,
- CURLFORM_CONTENTSLENGTH, postval->len,
+ CURLFORM_COPYNAME, ZSTR_VAL(string_key),
+ CURLFORM_NAMELENGTH, ZSTR_LEN(string_key),
+ CURLFORM_COPYCONTENTS, ZSTR_VAL(postval),
+ CURLFORM_CONTENTSLENGTH, ZSTR_LEN(postval),
CURLFORM_END);
if (form_error != CURL_FORMADD_OK) {
#if LIBCURL_VERSION_NUM >= 0x071101
zend_string *str = zval_get_string(zvalue);
/* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, str->len);
- error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, str->val);
+ error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, ZSTR_LEN(str));
+ error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, ZSTR_VAL(str));
zend_string_release(str);
#else
char *post = NULL;
zend_string *str = zval_get_string(zvalue);
- post = estrndup(str->val, str->len);
+ post = estrndup(ZSTR_VAL(str), ZSTR_LEN(str));
zend_llist_add_element(&ch->to_free->str, &post);
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, str->len);
+ error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, ZSTR_LEN(str));
zend_string_release(str);
#endif
}
zend_string *str = zval_get_string(zvalue);
int ret;
- if (str->len && php_check_open_basedir(str->val)) {
+ if (ZSTR_LEN(str) && php_check_open_basedir(ZSTR_VAL(str))) {
zend_string_release(str);
return FAILURE;
}
- ret = php_curl_option_str(ch, option, str->val, str->len, 0);
+ ret = php_curl_option_str(ch, option, ZSTR_VAL(str), ZSTR_LEN(str), 0);
zend_string_release(str);
return ret;
}
initial buffer is too small. See
http://connect.microsoft.com/VisualStudio/feedback/details/759720/vs2012-strftime-crash-with-z-formatting-code */
buf = zend_string_alloc(buf_len, 0);
- while ((real_len = strftime(buf->val, buf_len, format, &ta)) == buf_len || real_len == 0) {
+ while ((real_len = strftime(ZSTR_VAL(buf), buf_len, format, &ta)) == buf_len || real_len == 0) {
buf_len *= 2;
buf = zend_string_extend(buf, buf_len, 0);
if (!--max_reallocs) {
zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
timelib_sll utc_offset = dateobj->time->z;
- tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
+ ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
utc_offset > 0 ? '-' : '+',
abs(utc_offset / 60),
abs((utc_offset % 60)));
case TIMELIB_ZONETYPE_OFFSET: {
zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
- tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
+ ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
tzobj->tzi.utc_offset > 0 ? '-' : '+',
abs(tzobj->tzi.utc_offset / 60),
abs((tzobj->tzi.utc_offset % 60)));
zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
timelib_sll utc_offset = tzobj->tzi.utc_offset;
- tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
+ ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
utc_offset > 0 ? '-' : '+',
abs(utc_offset / 60),
abs((utc_offset % 60)));
zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
if (z_arg) { \
zend_string *str = zval_get_string(z_arg); \
- DATE_A64I((*intobj)->diff->member, str->val); \
+ DATE_A64I((*intobj)->diff->member, ZSTR_VAL(str)); \
zend_string_release(str); \
} else { \
(*intobj)->diff->member = -1LL; \
str = zval_get_string(newval);
- xmlNodeSetContentLen((xmlNodePtr) attrp, (xmlChar *) str->val, str->len + 1);
+ xmlNodeSetContentLen((xmlNodePtr) attrp, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1);
zend_string_release(str);
return SUCCESS;
str = zval_get_string(newval);
- xmlNodeSetContentLen(nodep, (xmlChar *) str->val, str->len + 1);
+ xmlNodeSetContentLen(nodep, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1);
zend_string_release(str);
return SUCCESS;
if (docp->encoding != NULL) {
xmlFree((xmlChar *)docp->encoding);
}
- docp->encoding = xmlStrdup((const xmlChar *) str->val);
+ docp->encoding = xmlStrdup((const xmlChar *) ZSTR_VAL(str));
} else {
php_error_docref(NULL, E_WARNING, "Invalid Document Encoding");
}
str = zval_get_string(newval);
- docp->version = xmlStrdup((const xmlChar *) str->val);
+ docp->version = xmlStrdup((const xmlChar *) ZSTR_VAL(str));
zend_string_release(str);
return SUCCESS;
str = zval_get_string(newval);
- docp->URL = xmlStrdup((const xmlChar *) str->val);
+ docp->URL = xmlStrdup((const xmlChar *) ZSTR_VAL(str));
zend_string_release(str);
return SUCCESS;
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
if (dom_set_doc_classmap(intern->document, basece, ce) == FAILURE) {
- php_error_docref(NULL, E_ERROR, "Class %s could not be registered.", ce->name->val);
+ php_error_docref(NULL, E_ERROR, "Class %s could not be registered.", ZSTR_VAL(ce->name));
}
RETURN_TRUE;
} else {
- php_error_docref(NULL, E_ERROR, "Class %s is not derived from %s.", ce->name->val, basece->name->val);
+ php_error_docref(NULL, E_ERROR, "Class %s is not derived from %s.", ZSTR_VAL(ce->name), ZSTR_VAL(basece->name));
}
RETURN_FALSE;
case XML_PI_NODE:
{
zend_string *str = zval_get_string(newval);
- xmlNodeSetContentLen(nodep, (xmlChar *) str->val, str->len + 1);
+ xmlNodeSetContentLen(nodep, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1);
zend_string_release(str);
break;
}
}
}
str = zval_get_string(newval);
- prefix = str->val;
+ prefix = ZSTR_VAL(str);
if (nsnode && nodep->ns != NULL && !xmlStrEqual(nodep->ns->prefix, (xmlChar *)prefix)) {
strURI = (char *) nodep->ns->href;
if (strURI == NULL ||
}
str = zval_get_string(newval);
- enc_str = xmlEncodeEntitiesReentrant(nodep->doc, (xmlChar *) str->val);
+ enc_str = xmlEncodeEntitiesReentrant(nodep->doc, (xmlChar *) ZSTR_VAL(str));
xmlNodeSetContent(nodep, enc_str);
xmlFree(enc_str);
zend_string_release(str);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(tmp), prefix, tmpns) {
if (Z_TYPE_P(tmpns) == IS_STRING) {
if (prefix) {
- xmlXPathRegisterNs(ctxp, (xmlChar *) prefix->val, (xmlChar *) Z_STRVAL_P(tmpns));
+ xmlXPathRegisterNs(ctxp, (xmlChar *) ZSTR_VAL(prefix), (xmlChar *) Z_STRVAL_P(tmpns));
}
}
} ZEND_HASH_FOREACH_END();
if (obj->prop_handler != NULL) {
hnd = zend_hash_find_ptr(obj->prop_handler, member_str);
} else if (instanceof_function(obj->std.ce, dom_node_class_entry)) {
- php_error(E_WARNING, "Couldn't fetch %s. Node no longer exists", obj->std.ce->name->val);
+ php_error(E_WARNING, "Couldn't fetch %s. Node no longer exists", ZSTR_VAL(obj->std.ce->name));
}
if (hnd) {
#define DOM_GET_OBJ(__ptr, __id, __prtype, __intern) { \
__intern = Z_DOMOBJ_P(__id); \
if (__intern->ptr == NULL || !(__ptr = (__prtype)((php_libxml_node_ptr *)__intern->ptr)->node)) { \
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", __intern->std.ce->name->val);\
+ php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(__intern->std.ce->name));\
RETURN_NULL();\
} \
}
str = zval_get_string(newval);
- xmlNodeSetContentLen(nodep, (xmlChar *) str->val, str->len + 1);
+ xmlNodeSetContentLen(nodep, (xmlChar *) ZSTR_VAL(str), ZSTR_LEN(str) + 1);
zend_string_release(str);
return SUCCESS;
__intern = Z_LIBXML_NODE_P(__id); \
if (__intern->node == NULL || !(__ptr = (__prtype)__intern->node->node)) { \
php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", \
- __intern->std.ce->name->val);\
+ ZSTR_VAL(__intern->std.ce->name));\
RETURN_NULL();\
} \
}
fci.no_separation = 0;
if (!zend_make_callable(&fci.function_name, &callable)) {
- php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", callable->val);
+ php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", ZSTR_VAL(callable));
} else if (intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable) == 0) {
- php_error_docref(NULL, E_WARNING, "Not allowed to call handler '%s()'.", callable->val);
+ php_error_docref(NULL, E_WARNING, "Not allowed to call handler '%s()'.", ZSTR_VAL(callable));
/* Push an empty string, so that we at least have an xslt result... */
valuePush(ctxt, xmlXPathNewString((xmlChar *)""));
} else {
valuePush(ctxt, xmlXPathNewString((xmlChar *)""));
} else {
zend_string *str = zval_get_string(&retval);
- valuePush(ctxt, xmlXPathNewString((xmlChar *) str->val));
+ valuePush(ctxt, xmlXPathNewString((xmlChar *) ZSTR_VAL(str)));
zend_string_release(str);
}
zval_ptr_dtor(&retval);
ZEND_INI_MH(OnUpdateEncode)
{
- if (new_value && new_value->len) {
+ if (new_value && ZSTR_LEN(new_value)) {
const zend_encoding **return_list;
size_t return_size;
- if (FAILURE == zend_multibyte_parse_encoding_list(new_value->val, new_value->len,
+ if (FAILURE == zend_multibyte_parse_encoding_list(ZSTR_VAL(new_value), ZSTR_LEN(new_value),
&return_list, &return_size, 0)) {
- php_error_docref(NULL, E_WARNING, "Illegal encoding ignored: '%s'", new_value->val);
+ php_error_docref(NULL, E_WARNING, "Illegal encoding ignored: '%s'", ZSTR_VAL(new_value));
return FAILURE;
}
efree(return_list);
if (new_value) {
const zend_encoding **return_list;
size_t return_size;
- if (FAILURE == zend_multibyte_parse_encoding_list(new_value->val, new_value->len,
+ if (FAILURE == zend_multibyte_parse_encoding_list(ZSTR_VAL(new_value), ZSTR_LEN(new_value),
&return_list, &return_size, 0)) {
- php_error_docref(NULL, E_WARNING, "Illegal encoding ignored: '%s'", new_value->val);
+ php_error_docref(NULL, E_WARNING, "Illegal encoding ignored: '%s'", ZSTR_VAL(new_value));
return FAILURE;
}
efree(return_list);
}
base = php_basename(FileName, strlen(FileName), NULL, 0);
- ImageInfo->FileName = estrndup(base->val, base->len);
+ ImageInfo->FileName = estrndup(ZSTR_VAL(base), ZSTR_LEN(base));
zend_string_release(base);
ImageInfo->read_thumbnail = read_thumbnail;
ImageInfo->read_all = read_all;
goto out;
}
- strncpy(ms->o.buf, res->val, res->len);
- ms->o.buf[res->len] = '\0';
+ strncpy(ms->o.buf, ZSTR_VAL(res), ZSTR_LEN(res));
+ ms->o.buf[ZSTR_LEN(res)] = '\0';
zend_string_release(res);
t = zend_string_alloc(len * 2 + 4, 0);
- t->val[j++] = '~';
+ ZSTR_VAL(t)[j++] = '~';
for (i = 0; i < len; i++, j++) {
switch (val[i]) {
case '~':
- t->val[j++] = '\\';
- t->val[j] = '~';
+ ZSTR_VAL(t)[j++] = '\\';
+ ZSTR_VAL(t)[j] = '~';
break;
default:
- t->val[j] = val[i];
+ ZSTR_VAL(t)[j] = val[i];
break;
}
}
- t->val[j++] = '~';
+ ZSTR_VAL(t)[j++] = '~';
if (options & PCRE_CASELESS)
- t->val[j++] = 'i';
+ ZSTR_VAL(t)[j++] = 'i';
if (options & PCRE_MULTILINE)
- t->val[j++] = 'm';
+ ZSTR_VAL(t)[j++] = 'm';
- t->val[j]='\0';
- t->len = j;
+ ZSTR_VAL(t)[j]='\0';
+ ZSTR_LEN(t) = j;
ZVAL_NEW_STR(pattern, t);
}
int i, size = sizeof(filter_list) / sizeof(filter_list_entry);
for (i = 0; i < size; ++i) {
- if ((strcasecmp(new_value->val, filter_list[i].name) == 0)) {
+ if ((strcasecmp(ZSTR_VAL(new_value), filter_list[i].name) == 0)) {
IF_G(default_filter) = filter_list[i].id;
return SUCCESS;
}
if (!new_value) {
IF_G(default_filter_flags) = FILTER_FLAG_NO_ENCODE_QUOTES;
} else {
- IF_G(default_filter_flags) = atoi(new_value->val);
+ IF_G(default_filter_flags) = atoi(ZSTR_VAL(new_value));
}
return SUCCESS;
}
zval_ptr_dtor(return_value);
RETURN_FALSE;
}
- if (arg_key->len == 0) {
+ if (ZSTR_LEN(arg_key) == 0) {
php_error_docref(NULL, E_WARNING, "Empty keys are not allowed in the definition array");
zval_ptr_dtor(return_value);
RETURN_FALSE;
}
if ((tmp = zend_hash_find(Z_ARRVAL_P(input), arg_key)) == NULL) {
if (add_empty) {
- add_assoc_null_ex(return_value, arg_key->val, arg_key->len);
+ add_assoc_null_ex(return_value, ZSTR_VAL(arg_key), ZSTR_LEN(arg_key));
}
} else {
zval nval;
}
*/
str = zend_string_alloc(3 * Z_STRLEN_P(value), 0);
- p = (unsigned char *) str->val;
+ p = (unsigned char *) ZSTR_VAL(str);
s = (unsigned char *) Z_STRVAL_P(value);
e = s + Z_STRLEN_P(value);
s++;
}
*p = '\0';
- str->len = p - (unsigned char *)str->val;
+ ZSTR_LEN(str) = p - (unsigned char *)ZSTR_VAL(str);
zval_ptr_dtor(value);
ZVAL_NEW_STR(value, str);
}
} else if ((str[i] < 32) && (flags & FILTER_FLAG_STRIP_LOW)) {
} else if ((str[i] == '`') && (flags & FILTER_FLAG_STRIP_BACKTICK)) {
} else {
- buf->val[c] = str[i];
+ ZSTR_VAL(buf)[c] = str[i];
++c;
}
}
/* update zval string data */
- buf->val[c] = '\0';
- buf->len = c;
+ ZSTR_VAL(buf)[c] = '\0';
+ ZSTR_LEN(buf) = c;
zval_ptr_dtor(value);
ZVAL_NEW_STR(value, buf);
}
c = 0;
for (i = 0; i < Z_STRLEN_P(value); i++) {
if ((*map)[str[i]]) {
- buf->val[c] = str[i];
+ ZSTR_VAL(buf)[c] = str[i];
++c;
}
}
/* update zval string data */
- buf->val[c] = '\0';
- buf->len = c;
+ ZSTR_VAL(buf)[c] = '\0';
+ ZSTR_LEN(buf) = c;
zval_ptr_dtor(value);
ZVAL_NEW_STR(value, buf);
}
return;
}
- stream = php_stream_open_wrapper(file->val, "rb", IGNORE_PATH | IGNORE_URL_WIN | REPORT_ERRORS, NULL);
+ stream = php_stream_open_wrapper(ZSTR_VAL(file), "rb", IGNORE_PATH | IGNORE_URL_WIN | REPORT_ERRORS, NULL);
if (stream == NULL) {
RETURN_FALSE;
}
}
/* needs to be malloc (persistent) - GD will free() it later */
- pstr = pestrndup(buff->val, buff->len, 1);
- io_ctx = gdNewDynamicCtxEx(buff->len, pstr, 0);
+ pstr = pestrndup(ZSTR_VAL(buff), ZSTR_LEN(buff), 1);
+ io_ctx = gdNewDynamicCtxEx(ZSTR_LEN(buff), pstr, 0);
if (!io_ctx) {
pefree(pstr, 1);
zend_string_release(buff);
}
fclose(tmp);
- VCWD_UNLINK((const char *)path->val); /* make sure that the temporary file is removed */
+ VCWD_UNLINK((const char *)ZSTR_VAL(path)); /* make sure that the temporary file is removed */
zend_string_release(path);
}
RETURN_TRUE;
if (key == NULL) {
continue;
}
- if (strcmp("linespacing", key->val) == 0) {
+ if (strcmp("linespacing", ZSTR_VAL(key)) == 0) {
strex.flags |= gdFTEX_LINESPACE;
strex.linespacing = zval_get_double(item);
}
ZEND_PARSE_PARAMETERS_END();
#endif
- PHP_GETTEXT_LENGTH_CHECK("msgid", msgid->len)
- msgstr = gettext(msgid->val);
+ PHP_GETTEXT_LENGTH_CHECK("msgid", ZSTR_LEN(msgid))
+ msgstr = gettext(ZSTR_VAL(msgid));
RETURN_STRING(msgstr);
}
php_var_serialize(&buf, &zv, &serialize_data);
PHP_VAR_SERIALIZE_DESTROY(serialize_data);
- *buffer = (unsigned char *) estrndup(buf.s->val, buf.s->len);
- *buf_len = buf.s->len;
+ *buffer = (unsigned char *) estrndup(ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));
+ *buf_len = ZSTR_LEN(buf.s);
zend_string_release(buf.s);
return SUCCESS;
}
str = zend_string_alloc(num_len, 0);
- mpz_get_str(str->val, base, gmpnum);
+ mpz_get_str(ZSTR_VAL(str), base, gmpnum);
/*
* From GMP documentation for mpz_sizeinbase():
* So let's check to see if we already have a \0 byte...
*/
- if (str->val[str->len - 1] == '\0') {
- str->len--;
+ if (ZSTR_VAL(str)[ZSTR_LEN(str) - 1] == '\0') {
+ ZSTR_LEN(str)--;
} else {
- str->val[str->len] = '\0';
+ ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
}
ZVAL_NEW_STR(result, str);
size_t out_len = count * size;
zend_string *out_string = zend_string_alloc(out_len, 0);
- mpz_export(out_string->val, NULL, order, size, endian, 0, gmpnumber);
- out_string->val[out_len] = '\0';
+ mpz_export(ZSTR_VAL(out_string), NULL, order, size, endian, 0, gmpnumber);
+ ZSTR_VAL(out_string)[out_len] = '\0';
RETURN_NEW_STR(out_string);
}
}
digest = zend_string_alloc(ops->digest_size, 0);
- ops->hash_final((unsigned char *) digest->val, context);
+ ops->hash_final((unsigned char *) ZSTR_VAL(digest), context);
efree(context);
if (raw_output) {
- digest->val[ops->digest_size] = 0;
+ ZSTR_VAL(digest)[ops->digest_size] = 0;
RETURN_NEW_STR(digest);
} else {
zend_string *hex_digest = zend_string_safe_alloc(ops->digest_size, 2, 0, 0);
- php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, ops->digest_size);
- hex_digest->val[2 * ops->digest_size] = 0;
+ php_hash_bin2hex(ZSTR_VAL(hex_digest), (unsigned char *) ZSTR_VAL(digest), ops->digest_size);
+ ZSTR_VAL(hex_digest)[2 * ops->digest_size] = 0;
zend_string_release(digest);
RETURN_NEW_STR(hex_digest);
}
ops->hash_update(context, (unsigned char *) buf, n);
}
php_stream_close(stream);
- ops->hash_final((unsigned char *) digest->val, context);
+ ops->hash_final((unsigned char *) ZSTR_VAL(digest), context);
} else {
- php_hash_hmac_round((unsigned char *) digest->val, ops, context, K, (unsigned char *) data, data_len);
+ php_hash_hmac_round((unsigned char *) ZSTR_VAL(digest), ops, context, K, (unsigned char *) data, data_len);
}
php_hash_string_xor_char(K, K, 0x6A, ops->block_size);
- php_hash_hmac_round((unsigned char *) digest->val, ops, context, K, (unsigned char *) digest->val, ops->digest_size);
+ php_hash_hmac_round((unsigned char *) ZSTR_VAL(digest), ops, context, K, (unsigned char *) ZSTR_VAL(digest), ops->digest_size);
/* Zero the key */
ZEND_SECURE_ZERO(K, ops->block_size);
efree(context);
if (raw_output) {
- digest->val[ops->digest_size] = 0;
+ ZSTR_VAL(digest)[ops->digest_size] = 0;
RETURN_NEW_STR(digest);
} else {
zend_string *hex_digest = zend_string_safe_alloc(ops->digest_size, 2, 0, 0);
- php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, ops->digest_size);
- hex_digest->val[2 * ops->digest_size] = 0;
+ php_hash_bin2hex(ZSTR_VAL(hex_digest), (unsigned char *) ZSTR_VAL(digest), ops->digest_size);
+ ZSTR_VAL(hex_digest)[2 * ops->digest_size] = 0;
zend_string_release(digest);
RETURN_NEW_STR(hex_digest);
}
digest_len = hash->ops->digest_size;
digest = zend_string_alloc(digest_len, 0);
- hash->ops->hash_final((unsigned char *) digest->val, hash->context);
+ hash->ops->hash_final((unsigned char *) ZSTR_VAL(digest), hash->context);
if (hash->options & PHP_HASH_HMAC) {
int i;
/* Feed this result into the outter hash */
hash->ops->hash_init(hash->context);
hash->ops->hash_update(hash->context, hash->key, hash->ops->block_size);
- hash->ops->hash_update(hash->context, (unsigned char *) digest->val, hash->ops->digest_size);
- hash->ops->hash_final((unsigned char *) digest->val, hash->context);
+ hash->ops->hash_update(hash->context, (unsigned char *) ZSTR_VAL(digest), hash->ops->digest_size);
+ hash->ops->hash_final((unsigned char *) ZSTR_VAL(digest), hash->context);
/* Zero the key */
ZEND_SECURE_ZERO(hash->key, hash->ops->block_size);
efree(hash->key);
hash->key = NULL;
}
- digest->val[digest_len] = 0;
+ ZSTR_VAL(digest)[digest_len] = 0;
efree(hash->context);
hash->context = NULL;
zend_list_close(Z_RES_P(zhash));
} else {
zend_string *hex_digest = zend_string_safe_alloc(digest_len, 2, 0, 0);
- php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, digest_len);
- hex_digest->val[2 * digest_len] = 0;
+ php_hash_bin2hex(ZSTR_VAL(hex_digest), (unsigned char *) ZSTR_VAL(digest), digest_len);
+ ZSTR_VAL(hex_digest)[2 * digest_len] = 0;
zend_string_release(digest);
RETURN_NEW_STR(hex_digest);
}
returnval = zend_string_alloc(length, 0);
if (raw_output) {
- memcpy(returnval->val, result, length);
+ memcpy(ZSTR_VAL(returnval), result, length);
} else {
- php_hash_bin2hex(returnval->val, result, digest_length);
+ php_hash_bin2hex(ZSTR_VAL(returnval), result, digest_length);
}
- returnval->val[length] = 0;
+ ZSTR_VAL(returnval)[length] = 0;
efree(result);
RETURN_NEW_STR(returnval);
}
char *s = buffer, *e = s + sizeof(buffer);
ZEND_HASH_FOREACH_STR_KEY(&php_hash_hashtable, str) {
- s += slprintf(s, e - s, "%s ", str->val);
+ s += slprintf(s, e - s, "%s ", ZSTR_VAL(str));
} ZEND_HASH_FOREACH_END();
*s = 0;
static PHP_INI_MH(OnUpdateInputEncoding)
{
- if (new_value->len >= ICONV_CSNMAXLEN) {
+ if (ZSTR_LEN(new_value) >= ICONV_CSNMAXLEN) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
static PHP_INI_MH(OnUpdateOutputEncoding)
{
- if(new_value->len >= ICONV_CSNMAXLEN) {
+ if (ZSTR_LEN(new_value) >= ICONV_CSNMAXLEN) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
static PHP_INI_MH(OnUpdateInternalEncoding)
{
- if(new_value->len >= ICONV_CSNMAXLEN) {
+ if (ZSTR_LEN(new_value) >= ICONV_CSNMAXLEN) {
return FAILURE;
}
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
output_context->out.free = 1;
_php_iconv_show_error(php_iconv_string(output_context->in.data, output_context->in.used, &out, get_output_encoding(), get_internal_encoding()), get_output_encoding(), get_internal_encoding());
if (out) {
- output_context->out.data = estrndup(out->val, out->len);
- output_context->out.used = out->len;
+ output_context->out.data = estrndup(ZSTR_VAL(out), ZSTR_LEN(out));
+ output_context->out.used = ZSTR_LEN(out);
zend_string_free(out);
} else {
output_context->out.data = NULL;
out_left = buf_growth - out_left;
smart_str_alloc(d, out_left, 0);
- out_p = (d)->s->val + (d)->s->len;
+ out_p = ZSTR_VAL((d)->s) + ZSTR_LEN((d)->s);
if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
#if ICONV_SUPPORTS_ERRNO
#if !ICONV_SUPPORTS_ERRNO
prev_in_left = in_left;
#endif
- (d)->s->len += (buf_growth - out_left);
+ ZSTR_LEN((d)->s) += (buf_growth - out_left);
buf_growth <<= 1;
}
} else {
out_left = buf_growth - out_left;
smart_str_alloc(d, out_left, 0);
- out_p = (d)->s->val + (d)->s->len;
+ out_p = ZSTR_VAL((d)->s) + ZSTR_LEN((d)->s);
if (iconv(cd, NULL, NULL, (char **) &out_p, &out_left) == (size_t)0) {
- (d)->s->len += (buf_growth - out_left);
+ ZSTR_LEN((d)->s) += (buf_growth - out_left);
break;
} else {
#if ICONV_SUPPORTS_ERRNO
}
#endif
}
- (d)->s->len += (buf_growth - out_left);
+ ZSTR_LEN((d)->s) += (buf_growth - out_left);
buf_growth <<= 1;
}
}
}
out_buffer = zend_string_alloc(out_size, 0);
- out_p = out_buffer->val;
+ out_p = ZSTR_VAL(out_buffer);
#ifdef NETWARE
result = iconv(cd, (char **) &in_p, &in_size, (char **)
}
if (out_left < 8) {
- size_t pos = out_p - out_buffer->val;
+ size_t pos = out_p - ZSTR_VAL(out_buffer);
out_buffer = zend_string_extend(out_buffer, out_size + 8, 0);
- out_p = out_buffer->val + pos;
+ out_p = ZSTR_VAL(out_buffer) + pos;
out_size += 7;
out_left += 7;
}
return PHP_ICONV_ERR_UNKNOWN;
}
- out_buffer->val[out_size - out_left] = '\0';
- out_buffer->len = out_size - out_left;
+ ZSTR_VAL(out_buffer)[out_size - out_left] = '\0';
+ ZSTR_LEN(out_buffer) = out_size - out_left;
iconv_close(cd);
out_size = 0;
bsz = out_left;
out_buf = zend_string_alloc(bsz, 0);
- out_p = out_buf->val;
+ out_p = ZSTR_VAL(out_buf);
while (in_left > 0) {
result = iconv(cd, (char **) &in_p, &in_left, (char **) &out_p, &out_left);
bsz += in_len;
out_buf = zend_string_extend(out_buf, bsz, 0);
- out_p = out_buf->val;
+ out_p = ZSTR_VAL(out_buf);
out_p += out_size;
out_left = bsz - out_size;
continue;
if (errno == E2BIG) {
bsz += 16;
out_buf = zend_string_extend(out_buf, bsz, 0);
- out_p = out_buf->val;
+ out_p = ZSTR_VAL(out_buf);
out_p += out_size;
out_left = bsz - out_size;
} else {
}
}
*out_p = '\0';
- out_buf->len = out_size;
+ ZSTR_LEN(out_buf) = out_size;
*out = out_buf;
return retval;
#endif
#endif
}
- ndl_buf_p = ndl_buf->val;
- ndl_buf_left = ndl_buf->len;
+ ndl_buf_p = ZSTR_VAL(ndl_buf);
+ ndl_buf_left = ZSTR_LEN(ndl_buf);
match_ofs = (size_t)-1;
for (in_p = haystk, in_left = haystk_nbytes, cnt = 0; in_left > 0; ++cnt) {
i = 0;
j = GENERIC_SUPERSET_NBYTES;
- lim = (size_t)(ndl_buf_p - ndl_buf->val);
+ lim = (size_t)(ndl_buf_p - ZSTR_VAL(ndl_buf));
while (j < lim) {
- if (_php_iconv_memequal(&ndl_buf->val[j], &ndl_buf->val[i],
+ if (_php_iconv_memequal(&ZSTR_VAL(ndl_buf)[j], &ZSTR_VAL(ndl_buf)[i],
GENERIC_SUPERSET_NBYTES)) {
i += GENERIC_SUPERSET_NBYTES;
} else {
j += GENERIC_SUPERSET_NBYTES;
}
- if (_php_iconv_memequal(buf, &ndl_buf->val[i], sizeof(buf))) {
+ if (_php_iconv_memequal(buf, &ZSTR_VAL(ndl_buf)[i], sizeof(buf))) {
match_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES;
i += GENERIC_SUPERSET_NBYTES;
- ndl_buf_p = &ndl_buf->val[i];
- ndl_buf_left = ndl_buf->len - i;
+ ndl_buf_p = &ZSTR_VAL(ndl_buf)[i];
+ ndl_buf_left = ZSTR_LEN(ndl_buf) - i;
} else {
match_ofs = (size_t)-1;
- ndl_buf_p = ndl_buf->val;
- ndl_buf_left = ndl_buf->len;
+ ndl_buf_p = ZSTR_VAL(ndl_buf);
+ ndl_buf_left = ZSTR_LEN(ndl_buf);
}
}
}
ndl_buf_left -= GENERIC_SUPERSET_NBYTES;
if (ndl_buf_left == 0) {
*pretval = match_ofs;
- ndl_buf_p = ndl_buf->val;
- ndl_buf_left = ndl_buf->len;
+ ndl_buf_p = ZSTR_VAL(ndl_buf);
+ ndl_buf_left = ZSTR_LEN(ndl_buf);
match_ofs = -1;
}
} else {
i = 0;
j = GENERIC_SUPERSET_NBYTES;
- lim = (size_t)(ndl_buf_p - ndl_buf->val);
+ lim = (size_t)(ndl_buf_p - ZSTR_VAL(ndl_buf));
while (j < lim) {
- if (_php_iconv_memequal(&ndl_buf->val[j], &ndl_buf->val[i],
+ if (_php_iconv_memequal(&ZSTR_VAL(ndl_buf)[j], &ZSTR_VAL(ndl_buf)[i],
GENERIC_SUPERSET_NBYTES)) {
i += GENERIC_SUPERSET_NBYTES;
} else {
j += GENERIC_SUPERSET_NBYTES;
}
- if (_php_iconv_memequal(buf, &ndl_buf->val[i], sizeof(buf))) {
+ if (_php_iconv_memequal(buf, &ZSTR_VAL(ndl_buf)[i], sizeof(buf))) {
match_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES;
i += GENERIC_SUPERSET_NBYTES;
- ndl_buf_p = &ndl_buf->val[i];
- ndl_buf_left = ndl_buf->len - i;
+ ndl_buf_p = &ZSTR_VAL(ndl_buf)[i];
+ ndl_buf_left = ZSTR_LEN(ndl_buf) - i;
} else {
match_ofs = (size_t)-1;
- ndl_buf_p = ndl_buf->val;
- ndl_buf_left = ndl_buf->len;
+ ndl_buf_p = ZSTR_VAL(ndl_buf);
+ ndl_buf_left = ZSTR_LEN(ndl_buf);
}
}
}
encoded = php_base64_encode((unsigned char *) buf, (out_size - out_left));
- if (char_cnt < encoded->len) {
+ if (char_cnt < ZSTR_LEN(encoded)) {
/* something went wrong! */
err = PHP_ICONV_ERR_UNKNOWN;
goto out;
}
- smart_str_appendl(pretval, encoded->val, encoded->len);
- char_cnt -= encoded->len;
+ smart_str_appendl(pretval, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
+ char_cnt -= ZSTR_LEN(encoded);
smart_str_appendl(pretval, "?=", sizeof("?=") - 1);
char_cnt -= 2;
}
}
- err = _php_iconv_appendl(pretval, decoded_text->val, decoded_text->len, cd);
+ err = _php_iconv_appendl(pretval, ZSTR_VAL(decoded_text), ZSTR_LEN(decoded_text), cd);
zend_string_release(decoded_text);
if (err != PHP_ICONV_ERR_SUCCESS) {
RETURN_FALSE;
}
- err = _php_iconv_strlen(&retval, str->val, str->len, charset);
+ err = _php_iconv_strlen(&retval, ZSTR_VAL(str), ZSTR_LEN(str), charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset);
if (err == PHP_ICONV_ERR_SUCCESS) {
RETVAL_LONG(retval);
}
if (ZEND_NUM_ARGS() < 3) {
- length = str->len;
+ length = ZSTR_LEN(str);
}
- err = _php_iconv_substr(&retval, str->val, str->len, offset, length, charset);
+ err = _php_iconv_substr(&retval, ZSTR_VAL(str), ZSTR_LEN(str), offset, length, charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset);
- if (err == PHP_ICONV_ERR_SUCCESS && str->len > 0 && retval.s != NULL) {
+ if (err == PHP_ICONV_ERR_SUCCESS && ZSTR_LEN(str) > 0 && retval.s != NULL) {
RETURN_NEW_STR(retval.s);
}
smart_str_free(&retval);
RETURN_FALSE;
}
- if (ndl->len < 1) {
+ if (ZSTR_LEN(ndl) < 1) {
RETURN_FALSE;
}
- err = _php_iconv_strpos(&retval, haystk->val, haystk->len, ndl->val, ndl->len,
+ err = _php_iconv_strpos(&retval, ZSTR_VAL(haystk), ZSTR_LEN(haystk), ZSTR_VAL(ndl), ZSTR_LEN(ndl),
offset, charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset);
RETURN_FALSE;
}
- if (ndl->len < 1) {
+ if (ZSTR_LEN(ndl) < 1) {
RETURN_FALSE;
}
RETURN_FALSE;
}
- err = _php_iconv_strpos(&retval, haystk->val, haystk->len, ndl->val, ndl->len,
+ err = _php_iconv_strpos(&retval, ZSTR_VAL(haystk), ZSTR_LEN(haystk), ZSTR_VAL(ndl), ZSTR_LEN(ndl),
-1, charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset);
if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-break-chars", sizeof("line-break-chars") - 1)) != NULL) {
if (Z_TYPE_P(pzval) != IS_STRING) {
tmp_str = zval_get_string(pzval);
- lfchars = tmp_str->val;
+ lfchars = ZSTR_VAL(tmp_str);
} else {
lfchars = Z_STRVAL_P(pzval);
}
}
}
- err = _php_iconv_mime_encode(&retval, field_name->val, field_name->len,
- field_value->val, field_value->len, line_len, lfchars, scheme_id,
+ err = _php_iconv_mime_encode(&retval, ZSTR_VAL(field_name), ZSTR_LEN(field_name),
+ ZSTR_VAL(field_value), ZSTR_LEN(field_value), line_len, lfchars, scheme_id,
out_charset, in_charset);
_php_iconv_show_error(err, out_charset, in_charset);
RETURN_FALSE;
}
- err = _php_iconv_mime_decode(&retval, encoded_str->val, encoded_str->len, charset, NULL, (int)mode);
+ err = _php_iconv_mime_decode(&retval, ZSTR_VAL(encoded_str), ZSTR_LEN(encoded_str), charset, NULL, (int)mode);
_php_iconv_show_error(err, charset, "???");
if (err == PHP_ICONV_ERR_SUCCESS) {
array_init(return_value);
- enc_str_tmp = encoded_str->val;
- enc_str_len_tmp = encoded_str->len;
+ enc_str_tmp = ZSTR_VAL(encoded_str);
+ enc_str_len_tmp = ZSTR_LEN(encoded_str);
while (enc_str_len_tmp > 0) {
smart_str decoded_header = {0};
char *header_name = NULL;
break;
}
- limit = decoded_header.s->val + decoded_header.s->len;
- for (p = decoded_header.s->val; p < limit; p++) {
+ limit = ZSTR_VAL(decoded_header.s) + ZSTR_LEN(decoded_header.s);
+ for (p = ZSTR_VAL(decoded_header.s); p < limit; p++) {
if (*p == ':') {
*p = '\0';
- header_name = decoded_header.s->val;
- header_name_len = p - decoded_header.s->val;
+ header_name = ZSTR_VAL(decoded_header.s);
+ header_name_len = p - ZSTR_VAL(decoded_header.s);
while (++p < limit) {
if (*p != ' ' && *p != '\t') {
RETURN_FALSE;
}
- err = php_iconv_string(in_buffer->val, (size_t)in_buffer->len, &out_buffer, out_charset, in_charset);
+ err = php_iconv_string(ZSTR_VAL(in_buffer), (size_t)ZSTR_LEN(in_buffer), &out_buffer, out_charset, in_charset);
_php_iconv_show_error(err, out_charset, in_charset);
if (err == PHP_ICONV_ERR_SUCCESS && out_buffer != NULL) {
RETVAL_STR(out_buffer);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS", &type, &type_len, &charset) == FAILURE)
return;
- if (charset->len >= ICONV_CSNMAXLEN) {
+ if (ZSTR_LEN(charset) >= ICONV_CSNMAXLEN) {
php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}
intl_errors_set_custom_msg(BREAKITER_ERROR_P(bio_orig),
"Could not clone BreakIterator", 0);
err_msg = intl_error_get_message(BREAKITER_ERROR_P(bio_orig));
- zend_throw_exception(NULL, err_msg->val, 0);
+ zend_throw_exception(NULL, ZSTR_VAL(err_msg), 0);
zend_string_free(err_msg);
} else {
bio_new->biter = new_biter;
assert(next <= slen && next >= cur);
res = zend_string_alloc(next - cur, 0);
- memcpy(res->val, &s[cur], res->len);
- res->val[res->len] = '\0';
+ memcpy(ZSTR_VAL(res), &s[cur], ZSTR_LEN(res));
+ ZSTR_VAL(res)[ZSTR_LEN(res)] = '\0';
ZVAL_STR(&zoi_bit->zoi_cur.current, res);
}
ALLOCA_FLAG(use_heap);
if (key == NULL) {
- ZSTR_ALLOCA_ALLOC(lc_method_name, method->len, use_heap);
- zend_str_tolower_copy(lc_method_name->val, method->val, method->len);
+ ZSTR_ALLOCA_ALLOC(lc_method_name, ZSTR_LEN(method), use_heap);
+ zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method), ZSTR_LEN(method));
} else {
lc_method_name = Z_STR_P(key);
}
- if (method->len == sizeof("getrulestatus") - 1
- && memcmp("getrulestatus", lc_method_name->val, lc_method_name->len) == 0) {
+ if (ZSTR_LEN(method) == sizeof("getrulestatus") - 1
+ && memcmp("getrulestatus", ZSTR_VAL(lc_method_name), ZSTR_LEN(lc_method_name)) == 0) {
IntlIterator_object *obj = php_intl_iterator_fetch_object(*object_ptr);
if (obj->iterator && !Z_ISUNDEF(obj->iterator->data)) {
zval *break_iter_zv = &obj->iterator->data;
BREAKITER_METHOD_FETCH_OBJECT;
- ut = utext_openUTF8(ut, text->val, text->len, BREAKITER_ERROR_CODE_P(bio));
+ ut = utext_openUTF8(ut, ZSTR_VAL(text), ZSTR_LEN(text), BREAKITER_ERROR_CODE_P(bio));
INTL_METHOD_CHECK_STATUS_OR_NULL(bio, "breakiter_set_text: error opening UText");
bio->biter->setText(ut, BREAKITER_ERROR_CODE(bio));
smart_str parse_error_str;
parse_error_str = intl_parse_error_to_string(&parseError);
spprintf(&msg, 0, "rbbi_create_instance: unable to create "
- "RuleBasedBreakIterator from rules (%s)", parse_error_str.s? parse_error_str.s->val : "");
+ "RuleBasedBreakIterator from rules (%s)", parse_error_str.s? ZSTR_VAL(parse_error_str.s) : "");
smart_str_free(&parse_error_str);
intl_error_set_custom_msg(NULL, msg, 1);
efree(msg);
}
zend_string *ret_rules = zend_string_alloc(rules_len, 0);
- memcpy(ret_rules->val, rules, rules_len);
- ret_rules->val[rules_len] = '\0';
+ memcpy(ZSTR_VAL(ret_rules), rules, rules_len);
+ ZSTR_VAL(ret_rules)[rules_len] = '\0';
RETURN_STR(ret_rules);
}
intl_errors_set_custom_msg(CALENDAR_ERROR_P(co_orig),
"Could not clone IntlCalendar", 0);
err_msg = intl_error_get_message(CALENDAR_ERROR_P(co_orig));
- zend_throw_exception(NULL, err_msg->val, 0);
+ zend_throw_exception(NULL, ZSTR_VAL(err_msg), 0);
zend_string_free(err_msg);
} else {
co_new->ucal = newCalendar;
THROW_UFAILURE(oldobj, "ucnv_safeClone", error);
err_msg = intl_error_get_message(&oldobj->error);
- zend_throw_exception(NULL, err_msg->val, 0);
+ zend_throw_exception(NULL, ZSTR_VAL(err_msg), 0);
zend_string_release(err_msg);
return retval;
if (mode == INTL_IDN_TO_ASCII) {
len = uidna_nameToASCII_UTF8(uts46, domain, domain_len,
- buffer->val, buffer_capac, &info, &status);
+ ZSTR_VAL(buffer), buffer_capac, &info, &status);
} else {
len = uidna_nameToUnicodeUTF8(uts46, domain, domain_len,
- buffer->val, buffer_capac, &info, &status);
+ ZSTR_VAL(buffer), buffer_capac, &info, &status);
}
if (php_intl_idn_check_status(status, "failed to convert name",
mode) == FAILURE) {
php_error_docref(NULL, E_ERROR, "ICU returned an unexpected length");
}
- buffer->val[len] = '\0';
- buffer->len = len;
+ ZSTR_VAL(buffer)[len] = '\0';
+ ZSTR_LEN(buffer) = len;
if (info.errors == 0) {
RETVAL_STR(buffer);
RETURN_FALSE;
}
- if (locale_name->len == 0) {
+ if (ZSTR_LEN(locale_name) == 0) {
default_locale = (char *)uloc_getDefault();
locale_name = zend_string_init(default_locale, strlen(default_locale), 0);
}
storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (zend_ulong)num_index);
} else { //string; assumed to be in UTF-8
- intl_stringFromChar(key, str_index->val, str_index->len, &err.code);
+ intl_stringFromChar(key, ZSTR_VAL(str_index), ZSTR_LEN(str_index), &err.code);
if (U_FAILURE(err.code)) {
char *message;
spprintf(&message, 0,
- "Invalid UTF-8 data in argument key: '%s'", str_index->val);
+ "Invalid UTF-8 data in argument key: '%s'", ZSTR_VAL(str_index));
intl_errors_set(&err, err.code, message, 1);
efree(message);
continue;
intl_errors_set_custom_msg(TIMEZONE_ERROR_P(to_orig),
"Could not clone IntlTimeZone", 0);
err_msg = intl_error_get_message(TIMEZONE_ERROR_P(to_orig));
- zend_throw_exception(NULL, err_msg->val, 0);
+ zend_throw_exception(NULL, ZSTR_VAL(err_msg), 0);
zend_string_free(err_msg);
} else {
to_new->utimezone = newTimeZone;
"Could not clone transliterator", 0 );
err_msg = intl_error_get_message( TRANSLITERATOR_ERROR_P( to_orig ) );
- php_error_docref( NULL, E_ERROR, "%s", err_msg->val );
+ php_error_docref( NULL, E_ERROR, "%s", ZSTR_VAL(err_msg) );
zend_string_free( err_msg ); /* if it's changed into a warning */
/* do not destroy tempz; we need to return something */
}
smart_str parse_error_str;
parse_error_str = intl_parse_error_to_string( &parse_error );
spprintf( &msg, 0, "transliterator_create_from_rules: unable to "
- "create ICU transliterator from rules (%s)", parse_error_str.s? parse_error_str.s->val : "" );
+ "create ICU transliterator from rules (%s)", parse_error_str.s? ZSTR_VAL(parse_error_str.s) : "" );
smart_str_free( &parse_error_str );
if( msg != NULL )
{
{
zend_string *message = intl_error_get_message( NULL );
php_error_docref0( NULL, E_WARNING, "Could not create "
- "transliterator with ID \"%s\" (%s)", Z_STRVAL_P( arg1 ), message->val );
+ "transliterator with ID \"%s\" (%s)", Z_STRVAL_P( arg1 ), ZSTR_VAL(message) );
zend_string_free( message );
ZVAL_UNDEF(&tmp_object);
/* don't set U_ILLEGAL_ARGUMENT_ERROR to allow fetching of inner error */
buffer_len = u_charName(cp, (UCharNameChoice)nameChoice, NULL, 0, &error);
buffer = zend_string_alloc(buffer_len, 0);
error = U_ZERO_ERROR;
- buffer_len = u_charName(cp, (UCharNameChoice)nameChoice, buffer->val, buffer->len + 1, &error);
+ buffer_len = u_charName(cp, (UCharNameChoice)nameChoice, ZSTR_VAL(buffer), ZSTR_LEN(buffer) + 1, &error);
if (U_FAILURE(error)) {
zend_string_free(buffer);
INTL_CHECK_STATUS(error, "Failure getting character name");
php_json_encode(buf, data, options);
} else if (r == PHP_JSON_OUTPUT_OBJECT) {
if (key) {
- if (key->val[0] == '\0' && Z_TYPE_P(val) == IS_OBJECT) {
+ if (ZSTR_VAL(key)[0] == '\0' && Z_TYPE_P(val) == IS_OBJECT) {
/* Skip protected and private members. */
if (tmp_ht && ZEND_HASH_APPLY_PROTECTION(tmp_ht)) {
ZEND_HASH_DEC_APPLY_COUNT(tmp_ht);
php_json_pretty_print_char(buf, options, '\n');
php_json_pretty_print_indent(buf, options);
- php_json_escape_string(buf, key->val, key->len, options & ~PHP_JSON_NUMERIC_CHECK);
+ php_json_escape_string(buf, ZSTR_VAL(key), ZSTR_LEN(key), options & ~PHP_JSON_NUMERIC_CHECK);
smart_str_appendc(buf, ':');
php_json_pretty_print_char(buf, options, ' ');
}
pos = 0;
- checkpoint = buf->s ? buf->s->len : 0;
+ checkpoint = buf->s ? ZSTR_LEN(buf->s) : 0;
/* pre-allocate for string length plus 2 quotes */
smart_str_alloc(buf, len+2, 0);
us = php_next_utf8_char((const unsigned char *)s, len, &pos, &status);
if (status != SUCCESS) {
if (buf->s) {
- buf->s->len = checkpoint;
+ ZSTR_LEN(buf->s) = checkpoint;
}
JSON_G(error_code) = PHP_JSON_ERROR_UTF8;
smart_str_appendl(buf, "null", 4);
ZVAL_STRING(&fname, "jsonSerialize");
if (FAILURE == call_user_function_ex(EG(function_table), val, &fname, &retval, 0, NULL, 1, NULL) || Z_TYPE(retval) == IS_UNDEF) {
- zend_throw_exception_ex(NULL, 0, "Failed calling %s::jsonSerialize()", ce->name->val);
+ zend_throw_exception_ex(NULL, 0, "Failed calling %s::jsonSerialize()", ZSTR_VAL(ce->name));
smart_str_appendl(buf, "null", sizeof("null") - 1);
zval_ptr_dtor(&fname);
return;
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 2.6.5. */
/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "2.6.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
+
/* Substitute the variable and function names. */
#define yyparse php_json_yyparse
#define yylex php_json_yylex
#define yyerror php_json_yyerror
+#define yylval php_json_yylval
+#define yychar php_json_yychar
#define yydebug php_json_yydebug
#define yynerrs php_json_yynerrs
-
/* Copy the first part of user declarations. */
-# ifndef YY_NULLPTR
+# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
+# define YY_NULL nullptr
# else
-# define YY_NULLPTR 0
+# define YY_NULL 0
# endif
# endif
/* In a future release of Bison, this section will be replaced
by #include "json_parser.tab.h". */
-#ifndef YY_PHP_JSON_YY_HOME_JAKUB_PROG_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
-# define YY_PHP_JSON_YY_HOME_JAKUB_PROG_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
-/* Debug traces. */
+#ifndef YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
+# define YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
+/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
extern int php_json_yydebug;
#endif
-/* Token type. */
+/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- enum yytokentype
- {
- PHP_JSON_T_NUL = 258,
- PHP_JSON_T_TRUE = 259,
- PHP_JSON_T_FALSE = 260,
- PHP_JSON_T_INT = 261,
- PHP_JSON_T_DOUBLE = 262,
- PHP_JSON_T_STRING = 263,
- PHP_JSON_T_ESTRING = 264,
- PHP_JSON_T_EOI = 265,
- PHP_JSON_T_ERROR = 266
- };
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ PHP_JSON_T_NUL = 258,
+ PHP_JSON_T_TRUE = 259,
+ PHP_JSON_T_FALSE = 260,
+ PHP_JSON_T_INT = 261,
+ PHP_JSON_T_DOUBLE = 262,
+ PHP_JSON_T_STRING = 263,
+ PHP_JSON_T_ESTRING = 264,
+ PHP_JSON_T_EOI = 265,
+ PHP_JSON_T_ERROR = 266
+ };
#endif
/* Tokens. */
#define PHP_JSON_T_NUL 258
#define PHP_JSON_T_EOI 265
#define PHP_JSON_T_ERROR 266
-/* Value type. */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-union YYSTYPE
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
{
} pair;
-};
-typedef union YYSTYPE YYSTYPE;
+} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int php_json_yyparse (void *YYPARSE_PARAM);
+#else
+int php_json_yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
int php_json_yyparse (php_json_parser *parser);
+#else
+int php_json_yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
-#endif /* !YY_PHP_JSON_YY_HOME_JAKUB_PROG_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */
+#endif /* !YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */
/* Copy the second part of user declarations. */
+
#ifdef short
# undef short
#endif
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#else
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
#endif
#ifdef YYTYPE_UINT16
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
# endif
#endif
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__ \
- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-# define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
# define YYUSE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
+/* Identity function, used to suppress warnings about constant conditions. */
+#ifndef lint
+# define YYID(N) (N)
#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int yyi)
+#else
+static int
+YYID (yyi)
+ int yyi;
#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
+{
+ return yyi;
+}
#endif
-
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's 'empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (YYID (0))
#endif
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
- while (0)
+ while (YYID (0))
# endif
# endif
#endif /* !YYCOPY_NEEDED */
#define YYNNTS 16
/* YYNRULES -- Number of rules. */
#define YYNRULES 36
-/* YYNSTATES -- Number of states. */
+/* YYNRULES -- Number of states. */
#define YYNSTATES 45
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 266
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
};
#if YYDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const yytype_uint8 yyprhs[] =
+{
+ 0, 0, 3, 6, 9, 10, 15, 17, 19, 20,
+ 22, 24, 28, 31, 35, 38, 39, 44, 46, 48,
+ 49, 51, 53, 57, 60, 62, 64, 66, 68, 70,
+ 72, 74, 76, 78, 80, 82, 84
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yytype_int8 yyrhs[] =
+{
+ 19, 0, -1, 32, 10, -1, 32, 33, -1, -1,
+ 12, 21, 23, 22, -1, 13, -1, 14, -1, -1,
+ 24, -1, 25, -1, 24, 15, 25, -1, 24, 33,
+ -1, 31, 16, 32, -1, 31, 33, -1, -1, 17,
+ 27, 29, 28, -1, 14, -1, 13, -1, -1, 30,
+ -1, 32, -1, 30, 15, 32, -1, 30, 33, -1,
+ 8, -1, 9, -1, 20, -1, 26, -1, 8, -1,
+ 9, -1, 6, -1, 7, -1, 3, -1, 4, -1,
+ 5, -1, 33, -1, 11, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 92, 92, 98, 105, 105, 113, 114, 123, 126,
"PHP_JSON_T_ERROR", "'{'", "'}'", "']'", "','", "':'", "'['", "$accept",
"start", "object", "$@1", "object_end", "members", "member", "pair",
"array", "$@2", "array_end", "elements", "element", "key", "value",
- "errlex", YY_NULLPTR
+ "errlex", YY_NULL
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
};
# endif
-#define YYPACT_NINF -18
-
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-18)))
-
-#define YYTABLE_NINF -1
-
-#define yytable_value_is_error(Yytable_value) \
- 0
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 18, 19, 19, 21, 20, 22, 22, 23, 23,
+ 24, 24, 24, 25, 25, 27, 26, 28, 28, 29,
+ 29, 30, 30, 30, 31, 31, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 33
+};
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-static const yytype_int8 yypact[] =
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
{
- -2, -18, -18, -18, -18, -18, -18, -18, -18, -18,
- -18, 11, -18, -18, 9, -18, 21, -2, -18, -18,
- -18, -18, -18, 18, 1, -18, -3, 20, 6, -18,
- -18, -18, -18, 21, -18, -2, -18, -18, -18, -18,
- -2, -18, -18, -18, -18
+ 0, 2, 2, 2, 0, 4, 1, 1, 0, 1,
+ 1, 3, 2, 3, 2, 0, 4, 1, 1, 0,
+ 1, 1, 3, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1
};
- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
static const yytype_uint8 yydefact[] =
{
0, 32, 33, 34, 30, 31, 28, 29, 36, 4,
0, 23, 11, 13, 22
};
- /* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
-{
- -18, -18, -18, -18, -18, -18, -18, -11, -18, -18,
- -18, -18, -18, -18, -17, 0
-};
-
- /* YYDEFGOTO[NTERM-NUM]. */
+/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
-1, 11, 12, 16, 32, 23, 24, 25, 13, 17,
39, 27, 28, 26, 14, 15
};
- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -18
+static const yytype_int8 yypact[] =
+{
+ -2, -18, -18, -18, -18, -18, -18, -18, -18, -18,
+ -18, 11, -18, -18, 9, -18, 21, -2, -18, -18,
+ -18, -18, -18, 18, 1, -18, -3, 20, 6, -18,
+ -18, -18, -18, 21, -18, -2, -18, -18, -18, -18,
+ -2, -18, -18, -18, -18
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int8 yypgoto[] =
+{
+ -18, -18, -18, -18, -18, -18, -18, -11, -18, -18,
+ -18, -18, -18, -18, -17, 0
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
29, 1, 2, 3, 4, 5, 6, 7, 8, 8,
22, 30, 31, 37, 38
};
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-18)))
+
+#define yytable_value_is_error(Yytable_value) \
+ YYID (0)
+
static const yytype_int8 yycheck[] =
{
17, 3, 4, 5, 6, 7, 8, 9, 11, 11,
9, 13, 14, 13, 14
};
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 3, 4, 5, 6, 7, 8, 9, 11, 12,
15, 33, 25, 32, 32
};
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 18, 19, 19, 21, 20, 22, 22, 23, 23,
- 24, 24, 24, 25, 25, 27, 26, 28, 28, 29,
- 29, 30, 30, 30, 31, 31, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 33
-};
-
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 2, 2, 0, 4, 1, 1, 0, 1,
- 1, 3, 2, 3, 2, 0, 4, 1, 1, 0,
- 1, 1, 3, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1
-};
-
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. However,
+ YYFAIL appears to be in use. Nevertheless, it is formally deprecated
+ in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+ discussed. */
+
+#define YYFAIL goto yyerrlab
+#if defined YYFAIL
+ /* This is here to suppress warnings from the GCC cpp's
+ -Wunused-macros. Normally we don't worry about that warning, but
+ some users do, and we want to make it easy for users to remove
+ YYFAIL uses, which will produce warnings from Bison 2.5. */
+#endif
#define YYRECOVERING() (!!yyerrstatus)
else \
{ \
yyerror (parser, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+ YYERROR; \
+ } \
+while (YYID (0))
/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
+#define YYTERROR 1
+#define YYERRCODE 256
+
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
+/* YYLEX -- calling `yylex' with the right arguments. */
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (&yylval, YYLEX_PARAM)
+#else
+# define YYLEX yylex (&yylval, parser)
+#endif
+
/* Enable debugging if requested. */
#if YYDEBUG
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (YYID (0))
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, parser); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, parser); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (YYID (0))
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, php_json_parser *parser)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep, parser)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+ php_json_parser *parser;
+#endif
{
FILE *yyo = yyoutput;
YYUSE (yyo);
- YYUSE (parser);
if (!yyvaluep)
return;
+ YYUSE (parser);
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+ YYUSE (yyoutput);
# endif
- YYUSE (yytype);
+ switch (yytype)
+ {
+ default:
+ break;
+ }
}
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, php_json_parser *parser)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep, parser)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+ php_json_parser *parser;
+#endif
{
- YYFPRINTF (yyoutput, "%s %s (",
- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+ if (yytype < YYNTOKENS)
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep, parser);
YYFPRINTF (yyoutput, ")");
| TOP (included). |
`------------------------------------------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+#else
+static void
+yy_stack_print (yybottom, yytop)
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
+#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (YYID (0))
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, php_json_parser *parser)
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule, php_json_parser *parser)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule, parser)
+ YYSTYPE *yyvsp;
+ int yyrule;
+ php_json_parser *parser;
+#endif
{
- unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
+ unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr,
- yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , parser);
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , parser);
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyssp, yyvsp, Rule, parser); \
-} while (0)
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyvsp, Rule, parser); \
+} while (YYID (0))
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+ const char *yystr;
+#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+#endif
{
char *yyd = yydest;
const char *yys = yysrc;
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = YY_NULLPTR;
+ const char *yyformat = YY_NULL;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
int yycount = 0;
/* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+ for details. YYERROR is fine as it does not invoke this
+ function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
break;
}
yyarg[yycount++] = yytname[yyx];
- {
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
+ yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
}
}
}
# undef YYCASE_
}
- {
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
+ yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
if (*yymsg_alloc < yysize)
{
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, php_json_parser *parser)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep, parser)
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
+ php_json_parser *parser;
+#endif
{
YYUSE (yyvaluep);
YYUSE (parser);
+
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
switch (yytype)
{
- case 3: /* PHP_JSON_T_NUL */
-
- { zval_dtor(&((*yyvaluep).value)); }
-
- break;
-
- case 4: /* PHP_JSON_T_TRUE */
-
- { zval_dtor(&((*yyvaluep).value)); }
-
- break;
-
- case 5: /* PHP_JSON_T_FALSE */
-
- { zval_dtor(&((*yyvaluep).value)); }
-
- break;
-
- case 6: /* PHP_JSON_T_INT */
-
- { zval_dtor(&((*yyvaluep).value)); }
-
- break;
-
- case 7: /* PHP_JSON_T_DOUBLE */
-
- { zval_dtor(&((*yyvaluep).value)); }
+ case 3: /* PHP_JSON_T_NUL */
- break;
+ { zval_dtor(&((*yyvaluep).value)); };
- case 8: /* PHP_JSON_T_STRING */
+ break;
+ case 4: /* PHP_JSON_T_TRUE */
- { zval_dtor(&((*yyvaluep).value)); }
+ { zval_dtor(&((*yyvaluep).value)); };
- break;
+ break;
+ case 5: /* PHP_JSON_T_FALSE */
- case 9: /* PHP_JSON_T_ESTRING */
+ { zval_dtor(&((*yyvaluep).value)); };
- { zval_dtor(&((*yyvaluep).value)); }
+ break;
+ case 6: /* PHP_JSON_T_INT */
- break;
+ { zval_dtor(&((*yyvaluep).value)); };
- case 10: /* PHP_JSON_T_EOI */
+ break;
+ case 7: /* PHP_JSON_T_DOUBLE */
- { zval_dtor(&((*yyvaluep).value)); }
+ { zval_dtor(&((*yyvaluep).value)); };
- break;
+ break;
+ case 8: /* PHP_JSON_T_STRING */
- case 11: /* PHP_JSON_T_ERROR */
+ { zval_dtor(&((*yyvaluep).value)); };
- { zval_dtor(&((*yyvaluep).value)); }
+ break;
+ case 9: /* PHP_JSON_T_ESTRING */
- break;
+ { zval_dtor(&((*yyvaluep).value)); };
- case 19: /* start */
+ break;
+ case 10: /* PHP_JSON_T_EOI */
- { zval_dtor(&((*yyvaluep).value)); }
+ { zval_dtor(&((*yyvaluep).value)); };
- break;
+ break;
+ case 11: /* PHP_JSON_T_ERROR */
- case 20: /* object */
+ { zval_dtor(&((*yyvaluep).value)); };
- { zval_dtor(&((*yyvaluep).value)); }
+ break;
+ case 19: /* start */
- break;
+ { zval_dtor(&((*yyvaluep).value)); };
- case 23: /* members */
+ break;
+ case 20: /* object */
- { zval_dtor(&((*yyvaluep).value)); }
+ { zval_dtor(&((*yyvaluep).value)); };
- break;
+ break;
+ case 23: /* members */
- case 24: /* member */
+ { zval_dtor(&((*yyvaluep).value)); };
- { zval_dtor(&((*yyvaluep).value)); }
+ break;
+ case 24: /* member */
- break;
+ { zval_dtor(&((*yyvaluep).value)); };
- case 25: /* pair */
+ break;
+ case 25: /* pair */
- { zend_string_release(((*yyvaluep).pair).key); zval_dtor(&((*yyvaluep).pair).val); }
+ { zend_string_release(((*yyvaluep).pair).key); zval_dtor(&((*yyvaluep).pair).val); };
- break;
+ break;
+ case 26: /* array */
- case 26: /* array */
+ { zval_dtor(&((*yyvaluep).value)); };
- { zval_dtor(&((*yyvaluep).value)); }
+ break;
+ case 29: /* elements */
- break;
+ { zval_dtor(&((*yyvaluep).value)); };
- case 29: /* elements */
+ break;
+ case 30: /* element */
- { zval_dtor(&((*yyvaluep).value)); }
+ { zval_dtor(&((*yyvaluep).value)); };
- break;
+ break;
+ case 31: /* key */
- case 30: /* element */
+ { zval_dtor(&((*yyvaluep).value)); };
- { zval_dtor(&((*yyvaluep).value)); }
+ break;
+ case 32: /* value */
- break;
+ { zval_dtor(&((*yyvaluep).value)); };
- case 31: /* key */
+ break;
+ case 33: /* errlex */
- { zval_dtor(&((*yyvaluep).value)); }
-
- break;
-
- case 32: /* value */
-
- { zval_dtor(&((*yyvaluep).value)); }
-
- break;
-
- case 33: /* errlex */
-
- { zval_dtor(&((*yyvaluep).value)); }
-
- break;
+ { zval_dtor(&((*yyvaluep).value)); };
+ break;
default:
- break;
+ break;
}
- YY_IGNORE_MAYBE_UNINITIALIZED_END
}
| yyparse. |
`----------*/
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
int
yyparse (php_json_parser *parser)
+#else
+int
+yyparse (parser)
+ php_json_parser *parser;
+#endif
+#endif
{
/* The lookahead symbol. */
int yychar;
-/* The semantic value of the lookahead symbol. */
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
+#else
/* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */
-YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
-YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
+static YYSTYPE yyval_default;
+# define YY_INITIAL_VALUE(Value) = Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+/* The semantic value of the lookahead symbol. */
+YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* Number of syntax errors so far. */
int yynerrs;
int yyerrstatus;
/* The stacks and their tools:
- 'yyss': related to states.
- 'yyvs': related to semantic values.
+ `yyss': related to states.
+ `yyvs': related to semantic values.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = yylex (&yylval, parser);
+ yychar = YYLEX;
}
if (yychar <= YYEOF)
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- '$$ = $1'.
+ `$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
case 2:
{
- ZVAL_COPY_VALUE(&(yyval.value), &(yyvsp[-1].value));
- ZVAL_COPY_VALUE(parser->return_value, &(yyvsp[-1].value));
- PHP_JSON_USE((yyvsp[0].value)); YYACCEPT;
+ ZVAL_COPY_VALUE(&(yyval.value), &(yyvsp[(1) - (2)].value));
+ ZVAL_COPY_VALUE(parser->return_value, &(yyvsp[(1) - (2)].value));
+ PHP_JSON_USE((yyvsp[(2) - (2)].value)); YYACCEPT;
}
-
break;
case 3:
{
- PHP_JSON_USE_2((yyval.value), (yyvsp[-1].value), (yyvsp[0].value));
+ PHP_JSON_USE_2((yyval.value), (yyvsp[(1) - (2)].value), (yyvsp[(2) - (2)].value));
}
-
break;
case 4:
{ PHP_JSON_DEPTH_INC; }
-
break;
case 5:
{
PHP_JSON_DEPTH_DEC;
- (yyval.value) = (yyvsp[-1].value);
+ (yyval.value) = (yyvsp[(3) - (4)].value);
}
-
break;
case 7:
parser->scanner.errcode = PHP_JSON_ERROR_STATE_MISMATCH;
YYERROR;
}
-
break;
case 8:
{
php_json_parser_object_init(parser, &(yyval.value));
}
-
break;
case 10:
{
php_json_parser_object_init(parser, &(yyval.value));
- if (php_json_parser_object_update(parser, &(yyval.value), (yyvsp[0].pair).key, &(yyvsp[0].pair).val) == FAILURE)
+ if (php_json_parser_object_update(parser, &(yyval.value), (yyvsp[(1) - (1)].pair).key, &(yyvsp[(1) - (1)].pair).val) == FAILURE)
YYERROR;
}
-
break;
case 11:
{
- if (php_json_parser_object_update(parser, &(yyvsp[-2].value), (yyvsp[0].pair).key, &(yyvsp[0].pair).val) == FAILURE)
+ if (php_json_parser_object_update(parser, &(yyvsp[(1) - (3)].value), (yyvsp[(3) - (3)].pair).key, &(yyvsp[(3) - (3)].pair).val) == FAILURE)
YYERROR;
- ZVAL_COPY_VALUE(&(yyval.value), &(yyvsp[-2].value));
+ ZVAL_COPY_VALUE(&(yyval.value), &(yyvsp[(1) - (3)].value));
}
-
break;
case 12:
{
- PHP_JSON_USE_2((yyval.value), (yyvsp[-1].value), (yyvsp[0].value));
+ PHP_JSON_USE_2((yyval.value), (yyvsp[(1) - (2)].value), (yyvsp[(2) - (2)].value));
}
-
break;
case 13:
{
- (yyval.pair).key = Z_STR((yyvsp[-2].value));
- ZVAL_COPY_VALUE(&(yyval.pair).val, &(yyvsp[0].value));
+ (yyval.pair).key = Z_STR((yyvsp[(1) - (3)].value));
+ ZVAL_COPY_VALUE(&(yyval.pair).val, &(yyvsp[(3) - (3)].value));
}
-
break;
case 14:
{
- PHP_JSON_USE_2((yyval.pair), (yyvsp[-1].value), (yyvsp[0].value));
+ PHP_JSON_USE_2((yyval.pair), (yyvsp[(1) - (2)].value), (yyvsp[(2) - (2)].value));
}
-
break;
case 15:
{ PHP_JSON_DEPTH_INC; }
-
break;
case 16:
{
PHP_JSON_DEPTH_DEC;
- ZVAL_COPY_VALUE(&(yyval.value), &(yyvsp[-1].value));
+ ZVAL_COPY_VALUE(&(yyval.value), &(yyvsp[(3) - (4)].value));
}
-
break;
case 18:
parser->scanner.errcode = PHP_JSON_ERROR_STATE_MISMATCH;
YYERROR;
}
-
break;
case 19:
{
php_json_parser_array_init(&(yyval.value));
}
-
break;
case 21:
{
php_json_parser_array_init(&(yyval.value));
- php_json_parser_array_append(&(yyval.value), &(yyvsp[0].value));
+ php_json_parser_array_append(&(yyval.value), &(yyvsp[(1) - (1)].value));
}
-
break;
case 22:
{
- php_json_parser_array_append(&(yyvsp[-2].value), &(yyvsp[0].value));
- ZVAL_COPY_VALUE(&(yyval.value), &(yyvsp[-2].value));
+ php_json_parser_array_append(&(yyvsp[(1) - (3)].value), &(yyvsp[(3) - (3)].value));
+ ZVAL_COPY_VALUE(&(yyval.value), &(yyvsp[(1) - (3)].value));
}
-
break;
case 23:
{
- PHP_JSON_USE_2((yyval.value), (yyvsp[-1].value), (yyvsp[0].value));
+ PHP_JSON_USE_2((yyval.value), (yyvsp[(1) - (2)].value), (yyvsp[(2) - (2)].value));
}
-
break;
case 36:
{
- PHP_JSON_USE_1((yyval.value), (yyvsp[0].value));
+ PHP_JSON_USE_1((yyval.value), (yyvsp[(1) - (1)].value));
YYERROR;
}
-
break;
*++yyvsp = yyval;
- /* Now 'shift' the result of the reduction. Determine what state
+ /* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
goto yynewstate;
-/*--------------------------------------.
-| yyerrlab -- here on detecting error. |
-`--------------------------------------*/
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ error, discard it. */
if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, parser);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, parser);
+ yychar = YYEMPTY;
+ }
}
/* Else will try to reuse lookahead token after shifting the error
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- /* Do not reclaim the symbols of the rule whose action triggered
+ /* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp, parser);
+ yystos[yystate], yyvsp, parser);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, parser);
}
- /* Do not reclaim the symbols of the rule whose action triggered
+ /* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, parser);
+ yystos[*yyssp], yyvsp, parser);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- return yyresult;
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
}
+
+
/* Functions */
void php_json_parser_init(php_json_parser *parser, zval *return_value, char *str, size_t str_len, int options, int max_depth)
zend_symtable_update(Z_ARRVAL_P(object), key, zvalue);
} else {
zval zkey;
- if (key->len == 0) {
+ if (ZSTR_LEN(key) == 0) {
zend_string_release(key);
key = zend_string_init("_empty_", sizeof("_empty_") - 1, 0);
- } else if (key->val[0] == '\0') {
+ } else if (ZSTR_VAL(key)[0] == '\0') {
parser->scanner.errcode = PHP_JSON_ERROR_INVALID_PROPERTY_NAME;
zend_string_release(key);
zval_dtor(zvalue);
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 2.6.5. */
/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
-#ifndef YY_PHP_JSON_YY_HOME_JAKUB_PROG_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
-# define YY_PHP_JSON_YY_HOME_JAKUB_PROG_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
-/* Debug traces. */
+#ifndef YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
+# define YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
+/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
extern int php_json_yydebug;
#endif
-/* Token type. */
+/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- enum yytokentype
- {
- PHP_JSON_T_NUL = 258,
- PHP_JSON_T_TRUE = 259,
- PHP_JSON_T_FALSE = 260,
- PHP_JSON_T_INT = 261,
- PHP_JSON_T_DOUBLE = 262,
- PHP_JSON_T_STRING = 263,
- PHP_JSON_T_ESTRING = 264,
- PHP_JSON_T_EOI = 265,
- PHP_JSON_T_ERROR = 266
- };
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ PHP_JSON_T_NUL = 258,
+ PHP_JSON_T_TRUE = 259,
+ PHP_JSON_T_FALSE = 260,
+ PHP_JSON_T_INT = 261,
+ PHP_JSON_T_DOUBLE = 262,
+ PHP_JSON_T_STRING = 263,
+ PHP_JSON_T_ESTRING = 264,
+ PHP_JSON_T_EOI = 265,
+ PHP_JSON_T_ERROR = 266
+ };
#endif
/* Tokens. */
#define PHP_JSON_T_NUL 258
#define PHP_JSON_T_EOI 265
#define PHP_JSON_T_ERROR 266
-/* Value type. */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-union YYSTYPE
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
{
} pair;
-};
-typedef union YYSTYPE YYSTYPE;
+} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int php_json_yyparse (void *YYPARSE_PARAM);
+#else
+int php_json_yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
int php_json_yyparse (php_json_parser *parser);
+#else
+int php_json_yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
-#endif /* !YY_PHP_JSON_YY_HOME_JAKUB_PROG_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */
+#endif /* !YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */
zend_symtable_update(Z_ARRVAL_P(object), key, zvalue);
} else {
zval zkey;
- if (key->len == 0) {
+ if (ZSTR_LEN(key) == 0) {
zend_string_release(key);
key = zend_string_init("_empty_", sizeof("_empty_") - 1, 0);
- } else if (key->val[0] == '\0') {
+ } else if (ZSTR_VAL(key)[0] == '\0') {
parser->scanner.errcode = PHP_JSON_ERROR_INVALID_PROPERTY_NAME;
zend_string_release(key);
zval_dtor(zvalue);
-/* Generated by re2c 0.14.3 */
+/* Generated by re2c 0.13.5 */
/*
+----------------------------------------------------------------------+
| PHP Version 7 |
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+
yych = *YYCURSOR;
if (yych <= ']') {
if (yych <= '"') {
if (yych <= '\f') {
if (yych <= 0x08) {
- if (yych >= 0x01) goto yy5;
+ if (yych >= 0x01) goto yy4;
} else {
- if (yych <= '\t') goto yy7;
- if (yych <= '\n') goto yy9;
- goto yy5;
+ if (yych <= '\t') goto yy6;
+ if (yych <= '\n') goto yy8;
+ goto yy4;
}
} else {
if (yych <= 0x1F) {
- if (yych <= '\r') goto yy10;
- goto yy5;
+ if (yych <= '\r') goto yy9;
+ goto yy4;
} else {
- if (yych <= ' ') goto yy11;
- if (yych <= '!') goto yy12;
- goto yy14;
+ if (yych <= ' ') goto yy10;
+ if (yych <= '!') goto yy11;
+ goto yy13;
}
}
} else {
if (yych <= '0') {
if (yych <= ',') {
- if (yych <= '+') goto yy12;
- goto yy16;
+ if (yych <= '+') goto yy11;
+ goto yy15;
} else {
- if (yych <= '-') goto yy18;
- if (yych <= '/') goto yy12;
- goto yy19;
+ if (yych <= '-') goto yy17;
+ if (yych <= '/') goto yy11;
+ goto yy18;
}
} else {
if (yych <= 'Z') {
- if (yych <= '9') goto yy21;
- if (yych <= ':') goto yy22;
- goto yy12;
+ if (yych <= '9') goto yy20;
+ if (yych <= ':') goto yy21;
+ goto yy11;
} else {
- if (yych <= '[') goto yy24;
- if (yych <= '\\') goto yy12;
- goto yy26;
+ if (yych <= '[') goto yy23;
+ if (yych <= '\\') goto yy11;
+ goto yy25;
}
}
}
if (yych <= '}') {
if (yych <= 's') {
if (yych <= 'f') {
- if (yych <= 'e') goto yy12;
- goto yy28;
+ if (yych <= 'e') goto yy11;
+ goto yy27;
} else {
- if (yych == 'n') goto yy29;
- goto yy12;
+ if (yych == 'n') goto yy28;
+ goto yy11;
}
} else {
if (yych <= 'z') {
- if (yych <= 't') goto yy30;
- goto yy12;
+ if (yych <= 't') goto yy29;
+ goto yy11;
} else {
- if (yych <= '{') goto yy31;
- if (yych <= '|') goto yy12;
- goto yy33;
+ if (yych <= '{') goto yy30;
+ if (yych <= '|') goto yy11;
+ goto yy32;
}
}
} else {
if (yych <= 0xEC) {
if (yych <= 0xC1) {
- if (yych <= 0x7F) goto yy12;
- goto yy35;
+ if (yych <= 0x7F) goto yy11;
+ goto yy34;
} else {
- if (yych <= 0xDF) goto yy37;
- if (yych <= 0xE0) goto yy38;
- goto yy39;
+ if (yych <= 0xDF) goto yy36;
+ if (yych <= 0xE0) goto yy37;
+ goto yy38;
}
} else {
if (yych <= 0xF0) {
- if (yych <= 0xED) goto yy40;
- if (yych <= 0xEF) goto yy41;
- goto yy42;
+ if (yych <= 0xED) goto yy39;
+ if (yych <= 0xEF) goto yy40;
+ goto yy41;
} else {
- if (yych <= 0xF3) goto yy43;
- if (yych <= 0xF4) goto yy44;
- goto yy35;
+ if (yych <= 0xF3) goto yy42;
+ if (yych <= 0xF4) goto yy43;
+ goto yy34;
}
}
}
return PHP_JSON_T_ERROR;
}
}
-yy5:
+yy4:
++YYCURSOR;
{
s->errcode = PHP_JSON_ERROR_CTRL_CHAR;
return PHP_JSON_T_ERROR;
}
-yy7:
+yy6:
++YYCURSOR;
yych = *YYCURSOR;
- goto yy82;
-yy8:
+ goto yy81;
+yy7:
{ goto std; }
+yy8:
+ yych = *++YYCURSOR;
+ goto yy7;
yy9:
yych = *++YYCURSOR;
- goto yy8;
+ if (yych == '\n') goto yy82;
+ goto yy81;
yy10:
yych = *++YYCURSOR;
- if (yych == '\n') goto yy83;
- goto yy82;
+ goto yy81;
yy11:
- yych = *++YYCURSOR;
- goto yy82;
-yy12:
++YYCURSOR;
-yy13:
+yy12:
{
s->errcode = PHP_JSON_ERROR_SYNTAX;
return PHP_JSON_T_ERROR;
}
-yy14:
+yy13:
++YYCURSOR;
{
s->str_start = s->cursor;
PHP_JSON_CONDITION_SET(STR_P1);
PHP_JSON_CONDITION_GOTO(STR_P1);
}
-yy16:
+yy15:
++YYCURSOR;
{ return ','; }
-yy18:
+yy17:
yych = *++YYCURSOR;
- if (yych <= '/') goto yy13;
- if (yych <= '0') goto yy80;
- if (yych <= '9') goto yy70;
- goto yy13;
-yy19:
+ if (yych <= '/') goto yy12;
+ if (yych <= '0') goto yy79;
+ if (yych <= '9') goto yy69;
+ goto yy12;
+yy18:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'D') {
- if (yych == '.') goto yy72;
+ if (yych == '.') goto yy71;
} else {
- if (yych <= 'E') goto yy73;
- if (yych == 'e') goto yy73;
+ if (yych <= 'E') goto yy72;
+ if (yych == 'e') goto yy72;
}
-yy20:
+yy19:
{
zend_bool bigint = 0, negative = s->token[0] == '-';
size_t digits = (size_t) (s->cursor - s->token - negative);
return PHP_JSON_T_DOUBLE;
}
}
-yy21:
+yy20:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- goto yy71;
-yy22:
+ goto yy70;
+yy21:
++YYCURSOR;
{ return ':'; }
-yy24:
+yy23:
++YYCURSOR;
{ return '['; }
-yy26:
+yy25:
++YYCURSOR;
{ return ']'; }
+yy27:
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych == 'a') goto yy64;
+ goto yy12;
yy28:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych == 'a') goto yy65;
- goto yy13;
+ if (yych == 'u') goto yy60;
+ goto yy12;
yy29:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych == 'u') goto yy61;
- goto yy13;
+ if (yych == 'r') goto yy56;
+ goto yy12;
yy30:
- yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych == 'r') goto yy57;
- goto yy13;
-yy31:
++YYCURSOR;
{ return '{'; }
-yy33:
+yy32:
++YYCURSOR;
{ return '}'; }
-yy35:
+yy34:
++YYCURSOR;
-yy36:
+yy35:
{
s->errcode = PHP_JSON_ERROR_UTF8;
return PHP_JSON_T_ERROR;
}
-yy37:
+yy36:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy36;
- if (yych <= 0xBF) goto yy48;
- goto yy36;
+ if (yych <= 0x7F) goto yy35;
+ if (yych <= 0xBF) goto yy47;
+ goto yy35;
+yy37:
+ yyaccept = 2;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= 0x9F) goto yy35;
+ if (yych <= 0xBF) goto yy55;
+ goto yy35;
yy38:
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x9F) goto yy36;
- if (yych <= 0xBF) goto yy56;
- goto yy36;
+ if (yych <= 0x7F) goto yy35;
+ if (yych <= 0xBF) goto yy54;
+ goto yy35;
yy39:
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x7F) goto yy36;
- if (yych <= 0xBF) goto yy55;
- goto yy36;
+ if (yych <= 0x7F) goto yy35;
+ if (yych <= 0x9F) goto yy53;
+ goto yy35;
yy40:
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x7F) goto yy36;
- if (yych <= 0x9F) goto yy54;
- goto yy36;
+ if (yych <= 0x7F) goto yy35;
+ if (yych <= 0xBF) goto yy52;
+ goto yy35;
yy41:
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x7F) goto yy36;
- if (yych <= 0xBF) goto yy53;
- goto yy36;
+ if (yych <= 0x8F) goto yy35;
+ if (yych <= 0xBF) goto yy50;
+ goto yy35;
yy42:
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x8F) goto yy36;
- if (yych <= 0xBF) goto yy51;
- goto yy36;
+ if (yych <= 0x7F) goto yy35;
+ if (yych <= 0xBF) goto yy48;
+ goto yy35;
yy43:
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x7F) goto yy36;
- if (yych <= 0xBF) goto yy49;
- goto yy36;
-yy44:
- yyaccept = 2;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x7F) goto yy36;
- if (yych >= 0x90) goto yy36;
+ if (yych <= 0x7F) goto yy35;
+ if (yych >= 0x90) goto yy35;
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy46;
- if (yych <= 0xBF) goto yy47;
-yy46:
+ if (yych <= 0x7F) goto yy45;
+ if (yych <= 0xBF) goto yy46;
+yy45:
YYCURSOR = YYMARKER;
if (yyaccept <= 1) {
- if (yyaccept == 0) {
- goto yy20;
+ if (yyaccept <= 0) {
+ goto yy19;
} else {
- goto yy13;
+ goto yy12;
}
} else {
- if (yyaccept == 2) {
- goto yy36;
+ if (yyaccept <= 2) {
+ goto yy35;
} else {
- goto yy77;
+ goto yy76;
}
}
+yy46:
+ yych = *++YYCURSOR;
+ if (yych <= 0x7F) goto yy45;
+ if (yych >= 0xC0) goto yy45;
yy47:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy46;
- if (yych >= 0xC0) goto yy46;
+ goto yy12;
yy48:
yych = *++YYCURSOR;
- goto yy13;
-yy49:
+ if (yych <= 0x7F) goto yy45;
+ if (yych >= 0xC0) goto yy45;
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy46;
- if (yych >= 0xC0) goto yy46;
+ if (yych <= 0x7F) goto yy45;
+ if (yych <= 0xBF) goto yy47;
+ goto yy45;
+yy50:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy46;
- if (yych <= 0xBF) goto yy48;
- goto yy46;
-yy51:
+ if (yych <= 0x7F) goto yy45;
+ if (yych >= 0xC0) goto yy45;
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy46;
- if (yych >= 0xC0) goto yy46;
+ if (yych <= 0x7F) goto yy45;
+ if (yych <= 0xBF) goto yy47;
+ goto yy45;
+yy52:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy46;
- if (yych <= 0xBF) goto yy48;
- goto yy46;
+ if (yych <= 0x7F) goto yy45;
+ if (yych <= 0xBF) goto yy47;
+ goto yy45;
yy53:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy46;
- if (yych <= 0xBF) goto yy48;
- goto yy46;
+ if (yych <= 0x7F) goto yy45;
+ if (yych <= 0xBF) goto yy47;
+ goto yy45;
yy54:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy46;
- if (yych <= 0xBF) goto yy48;
- goto yy46;
+ if (yych <= 0x7F) goto yy45;
+ if (yych <= 0xBF) goto yy47;
+ goto yy45;
yy55:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy46;
- if (yych <= 0xBF) goto yy48;
- goto yy46;
+ if (yych <= 0x7F) goto yy45;
+ if (yych <= 0xBF) goto yy47;
+ goto yy45;
yy56:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy46;
- if (yych <= 0xBF) goto yy48;
- goto yy46;
-yy57:
+ if (yych != 'u') goto yy45;
yych = *++YYCURSOR;
- if (yych != 'u') goto yy46;
- yych = *++YYCURSOR;
- if (yych != 'e') goto yy46;
+ if (yych != 'e') goto yy45;
++YYCURSOR;
{
ZVAL_TRUE(&s->value);
return PHP_JSON_T_TRUE;
}
-yy61:
+yy60:
yych = *++YYCURSOR;
- if (yych != 'l') goto yy46;
+ if (yych != 'l') goto yy45;
yych = *++YYCURSOR;
- if (yych != 'l') goto yy46;
+ if (yych != 'l') goto yy45;
++YYCURSOR;
{
ZVAL_NULL(&s->value);
return PHP_JSON_T_NUL;
}
-yy65:
+yy64:
yych = *++YYCURSOR;
- if (yych != 'l') goto yy46;
+ if (yych != 'l') goto yy45;
yych = *++YYCURSOR;
- if (yych != 's') goto yy46;
+ if (yych != 's') goto yy45;
yych = *++YYCURSOR;
- if (yych != 'e') goto yy46;
+ if (yych != 'e') goto yy45;
++YYCURSOR;
{
ZVAL_FALSE(&s->value);
return PHP_JSON_T_FALSE;
}
-yy70:
+yy69:
yyaccept = 0;
YYMARKER = ++YYCURSOR;
yych = *YYCURSOR;
-yy71:
+yy70:
if (yybm[0+yych] & 64) {
- goto yy70;
+ goto yy69;
}
if (yych <= 'D') {
- if (yych != '.') goto yy20;
+ if (yych != '.') goto yy19;
} else {
- if (yych <= 'E') goto yy73;
- if (yych == 'e') goto yy73;
- goto yy20;
+ if (yych <= 'E') goto yy72;
+ if (yych == 'e') goto yy72;
+ goto yy19;
}
-yy72:
+yy71:
yych = *++YYCURSOR;
- if (yych <= '/') goto yy46;
- if (yych <= '9') goto yy78;
- goto yy46;
-yy73:
+ if (yych <= '/') goto yy45;
+ if (yych <= '9') goto yy77;
+ goto yy45;
+yy72:
yych = *++YYCURSOR;
if (yych <= ',') {
- if (yych != '+') goto yy46;
+ if (yych != '+') goto yy45;
} else {
- if (yych <= '-') goto yy74;
- if (yych <= '/') goto yy46;
- if (yych <= '9') goto yy75;
- goto yy46;
+ if (yych <= '-') goto yy73;
+ if (yych <= '/') goto yy45;
+ if (yych <= '9') goto yy74;
+ goto yy45;
}
-yy74:
+yy73:
yych = *++YYCURSOR;
- if (yych <= '/') goto yy46;
- if (yych >= ':') goto yy46;
-yy75:
+ if (yych <= '/') goto yy45;
+ if (yych >= ':') goto yy45;
+yy74:
++YYCURSOR;
yych = *YYCURSOR;
- if (yych <= '/') goto yy77;
- if (yych <= '9') goto yy75;
-yy77:
+ if (yych <= '/') goto yy76;
+ if (yych <= '9') goto yy74;
+yy76:
{
ZVAL_DOUBLE(&s->value, zend_strtod((char *) s->token, NULL));
return PHP_JSON_T_DOUBLE;
}
-yy78:
+yy77:
yyaccept = 3;
YYMARKER = ++YYCURSOR;
yych = *YYCURSOR;
if (yych <= 'D') {
- if (yych <= '/') goto yy77;
- if (yych <= '9') goto yy78;
- goto yy77;
+ if (yych <= '/') goto yy76;
+ if (yych <= '9') goto yy77;
+ goto yy76;
} else {
- if (yych <= 'E') goto yy73;
- if (yych == 'e') goto yy73;
- goto yy77;
+ if (yych <= 'E') goto yy72;
+ if (yych == 'e') goto yy72;
+ goto yy76;
}
-yy80:
+yy79:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'D') {
- if (yych == '.') goto yy72;
- goto yy20;
+ if (yych == '.') goto yy71;
+ goto yy19;
} else {
- if (yych <= 'E') goto yy73;
- if (yych == 'e') goto yy73;
- goto yy20;
+ if (yych <= 'E') goto yy72;
+ if (yych == 'e') goto yy72;
+ goto yy19;
}
-yy81:
+yy80:
++YYCURSOR;
yych = *YYCURSOR;
-yy82:
+yy81:
if (yybm[0+yych] & 128) {
- goto yy81;
+ goto yy80;
}
- goto yy8;
-yy83:
+ goto yy7;
+yy82:
++YYCURSOR;
yych = *YYCURSOR;
- goto yy8;
+ goto yy7;
}
/* *********************************** */
yyc_STR_P1:
yych = *YYCURSOR;
if (yych <= 0xDF) {
if (yych <= '[') {
- if (yych <= 0x1F) goto yy86;
- if (yych == '"') goto yy90;
- goto yy88;
+ if (yych <= 0x1F) goto yy85;
+ if (yych == '"') goto yy89;
+ goto yy87;
} else {
- if (yych <= '\\') goto yy92;
- if (yych <= 0x7F) goto yy88;
- if (yych <= 0xC1) goto yy94;
- goto yy96;
+ if (yych <= '\\') goto yy91;
+ if (yych <= 0x7F) goto yy87;
+ if (yych <= 0xC1) goto yy93;
+ goto yy95;
}
} else {
if (yych <= 0xEF) {
- if (yych <= 0xE0) goto yy97;
- if (yych <= 0xEC) goto yy98;
- if (yych <= 0xED) goto yy99;
- goto yy100;
+ if (yych <= 0xE0) goto yy96;
+ if (yych <= 0xEC) goto yy97;
+ if (yych <= 0xED) goto yy98;
+ goto yy99;
} else {
- if (yych <= 0xF0) goto yy101;
- if (yych <= 0xF3) goto yy102;
- if (yych <= 0xF4) goto yy103;
- goto yy94;
+ if (yych <= 0xF0) goto yy100;
+ if (yych <= 0xF3) goto yy101;
+ if (yych <= 0xF4) goto yy102;
+ goto yy93;
}
}
-yy86:
+yy85:
++YYCURSOR;
{
s->errcode = PHP_JSON_ERROR_CTRL_CHAR;
return PHP_JSON_T_ERROR;
}
-yy88:
+yy87:
++YYCURSOR;
-yy89:
+yy88:
{ PHP_JSON_CONDITION_GOTO(STR_P1); }
-yy90:
+yy89:
++YYCURSOR;
{
zend_string *str;
return PHP_JSON_T_ESTRING;
}
str = zend_string_alloc(len, 0);
- str->val[len] = '\0';
+ ZSTR_VAL(str)[len] = '\0';
ZVAL_STR(&s->value, str);
if (s->str_esc) {
s->pstr = (php_json_ctype *) Z_STRVAL(s->value);
return PHP_JSON_T_STRING;
}
}
-yy92:
+yy91:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'e') {
if (yych <= '/') {
- if (yych == '"') goto yy116;
- if (yych >= '/') goto yy116;
+ if (yych == '"') goto yy115;
+ if (yych >= '/') goto yy115;
} else {
if (yych <= '\\') {
- if (yych >= '\\') goto yy116;
+ if (yych >= '\\') goto yy115;
} else {
- if (yych == 'b') goto yy116;
+ if (yych == 'b') goto yy115;
}
}
} else {
if (yych <= 'q') {
- if (yych <= 'f') goto yy116;
- if (yych == 'n') goto yy116;
+ if (yych <= 'f') goto yy115;
+ if (yych == 'n') goto yy115;
} else {
if (yych <= 's') {
- if (yych <= 'r') goto yy116;
+ if (yych <= 'r') goto yy115;
} else {
- if (yych <= 't') goto yy116;
- if (yych <= 'u') goto yy118;
+ if (yych <= 't') goto yy115;
+ if (yych <= 'u') goto yy117;
}
}
}
-yy93:
+yy92:
{
s->errcode = PHP_JSON_ERROR_SYNTAX;
return PHP_JSON_T_ERROR;
}
-yy94:
+yy93:
++YYCURSOR;
-yy95:
+yy94:
{
s->errcode = PHP_JSON_ERROR_UTF8;
return PHP_JSON_T_ERROR;
}
-yy96:
+yy95:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy95;
- if (yych <= 0xBF) goto yy107;
- goto yy95;
+ if (yych <= 0x7F) goto yy94;
+ if (yych <= 0xBF) goto yy106;
+ goto yy94;
+yy96:
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= 0x9F) goto yy94;
+ if (yych <= 0xBF) goto yy114;
+ goto yy94;
yy97:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x9F) goto yy95;
- if (yych <= 0xBF) goto yy115;
- goto yy95;
+ if (yych <= 0x7F) goto yy94;
+ if (yych <= 0xBF) goto yy113;
+ goto yy94;
yy98:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x7F) goto yy95;
- if (yych <= 0xBF) goto yy114;
- goto yy95;
+ if (yych <= 0x7F) goto yy94;
+ if (yych <= 0x9F) goto yy112;
+ goto yy94;
yy99:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x7F) goto yy95;
- if (yych <= 0x9F) goto yy113;
- goto yy95;
+ if (yych <= 0x7F) goto yy94;
+ if (yych <= 0xBF) goto yy111;
+ goto yy94;
yy100:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x7F) goto yy95;
- if (yych <= 0xBF) goto yy112;
- goto yy95;
+ if (yych <= 0x8F) goto yy94;
+ if (yych <= 0xBF) goto yy109;
+ goto yy94;
yy101:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x8F) goto yy95;
- if (yych <= 0xBF) goto yy110;
- goto yy95;
+ if (yych <= 0x7F) goto yy94;
+ if (yych <= 0xBF) goto yy107;
+ goto yy94;
yy102:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x7F) goto yy95;
- if (yych <= 0xBF) goto yy108;
- goto yy95;
-yy103:
- yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x7F) goto yy95;
- if (yych >= 0x90) goto yy95;
+ if (yych <= 0x7F) goto yy94;
+ if (yych >= 0x90) goto yy94;
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy105;
- if (yych <= 0xBF) goto yy106;
-yy105:
+ if (yych <= 0x7F) goto yy104;
+ if (yych <= 0xBF) goto yy105;
+yy104:
YYCURSOR = YYMARKER;
if (yyaccept <= 1) {
- if (yyaccept == 0) {
- goto yy93;
+ if (yyaccept <= 0) {
+ goto yy92;
} else {
- goto yy95;
+ goto yy94;
}
} else {
- goto yy127;
+ goto yy126;
}
+yy105:
+ yych = *++YYCURSOR;
+ if (yych <= 0x7F) goto yy104;
+ if (yych >= 0xC0) goto yy104;
yy106:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy105;
- if (yych >= 0xC0) goto yy105;
+ goto yy88;
yy107:
yych = *++YYCURSOR;
- goto yy89;
-yy108:
+ if (yych <= 0x7F) goto yy104;
+ if (yych >= 0xC0) goto yy104;
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy105;
- if (yych >= 0xC0) goto yy105;
+ if (yych <= 0x7F) goto yy104;
+ if (yych <= 0xBF) goto yy106;
+ goto yy104;
+yy109:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy105;
- if (yych <= 0xBF) goto yy107;
- goto yy105;
-yy110:
+ if (yych <= 0x7F) goto yy104;
+ if (yych >= 0xC0) goto yy104;
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy105;
- if (yych >= 0xC0) goto yy105;
+ if (yych <= 0x7F) goto yy104;
+ if (yych <= 0xBF) goto yy106;
+ goto yy104;
+yy111:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy105;
- if (yych <= 0xBF) goto yy107;
- goto yy105;
+ if (yych <= 0x7F) goto yy104;
+ if (yych <= 0xBF) goto yy106;
+ goto yy104;
yy112:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy105;
- if (yych <= 0xBF) goto yy107;
- goto yy105;
+ if (yych <= 0x7F) goto yy104;
+ if (yych <= 0xBF) goto yy106;
+ goto yy104;
yy113:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy105;
- if (yych <= 0xBF) goto yy107;
- goto yy105;
+ if (yych <= 0x7F) goto yy104;
+ if (yych <= 0xBF) goto yy106;
+ goto yy104;
yy114:
yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy105;
- if (yych <= 0xBF) goto yy107;
- goto yy105;
+ if (yych <= 0x7F) goto yy104;
+ if (yych <= 0xBF) goto yy106;
+ goto yy104;
yy115:
- yych = *++YYCURSOR;
- if (yych <= 0x7F) goto yy105;
- if (yych <= 0xBF) goto yy107;
- goto yy105;
-yy116:
++YYCURSOR;
{
s->str_esc++;
PHP_JSON_CONDITION_GOTO(STR_P1);
}
-yy118:
+yy117:
yych = *++YYCURSOR;
if (yych <= 'D') {
if (yych <= '9') {
- if (yych <= '/') goto yy105;
- if (yych >= '1') goto yy120;
+ if (yych <= '/') goto yy104;
+ if (yych >= '1') goto yy119;
} else {
- if (yych <= '@') goto yy105;
- if (yych <= 'C') goto yy120;
- goto yy121;
+ if (yych <= '@') goto yy104;
+ if (yych <= 'C') goto yy119;
+ goto yy120;
}
} else {
if (yych <= 'c') {
- if (yych <= 'F') goto yy120;
- if (yych <= '`') goto yy105;
- goto yy120;
+ if (yych <= 'F') goto yy119;
+ if (yych <= '`') goto yy104;
+ goto yy119;
} else {
- if (yych <= 'd') goto yy121;
- if (yych <= 'f') goto yy120;
- goto yy105;
+ if (yych <= 'd') goto yy120;
+ if (yych <= 'f') goto yy119;
+ goto yy104;
}
}
yych = *++YYCURSOR;
if (yych <= '9') {
- if (yych <= '/') goto yy105;
- if (yych <= '0') goto yy140;
- if (yych <= '7') goto yy141;
- goto yy122;
+ if (yych <= '/') goto yy104;
+ if (yych <= '0') goto yy139;
+ if (yych <= '7') goto yy140;
+ goto yy121;
} else {
if (yych <= 'F') {
- if (yych <= '@') goto yy105;
- goto yy122;
+ if (yych <= '@') goto yy104;
+ goto yy121;
} else {
- if (yych <= '`') goto yy105;
- if (yych <= 'f') goto yy122;
- goto yy105;
+ if (yych <= '`') goto yy104;
+ if (yych <= 'f') goto yy121;
+ goto yy104;
}
}
-yy120:
+yy119:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych <= '9') goto yy122;
- goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych <= '9') goto yy121;
+ goto yy104;
} else {
- if (yych <= 'F') goto yy122;
- if (yych <= '`') goto yy105;
- if (yych <= 'f') goto yy122;
- goto yy105;
+ if (yych <= 'F') goto yy121;
+ if (yych <= '`') goto yy104;
+ if (yych <= 'f') goto yy121;
+ goto yy104;
}
-yy121:
+yy120:
yych = *++YYCURSOR;
if (yych <= 'B') {
if (yych <= '7') {
- if (yych <= '/') goto yy105;
+ if (yych <= '/') goto yy104;
} else {
- if (yych <= '9') goto yy123;
- if (yych <= '@') goto yy105;
- goto yy123;
+ if (yych <= '9') goto yy122;
+ if (yych <= '@') goto yy104;
+ goto yy122;
}
} else {
if (yych <= '`') {
- if (yych <= 'F') goto yy124;
- goto yy105;
+ if (yych <= 'F') goto yy123;
+ goto yy104;
} else {
- if (yych <= 'b') goto yy123;
- if (yych <= 'f') goto yy124;
- goto yy105;
+ if (yych <= 'b') goto yy122;
+ if (yych <= 'f') goto yy123;
+ goto yy104;
}
}
+yy121:
+ yych = *++YYCURSOR;
+ if (yych <= '@') {
+ if (yych <= '/') goto yy104;
+ if (yych <= '9') goto yy136;
+ goto yy104;
+ } else {
+ if (yych <= 'F') goto yy136;
+ if (yych <= '`') goto yy104;
+ if (yych <= 'f') goto yy136;
+ goto yy104;
+ }
yy122:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych <= '9') goto yy137;
- goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych <= '9') goto yy127;
+ goto yy104;
} else {
- if (yych <= 'F') goto yy137;
- if (yych <= '`') goto yy105;
- if (yych <= 'f') goto yy137;
- goto yy105;
+ if (yych <= 'F') goto yy127;
+ if (yych <= '`') goto yy104;
+ if (yych <= 'f') goto yy127;
+ goto yy104;
}
yy123:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych <= '9') goto yy128;
- goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych >= ':') goto yy104;
} else {
- if (yych <= 'F') goto yy128;
- if (yych <= '`') goto yy105;
- if (yych <= 'f') goto yy128;
- goto yy105;
+ if (yych <= 'F') goto yy124;
+ if (yych <= '`') goto yy104;
+ if (yych >= 'g') goto yy104;
}
yy124:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych >= ':') goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych >= ':') goto yy104;
} else {
if (yych <= 'F') goto yy125;
- if (yych <= '`') goto yy105;
- if (yych >= 'g') goto yy105;
+ if (yych <= '`') goto yy104;
+ if (yych >= 'g') goto yy104;
}
yy125:
- yych = *++YYCURSOR;
- if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych >= ':') goto yy105;
- } else {
- if (yych <= 'F') goto yy126;
- if (yych <= '`') goto yy105;
- if (yych >= 'g') goto yy105;
- }
-yy126:
++YYCURSOR;
-yy127:
+yy126:
{
s->errcode = PHP_JSON_ERROR_UTF16;
return PHP_JSON_T_ERROR;
}
-yy128:
+yy127:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych >= ':') goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych >= ':') goto yy104;
} else {
- if (yych <= 'F') goto yy129;
- if (yych <= '`') goto yy105;
- if (yych >= 'g') goto yy105;
+ if (yych <= 'F') goto yy128;
+ if (yych <= '`') goto yy104;
+ if (yych >= 'g') goto yy104;
}
-yy129:
+yy128:
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych != '\\') goto yy127;
+ if (yych != '\\') goto yy126;
yych = *++YYCURSOR;
- if (yych != 'u') goto yy105;
+ if (yych != 'u') goto yy104;
yych = *++YYCURSOR;
- if (yych == 'D') goto yy132;
- if (yych != 'd') goto yy105;
-yy132:
+ if (yych == 'D') goto yy131;
+ if (yych != 'd') goto yy104;
+yy131:
yych = *++YYCURSOR;
- if (yych <= 'B') goto yy105;
- if (yych <= 'F') goto yy133;
- if (yych <= 'b') goto yy105;
- if (yych >= 'g') goto yy105;
-yy133:
+ if (yych <= 'B') goto yy104;
+ if (yych <= 'F') goto yy132;
+ if (yych <= 'b') goto yy104;
+ if (yych >= 'g') goto yy104;
+yy132:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych >= ':') goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych >= ':') goto yy104;
} else {
- if (yych <= 'F') goto yy134;
- if (yych <= '`') goto yy105;
- if (yych >= 'g') goto yy105;
+ if (yych <= 'F') goto yy133;
+ if (yych <= '`') goto yy104;
+ if (yych >= 'g') goto yy104;
}
-yy134:
+yy133:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych >= ':') goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych >= ':') goto yy104;
} else {
- if (yych <= 'F') goto yy135;
- if (yych <= '`') goto yy105;
- if (yych >= 'g') goto yy105;
+ if (yych <= 'F') goto yy134;
+ if (yych <= '`') goto yy104;
+ if (yych >= 'g') goto yy104;
}
-yy135:
+yy134:
++YYCURSOR;
{
s->str_esc += 8;
PHP_JSON_CONDITION_GOTO(STR_P1);
}
-yy137:
+yy136:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych >= ':') goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych >= ':') goto yy104;
} else {
- if (yych <= 'F') goto yy138;
- if (yych <= '`') goto yy105;
- if (yych >= 'g') goto yy105;
+ if (yych <= 'F') goto yy137;
+ if (yych <= '`') goto yy104;
+ if (yych >= 'g') goto yy104;
}
-yy138:
+yy137:
++YYCURSOR;
{
s->str_esc += 3;
PHP_JSON_CONDITION_GOTO(STR_P1);
}
-yy140:
+yy139:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych <= '7') goto yy145;
- if (yych <= '9') goto yy142;
- goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych <= '7') goto yy144;
+ if (yych <= '9') goto yy141;
+ goto yy104;
} else {
- if (yych <= 'F') goto yy142;
- if (yych <= '`') goto yy105;
- if (yych <= 'f') goto yy142;
- goto yy105;
+ if (yych <= 'F') goto yy141;
+ if (yych <= '`') goto yy104;
+ if (yych <= 'f') goto yy141;
+ goto yy104;
}
-yy141:
+yy140:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych >= ':') goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych >= ':') goto yy104;
} else {
- if (yych <= 'F') goto yy142;
- if (yych <= '`') goto yy105;
- if (yych >= 'g') goto yy105;
+ if (yych <= 'F') goto yy141;
+ if (yych <= '`') goto yy104;
+ if (yych >= 'g') goto yy104;
}
-yy142:
+yy141:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych >= ':') goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych >= ':') goto yy104;
} else {
- if (yych <= 'F') goto yy143;
- if (yych <= '`') goto yy105;
- if (yych >= 'g') goto yy105;
+ if (yych <= 'F') goto yy142;
+ if (yych <= '`') goto yy104;
+ if (yych >= 'g') goto yy104;
}
-yy143:
+yy142:
++YYCURSOR;
{
s->str_esc += 4;
PHP_JSON_CONDITION_GOTO(STR_P1);
}
-yy145:
+yy144:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy105;
- if (yych >= ':') goto yy105;
+ if (yych <= '/') goto yy104;
+ if (yych >= ':') goto yy104;
} else {
- if (yych <= 'F') goto yy146;
- if (yych <= '`') goto yy105;
- if (yych >= 'g') goto yy105;
+ if (yych <= 'F') goto yy145;
+ if (yych <= '`') goto yy104;
+ if (yych >= 'g') goto yy104;
}
-yy146:
+yy145:
++YYCURSOR;
{
s->str_esc += 5;
/* *********************************** */
yyc_STR_P2:
yych = *YYCURSOR;
- if (yych == '"') goto yy152;
- if (yych == '\\') goto yy154;
+ if (yych == '"') goto yy151;
+ if (yych == '\\') goto yy153;
++YYCURSOR;
{ PHP_JSON_CONDITION_GOTO(STR_P2); }
-yy152:
+yy151:
++YYCURSOR;
YYSETCONDITION(yycJS);
{
PHP_JSON_SCANNER_COPY_ESC();
return PHP_JSON_T_STRING;
}
-yy154:
+yy153:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych == 'u') goto yy156;
-yy155:
+ if (yych == 'u') goto yy155;
+yy154:
{
char esc;
PHP_JSON_SCANNER_COPY_ESC();
s->str_start = s->cursor;
PHP_JSON_CONDITION_GOTO(STR_P2);
}
-yy156:
+yy155:
yych = *++YYCURSOR;
if (yych <= 'D') {
if (yych <= '9') {
- if (yych <= '/') goto yy157;
- if (yych <= '0') goto yy158;
- goto yy159;
+ if (yych <= '/') goto yy156;
+ if (yych <= '0') goto yy157;
+ goto yy158;
} else {
- if (yych <= '@') goto yy157;
- if (yych <= 'C') goto yy159;
- goto yy160;
+ if (yych <= '@') goto yy156;
+ if (yych <= 'C') goto yy158;
+ goto yy159;
}
} else {
if (yych <= 'c') {
- if (yych <= 'F') goto yy159;
- if (yych >= 'a') goto yy159;
+ if (yych <= 'F') goto yy158;
+ if (yych >= 'a') goto yy158;
} else {
- if (yych <= 'd') goto yy160;
- if (yych <= 'f') goto yy159;
+ if (yych <= 'd') goto yy159;
+ if (yych <= 'f') goto yy158;
}
}
-yy157:
+yy156:
YYCURSOR = YYMARKER;
- goto yy155;
-yy158:
+ goto yy154;
+yy157:
yych = *++YYCURSOR;
if (yych <= '9') {
- if (yych <= '/') goto yy157;
- if (yych <= '0') goto yy175;
- if (yych <= '7') goto yy176;
- goto yy162;
+ if (yych <= '/') goto yy156;
+ if (yych <= '0') goto yy174;
+ if (yych <= '7') goto yy175;
+ goto yy161;
} else {
if (yych <= 'F') {
- if (yych <= '@') goto yy157;
- goto yy162;
+ if (yych <= '@') goto yy156;
+ goto yy161;
} else {
- if (yych <= '`') goto yy157;
- if (yych <= 'f') goto yy162;
- goto yy157;
+ if (yych <= '`') goto yy156;
+ if (yych <= 'f') goto yy161;
+ goto yy156;
}
}
+yy158:
+ yych = *++YYCURSOR;
+ if (yych <= '@') {
+ if (yych <= '/') goto yy156;
+ if (yych <= '9') goto yy161;
+ goto yy156;
+ } else {
+ if (yych <= 'F') goto yy161;
+ if (yych <= '`') goto yy156;
+ if (yych <= 'f') goto yy161;
+ goto yy156;
+ }
yy159:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych <= '9') goto yy162;
- goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych <= '7') goto yy161;
+ if (yych >= ':') goto yy156;
} else {
- if (yych <= 'F') goto yy162;
- if (yych <= '`') goto yy157;
- if (yych <= 'f') goto yy162;
- goto yy157;
+ if (yych <= 'B') goto yy160;
+ if (yych <= '`') goto yy156;
+ if (yych >= 'c') goto yy156;
}
yy160:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych <= '7') goto yy162;
- if (yych >= ':') goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych <= '9') goto yy165;
+ goto yy156;
} else {
- if (yych <= 'B') goto yy161;
- if (yych <= '`') goto yy157;
- if (yych >= 'c') goto yy157;
+ if (yych <= 'F') goto yy165;
+ if (yych <= '`') goto yy156;
+ if (yych <= 'f') goto yy165;
+ goto yy156;
}
yy161:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych <= '9') goto yy166;
- goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych >= ':') goto yy156;
} else {
- if (yych <= 'F') goto yy166;
- if (yych <= '`') goto yy157;
- if (yych <= 'f') goto yy166;
- goto yy157;
+ if (yych <= 'F') goto yy162;
+ if (yych <= '`') goto yy156;
+ if (yych >= 'g') goto yy156;
}
yy162:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych >= ':') goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych >= ':') goto yy156;
} else {
if (yych <= 'F') goto yy163;
- if (yych <= '`') goto yy157;
- if (yych >= 'g') goto yy157;
+ if (yych <= '`') goto yy156;
+ if (yych >= 'g') goto yy156;
}
yy163:
- yych = *++YYCURSOR;
- if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych >= ':') goto yy157;
- } else {
- if (yych <= 'F') goto yy164;
- if (yych <= '`') goto yy157;
- if (yych >= 'g') goto yy157;
- }
-yy164:
++YYCURSOR;
{
int utf16 = php_json_ucs2_to_int(s, 4);
s->str_start = s->cursor;
PHP_JSON_CONDITION_GOTO(STR_P2);
}
-yy166:
+yy165:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych >= ':') goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych >= ':') goto yy156;
} else {
- if (yych <= 'F') goto yy167;
- if (yych <= '`') goto yy157;
- if (yych >= 'g') goto yy157;
+ if (yych <= 'F') goto yy166;
+ if (yych <= '`') goto yy156;
+ if (yych >= 'g') goto yy156;
}
-yy167:
+yy166:
yych = *++YYCURSOR;
- if (yych != '\\') goto yy157;
+ if (yych != '\\') goto yy156;
yych = *++YYCURSOR;
- if (yych != 'u') goto yy157;
+ if (yych != 'u') goto yy156;
yych = *++YYCURSOR;
- if (yych == 'D') goto yy170;
- if (yych != 'd') goto yy157;
-yy170:
+ if (yych == 'D') goto yy169;
+ if (yych != 'd') goto yy156;
+yy169:
yych = *++YYCURSOR;
- if (yych <= 'B') goto yy157;
- if (yych <= 'F') goto yy171;
- if (yych <= 'b') goto yy157;
- if (yych >= 'g') goto yy157;
-yy171:
+ if (yych <= 'B') goto yy156;
+ if (yych <= 'F') goto yy170;
+ if (yych <= 'b') goto yy156;
+ if (yych >= 'g') goto yy156;
+yy170:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych >= ':') goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych >= ':') goto yy156;
} else {
- if (yych <= 'F') goto yy172;
- if (yych <= '`') goto yy157;
- if (yych >= 'g') goto yy157;
+ if (yych <= 'F') goto yy171;
+ if (yych <= '`') goto yy156;
+ if (yych >= 'g') goto yy156;
}
-yy172:
+yy171:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych >= ':') goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych >= ':') goto yy156;
} else {
- if (yych <= 'F') goto yy173;
- if (yych <= '`') goto yy157;
- if (yych >= 'g') goto yy157;
+ if (yych <= 'F') goto yy172;
+ if (yych <= '`') goto yy156;
+ if (yych >= 'g') goto yy156;
}
-yy173:
+yy172:
++YYCURSOR;
{
int utf32, utf16_hi, utf16_lo;
s->str_start = s->cursor;
PHP_JSON_CONDITION_GOTO(STR_P2);
}
-yy175:
+yy174:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych <= '7') goto yy180;
- if (yych <= '9') goto yy177;
- goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych <= '7') goto yy179;
+ if (yych <= '9') goto yy176;
+ goto yy156;
} else {
- if (yych <= 'F') goto yy177;
- if (yych <= '`') goto yy157;
- if (yych <= 'f') goto yy177;
- goto yy157;
+ if (yych <= 'F') goto yy176;
+ if (yych <= '`') goto yy156;
+ if (yych <= 'f') goto yy176;
+ goto yy156;
}
-yy176:
+yy175:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych >= ':') goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych >= ':') goto yy156;
} else {
- if (yych <= 'F') goto yy177;
- if (yych <= '`') goto yy157;
- if (yych >= 'g') goto yy157;
+ if (yych <= 'F') goto yy176;
+ if (yych <= '`') goto yy156;
+ if (yych >= 'g') goto yy156;
}
-yy177:
+yy176:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych >= ':') goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych >= ':') goto yy156;
} else {
- if (yych <= 'F') goto yy178;
- if (yych <= '`') goto yy157;
- if (yych >= 'g') goto yy157;
+ if (yych <= 'F') goto yy177;
+ if (yych <= '`') goto yy156;
+ if (yych >= 'g') goto yy156;
}
-yy178:
+yy177:
++YYCURSOR;
{
int utf16 = php_json_ucs2_to_int(s, 3);
s->str_start = s->cursor;
PHP_JSON_CONDITION_GOTO(STR_P2);
}
-yy180:
+yy179:
yych = *++YYCURSOR;
if (yych <= '@') {
- if (yych <= '/') goto yy157;
- if (yych >= ':') goto yy157;
+ if (yych <= '/') goto yy156;
+ if (yych >= ':') goto yy156;
} else {
- if (yych <= 'F') goto yy181;
- if (yych <= '`') goto yy157;
- if (yych >= 'g') goto yy157;
+ if (yych <= 'F') goto yy180;
+ if (yych <= '`') goto yy156;
+ if (yych >= 'g') goto yy156;
}
-yy181:
+yy180:
++YYCURSOR;
{
int utf16 = php_json_ucs2_to_int(s, 2);
return PHP_JSON_T_ESTRING;
}
str = zend_string_alloc(len, 0);
- str->val[len] = '\0';
+ ZSTR_VAL(str)[len] = '\0';
ZVAL_STR(&s->value, str);
if (s->str_esc) {
s->pstr = (php_json_ctype *) Z_STRVAL(s->value);
-/* Generated by re2c 0.14.3 */
+/* Generated by re2c 0.13.5 */
enum YYCONDTYPE {
yycJS,
if (output == 1) {
if (LIBXML(error_list)) {
- _php_list_set_error_structure(NULL, LIBXML(error_buffer).s->val);
+ _php_list_set_error_structure(NULL, ZSTR_VAL(LIBXML(error_buffer).s));
} else {
switch (error_type) {
case PHP_LIBXML_CTX_ERROR:
- php_libxml_ctx_error_level(E_WARNING, ctx, LIBXML(error_buffer).s->val);
+ php_libxml_ctx_error_level(E_WARNING, ctx, ZSTR_VAL(LIBXML(error_buffer).s));
break;
case PHP_LIBXML_CTX_WARNING:
- php_libxml_ctx_error_level(E_NOTICE, ctx, LIBXML(error_buffer).s->val);
+ php_libxml_ctx_error_level(E_NOTICE, ctx, ZSTR_VAL(LIBXML(error_buffer).s));
break;
default:
- php_error_docref(NULL, E_WARNING, "%s", LIBXML(error_buffer).s->val);
+ php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(LIBXML(error_buffer).s));
}
}
smart_str_free(&LIBXML(error_buffer));
php_stream_rewind(SG(request_info).request_body);
post_data_str = php_stream_copy_to_mem(SG(request_info).request_body, PHP_STREAM_COPY_ALL, 0);
- detected = _php_mb_encoding_handler_ex(&info, arg, post_data_str->val);
+ detected = _php_mb_encoding_handler_ex(&info, arg, ZSTR_VAL(post_data_str));
zend_string_release(post_data_str);
MBSTRG(http_input_identify) = detected;
{
enum mbfl_no_language no_language;
- no_language = mbfl_name2no_language(new_value->val);
+ no_language = mbfl_name2no_language(ZSTR_VAL(new_value));
if (no_language == mbfl_no_language_invalid) {
MBSTRG(language) = mbfl_no_language_neutral;
return FAILURE;
return SUCCESS;
}
- if (FAILURE == php_mb_parse_encoding_list(new_value->val, new_value->len, &list, &size, 1)) {
+ if (FAILURE == php_mb_parse_encoding_list(ZSTR_VAL(new_value), ZSTR_LEN(new_value), &list, &size, 1)) {
return FAILURE;
}
return SUCCESS;
}
- if (FAILURE == php_mb_parse_encoding_list(new_value->val, new_value->len, &list, &size, 1)) {
+ if (FAILURE == php_mb_parse_encoding_list(ZSTR_VAL(new_value), ZSTR_LEN(new_value), &list, &size, 1)) {
return FAILURE;
}
{
const mbfl_encoding *encoding;
- if (new_value == NULL || new_value->len == 0) {
+ if (new_value == NULL || ZSTR_LEN(new_value) == 0) {
encoding = mbfl_name2encoding(get_output_encoding());
if (!encoding) {
MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
return SUCCESS;
}
} else {
- encoding = mbfl_name2encoding(new_value->val);
+ encoding = mbfl_name2encoding(ZSTR_VAL(new_value));
if (!encoding) {
MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass;
}
if (stage & (PHP_INI_STAGE_STARTUP | PHP_INI_STAGE_SHUTDOWN | PHP_INI_STAGE_RUNTIME)) {
- if (new_value && new_value->len) {
- return _php_mb_ini_mbstring_internal_encoding_set(new_value->val, new_value->len);
+ if (new_value && ZSTR_LEN(new_value)) {
+ return _php_mb_ini_mbstring_internal_encoding_set(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
} else {
return _php_mb_ini_mbstring_internal_encoding_set(get_internal_encoding(), strlen(get_internal_encoding())+1);
}
char *endptr = NULL;
if (new_value != NULL) {
- if (strcasecmp("none", new_value->val) == 0) {
+ if (strcasecmp("none", ZSTR_VAL(new_value)) == 0) {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
- } else if (strcasecmp("long", new_value->val) == 0) {
+ } else if (strcasecmp("long", ZSTR_VAL(new_value)) == 0) {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
- } else if (strcasecmp("entity", new_value->val) == 0) {
+ } else if (strcasecmp("entity", ZSTR_VAL(new_value)) == 0) {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
} else {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- if (new_value->len >0) {
- c = strtol(new_value->val, &endptr, 0);
+ if (ZSTR_LEN(new_value) > 0) {
+ c = strtol(ZSTR_VAL(new_value), &endptr, 0);
if (*endptr == '\0') {
MBSTRG(filter_illegal_substchar) = c;
MBSTRG(current_filter_illegal_substchar) = c;
}
tmp = php_trim(new_value, NULL, 0, 3);
- if (tmp->len > 0) {
- if (!(re = _php_mb_compile_regex(tmp->val))) {
+ if (ZSTR_LEN(tmp) > 0) {
+ if (!(re = _php_mb_compile_regex(ZSTR_VAL(tmp)))) {
zend_string_release(tmp);
return FAILURE;
}
} else {
zend_string *ini_name = zend_string_init("mbstring.language", sizeof("mbstring.language") - 1, 0);
if (FAILURE == zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)) {
- php_error_docref(NULL, E_WARNING, "Unknown language \"%s\"", name->val);
+ php_error_docref(NULL, E_WARNING, "Unknown language \"%s\"", ZSTR_VAL(name));
RETVAL_FALSE;
} else {
RETVAL_TRUE;
zval val;
/* FIXME: some locale free implementation is
* really required here,,, */
- php_strtoupper(fld_name->val, fld_name->len);
+ php_strtoupper(ZSTR_VAL(fld_name), ZSTR_LEN(fld_name));
ZVAL_STR(&val, fld_val);
zend_hash_update(ht, fld_name, &val);
zval val;
/* FIXME: some locale free implementation is
* really required here,,, */
- php_strtoupper(fld_name->val, fld_name->len);
+ php_strtoupper(ZSTR_VAL(fld_name), ZSTR_LEN(fld_name));
ZVAL_STR(&val, fld_val);
zend_hash_update(ht, fld_name, &val);
MAIL_ASCIIZ_CHECK_MBSTRING(headers, headers_len);
}
if (extra_cmd) {
- MAIL_ASCIIZ_CHECK_MBSTRING(extra_cmd->val, extra_cmd->len);
+ MAIL_ASCIIZ_CHECK_MBSTRING(ZSTR_VAL(extra_cmd), ZSTR_LEN(extra_cmd));
}
zend_hash_init(&ht_headers, 0, NULL, ZVAL_PTR_DTOR, 0);
if (force_extra_parameters) {
extra_cmd = php_escape_shell_cmd(force_extra_parameters);
} else if (extra_cmd) {
- extra_cmd = php_escape_shell_cmd(extra_cmd->val);
+ extra_cmd = php_escape_shell_cmd(ZSTR_VAL(extra_cmd));
}
- if (!err && php_mail(to_r, subject, message, headers, extra_cmd ? extra_cmd->val : NULL)) {
+ if (!err && php_mail(to_r, subject, message, headers, extra_cmd ? ZSTR_VAL(extra_cmd) : NULL)) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
/* null terminate buffer */
smart_str_0(&eval_buf);
/* do eval */
- if (zend_eval_stringl(eval_buf.s->val, eval_buf.s->len, &v, description) == FAILURE) {
+ if (zend_eval_stringl(ZSTR_VAL(eval_buf.s), ZSTR_LEN(eval_buf.s), &v, description) == FAILURE) {
efree(description);
- php_error_docref(NULL,E_ERROR, "Failed evaluating code: %s%s", PHP_EOL, eval_buf.s->val);
+ php_error_docref(NULL,E_ERROR, "Failed evaluating code: %s%s", PHP_EOL, ZSTR_VAL(eval_buf.s));
/* zend_error() does not return in this case */
}
convert_to_string(&v);
smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRLEN(v));
/* Clean up */
- eval_buf.s->len = 0;
+ ZSTR_LEN(eval_buf.s) = 0;
zval_dtor(&v);
} else if (is_callable) {
zval args[1];
convert_to_string_ex(&retval);
smart_str_appendl(&out_buf, Z_STRVAL(retval), Z_STRLEN(retval));
if (eval_buf.s) {
- eval_buf.s->len = 0;
+ ZSTR_LEN(eval_buf.s) = 0;
}
zval_ptr_dtor(&retval);
} else {
php_info_print_table_header(2, "mcrypt_filter support", "enabled");
php_info_print_table_row(2, "Version", LIBMCRYPT_VERSION);
php_info_print_table_row(2, "Api No", mcrypt_api_no);
- php_info_print_table_row(2, "Supported ciphers", tmp1.s->val);
- php_info_print_table_row(2, "Supported modes", tmp2.s->val);
+ php_info_print_table_row(2, "Supported ciphers", ZSTR_VAL(tmp1.s));
+ php_info_print_table_row(2, "Supported modes", ZSTR_VAL(tmp2.s));
smart_str_free(&tmp1);
smart_str_free(&tmp2);
smart_str_appends(&str, " supported");
smart_str_0(&str);
- result = estrndup(str.s->val, str.s->len);
+ result = estrndup(ZSTR_VAL(str.s), ZSTR_LEN(str.s));
smart_str_free(&str);
return result;
mysqli_object *intern = Z_MYSQLI_P(zv);
if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) {
/* We know that we have a mysqli object, so this failure should be emitted */
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", intern->zo.ce->name->val);
+ php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(intern->zo.ce->name));
return NULL;
}
mysql = (MY_MYSQL *)(my_res->ptr);
ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_AUTO);
}
if (!ce) {
- php_error_docref(NULL, E_WARNING, "Could not find class '%s'", class_name->val);
+ php_error_docref(NULL, E_WARNING, "Could not find class '%s'", ZSTR_VAL(class_name));
return;
}
fetchtype = MYSQLI_ASSOC;
fcc.object = Z_OBJ_P(return_value);
if (zend_call_function(&fci, &fcc) == FAILURE) {
- zend_throw_exception_ex(zend_exception_get_default(), 0, "Could not execute %s::%s()", ce->name->val, ce->constructor->common.function_name->val);
+ zend_throw_exception_ex(zend_exception_get_default(), 0, "Could not execute %s::%s()", ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name));
} else {
zval_ptr_dtor(&retval);
}
efree(fci.params);
}
} else if (ctor_params) {
- zend_throw_exception_ex(zend_exception_get_default(), 0, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name->val);
+ zend_throw_exception_ex(zend_exception_get_default(), 0, "Class %s does not have a constructor hence you cannot use ctor_params", ZSTR_VAL(ce->name));
}
}
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
newstr = zend_string_alloc(2 * escapestr_len, 0);
- newstr->len = mysql_real_escape_string(mysql->mysql, newstr->val, escapestr, escapestr_len);
- newstr = zend_string_truncate(newstr, newstr->len, 0);
+ ZSTR_LEN(newstr) = mysql_real_escape_string(mysql->mysql, ZSTR_VAL(newstr), escapestr, escapestr_len);
+ newstr = zend_string_truncate(newstr, ZSTR_LEN(newstr), 0);
RETURN_NEW_STR(newstr);
}
le.ptr = plist = calloc(1, sizeof(mysqli_plist_entry));
zend_ptr_stack_init_ex(&plist->free_links, 1);
- zend_hash_str_update_mem(&EG(persistent_list), hash_key->val, hash_key->len, &le, sizeof(le));
+ zend_hash_str_update_mem(&EG(persistent_list), ZSTR_VAL(hash_key), ZSTR_LEN(hash_key), &le, sizeof(le));
}
}
}
MYSQLI_RESOURCE *my_res;
mysqli_object *intern = Z_MYSQLI_P(elem);
if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) {
- php_error_docref(NULL, E_WARNING, "[%d] Couldn't fetch %s", i, intern->zo.ce->name->val);
+ php_error_docref(NULL, E_WARNING, "[%d] Couldn't fetch %s", i, ZSTR_VAL(intern->zo.ce->name));
continue;
}
mysql = (MY_MYSQL*) my_res->ptr;
if (MYSQLI_STATUS_VALID && my_res->status < MYSQLI_STATUS_VALID) {
- php_error_docref(NULL, E_WARNING, "Invalid object %d or resource %s", i, intern->zo.ce->name->val);
+ php_error_docref(NULL, E_WARNING, "Invalid object %d or resource %s", i, ZSTR_VAL(intern->zo.ce->name));
continue;
}
(*out_array)[current++] = mysql->mysql;
MYSQLI_RESOURCE *my_res;
mysqli_object *intern = Z_MYSQLI_P(elem);
if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) {
- php_error_docref(NULL, E_WARNING, "[%d] Couldn't fetch %s", i, intern->zo.ce->name->val);
+ php_error_docref(NULL, E_WARNING, "[%d] Couldn't fetch %s", i, ZSTR_VAL(intern->zo.ce->name));
continue;
}
mysql = (MY_MYSQL *) my_res->ptr;
char * name_esc = mysqli_escape_string_for_tx_name_in_comment(name);
char * query;
unsigned int query_len = spprintf(&query, 0, "START TRANSACTION%s %s",
- name_esc? name_esc:"", tmp_str.s? tmp_str.s->val:"");
+ name_esc? name_esc:"", tmp_str.s? ZSTR_VAL(tmp_str.s):"");
smart_str_free(&tmp_str);
if (name_esc) {
#define MYSQLI_GET_MYSQL(statusval) \
MYSQL *p; \
if (!obj->ptr || !(MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr) { \
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", obj->zo.ce->name->val);\
+ php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));\
ZVAL_NULL(retval);\
return retval; \
} else { \
#define MYSQLI_GET_RESULT(statusval) \
MYSQL_RES *p; \
if (!obj->ptr) { \
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", obj->zo.ce->name->val);\
+ php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));\
ZVAL_NULL(retval);\
return retval; \
} else { \
#define MYSQLI_GET_STMT(statusval) \
MYSQL_STMT *p; \
if (!obj->ptr) { \
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", obj->zo.ce->name->val);\
+ php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));\
ZVAL_NULL(retval);\
return retval; \
} else { \
MYSQLI_RESOURCE *my_res; \
mysqli_object *intern = Z_MYSQLI_P(__id); \
if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) {\
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", intern->zo.ce->name->val);\
+ php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(intern->zo.ce->name));\
RETURN_NULL();\
}\
__ptr = (__type)my_res->ptr; \
if (__check && my_res->status < __check) { \
- php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", intern->zo.ce->name->val); \
+ php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \
RETURN_NULL();\
}\
}
{ \
MYSQLI_RESOURCE *my_res; \
if (!(my_res = (MYSQLI_RESOURCE *)(__obj->ptr))) {\
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", intern->zo.ce->name->val);\
+ php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(intern->zo.ce->name));\
return;\
}\
__ptr = (__type)my_res->ptr; \
if (__check && my_res->status < __check) { \
- php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", intern->zo.ce->name->val); \
+ php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \
return;\
}\
}
MYSQLI_FETCH_RESOURCE((__ptr), MY_MYSQL *, (__id), "mysqli_link", (__check)); \
if (!(__ptr)->mysql) { \
mysqli_object *intern = Z_MYSQLI_P(__id); \
- php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", intern->zo.ce->name->val); \
+ php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \
RETURN_NULL(); \
} \
}
MYSQLI_FETCH_RESOURCE((__ptr), MY_STMT *, (__id), "mysqli_stmt", (__check)); \
if (!(__ptr)->stmt) { \
mysqli_object *intern = Z_MYSQLI_P(__id); \
- php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", intern->zo.ce->name->val); \
+ php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \
RETURN_NULL();\
} \
}
if (PASS == (ret = PACKET_READ(stats_header, conn))) {
/* will be freed by Zend, thus don't use the mnd_ allocator */
*message = zend_string_init(stats_header->message, stats_header->message_len, 0);
- DBG_INF((*message)->val);
+ DBG_INF(ZSTR_VAL(*message));
}
PACKET_FREE(stats_header);
} while (0);
MYSQLND_METHOD(mysqlnd_conn_data, tx_cor_options_to_string)(const MYSQLND_CONN_DATA * const conn, smart_str * str, const unsigned int mode)
{
if (mode & TRANS_COR_AND_CHAIN && !(mode & TRANS_COR_AND_NO_CHAIN)) {
- if (str->s && str->s->len) {
+ if (str->s && ZSTR_LEN(str->s)) {
smart_str_appendl(str, " ", sizeof(" ") - 1);
}
smart_str_appendl(str, "AND CHAIN", sizeof("AND CHAIN") - 1);
} else if (mode & TRANS_COR_AND_NO_CHAIN && !(mode & TRANS_COR_AND_CHAIN)) {
- if (str->s && str->s->len) {
+ if (str->s && ZSTR_LEN(str->s)) {
smart_str_appendl(str, " ", sizeof(" ") - 1);
}
smart_str_appendl(str, "AND NO CHAIN", sizeof("AND NO CHAIN") - 1);
}
if (mode & TRANS_COR_RELEASE && !(mode & TRANS_COR_NO_RELEASE)) {
- if (str->s && str->s->len) {
+ if (str->s && ZSTR_LEN(str->s)) {
smart_str_appendl(str, " ", sizeof(" ") - 1);
}
smart_str_appendl(str, "RELEASE", sizeof("RELEASE") - 1);
} else if (mode & TRANS_COR_NO_RELEASE && !(mode & TRANS_COR_RELEASE)) {
- if (str->s && str->s->len) {
+ if (str->s && ZSTR_LEN(str->s)) {
smart_str_appendl(str, " ", sizeof(" ") - 1);
}
smart_str_appendl(str, "NO RELEASE", sizeof("NO RELEASE") - 1);
char * name_esc = mysqlnd_escape_string_for_tx_name_in_comment(name);
query_len = mnd_sprintf(&query, 0, (commit? "COMMIT%s %s":"ROLLBACK%s %s"),
- name_esc? name_esc:"", tmp_str.s? tmp_str.s->val:"");
+ name_esc? name_esc:"", tmp_str.s? ZSTR_VAL(tmp_str.s):"");
smart_str_free(&tmp_str);
if (name_esc) {
mnd_efree(name_esc);
smart_str_free(&tmp_str);
break;
} else if (mode & TRANS_START_READ_WRITE) {
- if (tmp_str.s && tmp_str.s->len) {
+ if (tmp_str.s && ZSTR_LEN(tmp_str.s)) {
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
}
smart_str_appendl(&tmp_str, "READ WRITE", sizeof("READ WRITE") - 1);
} else if (mode & TRANS_START_READ_ONLY) {
- if (tmp_str.s && tmp_str.s->len) {
+ if (tmp_str.s && ZSTR_LEN(tmp_str.s)) {
smart_str_appendl(&tmp_str, ", ", sizeof(", ") - 1);
}
smart_str_appendl(&tmp_str, "READ ONLY", sizeof("READ ONLY") - 1);
{
char * name_esc = mysqlnd_escape_string_for_tx_name_in_comment(name);
char * query;
- unsigned int query_len = mnd_sprintf(&query, 0, "START TRANSACTION%s %s", name_esc? name_esc:"", tmp_str.s? tmp_str.s->val:"");
+ unsigned int query_len = mnd_sprintf(&query, 0, "START TRANSACTION%s %s", name_esc? name_esc:"", tmp_str.s? ZSTR_VAL(tmp_str.s):"");
smart_str_free(&tmp_str);
if (name_esc) {
mnd_efree(name_esc);
smart_str_appendc(&tmp_str, *p);
} while (*p++);
- ret = (persistent) ? __zend_malloc(tmp_str.s->len + sizeof(size_t)) : _emalloc(REAL_SIZE(tmp_str.s->len + sizeof(size_t)) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- memcpy(FAKE_PTR(ret), tmp_str.s->val, tmp_str.s->len);
+ ret = (persistent) ? __zend_malloc(ZSTR_LEN(tmp_str.s) + sizeof(size_t)) : _emalloc(REAL_SIZE(ZSTR_LEN(tmp_str.s) + sizeof(size_t)) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ memcpy(FAKE_PTR(ret), ZSTR_VAL(tmp_str.s), ZSTR_LEN(tmp_str.s));
if (ret && collect_memory_statistics) {
- *(size_t *) ret = tmp_str.s->len;
+ *(size_t *) ret = ZSTR_LEN(tmp_str.s);
MYSQLND_INC_GLOBAL_STATISTIC(persistent? STAT_MEM_STRDUP_COUNT : STAT_MEM_ESTRDUP_COUNT);
}
smart_str_free(&tmp_str);
if (stream) {
if ((key_str = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) {
- BIO * bio = BIO_new_mem_buf(key_str->val, key_str->len);
+ BIO * bio = BIO_new_mem_buf(ZSTR_VAL(key_str), ZSTR_LEN(key_str));
ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
BIO_free(bio);
DBG_INF("Successfully loaded");
- DBG_INF_FMT("Public key:%*.s", key_str->len, key_str->val);
+ DBG_INF_FMT("Public key:%*.s", ZSTR_LEN(key_str), ZSTR_VAL(key_str));
zend_string_release(key_str);
}
php_stream_close(stream);
" min_own=%5llu max_own=%7llu avg_own=%7llu "
" min_in_calls=%5llu max_in_calls=%7llu avg_in_calls=%7llu"
" min_total=%5llu max_total=%7llu avg_total=%7llu"
- ,string_key->val
+ ,ZSTR_VAL(string_key)
,(uint64_t) f_profile->calls
,(uint64_t) f_profile->own_underporm_calls
,(uint64_t) f_profile->in_calls_underporm_calls
mnd_sprintf_free(hashed_details);
}
errcode = CR_CONNECTION_ERROR;
- SET_CLIENT_ERROR(*error_info, errcode? errcode:CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, errstr->val);
+ SET_CLIENT_ERROR(*error_info, errcode? errcode:CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, ZSTR_VAL(errstr));
if (errstr) {
/* no mnd_ since we don't allocate it */
zend_string_release(errstr);
if (orig_fields[i].sname) {
new_fields[i].sname = zend_string_copy(orig_fields[i].sname);
- new_fields[i].name = new_fields[i].sname->val;
- new_fields[i].name_length = new_fields[i].sname->len;
+ new_fields[i].name = ZSTR_VAL(new_fields[i].sname);
+ new_fields[i].name_length = ZSTR_LEN(new_fields[i].sname);
}
if (orig_fields[i].org_name && orig_fields[i].org_name != mysqlnd_empty_string) {
if (key) { /* HASH_KEY_IS_STRING */
size_t value_len = Z_STRLEN_P(entry_value);
- ca_payload_len += php_mysqlnd_net_store_length_size(key->len);
- ca_payload_len += key->len;
+ ca_payload_len += php_mysqlnd_net_store_length_size(ZSTR_LEN(key));
+ ca_payload_len += ZSTR_LEN(key);
ca_payload_len += php_mysqlnd_net_store_length_size(value_len);
ca_payload_len += value_len;
}
size_t value_len = Z_STRLEN_P(entry_value);
/* copy key */
- p = php_mysqlnd_net_store_length(p, key->len);
- memcpy(p, key->val, key->len);
- p+= key->len;
+ p = php_mysqlnd_net_store_length(p, ZSTR_LEN(key));
+ memcpy(p, ZSTR_VAL(key), ZSTR_LEN(key));
+ p+= ZSTR_LEN(key);
/* copy value */
p = php_mysqlnd_net_store_length(p, value_len);
memcpy(p, Z_STRVAL_P(entry_value), value_len);
} else {
meta->sname = ZSTR_EMPTY_ALLOC();
}
- meta->name = meta->sname->val;
- meta->name_length = meta->sname->len;
+ meta->name = ZSTR_VAL(meta->sname);
+ meta->name_length = ZSTR_LEN(meta->sname);
/* Now do allocs */
if (meta->catalog && meta->catalog != mysqlnd_empty_string) {
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(values), string_key, values_entry) {
convert_to_string(values_entry);
- php_info_print_table_row(2, string_key->val, Z_STRVAL_P(values_entry));
+ php_info_print_table_row(2, ZSTR_VAL(string_key), Z_STRVAL_P(values_entry));
} ZEND_HASH_FOREACH_END();
}
/* }}} */
smart_str tmp_str = {0};
mysqlnd_plugin_apply_with_argument(mysqlnd_minfo_dump_loaded_plugins, &tmp_str);
smart_str_0(&tmp_str);
- php_info_print_table_row(2, "Loaded plugins", tmp_str.s? tmp_str.s->val : "");
+ php_info_print_table_row(2, "Loaded plugins", tmp_str.s? ZSTR_VAL(tmp_str.s) : "");
smart_str_free(&tmp_str);
mysqlnd_minfo_dump_api_plugins(&tmp_str);
smart_str_0(&tmp_str);
- php_info_print_table_row(2, "API Extensions", tmp_str.s? tmp_str.s->val : "");
+ php_info_print_table_row(2, "API Extensions", tmp_str.s? ZSTR_VAL(tmp_str.s) : "");
smart_str_free(&tmp_str);
}
{
zend_long long_value;
- ZEND_ATOL(long_value, new_value->val);
+ ZEND_ATOL(long_value, ZSTR_VAL(new_value));
if (long_value < MYSQLND_NET_CMD_BUFFER_MIN_SIZE) {
return FAILURE;
}
ALLOCA_FLAG(use_heap);
if ((c = zend_hash_find_ptr(EG(zend_constants), name)) == NULL) {
- lookup_name = DO_ALLOCA(name->len + 1);
- memcpy(lookup_name, name->val, name->len + 1);
- zend_str_tolower(lookup_name, name->len);
+ lookup_name = DO_ALLOCA(ZSTR_LEN(name) + 1);
+ memcpy(lookup_name, ZSTR_VAL(name), ZSTR_LEN(name) + 1);
+ zend_str_tolower(lookup_name, ZSTR_LEN(name));
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, name->len)) != NULL) {
+ if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, ZSTR_LEN(name))) != NULL) {
if (!(c->flags & CONST_CT_SUBST) || (c->flags & CONST_CS)) {
retval = 0;
}
l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline));
if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(last_op))) {
zend_string *tmp = zend_string_alloc(l, 0);
- memcpy(tmp->val, Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len);
+ memcpy(ZSTR_VAL(tmp), Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len);
Z_STR(ZEND_OP1_LITERAL(last_op)) = tmp;
} else {
Z_STR(ZEND_OP1_LITERAL(last_op)) = zend_string_extend(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0);
l = old_len + Z_STRLEN(ZEND_OP2_LITERAL(opline));
if (!Z_REFCOUNTED(ZEND_OP2_LITERAL(src))) {
zend_string *tmp = zend_string_alloc(l, 0);
- memcpy(tmp->val, Z_STRVAL(ZEND_OP2_LITERAL(src)), old_len);
+ memcpy(ZSTR_VAL(tmp), Z_STRVAL(ZEND_OP2_LITERAL(src)), old_len);
Z_STR(ZEND_OP2_LITERAL(last_op)) = tmp;
} else {
Z_STR(ZEND_OP2_LITERAL(src)) = zend_string_extend(Z_STR(ZEND_OP2_LITERAL(src)), l, 0);
if (info[i].flags & LITERAL_EX_OBJ) {
int key_len = MAX_LENGTH_OF_LONG + sizeof("->") + Z_STRLEN(op_array->literals[i]);
key = zend_string_alloc(key_len, 0);
- key->len = snprintf(key->val, key->len-1, "%d->%s", info[i].u.num, Z_STRVAL(op_array->literals[i]));
+ ZSTR_LEN(key) = snprintf(ZSTR_VAL(key), ZSTR_LEN(key)-1, "%d->%s", info[i].u.num, Z_STRVAL(op_array->literals[i]));
} else if (info[i].flags & LITERAL_EX_CLASS) {
int key_len;
zval *class_name = &op_array->literals[(info[i].u.num < i) ? map[info[i].u.num] : info[i].u.num];
key_len = Z_STRLEN_P(class_name) + sizeof("::") + Z_STRLEN(op_array->literals[i]);
key = zend_string_alloc(key_len, 0);
- memcpy(key->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name));
- memcpy(key->val + Z_STRLEN_P(class_name), "::", sizeof("::") - 1);
- memcpy(key->val + Z_STRLEN_P(class_name) + sizeof("::") - 1,
+ memcpy(ZSTR_VAL(key), Z_STRVAL_P(class_name), Z_STRLEN_P(class_name));
+ memcpy(ZSTR_VAL(key) + Z_STRLEN_P(class_name), "::", sizeof("::") - 1);
+ memcpy(ZSTR_VAL(key) + Z_STRLEN_P(class_name) + sizeof("::") - 1,
Z_STRVAL(op_array->literals[i]),
Z_STRLEN(op_array->literals[i]) + 1);
} else {
key = zend_string_init(Z_STRVAL(op_array->literals[i]), Z_STRLEN(op_array->literals[i]), 0);
}
- key->h = zend_hash_func(key->val, key->len);
- key->h += info[i].flags;
+ ZSTR_H(key) = zend_hash_func(ZSTR_VAL(key), ZSTR_LEN(key));
+ ZSTR_H(key) += info[i].flags;
}
if ((info[i].flags & LITERAL_MAY_MERGE) &&
(pos = zend_hash_find(&hash, key)) != NULL &&
/* for A::B */
if (op_array->scope &&
!strncasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)),
- op_array->scope->name->val, Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1)) {
+ ZSTR_VAL(op_array->scope->name), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1)) {
ce = op_array->scope;
} else {
if ((ce = zend_hash_find_ptr(EG(class_table),
!zend_optimizer_is_disabled_func("dirname", sizeof("dirname") - 1) &&
IS_ABSOLUTE_PATH(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)))) {
zend_string *dirname = zend_string_init(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)), 0);
- dirname->len = zend_dirname(dirname->val, dirname->len);
- if (IS_ABSOLUTE_PATH(dirname->val, dirname->len)) {
+ ZSTR_LEN(dirname) = zend_dirname(ZSTR_VAL(dirname), ZSTR_LEN(dirname));
+ if (IS_ABSOLUTE_PATH(ZSTR_VAL(dirname), ZSTR_LEN(dirname))) {
zval t;
ZVAL_STR(&t, dirname);
while (i < op_array->last_var) {
if (op_array->vars[i] == name ||
- (op_array->vars[i]->h == hash_value &&
- op_array->vars[i]->len == name->len &&
- memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) {
+ (ZSTR_H(op_array->vars[i]) == hash_value &&
+ ZSTR_LEN(op_array->vars[i]) == ZSTR_LEN(name) &&
+ memcmp(ZSTR_VAL(op_array->vars[i]), ZSTR_VAL(name), ZSTR_LEN(name)) == 0)) {
return (int)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, i);
}
i++;
arData = ZCSG(interned_strings).arData;
while (idx != HT_INVALID_IDX) {
p = HT_HASH_TO_BUCKET_EX(arData, idx);
- if ((p->h == h) && (p->key->len == str->len)) {
- if (!memcmp(p->key->val, str->val, str->len)) {
+ if ((p->h == h) && (ZSTR_LEN(p->key) == ZSTR_LEN(str))) {
+ if (!memcmp(ZSTR_VAL(p->key), ZSTR_VAL(str), ZSTR_LEN(str))) {
return p->key;
}
}
idx = HT_HASH(&ZCSG(interned_strings), nIndex);
while (idx != HT_INVALID_IDX) {
p = HT_HASH_TO_BUCKET(&ZCSG(interned_strings), idx);
- if ((p->h == h) && (p->key->len == str->len)) {
- if (!memcmp(p->key->val, str->val, str->len)) {
+ if ((p->h == h) && (ZSTR_LEN(p->key) == ZSTR_LEN(str))) {
+ if (!memcmp(ZSTR_VAL(p->key), ZSTR_VAL(str), ZSTR_LEN(str))) {
zend_string_release(str);
return p->key;
}
GC_TYPE(p->key) = IS_STRING;
GC_FLAGS(p->key) = IS_STR_INTERNED | IS_STR_PERMANENT;
#endif
- p->key->h = str->h;
- p->key->len = str->len;
- memcpy(p->key->val, str->val, str->len);
+ ZSTR_H(p->key) = ZSTR_H(str);
+ ZSTR_LEN(p->key) = ZSTR_LEN(str);
+ memcpy(ZSTR_VAL(p->key), ZSTR_VAL(str), ZSTR_LEN(str));
ZVAL_INTERNED_STR(&p->val, p->key);
Z_NEXT(p->val) = HT_HASH(&ZCSG(interned_strings), nIndex);
HT_HASH(&ZCSG(interned_strings), nIndex) = HT_IDX_TO_HASH(idx);
case ZEND_HANDLE_FILENAME:
case ZEND_HANDLE_MAPPED:
if (file_handle->opened_path) {
- char *file_path = file_handle->opened_path->val;
+ char *file_path = ZSTR_VAL(file_handle->opened_path);
if (is_stream_path(file_path)) {
if (zend_get_stream_timestamp(file_path, &statbuf) == SUCCESS) {
*/
if (file_handle->opened_path) {
if (persistent_script->full_path != file_handle->opened_path &&
- (persistent_script->full_path->len != file_handle->opened_path->len ||
- memcmp(persistent_script->full_path->val, file_handle->opened_path->val, file_handle->opened_path->len) != 0)) {
+ (ZSTR_LEN(persistent_script->full_path) != ZSTR_LEN(file_handle->opened_path) ||
+ memcmp(ZSTR_VAL(persistent_script->full_path), ZSTR_VAL(file_handle->opened_path), ZSTR_LEN(file_handle->opened_path)) != 0)) {
return FAILURE;
}
} else {
full_path_ptr = accelerator_orig_zend_resolve_path(file_handle->filename, strlen(file_handle->filename));
if (full_path_ptr &&
persistent_script->full_path != full_path_ptr &&
- (persistent_script->full_path->len != full_path_ptr->len ||
- memcmp(persistent_script->full_path->val, full_path_ptr->val, full_path_ptr->len) != 0)) {
+ (ZSTR_LEN(persistent_script->full_path) != ZSTR_LEN(full_path_ptr) ||
+ memcmp(ZSTR_VAL(persistent_script->full_path), ZSTR_VAL(full_path_ptr), ZSTR_LEN(full_path_ptr)) != 0)) {
zend_string_release(full_path_ptr);
return FAILURE;
}
}
ps_handle.type = ZEND_HANDLE_FILENAME;
- ps_handle.filename = persistent_script->full_path->val;
+ ps_handle.filename = ZSTR_VAL(persistent_script->full_path);
ps_handle.opened_path = persistent_script->full_path;
if (zend_get_file_handle_timestamp(&ps_handle, NULL) == persistent_script->timestamp) {
zend_accel_error(ACCEL_LOG_INFO, "getcwd() failed for '%s' (%d), please try to set opcache.use_cwd to 0 in ini file", path, errno);
return NULL;
}
- cwd = cwd_str->val;
- cwd_len = cwd_str->len;
+ cwd = ZSTR_VAL(cwd_str);
+ cwd_len = ZSTR_LEN(cwd_str);
#ifndef ZTS
if (ZCG(cwd_check)) {
ZCG(cwd_check) = 0;
}
if (str) {
char buf[32];
- char *res = zend_print_long_to_buf(buf + sizeof(buf) - 1, str->val - ZCSG(interned_strings_start));
+ char *res = zend_print_long_to_buf(buf + sizeof(buf) - 1, ZSTR_VAL(str) - ZCSG(interned_strings_start));
cwd_len = ZCG(cwd_key_len) = buf + sizeof(buf) - 1 - res;
cwd = ZCG(cwd_key);
if (EXPECTED(ZCG(include_path_key_len))) {
include_path = ZCG(include_path_key);
include_path_len = ZCG(include_path_key_len);
- } else if (!ZCG(include_path) || ZCG(include_path)->len == 0) {
+ } else if (!ZCG(include_path) || ZSTR_LEN(ZCG(include_path)) == 0) {
include_path = "";
include_path_len = 0;
} else {
- include_path = ZCG(include_path)->val;
- include_path_len = ZCG(include_path)->len;
+ include_path = ZSTR_VAL(ZCG(include_path));
+ include_path_len = ZSTR_LEN(ZCG(include_path));
#ifndef ZTS
if (ZCG(include_path_check)) {
}
if (str) {
char buf[32];
- char *res = zend_print_long_to_buf(buf + sizeof(buf) - 1, str->val - ZCSG(interned_strings_start));
+ char *res = zend_print_long_to_buf(buf + sizeof(buf) - 1, ZSTR_VAL(str) - ZCSG(interned_strings_start));
include_path_len = ZCG(include_path_key_len) = buf + sizeof(buf) - 1 - res;
include_path = ZCG(include_path_key);
if (EXPECTED(EG(current_execute_data)) &&
EXPECTED((parent_script = zend_get_executed_filename_ex()) != NULL)) {
- parent_script_len = parent_script->len;
- while ((--parent_script_len > 0) && !IS_SLASH(parent_script->val[parent_script_len]));
+ parent_script_len = ZSTR_LEN(parent_script);
+ while ((--parent_script_len > 0) && !IS_SLASH(ZSTR_VAL(parent_script)[parent_script_len]));
if (UNEXPECTED((size_t)(key_length + parent_script_len + 1) >= sizeof(ZCG(key)))) {
return NULL;
}
ZCG(key)[key_length] = ':';
key_length += 1;
- memcpy(ZCG(key) + key_length, parent_script->val, parent_script_len);
+ memcpy(ZCG(key) + key_length, ZSTR_VAL(parent_script), parent_script_len);
key_length += parent_script_len;
}
ZCG(key)[key_length] = '\0';
zend_file_handle file_handle;
file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = realpath->val;
+ file_handle.filename = ZSTR_VAL(realpath);
file_handle.opened_path = realpath;
if (force ||
new_persistent_script->is_phar =
new_persistent_script->full_path &&
- strstr(new_persistent_script->full_path->val, ".phar") &&
- !strstr(new_persistent_script->full_path->val, "://");
+ strstr(ZSTR_VAL(new_persistent_script->full_path), ".phar") &&
+ !strstr(ZSTR_VAL(new_persistent_script->full_path), "://");
/* Consistency check */
if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) {
zend_accel_error(
((char*)new_persistent_script->mem + new_persistent_script->size < (char*)ZCG(mem)) ? ACCEL_LOG_ERROR : ACCEL_LOG_WARNING,
"Internal error: wrong size calculation: %s start=0x%08x, end=0x%08x, real=0x%08x\n",
- new_persistent_script->full_path->val,
+ ZSTR_VAL(new_persistent_script->full_path),
new_persistent_script->mem,
(char *)new_persistent_script->mem + new_persistent_script->size,
ZCG(mem));
new_persistent_script->is_phar =
new_persistent_script->full_path &&
- strstr(new_persistent_script->full_path->val, ".phar") &&
- !strstr(new_persistent_script->full_path->val, "://");
+ strstr(ZSTR_VAL(new_persistent_script->full_path), ".phar") &&
+ !strstr(ZSTR_VAL(new_persistent_script->full_path), "://");
/* Consistency check */
if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) {
zend_accel_error(
((char*)new_persistent_script->mem + new_persistent_script->size < (char*)ZCG(mem)) ? ACCEL_LOG_ERROR : ACCEL_LOG_WARNING,
"Internal error: wrong size calculation: %s start=0x%08x, end=0x%08x, real=0x%08x\n",
- new_persistent_script->full_path->val,
+ ZSTR_VAL(new_persistent_script->full_path),
new_persistent_script->mem,
(char *)new_persistent_script->mem + new_persistent_script->size,
ZCG(mem));
new_persistent_script->dynamic_members.checksum = zend_accel_script_checksum(new_persistent_script);
/* store script structure in the hash table */
- bucket = zend_accel_hash_update(&ZCSG(hash), new_persistent_script->full_path->val, new_persistent_script->full_path->len, 0, new_persistent_script);
+ bucket = zend_accel_hash_update(&ZCSG(hash), ZSTR_VAL(new_persistent_script->full_path), ZSTR_LEN(new_persistent_script->full_path), 0, new_persistent_script);
if (bucket) {
zend_accel_error(ACCEL_LOG_INFO, "Cached script '%s'", new_persistent_script->full_path);
if (key &&
/* key may contain non-persistent PHAR aliases (see issues #115 and #149) */
memcmp(key, "phar://", sizeof("phar://") - 1) != 0 &&
- (new_persistent_script->full_path->len != key_length ||
- memcmp(new_persistent_script->full_path->val, key, key_length) != 0)) {
+ (ZSTR_LEN(new_persistent_script->full_path) != key_length ||
+ memcmp(ZSTR_VAL(new_persistent_script->full_path), key, key_length) != 0)) {
/* link key to the same persistent script in hash table */
if (zend_accel_hash_update(&ZCSG(hash), key, key_length, 1, bucket)) {
zend_accel_error(ACCEL_LOG_INFO, "Added key '%s'", key);
}
/* check blacklist right after ensuring that file was opened */
- if (file_handle->opened_path && zend_accel_blacklist_is_blacklisted(&accel_blacklist, file_handle->opened_path->val)) {
+ if (file_handle->opened_path && zend_accel_blacklist_is_blacklisted(&accel_blacklist, ZSTR_VAL(file_handle->opened_path))) {
ZCSG(blacklist_misses)++;
*op_array_p = accelerator_orig_compile_file(file_handle, type);
return NULL;
/* ext/phar has to load phar's metadata into memory */
if (persistent_script->is_phar) {
php_stream_statbuf ssb;
- char *fname = emalloc(sizeof("phar://") + persistent_script->full_path->len);
+ char *fname = emalloc(sizeof("phar://") + ZSTR_LEN(persistent_script->full_path));
memcpy(fname, "phar://", sizeof("phar://") - 1);
- memcpy(fname + sizeof("phar://") - 1, persistent_script->full_path->val, persistent_script->full_path->len + 1);
+ memcpy(fname + sizeof("phar://") - 1, ZSTR_VAL(persistent_script->full_path), ZSTR_LEN(persistent_script->full_path) + 1);
php_stream_stat_path(fname, &ssb);
efree(fname);
}
/* ext/phar has to load phar's metadata into memory */
if (persistent_script->is_phar) {
php_stream_statbuf ssb;
- char *fname = emalloc(sizeof("phar://") + persistent_script->full_path->len);
+ char *fname = emalloc(sizeof("phar://") + ZSTR_LEN(persistent_script->full_path));
memcpy(fname, "phar://", sizeof("phar://") - 1);
- memcpy(fname + sizeof("phar://") - 1, persistent_script->full_path->val, persistent_script->full_path->len + 1);
+ memcpy(fname + sizeof("phar://") - 1, ZSTR_VAL(persistent_script->full_path), ZSTR_LEN(persistent_script->full_path) + 1);
php_stream_stat_path(fname, &ssb);
efree(fname);
}
{
return zend_accel_hash_find_ex(
accel_hash,
- key->val,
- key->len,
+ ZSTR_VAL(key),
+ ZSTR_LEN(key),
zend_string_hash_val(key),
1);
}
{
return (zend_accel_hash_entry *)zend_accel_hash_find_ex(
accel_hash,
- key->val,
- key->len,
+ ZSTR_VAL(key),
+ ZSTR_LEN(key),
zend_string_hash_val(key),
0);
}
(void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
p = (zend_long *) (base + (size_t)mh_arg1);
- memsize = atoi(new_value->val);
+ memsize = atoi(ZSTR_VAL(new_value));
/* sanity check we must use at least 8 MB */
if (memsize < 8) {
const char *new_new_value = "8";
(void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
p = (zend_long *) (base + (size_t)mh_arg1);
- size = atoi(new_value->val);
+ size = atoi(ZSTR_VAL(new_value));
/* sanity check we must use a value between MIN_ACCEL_FILES and MAX_ACCEL_FILES */
if (size < MIN_ACCEL_FILES || size > MAX_ACCEL_FILES) {
(void)entry; (void)mh_arg2; (void)mh_arg3; (void)stage;
p = (double *) (base + (size_t)mh_arg1);
- percentage = atoi(new_value->val);
+ percentage = atoi(ZSTR_VAL(new_value));
if (percentage <= 0 || percentage > 50) {
const char *new_new_value = "5";
#endif
p = (zend_bool *) (base+(size_t) mh_arg1);
- if ((new_value->len == 2 && strcasecmp("on", new_value->val) == 0) ||
- (new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) ||
- (new_value->len == 4 && strcasecmp("true", new_value->val) == 0) ||
- atoi(new_value->val) != 0) {
+ if ((ZSTR_LEN(new_value) == 2 && strcasecmp("on", ZSTR_VAL(new_value)) == 0) ||
+ (ZSTR_LEN(new_value) == 3 && strcasecmp("yes", ZSTR_VAL(new_value)) == 0) ||
+ (ZSTR_LEN(new_value) == 4 && strcasecmp("true", ZSTR_VAL(new_value)) == 0) ||
+ atoi(ZSTR_VAL(new_value)) != 0) {
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporary enabled (it may be only disabled till the end of request)");
return FAILURE;
} else {
static ZEND_INI_MH(OnUpdateFileCache)
{
if (new_value) {
- if (!new_value->len) {
+ if (!ZSTR_LEN(new_value)) {
new_value = NULL;
} else {
zend_stat_t buf;
- if (!IS_ABSOLUTE_PATH(new_value->val, new_value->len) ||
- zend_stat(new_value->val, &buf) != 0 ||
+ if (!IS_ABSOLUTE_PATH(ZSTR_VAL(new_value), ZSTR_LEN(new_value)) ||
+ zend_stat(ZSTR_VAL(new_value), &buf) != 0 ||
!S_ISDIR(buf.st_mode) ||
#ifndef ZEND_WIN32
- access(new_value->val, R_OK | W_OK | X_OK) != 0) {
+ access(ZSTR_VAL(new_value), R_OK | W_OK | X_OK) != 0) {
#else
- _access(new_value->val, 06) != 0) {
+ _access(ZSTR_VAL(new_value), 06) != 0) {
#endif
zend_accel_error(ACCEL_LOG_WARNING, "opcache.file_cache must be a full path of accessable directory.\n");
new_value = NULL;
char *key;
int key_length;
- key = accel_make_persistent_key(filename->val, filename->len, &key_length);
+ key = accel_make_persistent_key(ZSTR_VAL(filename), ZSTR_LEN(filename), &key_length);
if (key != NULL) {
zend_persistent_script *persistent_script = zend_accel_hash_str_find(&ZCSG(hash), key, key_length);
if (persistent_script && !persistent_script->corrupted) {
zend_file_handle handle = {{0}, NULL, NULL, 0, 0};
- handle.filename = filename->val;
+ handle.filename = ZSTR_VAL(filename);
handle.type = ZEND_HANDLE_FILENAME;
if (ZCG(accel_directives).validate_timestamps) {
ZEND_ASSERT(p->key);
t = zend_hash_find(target, p->key);
if (UNEXPECTED(t != NULL)) {
- if (EXPECTED(p->key->len > 0) && EXPECTED(p->key->val[0] == 0)) {
+ if (EXPECTED(ZSTR_LEN(p->key) > 0) && EXPECTED(ZSTR_VAL(p->key)[0] == 0)) {
/* Mangled key */
t = zend_hash_update(target, p->key, &p->val);
} else {
if (function2->type == ZEND_USER_FUNCTION
&& function2->op_array.last > 0) {
zend_error(E_ERROR, "Cannot redeclare %s() (previously declared in %s:%d)",
- function1->common.function_name->val,
- function2->op_array.filename->val,
+ ZSTR_VAL(function1->common.function_name),
+ ZSTR_VAL(function2->op_array.filename),
(int)function2->op_array.opcodes[0].lineno);
} else {
- zend_error(E_ERROR, "Cannot redeclare %s()", function1->common.function_name->val);
+ zend_error(E_ERROR, "Cannot redeclare %s()", ZSTR_VAL(function1->common.function_name));
}
}
ZEND_ASSERT(p->key);
t = zend_hash_find(target, p->key);
if (UNEXPECTED(t != NULL)) {
- if (EXPECTED(p->key->len > 0) && EXPECTED(p->key->val[0] == 0)) {
+ if (EXPECTED(ZSTR_LEN(p->key) > 0) && EXPECTED(ZSTR_VAL(p->key)[0] == 0)) {
/* Mangled key */
zend_hash_update_ptr(target, p->key, ARENA_REALLOC(Z_PTR(p->val)));
} else {
if (function2->type == ZEND_USER_FUNCTION
&& function2->op_array.last > 0) {
zend_error(E_ERROR, "Cannot redeclare %s() (previously declared in %s:%d)",
- function1->common.function_name->val,
- function2->op_array.filename->val,
+ ZSTR_VAL(function1->common.function_name),
+ ZSTR_VAL(function2->op_array.filename),
(int)function2->op_array.opcodes[0].lineno);
} else {
- zend_error(E_ERROR, "Cannot redeclare %s()", function1->common.function_name->val);
+ zend_error(E_ERROR, "Cannot redeclare %s()", ZSTR_VAL(function1->common.function_name));
}
}
ZEND_ASSERT(p->key);
t = zend_hash_find(target, p->key);
if (UNEXPECTED(t != NULL)) {
- if (EXPECTED(p->key->len > 0) && EXPECTED(p->key->val[0] == 0)) {
+ if (EXPECTED(ZSTR_LEN(p->key) > 0) && EXPECTED(ZSTR_VAL(p->key)[0] == 0)) {
/* Mangled key - ignore and wait for runtime */
continue;
} else if (UNEXPECTED(!ZCG(accel_directives).ignore_dups)) {
CG(in_compilation) = 1;
zend_set_compiled_filename(ce1->info.user.filename);
CG(zend_lineno) = ce1->info.user.line_start;
- zend_error(E_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce1), ce1->name->val);
+ zend_error(E_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce1), ZSTR_VAL(ce1->name));
}
#ifdef __SSE2__
zend_string *name;
char haltoff[] = "__COMPILER_HALT_OFFSET__";
- name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, persistent_script->full_path->val, persistent_script->full_path->len, 0);
+ name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, ZSTR_VAL(persistent_script->full_path), ZSTR_LEN(persistent_script->full_path), 0);
if (!zend_hash_exists(EG(zend_constants), name)) {
- zend_register_long_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0);
+ zend_register_long_constant(ZSTR_VAL(name), ZSTR_LEN(name), persistent_script->compiler_halt_offset, CONST_CS, 0);
}
zend_string_release(name);
}
len = ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(ZSTR_LEN(str)));
ret = (void*)(info->str_size | Z_UL(1));
zend_shared_alloc_register_xlat_entry(str, ret);
- if (info->str_size + len > ((zend_string*)ZCG(mem))->len) {
+ if (info->str_size + len > ZSTR_LEN((zend_string*)ZCG(mem))) {
size_t new_len = info->str_size + len;
ZCG(mem) = (void*)zend_string_realloc(
(zend_string*)ZCG(mem),
((_ZSTR_HEADER_SIZE + 1 + new_len + 4095) & ~0xfff) - (_ZSTR_HEADER_SIZE + 1),
0);
}
- memcpy(((zend_string*)ZCG(mem))->val + info->str_size, str, len);
+ memcpy(ZSTR_VAL((zend_string*)ZCG(mem)) + info->str_size, str, len);
info->str_size += len;
return ret;
}
void *mem, *buf;
len = strlen(ZCG(accel_directives).file_cache);
- filename = emalloc(len + 33 + script->full_path->len + sizeof(SUFFIX));
+ filename = emalloc(len + 33 + ZSTR_LEN(script->full_path) + sizeof(SUFFIX));
memcpy(filename, ZCG(accel_directives).file_cache, len);
filename[len] = '/';
memcpy(filename + len + 1, ZCG(system_id), 32);
- memcpy(filename + len + 33, script->full_path->val, script->full_path->len);
- memcpy(filename + len + 33 + script->full_path->len, SUFFIX, sizeof(SUFFIX));
+ memcpy(filename + len + 33, ZSTR_VAL(script->full_path), ZSTR_LEN(script->full_path));
+ memcpy(filename + len + 33 + ZSTR_LEN(script->full_path), SUFFIX, sizeof(SUFFIX));
if (zend_file_cache_mkdir(filename, len) != SUCCESS) {
zend_accel_error(ACCEL_LOG_WARNING, "opcache cannot create directory for file '%s'\n", filename);
zend_shared_alloc_destroy_xlat_table();
info.checksum = zend_adler32(ADLER32_INIT, buf, script->size);
- info.checksum = zend_adler32(info.checksum, (signed char*)((zend_string*)ZCG(mem))->val, info.str_size);
+ info.checksum = zend_adler32(info.checksum, (signed char*)ZSTR_VAL((zend_string*)ZCG(mem)), info.str_size);
#ifndef ZEND_WIN32
vec[0].iov_base = &info;
vec[0].iov_len = sizeof(info);
vec[1].iov_base = buf;
vec[1].iov_len = script->size;
- vec[2].iov_base = ((zend_string*)ZCG(mem))->val;
+ vec[2].iov_base = ZSTR_VAL((zend_string*)ZCG(mem));
vec[2].iov_len = info.str_size;
if (writev(fd, vec, 3) != (ssize_t)(sizeof(info) + script->size + info.str_size)) {
return NULL;
}
len = strlen(ZCG(accel_directives).file_cache);
- filename = emalloc(len + 33 + full_path->len + sizeof(SUFFIX));
+ filename = emalloc(len + 33 + ZSTR_LEN(full_path) + sizeof(SUFFIX));
memcpy(filename, ZCG(accel_directives).file_cache, len);
filename[len] = '/';
memcpy(filename + len + 1, ZCG(system_id), 32);
- memcpy(filename + len + 33, full_path->val, full_path->len);
- memcpy(filename + len + 33 + full_path->len, SUFFIX, sizeof(SUFFIX));
+ memcpy(filename + len + 33, ZSTR_VAL(full_path), ZSTR_LEN(full_path));
+ memcpy(filename + len + 33 + ZSTR_LEN(full_path), SUFFIX, sizeof(SUFFIX));
fd = open(filename, O_RDONLY | O_BINARY);
if (fd < 0) {
if (cache_it) {
script->dynamic_members.checksum = zend_accel_script_checksum(script);
- zend_accel_hash_update(&ZCSG(hash), script->full_path->val, script->full_path->len, 0, script);
+ zend_accel_hash_update(&ZCSG(hash), ZSTR_VAL(script->full_path), ZSTR_LEN(script->full_path), 0, script);
zend_shared_alloc_unlock();
zend_arena_release(&CG(arena), checkpoint);
char *filename;
len = strlen(ZCG(accel_directives).file_cache);
- filename = emalloc(len + 33 + full_path->len + sizeof(SUFFIX));
+ filename = emalloc(len + 33 + ZSTR_LEN(full_path) + sizeof(SUFFIX));
memcpy(filename, ZCG(accel_directives).file_cache, len);
filename[len] = '/';
memcpy(filename + len + 1, ZCG(system_id), 32);
- memcpy(filename + len + 33, full_path->val, full_path->len);
- memcpy(filename + len + 33 + full_path->len, SUFFIX, sizeof(SUFFIX));
+ memcpy(filename + len + 33, ZSTR_VAL(full_path), ZSTR_LEN(full_path));
+ memcpy(filename + len + 33 + ZSTR_LEN(full_path), SUFFIX, sizeof(SUFFIX));
unlink(filename);
efree(filename);
}
s = zend_string_alloc(strlen(spkac) + strlen(spkstr), 0);
- sprintf(s->val, "%s%s", spkac, spkstr);
- s->len = strlen(s->val);
+ sprintf(ZSTR_VAL(s), "%s%s", spkac, spkstr);
+ ZSTR_LEN(s) = strlen(ZSTR_VAL(s));
RETVAL_STR(s);
goto cleanup;
efree(spkstr);
}
- if (s && s->len <= 0) {
+ if (s && ZSTR_LEN(s) <= 0) {
RETVAL_FALSE;
}
ret = zend_string_init((char*)md, n, 0);
} else {
ret = zend_string_alloc(n * 2, 0);
- make_digest_ex(ret->val, md, n);
- ret->val[n * 2] = '\0';
+ make_digest_ex(ZSTR_VAL(ret), md, n);
+ ZSTR_VAL(ret)[n * 2] = '\0';
}
return ret;
convert_to_string_ex(item);
- nid = OBJ_txt2nid(strindex->val);
+ nid = OBJ_txt2nid(ZSTR_VAL(strindex));
if (nid != NID_undef) {
if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_UTF8,
(unsigned char*)Z_STRVAL_P(item), -1, -1, 0))
return FAILURE;
}
} else {
- php_error_docref(NULL, E_WARNING, "dn: %s is not a recognized name", strindex->val);
+ php_error_docref(NULL, E_WARNING, "dn: %s is not a recognized name", ZSTR_VAL(strindex));
}
}
} ZEND_HASH_FOREACH_END();
convert_to_string_ex(item);
- nid = OBJ_txt2nid(strindex->val);
+ nid = OBJ_txt2nid(ZSTR_VAL(strindex));
if (nid != NID_undef) {
if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_UTF8, (unsigned char*)Z_STRVAL_P(item), -1, -1, 0)) {
php_error_docref(NULL, E_WARNING, "attribs: add_entry_by_NID %d -> %s (failed)", nid, Z_STRVAL_P(item));
return FAILURE;
}
} else {
- php_error_docref(NULL, E_WARNING, "dn: %s is not a recognized name", strindex->val);
+ php_error_docref(NULL, E_WARNING, "dn: %s is not a recognized name", ZSTR_VAL(strindex));
}
} ZEND_HASH_FOREACH_END();
for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++) {
#define OPENSSL_PKEY_GET_BN(_type, _name) do { \
if (pkey->pkey._type->_name != NULL) { \
int len = BN_num_bytes(pkey->pkey._type->_name); \
- zend_string *str = zend_string_alloc(len, 0); \
- BN_bn2bin(pkey->pkey._type->_name, (unsigned char*)str->val); \
- str->val[len] = 0; \
+ zend_string *str = zend_string_alloc(len, 0); \
+ BN_bn2bin(pkey->pkey._type->_name, (unsigned char*)ZSTR_VAL(str)); \
+ ZSTR_VAL(str)[len] = 0; \
add_assoc_str(&_type, #_name, str); \
} \
} while (0)
out_buffer = zend_string_alloc(key_length, 0);
- if (PKCS5_PBKDF2_HMAC(password, (int)password_len, (unsigned char *)salt, (int)salt_len, (int)iterations, digest, (int)key_length, (unsigned char*)out_buffer->val) == 1) {
- out_buffer->val[key_length] = 0;
+ if (PKCS5_PBKDF2_HMAC(password, (int)password_len, (unsigned char *)salt, (int)salt_len, (int)iterations, digest, (int)key_length, (unsigned char*)ZSTR_VAL(out_buffer)) == 1) {
+ ZSTR_VAL(out_buffer)[key_length] = 0;
RETURN_NEW_STR(out_buffer);
} else {
zend_string_release(out_buffer);
convert_to_string_ex(zcertval);
if (strindex) {
- BIO_printf(outfile, "%s: %s\n", strindex->val, Z_STRVAL_P(zcertval));
+ BIO_printf(outfile, "%s: %s\n", ZSTR_VAL(strindex), Z_STRVAL_P(zcertval));
} else {
BIO_printf(outfile, "%s\n", Z_STRVAL_P(zcertval));
}
convert_to_string_ex(hval);
if (strindex) {
- BIO_printf(outfile, "%s: %s\n", strindex->val, Z_STRVAL_P(hval));
+ BIO_printf(outfile, "%s: %s\n", ZSTR_VAL(strindex), Z_STRVAL_P(hval));
} else {
BIO_printf(outfile, "%s\n", Z_STRVAL_P(hval));
}
case EVP_PKEY_RSA2:
successful = (RSA_private_encrypt((int)data_len,
(unsigned char *)data,
- (unsigned char *)cryptedbuf->val,
+ (unsigned char *)ZSTR_VAL(cryptedbuf),
pkey->pkey.rsa,
(int)padding) == cryptedlen);
break;
if (successful) {
zval_dtor(crypted);
- cryptedbuf->val[cryptedlen] = '\0';
+ ZSTR_VAL(cryptedbuf)[cryptedlen] = '\0';
ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
(int)padding);
if (cryptedlen != -1) {
cryptedbuf = zend_string_alloc(cryptedlen, 0);
- memcpy(cryptedbuf->val, crypttemp, cryptedlen);
+ memcpy(ZSTR_VAL(cryptedbuf), crypttemp, cryptedlen);
successful = 1;
}
break;
if (successful) {
zval_dtor(crypted);
- cryptedbuf->val[cryptedlen] = '\0';
+ ZSTR_VAL(cryptedbuf)[cryptedlen] = '\0';
ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
case EVP_PKEY_RSA2:
successful = (RSA_public_encrypt((int)data_len,
(unsigned char *)data,
- (unsigned char *)cryptedbuf->val,
+ (unsigned char *)ZSTR_VAL(cryptedbuf),
pkey->pkey.rsa,
(int)padding) == cryptedlen);
break;
if (successful) {
zval_dtor(crypted);
- cryptedbuf->val[cryptedlen] = '\0';
+ ZSTR_VAL(cryptedbuf)[cryptedlen] = '\0';
ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
(int)padding);
if (cryptedlen != -1) {
cryptedbuf = zend_string_alloc(cryptedlen, 0);
- memcpy(cryptedbuf->val, crypttemp, cryptedlen);
+ memcpy(ZSTR_VAL(cryptedbuf), crypttemp, cryptedlen);
successful = 1;
}
break;
if (successful) {
zval_dtor(crypted);
- cryptedbuf->val[cryptedlen] = '\0';
+ ZSTR_VAL(cryptedbuf)[cryptedlen] = '\0';
ZVAL_NEW_STR(crypted, cryptedbuf);
cryptedbuf = NULL;
RETVAL_TRUE;
EVP_SignInit(&md_ctx, mdtype);
EVP_SignUpdate(&md_ctx, data, data_len);
- if (EVP_SignFinal (&md_ctx, (unsigned char*)sigbuf->val, &siglen, pkey)) {
+ if (EVP_SignFinal (&md_ctx, (unsigned char*)ZSTR_VAL(sigbuf), &siglen, pkey)) {
zval_dtor(signature);
- sigbuf->val[siglen] = '\0';
- sigbuf->len = siglen;
+ ZSTR_VAL(sigbuf)[siglen] = '\0';
+ ZSTR_LEN(sigbuf) = siglen;
ZVAL_NEW_STR(signature, sigbuf);
RETVAL_TRUE;
} else {
EVP_DigestInit(&md_ctx, mdtype);
EVP_DigestUpdate(&md_ctx, (unsigned char *)data, data_len);
- if (EVP_DigestFinal (&md_ctx, (unsigned char *)sigbuf->val, &siglen)) {
+ if (EVP_DigestFinal (&md_ctx, (unsigned char *)ZSTR_VAL(sigbuf), &siglen)) {
if (raw_output) {
- sigbuf->val[siglen] = '\0';
- sigbuf->len = siglen;
+ ZSTR_VAL(sigbuf)[siglen] = '\0';
+ ZSTR_LEN(sigbuf) = siglen;
RETVAL_STR(sigbuf);
} else {
int digest_str_len = siglen * 2;
zend_string *digest_str = zend_string_alloc(digest_str_len, 0);
- make_digest_ex(digest_str->val, (unsigned char*)sigbuf->val, siglen);
- digest_str->val[digest_str_len] = '\0';
+ make_digest_ex(ZSTR_VAL(digest_str), (unsigned char*)ZSTR_VAL(sigbuf), siglen);
+ ZSTR_VAL(digest_str)[digest_str_len] = '\0';
zend_string_release(sigbuf);
RETVAL_STR(digest_str);
}
EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0);
}
if (data_len > 0) {
- EVP_EncryptUpdate(&cipher_ctx, (unsigned char*)outbuf->val, &i, (unsigned char *)data, (int)data_len);
+ EVP_EncryptUpdate(&cipher_ctx, (unsigned char*)ZSTR_VAL(outbuf), &i, (unsigned char *)data, (int)data_len);
}
outlen = i;
- if (EVP_EncryptFinal(&cipher_ctx, (unsigned char *)outbuf->val + i, &i)) {
+ if (EVP_EncryptFinal(&cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + i, &i)) {
outlen += i;
if (options & OPENSSL_RAW_DATA) {
- outbuf->val[outlen] = '\0';
- outbuf->len = outlen;
+ ZSTR_VAL(outbuf)[outlen] = '\0';
+ ZSTR_LEN(outbuf) = outlen;
RETVAL_STR(outbuf);
} else {
zend_string *base64_str;
- base64_str = php_base64_encode((unsigned char*)outbuf->val, outlen);
+ base64_str = php_base64_encode((unsigned char*)ZSTR_VAL(outbuf), outlen);
zend_string_release(outbuf);
RETVAL_STR(base64_str);
}
php_error_docref(NULL, E_WARNING, "Failed to base64 decode the input");
RETURN_FALSE;
}
- data_len = base64_str->len;
- data = base64_str->val;
+ data_len = ZSTR_LEN(base64_str);
+ data = ZSTR_VAL(base64_str);
}
keylen = EVP_CIPHER_key_length(cipher_type);
if (options & OPENSSL_ZERO_PADDING) {
EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0);
}
- EVP_DecryptUpdate(&cipher_ctx, (unsigned char*)outbuf->val, &i, (unsigned char *)data, (int)data_len);
+ EVP_DecryptUpdate(&cipher_ctx, (unsigned char*)ZSTR_VAL(outbuf), &i, (unsigned char *)data, (int)data_len);
outlen = i;
- if (EVP_DecryptFinal(&cipher_ctx, (unsigned char *)outbuf->val + i, &i)) {
+ if (EVP_DecryptFinal(&cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + i, &i)) {
outlen += i;
- outbuf->val[outlen] = '\0';
- outbuf->len = outlen;
+ ZSTR_VAL(outbuf)[outlen] = '\0';
+ ZSTR_LEN(outbuf) = outlen;
RETVAL_STR(outbuf);
} else {
zend_string_release(outbuf);
pub = BN_bin2bn((unsigned char*)pub_str, (int)pub_len, NULL);
data = zend_string_alloc(DH_size(pkey->pkey.dh), 0);
- len = DH_compute_key((unsigned char*)data->val, pub, pkey->pkey.dh);
+ len = DH_compute_key((unsigned char*)ZSTR_VAL(data), pub, pkey->pkey.dh);
if (len >= 0) {
- data->len = len;
- data->val[len] = 0;
+ ZSTR_LEN(data) = len;
+ ZSTR_VAL(data)[len] = 0;
RETVAL_STR(data);
} else {
zend_string_release(data);
RETURN_FALSE;
}
#else
- if ((strong_result = RAND_pseudo_bytes((unsigned char*)buffer->val, buffer_length)) < 0) {
+ if ((strong_result = RAND_pseudo_bytes((unsigned char*)ZSTR_VAL(buffer), buffer_length)) < 0) {
zend_string_release(buffer);
if (zstrong_result_returned) {
ZVAL_FALSE(zstrong_result_returned);
}
#endif
- buffer->val[buffer_length] = 0;
+ ZSTR_VAL(buffer)[buffer_length] = 0;
RETVAL_STR(buffer);
if (zstrong_result_returned) {
"SSL operation failed with code %d. %s%s",
err,
ebuf.s ? "OpenSSL Error messages:\n" : "",
- ebuf.s ? ebuf.s->val : "");
+ ebuf.s ? ZSTR_VAL(ebuf.s) : "");
if (ebuf.s) {
smart_str_free(&ebuf);
}
fingerprint = php_openssl_x509_fingerprint(peer, method, 0);
if (fingerprint) {
- result = strcasecmp(expected, fingerprint->val);
+ result = strcasecmp(expected, ZSTR_VAL(fingerprint));
zend_string_release(fingerprint);
}
php_error_docref(NULL, E_WARNING, "Invalid peer_fingerprint array; [algo => fingerprint] form required");
return 0;
}
- if (php_x509_fingerprint_cmp(peer, key->val, Z_STRVAL_P(current)) != 0) {
+ if (php_x509_fingerprint_cmp(peer, ZSTR_VAL(key), Z_STRVAL_P(current)) != 0) {
return 0;
}
} ZEND_HASH_FOREACH_END();
SSL_CTX_free(ctx);
return FAILURE;
} else {
- sslsock->sni_certs[i].name = pestrdup(key->val, php_stream_is_persistent(stream));
+ sslsock->sni_certs[i].name = pestrdup(ZSTR_VAL(key), php_stream_is_persistent(stream));
sslsock->sni_certs[i].ctx = ctx;
++i;
}
convert_to_string_ex(element);
/* Length of element + equal sign + length of key + null */
- pair_length = Z_STRLEN_P(element) + key->len + 2;
+ pair_length = Z_STRLEN_P(element) + ZSTR_LEN(key) + 2;
*pair = emalloc(pair_length);
- strlcpy(*pair, key->val, key->len + 1);
+ strlcpy(*pair, ZSTR_VAL(key), ZSTR_LEN(key) + 1);
strlcat(*pair, "=", pair_length);
strlcat(*pair, Z_STRVAL_P(element), pair_length);
if (!zend_is_callable(handle, 0, &func_name)) {
PCNTL_G(last_error) = EINVAL;
- php_error_docref(NULL, E_WARNING, "%s is not a callable function name error", func_name->val);
+ php_error_docref(NULL, E_WARNING, "%s is not a callable function name error", ZSTR_VAL(func_name));
zend_string_release(func_name);
RETURN_FALSE;
}
#if HAVE_SETLOCALE
if (pce->locale == BG(locale_string) ||
(pce->locale && BG(locale_string) &&
- pce->locale->len == BG(locale_string)->len &&
- !memcmp(pce->locale->val, BG(locale_string)->val, pce->locale->len)) ||
+ ZSTR_LEN(pce->locale) == ZSTR_LEN(BG(locale_string)) &&
+ !memcmp(ZSTR_VAL(pce->locale), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(pce->locale))) ||
(!pce->locale &&
- BG(locale_string)->len == 1 &&
- BG(locale_string)->val[0] == 'C') ||
+ ZSTR_LEN(BG(locale_string)) == 1 &&
+ ZSTR_VAL(BG(locale_string))[0] == 'C') ||
(!BG(locale_string) &&
- pce->locale->len == 1 &&
- pce->locale->val[0] == 'C')) {
+ ZSTR_LEN(pce->locale) == 1 &&
+ ZSTR_VAL(pce->locale)[0] == 'C')) {
return pce;
}
#else
#endif
}
- p = regex->val;
+ p = ZSTR_VAL(regex);
/* Parse through the leading whitespace, and display a warning if we
get to the end without encountering a delimiter. */
while (isspace((int)*(unsigned char *)p)) p++;
if (*p == 0) {
php_error_docref(NULL, E_WARNING,
- p < regex->val + regex->len ? "Null byte in regex" : "Empty regular expression");
+ p < ZSTR_VAL(regex) + ZSTR_LEN(regex) ? "Null byte in regex" : "Empty regular expression");
return NULL;
}
}
if (*pp == 0) {
- if (pp < regex->val + regex->len) {
+ if (pp < ZSTR_VAL(regex) + ZSTR_LEN(regex)) {
php_error_docref(NULL,E_WARNING, "Null byte in regex");
} else if (start_delimiter == end_delimiter) {
php_error_docref(NULL,E_WARNING, "No ending delimiter '%c' found", delimiter);
/* Parse through the options, setting appropriate flags. Display
a warning if we encounter an unknown modifier. */
- while (pp < regex->val + regex->len) {
+ while (pp < ZSTR_VAL(regex) + ZSTR_LEN(regex)) {
switch (*pp++) {
/* Perl compatible options */
case 'i': coptions |= PCRE_CASELESS; break;
#if HAVE_SETLOCALE
if (BG(locale_string) &&
- (BG(locale_string)->len != 1 || BG(locale_string)->val[0] != 'C')) {
+ (ZSTR_LEN(BG(locale_string)) != 1 || ZSTR_VAL(BG(locale_string))[0] != 'C')) {
tables = pcre_maketables();
}
#endif
new_entry.locale = BG(locale_string) ?
((GC_FLAGS(BG(locale_string)) & IS_STR_PERSISTENT) ?
zend_string_copy(BG(locale_string)) :
- zend_string_init(BG(locale_string)->val, BG(locale_string)->len, 1)) :
+ zend_string_init(ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)), 1)) :
NULL;
new_entry.tables = tables;
#endif
* See bug #63180
*/
if (!ZSTR_IS_INTERNED(regex) || !(GC_FLAGS(regex) & IS_STR_PERMANENT)) {
- zend_string *str = zend_string_init(regex->val, regex->len, 1);
+ zend_string *str = zend_string_init(ZSTR_VAL(regex), ZSTR_LEN(regex), 1);
GC_REFCOUNT(str) = 0; /* will be incremented by zend_hash_update_mem() */
- str->h = regex->h;
+ ZSTR_H(str) = ZSTR_H(regex);
regex = str;
}
}
pce->refcount++;
- php_pcre_match_impl(pce, subject->val, (int)subject->len, return_value, subpats,
+ php_pcre_match_impl(pce, ZSTR_VAL(subject), (int)ZSTR_LEN(subject), return_value, subpats,
global, ZEND_NUM_ARGS() >= 4, flags, start_offset);
pce->refcount--;
}
}
/* copy the part of the string before the match */
- memcpy(&result->val[result_len], piece, match-piece);
+ memcpy(&ZSTR_VAL(result)[result_len], piece, match-piece);
result_len += (int)(match-piece);
/* copy replacement and backrefs */
- walkbuf = result->val + result_len;
+ walkbuf = ZSTR_VAL(result) + result_len;
walk = replace;
walk_last = 0;
}
*walkbuf = '\0';
/* increment the result length by how much we've added to the string */
- result_len += (int)(walkbuf - (result->val + result_len));
+ result_len += (int)(walkbuf - (ZSTR_VAL(result) + result_len));
} else {
/* Use custom function to get replacement string and its length. */
eval_result = preg_do_repl_func(replace_val, subject, offsets, subpat_names, count, mark);
ZEND_ASSERT(eval_result);
- new_len += (int)eval_result->len;
+ new_len += (int)ZSTR_LEN(eval_result);
if (new_len >= alloc_len) {
alloc_len = alloc_len + 2 * new_len;
if (result == NULL) {
}
}
/* copy the part of the string before the match */
- memcpy(&result->val[result_len], piece, match-piece);
+ memcpy(ZSTR_VAL(result) + result_len, piece, match-piece);
result_len += (int)(match-piece);
/* copy replacement and backrefs */
- walkbuf = result->val + result_len;
+ walkbuf = ZSTR_VAL(result) + result_len;
/* If using custom function, copy result to the buffer and clean up. */
- memcpy(walkbuf, eval_result->val, eval_result->len);
- result_len += (int)eval_result->len;
+ memcpy(walkbuf, ZSTR_VAL(eval_result), ZSTR_LEN(eval_result));
+ result_len += (int)ZSTR_LEN(eval_result);
zend_string_release(eval_result);
}
offsets[0] = start_offset;
offsets[1] = start_offset + unit_len;
- memcpy(&result->val[result_len], piece, unit_len);
+ memcpy(ZSTR_VAL(result) + result_len, piece, unit_len);
result_len += unit_len;
} else {
if (!result && subject_str) {
}
}
/* stick that last bit of string on our output */
- memcpy(&result->val[result_len], piece, subject_len - start_offset);
+ memcpy(ZSTR_VAL(result) + result_len, piece, subject_len - start_offset);
result_len += subject_len - start_offset;
- result->val[result_len] = '\0';
- result->len = result_len;
+ ZSTR_VAL(result)[result_len] = '\0';
+ ZSTR_LEN(result) = result_len;
break;
}
} else {
for further replacements. */
if ((result = php_pcre_replace(regex_str,
subject_str,
- subject_str->val,
- (int)subject_str->len,
+ ZSTR_VAL(subject_str),
+ (int)ZSTR_LEN(subject_str),
replace_value,
is_callable_replace,
limit,
} else {
result = php_pcre_replace(Z_STR_P(regex),
subject_str,
- subject_str->val,
- (int)subject_str->len,
+ ZSTR_VAL(subject_str),
+ (int)ZSTR_LEN(subject_str),
replace,
is_callable_replace,
limit,
#endif
if (!zend_is_callable(replace, 0, &callback_name)) {
- php_error_docref(NULL, E_WARNING, "Requires argument 2, '%s', to be a valid callback", callback_name->val);
+ php_error_docref(NULL, E_WARNING, "Requires argument 2, '%s', to be a valid callback", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
ZVAL_COPY(return_value, subject);
return;
}
if (!zend_is_callable(replace, 0, &callback_name)) {
- php_error_docref(NULL, E_WARNING, "'%s' is not a valid callback", callback_name->val);
+ php_error_docref(NULL, E_WARNING, "'%s' is not a valid callback", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
zval_ptr_dtor(®ex);
zval_ptr_dtor(return_value);
}
pce->refcount++;
- php_pcre_split_impl(pce, subject->val, (int)subject->len, return_value, (int)limit_val, flags);
+ php_pcre_split_impl(pce, ZSTR_VAL(subject), (int)ZSTR_LEN(subject), return_value, (int)limit_val, flags);
pce->refcount--;
}
/* }}} */
out_str = zend_string_safe_alloc(4, in_str_len, 0, 0);
/* Go through the string and quote necessary characters */
- for (p = in_str, q = out_str->val; p != in_str_end; p++) {
+ for (p = in_str, q = ZSTR_VAL(out_str); p != in_str_end; p++) {
c = *p;
switch(c) {
case '.':
*q = '\0';
/* Reallocate string and return it */
- out_str = zend_string_truncate(out_str, q - out_str->val, 0);
+ out_str = zend_string_truncate(out_str, q - ZSTR_VAL(out_str), 0);
RETURN_NEW_STR(out_str);
}
/* }}} */
zend_string *subject_str = zval_get_string(entry);
/* Perform the match */
- count = pcre_exec(pce->re, extra, subject_str->val,
- (int)subject_str->len, 0,
+ count = pcre_exec(pce->re, extra, ZSTR_VAL(subject_str),
+ (int)ZSTR_LEN(subject_str), 0,
0, offsets, size_offsets);
/* Check for too many substrings condition. */
}
if (dbh->error_mode == PDO_ERRMODE_WARNING) {
- php_error_docref(NULL, E_WARNING, "%s", message->val);
+ php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(message));
} else if (EG(exception) == NULL) {
zval ex;
zend_class_entry *def_ex = php_pdo_get_exception_base(1), *pdo_ex = php_pdo_get_exception();
pdo_dbh_object_t *dbh_obj = php_pdo_dbh_fetch_object(*object);
zend_string *lc_method_name;
- lc_method_name = zend_string_init(method_name->val, method_name->len, 0);
- zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
+ lc_method_name = zend_string_init(ZSTR_VAL(method_name), ZSTR_LEN(method_name), 0);
+ zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method_name), ZSTR_LEN(method_name));
if ((fbc = std_object_handlers.get_method(object, method_name, key)) == NULL) {
/* not a pre-defined method, nor a user-defined method; check
if (stmt->named_rewrite_template) {
/* magic/hack.
- * We pretend that the query was positional even if
+ * We we pretend that the query was positional even if
* it was named so that we fall into the
* named rewrite case below. Not too pretty,
* but it works. */
zend_string *buf;
buf = php_stream_copy_to_mem(stm, PHP_STREAM_COPY_ALL, 0);
- if (!stmt->dbh->methods->quoter(stmt->dbh, buf->val, buf->len, &plc->quoted, &plc->qlen,
+ if (!stmt->dbh->methods->quoter(stmt->dbh, ZSTR_VAL(buf), ZSTR_LEN(buf), &plc->quoted, &plc->qlen,
param->param_type)) {
/* bork */
ret = -1;
zend_string *buf;
buf = php_stream_copy_to_mem(stm, PHP_STREAM_COPY_ALL, 0);
- if (!stmt->dbh->methods->quoter(stmt->dbh, buf->val, buf->len, &plc->quoted, &plc->qlen,
+ if (!stmt->dbh->methods->quoter(stmt->dbh, ZSTR_VAL(buf), ZSTR_LEN(buf), &plc->quoted, &plc->qlen,
param->param_type)) {
/* bork */
ret = -1;
}
ZEND_HASH_FOREACH_PTR(stmt->bound_param_map, name) {
- if (strncmp(name, param->name->val, param->name->len + 1)) {
+ if (strncmp(name, ZSTR_VAL(param->name), ZSTR_LEN(param->name) + 1)) {
position++;
continue;
}
/* if we are applying case conversions on column names, do so now */
if (stmt->dbh->native_case != stmt->dbh->desired_case && stmt->dbh->desired_case != PDO_CASE_NATURAL) {
- char *s = stmt->columns[col].name->val;
+ char *s = ZSTR_VAL(stmt->columns[col].name);
switch (stmt->dbh->desired_case) {
case PDO_CASE_UPPER:
int i;
for (i = 0; i < stmt->column_count; i++) {
- if (stmt->columns[i].name->len == param->name->len &&
- strncmp(stmt->columns[i].name->val, param->name->val, param->name->len + 1) == 0) {
+ if (ZSTR_LEN(stmt->columns[i].name) == ZSTR_LEN(param->name) &&
+ strncmp(ZSTR_VAL(stmt->columns[i].name), ZSTR_VAL(param->name), ZSTR_LEN(param->name) + 1) == 0) {
param->paramno = i;
break;
}
* then this will trigger, and we don't want that */
if (param->paramno == -1) {
char *tmp;
- spprintf(&tmp, 0, "Did not find column name '%s' in the defined columns; it will not be bound", param->name->val);
+ spprintf(&tmp, 0, "Did not find column name '%s' in the defined columns; it will not be bound", ZSTR_VAL(param->name));
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", tmp);
efree(tmp);
}
}
if (param->name) {
- if (is_param && param->name->val[0] != ':') {
- zend_string *temp = zend_string_alloc(param->name->len + 1, 0);
- temp->val[0] = ':';
- memmove(temp->val + 1, param->name->val, param->name->len + 1);
+ if (is_param && ZSTR_VAL(param->name)[0] != ':') {
+ zend_string *temp = zend_string_alloc(ZSTR_LEN(param->name) + 1, 0);
+ ZSTR_VAL(temp)[0] = ':';
+ memmove(ZSTR_VAL(temp) + 1, ZSTR_VAL(param->name), ZSTR_LEN(param->name) + 1);
param->name = temp;
} else {
- param->name = zend_string_init(param->name->val, param->name->len, 0);
+ param->name = zend_string_init(ZSTR_VAL(param->name), ZSTR_LEN(param->name), 0);
}
}
zend_string *key = NULL;
ZEND_HASH_FOREACH_KEY_PTR(stmt->bound_params, num, key, param) {
if (key) {
- php_stream_printf(out, "Key: Name: [%d] %.*s\n", key->len, key->len, key->val);
+ php_stream_printf(out, "Key: Name: [%d] %.*s\n", ZSTR_LEN(key), ZSTR_LEN(key), ZSTR_VAL(key));
} else {
php_stream_printf(out, "Key: Position #%pd:\n", num);
}
php_stream_printf(out, "paramno=%pd\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\n",
- param->paramno, param->name? param->name->len : 0, param->name? param->name->len : 0,
- param->name ? param->name->val : "",
+ param->paramno, param->name? ZSTR_LEN(param->name) : 0, param->name? ZSTR_LEN(param->name) : 0,
+ param->name ? ZSTR_VAL(param->name) : "",
param->is_param,
param->param_type);
zend_string *lc_method_name;
zend_object *object = *object_pp;
- lc_method_name = zend_string_alloc(method_name->len, 0);
- zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
+ lc_method_name = zend_string_alloc(ZSTR_LEN(method_name), 0);
+ zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method_name), ZSTR_LEN(method_name));
if ((fbc = zend_hash_find_ptr(&object->ce->function_table, lc_method_name)) == NULL) {
pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
/* TODO: replace this with a hash of available column names to column
* numbers */
for (colno = 0; colno < stmt->column_count; colno++) {
- if (stmt->columns[colno].name->len == Z_STRLEN_P(member) &&
- strncmp(stmt->columns[colno].name->val, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
+ if (ZSTR_LEN(stmt->columns[colno].name) == Z_STRLEN_P(member) &&
+ strncmp(ZSTR_VAL(stmt->columns[colno].name), Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
fetch_value(stmt, rv, colno, NULL);
//???
//Z_SET_REFCOUNT_P(rv, 0);
/* TODO: replace this with a hash of available column names to column
* numbers */
for (colno = 0; colno < stmt->column_count; colno++) {
- if (stmt->columns[colno].name->len == Z_STRLEN_P(member) &&
- strncmp(stmt->columns[colno].name->val, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
+ if (ZSTR_LEN(stmt->columns[colno].name) == Z_STRLEN_P(member) &&
+ strncmp(ZSTR_VAL(stmt->columns[colno].name), Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
return 1;
}
}
zend_function *fbc;
zend_string *lc_method_name;
- lc_method_name = zend_string_alloc(method_name->len, 0);
- zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
+ lc_method_name = zend_string_alloc(ZSTR_LEN(method_name), 0);
+ zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method_name), ZSTR_LEN(method_name));
if ((fbc = zend_hash_find_ptr(&pdo_row_ce->function_table, lc_method_name)) == NULL) {
zend_string_release(lc_method_name);
/* support both full connection string & connection string + login and/or password */
if (tmp_user && tmp_pass) {
- spprintf(&conn_str, 0, "%s user='%s' password='%s' connect_timeout=%pd", (char *) dbh->data_source, tmp_user->val, tmp_pass->val, connect_timeout);
+ spprintf(&conn_str, 0, "%s user='%s' password='%s' connect_timeout=%pd", (char *) dbh->data_source, ZSTR_VAL(tmp_user), ZSTR_VAL(tmp_pass), connect_timeout);
} else if (tmp_user) {
- spprintf(&conn_str, 0, "%s user='%s' connect_timeout=%pd", (char *) dbh->data_source, tmp_user->val, connect_timeout);
+ spprintf(&conn_str, 0, "%s user='%s' connect_timeout=%pd", (char *) dbh->data_source, ZSTR_VAL(tmp_user), connect_timeout);
} else if (tmp_pass) {
- spprintf(&conn_str, 0, "%s password='%s' connect_timeout=%pd", (char *) dbh->data_source, tmp_pass->val, connect_timeout);
+ spprintf(&conn_str, 0, "%s password='%s' connect_timeout=%pd", (char *) dbh->data_source, ZSTR_VAL(tmp_pass), connect_timeout);
} else {
spprintf(&conn_str, 0, "%s connect_timeout=%pd", (char *) dbh->data_source, connect_timeout);
}
case PDO_PARAM_EVT_NORMALIZE:
/* decode name from $1, $2 into 0, 1 etc. */
if (param->name) {
- if (param->name->val[0] == '$') {
- ZEND_ATOL(param->paramno, param->name->val + 1);
+ if (ZSTR_VAL(param->name)[0] == '$') {
+ ZEND_ATOL(param->paramno, ZSTR_VAL(param->name) + 1);
} else {
/* resolve parameter name to rewritten name */
char *namevar;
ZEND_ATOL(param->paramno, namevar + 1);
param->paramno--;
} else {
- pdo_raise_impl_error(stmt->dbh, stmt, "HY093", param->name->val);
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY093", ZSTR_VAL(param->name));
return 0;
}
}
PDO_CONSTRUCT_CHECK;
if (!zend_is_callable(callback, 0, &cbname)) {
- php_error_docref(NULL, E_WARNING, "function '%s' is not callable", cbname->val);
+ php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release(cbname);
RETURN_FALSE;
}
PDO_CONSTRUCT_CHECK;
if (!zend_is_callable(step_callback, 0, &cbname)) {
- php_error_docref(NULL, E_WARNING, "function '%s' is not callable", cbname->val);
+ php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release(cbname);
RETURN_FALSE;
}
zend_string_release(cbname);
if (!zend_is_callable(fini_callback, 0, &cbname)) {
- php_error_docref(NULL, E_WARNING, "function '%s' is not callable", cbname->val);
+ php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release(cbname);
RETURN_FALSE;
}
PDO_CONSTRUCT_CHECK;
if (!zend_is_callable(callback, 0, &cbname)) {
- php_error_docref(NULL, E_WARNING, "function '%s' is not callable", cbname->val);
+ php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release(cbname);
RETURN_FALSE;
}
if (param->is_param) {
if (param->paramno == -1) {
- param->paramno = sqlite3_bind_parameter_index(S->stmt, param->name->val) - 1;
+ param->paramno = sqlite3_bind_parameter_index(S->stmt, ZSTR_VAL(param->name)) - 1;
}
switch (PDO_PARAM_TYPE(param->param_type)) {
/* hash it up */
new_le.type = le_plink;
new_le.ptr = pgsql;
- if (zend_hash_str_update_mem(&EG(persistent_list), str.s->val, str.s->len, &new_le, sizeof(zend_resource)) == NULL) {
+ if (zend_hash_str_update_mem(&EG(persistent_list), ZSTR_VAL(str.s), ZSTR_LEN(str.s), &new_le, sizeof(zend_resource)) == NULL) {
goto err;
}
PGG(num_links)++;
continue;
}
- str.s->len = 0;
+ ZSTR_LEN(str.s) = 0;
smart_str_appends(&str, "pgsql_oid_");
smart_str_appends(&str, tmp_oid);
smart_str_0(&str);
smart_str_append_unsigned(&querystr, oid);
smart_str_0(&querystr);
- if ((tmp_res = PQexec(pg_result->conn, querystr.s->val)) == NULL || PQresultStatus(tmp_res) != PGRES_TUPLES_OK) {
+ if ((tmp_res = PQexec(pg_result->conn, ZSTR_VAL(querystr.s))) == NULL || PQresultStatus(tmp_res) != PGRES_TUPLES_OK) {
if (tmp_res) {
PQclear(tmp_res);
}
ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_AUTO);
}
if (!ce) {
- php_error_docref(NULL, E_WARNING, "Could not find class '%s'", class_name->val);
+ php_error_docref(NULL, E_WARNING, "Could not find class '%s'", ZSTR_VAL(class_name));
return;
}
result_type = PGSQL_ASSOC;
}
buf = zend_string_alloc(buf_len, 0);
- if ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf->val, buf->len))<0) {
+ if ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, ZSTR_VAL(buf), ZSTR_LEN(buf)))<0) {
zend_string_free(buf);
RETURN_FALSE;
}
- buf->len = nbytes;
- buf->val[buf->len] = '\0';
+ ZSTR_LEN(buf) = nbytes;
+ ZSTR_VAL(buf)[ZSTR_LEN(buf)] = '\0';
RETURN_NEW_STR(buf);
}
/* }}} */
break;
}
- to = zend_string_alloc(from->len * 2, 0);
+ to = zend_string_alloc(ZSTR_LEN(from) * 2, 0);
#ifdef HAVE_PQESCAPE_CONN
if (link) {
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
RETURN_FALSE;
}
- to->len = PQescapeStringConn(pgsql, to->val, from->val, from->len, NULL);
+ ZSTR_LEN(to) = PQescapeStringConn(pgsql, ZSTR_VAL(to), ZSTR_VAL(from), ZSTR_LEN(from), NULL);
} else
#endif
{
- to->len = PQescapeString(to->val, from->val, from->len);
+ ZSTR_LEN(to) = PQescapeString(ZSTR_VAL(to), ZSTR_VAL(from), ZSTR_LEN(from));
}
- to = zend_string_truncate(to, to->len, 0);
+ to = zend_string_truncate(to, ZSTR_LEN(to), 0);
RETURN_NEW_STR(to);
}
/* }}} */
smart_str_0(&querystr);
efree(src);
- pg_result = PQexec(pg_link, querystr.s->val);
+ pg_result = PQexec(pg_link, ZSTR_VAL(querystr.s));
if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = PQntuples(pg_result)) == 0) {
php_error_docref(NULL, E_WARNING, "Table '%s' doesn't exists", table_name);
smart_str_free(&querystr);
} \
/* raise error if it's not null and cannot be ignored */ \
else if (!(opt & PGSQL_CONV_IGNORE_NOT_NULL) && Z_TYPE_P(not_null) == IS_TRUE) { \
- php_error_docref(NULL, E_NOTICE, "Detected NULL for 'NOT NULL' field '%s'", field->val); \
+ php_error_docref(NULL, E_NOTICE, "Detected NULL for 'NOT NULL' field '%s'", ZSTR_VAL(field)); \
err = 1; \
} \
}
}
if (!err && (def = zend_hash_find(Z_ARRVAL(meta), field)) == NULL) {
- php_error_docref(NULL, E_NOTICE, "Invalid field name (%s) in values", field->val);
+ php_error_docref(NULL, E_NOTICE, "Invalid field name (%s) in values", ZSTR_VAL(field));
err = 1;
}
if (!err && (type = zend_hash_str_find(Z_ARRVAL_P(def), "type", sizeof("type") - 1)) == NULL) {
ZVAL_STRINGL(&new_val, "'f'", sizeof("'f'")-1);
}
else {
- php_error_docref(NULL, E_NOTICE, "Detected invalid value (%s) for PostgreSQL %s field (%s)", Z_STRVAL_P(val), Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Detected invalid value (%s) for PostgreSQL %s field (%s)", Z_STRVAL_P(val), Z_STRVAL_P(type), ZSTR_VAL(field));
err = 1;
}
}
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects string, null, long or boolelan value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects string, null, long or boolelan value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for pgsql '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for pgsql '%s' (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
/* PostgreSQL ignores \0 */
str = zend_string_alloc(Z_STRLEN_P(val) * 2, 0);
/* better to use PGSQLescapeLiteral since PGescapeStringConn does not handle special \ */
- str->len = PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
- str = zend_string_truncate(str, str->len, 0);
+ ZSTR_LEN(str) = PQescapeStringConn(pg_link, ZSTR_VAL(str), Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
+ str = zend_string_truncate(str, ZSTR_LEN(str), 0);
ZVAL_NEW_STR(&new_val, str);
php_pgsql_add_quotes(&new_val, 1);
}
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for '%s' (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL or string for '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for '%s' (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
#ifdef HAVE_PQESCAPE
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), ZSTR_VAL(field));
}
break;
default:
/* should not happen */
- php_error_docref(NULL, E_NOTICE, "Unknown or system data type '%s' for '%s'. Report error", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Unknown or system data type '%s' for '%s'. Report error", Z_STRVAL_P(type), ZSTR_VAL(field));
err = 1;
break;
} /* switch */
if (!skip_field) {
char *escaped;
- if (_php_pgsql_detect_identifier_escape(field->val, field->len) == SUCCESS) {
+ if (_php_pgsql_detect_identifier_escape(ZSTR_VAL(field), ZSTR_LEN(field)) == SUCCESS) {
zend_hash_update(Z_ARRVAL_P(result), field, &new_val);
} else {
- escaped = PGSQLescapeIdentifier(pg_link, field->val, field->len);
+ escaped = PGSQLescapeIdentifier(pg_link, ZSTR_VAL(field), ZSTR_LEN(field));
add_assoc_zval(result, escaped, &new_val);
PGSQLfree(escaped);
}
static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong opt) /* {{{ */
{
if (opt & PGSQL_DML_ASYNC) {
- if (PQsendQuery(pg_link, querystr->s->val)) {
+ if (PQsendQuery(pg_link, ZSTR_VAL(querystr->s))) {
return 0;
}
}
else {
PGresult *pg_result;
- pg_result = PQexec(pg_link, querystr->s->val);
+ pg_result = PQexec(pg_link, ZSTR_VAL(querystr->s));
if (PQresultStatus(pg_result) == expect) {
PQclear(pg_result);
return 0;
goto cleanup;
}
if (opt & PGSQL_DML_ESCAPE) {
- tmp = PGSQLescapeIdentifier(pg_link, fld->val, fld->len + 1);
+ tmp = PGSQLescapeIdentifier(pg_link, ZSTR_VAL(fld), ZSTR_LEN(fld) + 1);
smart_str_appends(&querystr, tmp);
PGSQLfree(tmp);
} else {
- smart_str_appendl(&querystr, fld->val, fld->len);
+ smart_str_appendl(&querystr, ZSTR_VAL(fld), ZSTR_LEN(fld));
}
smart_str_appendc(&querystr, ',');
} ZEND_HASH_FOREACH_END();
- querystr.s->len--;
+ ZSTR_LEN(querystr.s)--;
smart_str_appends(&querystr, ") VALUES (");
/* make values string */
smart_str_appendc(&querystr, ',');
} ZEND_HASH_FOREACH_END();
/* Remove the trailing "," */
- querystr.s->len--;
+ ZSTR_LEN(querystr.s)--;
smart_str_appends(&querystr, ");");
no_values:
if (php_pgsql_insert(pg_link, table, values, option|PGSQL_DML_STRING, &sql) == FAILURE) {
RETURN_FALSE;
}
- pg_result = PQexec(pg_link, sql->val);
+ pg_result = PQexec(pg_link, ZSTR_VAL(sql));
if ((PGG(auto_reset_persistent) & 2) && PQstatus(pg_link) != CONNECTION_OK) {
PQclear(pg_result);
PQreset(pg_link);
- pg_result = PQexec(pg_link, sql->val);
+ pg_result = PQexec(pg_link, ZSTR_VAL(sql));
}
efree(sql);
return -1;
}
if (opt & PGSQL_DML_ESCAPE) {
- tmp = PGSQLescapeIdentifier(pg_link, fld->val, fld->len + 1);
+ tmp = PGSQLescapeIdentifier(pg_link, ZSTR_VAL(fld), ZSTR_LEN(fld) + 1);
smart_str_appends(querystr, tmp);
PGSQLfree(tmp);
} else {
- smart_str_appendl(querystr, fld->val, fld->len);
+ smart_str_appendl(querystr, ZSTR_VAL(fld), ZSTR_LEN(fld));
}
if (where_cond && (Z_TYPE_P(val) == IS_TRUE || Z_TYPE_P(val) == IS_FALSE || (Z_TYPE_P(val) == IS_STRING && !strcmp(Z_STRVAL_P(val), "NULL")))) {
smart_str_appends(querystr, " IS ");
smart_str_appendl(querystr, pad, pad_len);
} ZEND_HASH_FOREACH_END();
if (querystr->s) {
- querystr->s->len -= pad_len;
+ ZSTR_LEN(querystr->s) -= pad_len;
}
return 0;
smart_str_appendc(&querystr, ';');
smart_str_0(&querystr);
- pg_result = PQexec(pg_link, querystr.s->val);
+ pg_result = PQexec(pg_link, ZSTR_VAL(querystr.s));
if (PQresultStatus(pg_result) == PGRES_TUPLES_OK) {
ret = php_pgsql_result2array(pg_result, ret_array);
} else {
- php_error_docref(NULL, E_NOTICE, "Failed to execute '%s'", querystr.s->val);
+ php_error_docref(NULL, E_NOTICE, "Failed to execute '%s'", ZSTR_VAL(querystr.s));
}
PQclear(pg_result);
}
zend_hash_move_forward(data);
- to_read = MIN(str_key->len, count);
+ to_read = MIN(ZSTR_LEN(str_key), count);
- if (to_read == 0 || count < str_key->len) {
+ if (to_read == 0 || count < ZSTR_LEN(str_key)) {
return 0;
}
memset(buf, 0, sizeof(php_stream_dirent));
- memcpy(((php_stream_dirent *) buf)->d_name, str_key->val, to_read);
+ memcpy(((php_stream_dirent *) buf)->d_name, ZSTR_VAL(str_key), to_read);
((php_stream_dirent *) buf)->d_name[to_read + 1] = '\0';
return sizeof(php_stream_dirent);
f = (Bucket *) a;
s = (Bucket *) b;
- result = zend_binary_strcmp(f->key->val, f->key->len, s->key->val, s->key->len);
+ result = zend_binary_strcmp(ZSTR_VAL(f->key), ZSTR_LEN(f->key), ZSTR_VAL(s->key), ZSTR_LEN(s->key));
if (result < 0) {
return -1;
break;
}
- keylen = str_key->len;
+ keylen = ZSTR_LEN(str_key);
if (keylen <= (uint)dirlen) {
- if (keylen < (uint)dirlen || !strncmp(str_key->val, dir, dirlen)) {
+ if (keylen < (uint)dirlen || !strncmp(ZSTR_VAL(str_key), dir, dirlen)) {
if (SUCCESS != zend_hash_move_forward(manifest)) {
break;
}
if (*dir == '/') {
/* root directory */
- if (keylen >= sizeof(".phar")-1 && !memcmp(str_key->val, ".phar", sizeof(".phar")-1)) {
+ if (keylen >= sizeof(".phar")-1 && !memcmp(ZSTR_VAL(str_key), ".phar", sizeof(".phar")-1)) {
/* do not add any magic entries to this directory */
if (SUCCESS != zend_hash_move_forward(manifest)) {
break;
continue;
}
- if (NULL != (found = (char *) memchr(str_key->val, '/', keylen))) {
+ if (NULL != (found = (char *) memchr(ZSTR_VAL(str_key), '/', keylen))) {
/* the entry has a path separator and is a subdirectory */
- entry = (char *) safe_emalloc(found - str_key->val, 1, 1);
- memcpy(entry, str_key->val, found - str_key->val);
- keylen = found - str_key->val;
+ entry = (char *) safe_emalloc(found - ZSTR_VAL(str_key), 1, 1);
+ memcpy(entry, ZSTR_VAL(str_key), found - ZSTR_VAL(str_key));
+ keylen = found - ZSTR_VAL(str_key);
entry[keylen] = '\0';
} else {
entry = (char *) safe_emalloc(keylen, 1, 1);
- memcpy(entry, str_key->val, keylen);
+ memcpy(entry, ZSTR_VAL(str_key), keylen);
entry[keylen] = '\0';
}
goto PHAR_ADD_ENTRY;
} else {
- if (0 != memcmp(str_key->val, dir, dirlen)) {
+ if (0 != memcmp(ZSTR_VAL(str_key), dir, dirlen)) {
/* entry in directory not found */
if (SUCCESS != zend_hash_move_forward(manifest)) {
break;
}
continue;
} else {
- if (str_key->val[dirlen] != '/') {
+ if (ZSTR_VAL(str_key)[dirlen] != '/') {
if (SUCCESS != zend_hash_move_forward(manifest)) {
break;
}
}
}
- save = str_key->val;
+ save = ZSTR_VAL(str_key);
save += dirlen + 1; /* seek to just past the path separator */
if (NULL != (found = (char *) memchr(save, '/', keylen - dirlen - 1))) {
while (FAILURE != zend_hash_has_more_elements(&phar->manifest)) {
if (HASH_KEY_NON_EXISTENT !=
zend_hash_get_current_key(&phar->manifest, &str_key, &unused)) {
- if (str_key->len > (uint)i_len && 0 == memcmp(str_key->val, internal_file, i_len)) {
+ if (ZSTR_LEN(str_key) > (uint)i_len && 0 == memcmp(ZSTR_VAL(str_key), internal_file, i_len)) {
/* directory found */
internal_file = estrndup(internal_file,
i_len);
HASH_KEY_NON_EXISTENT != zend_hash_get_current_key(&phar->manifest, &str_key, &unused);
zend_hash_move_forward(&phar->manifest)
) {
- if (str_key->len > path_len &&
- memcmp(str_key->val, resource->path+1, path_len) == 0 &&
- IS_SLASH(str_key->val[path_len])) {
+ if (ZSTR_LEN(str_key) > path_len &&
+ memcmp(ZSTR_VAL(str_key), resource->path+1, path_len) == 0 &&
+ IS_SLASH(ZSTR_VAL(str_key)[path_len])) {
php_stream_wrapper_log_error(wrapper, options, "phar error: Directory not empty");
if (entry->is_temp_dir) {
efree(entry->filename);
HASH_KEY_NON_EXISTENT != zend_hash_get_current_key(&phar->virtual_dirs, &str_key, &unused);
zend_hash_move_forward(&phar->virtual_dirs)) {
- if (str_key->len > path_len &&
- memcmp(str_key->val, resource->path+1, path_len) == 0 &&
- IS_SLASH(str_key->val[path_len])) {
+ if (ZSTR_LEN(str_key) > path_len &&
+ memcmp(ZSTR_VAL(str_key), resource->path+1, path_len) == 0 &&
+ IS_SLASH(ZSTR_VAL(str_key)[path_len])) {
php_stream_wrapper_log_error(wrapper, options, "phar error: Directory not empty");
if (entry->is_temp_dir) {
efree(entry->filename);
}
if (use_include_path) {
if ((entry_str = phar_find_in_include_path(entry, entry_len, NULL))) {
- name = entry_str->val;
+ name = ZSTR_VAL(entry_str);
goto phar_it;
} else {
/* this file is not in the phar, use the original path */
/* uses mmap if possible */
contents = php_stream_copy_to_mem(stream, maxlen, 0);
- if (contents && contents->len > 0) {
+ if (contents && ZSTR_LEN(contents) > 0) {
RETVAL_STR(contents);
} else if (contents) {
zend_string_release(contents);
efree(arch);
goto skip_phar;
} else {
- name = entry_str->val;
+ name = ZSTR_VAL(entry_str);
}
} else {
entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1);
efree(arch);
goto skip_phar;
} else {
- name = entry_str->val;
+ name = ZSTR_VAL(entry_str);
}
} else {
entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1);
{
zend_bool old, ini;
- if (entry->name->len == sizeof("phar.readonly")-1) {
+ if (ZSTR_LEN(entry->name) == sizeof("phar.readonly")-1) {
old = PHAR_G(readonly_orig);
} else {
old = PHAR_G(require_hash_orig);
}
- if (new_value->len == 2 && !strcasecmp("on", new_value->val)) {
+ if (ZSTR_LEN(new_value) == 2 && !strcasecmp("on", ZSTR_VAL(new_value))) {
ini = (zend_bool) 1;
}
- else if (new_value->len == 3 && !strcasecmp("yes", new_value->val)) {
+ else if (ZSTR_LEN(new_value) == 3 && !strcasecmp("yes", ZSTR_VAL(new_value))) {
ini = (zend_bool) 1;
}
- else if (new_value->len == 4 && !strcasecmp("true", new_value->val)) {
+ else if (ZSTR_LEN(new_value) == 4 && !strcasecmp("true", ZSTR_VAL(new_value))) {
ini = (zend_bool) 1;
}
else {
- ini = (zend_bool) atoi(new_value->val);
+ ini = (zend_bool) atoi(ZSTR_VAL(new_value));
}
/* do not allow unsetting in runtime */
if (stage == ZEND_INI_STAGE_STARTUP) {
- if (entry->name->len == sizeof("phar.readonly")-1) {
+ if (ZSTR_LEN(entry->name) == sizeof("phar.readonly")-1) {
PHAR_G(readonly_orig) = ini;
} else {
PHAR_G(require_hash_orig) = ini;
return FAILURE;
}
- if (entry->name->len == sizeof("phar.readonly")-1) {
+ if (ZSTR_LEN(entry->name) == sizeof("phar.readonly")-1) {
PHAR_G(readonly) = ini;
if (PHAR_G(request_init) && PHAR_G(phar_fname_map.u.flags)) {
zend_hash_apply_with_argument(&(PHAR_G(phar_fname_map)), phar_set_writeable_bit, (void *)&ini);
ZEND_INI_MH(phar_ini_cache_list) /* {{{ */
{
- PHAR_G(cache_list) = new_value->val;
+ PHAR_G(cache_list) = ZSTR_VAL(new_value);
if (stage == ZEND_INI_STAGE_STARTUP) {
phar_split_cache_list();
fp = php_stream_open_wrapper(fname, "rb", IGNORE_URL|STREAM_MUST_SEEK|0, &actual);
if (actual) {
- fname = actual->val;
- fname_len = actual->len;
+ fname = ZSTR_VAL(actual);
+ fname_len = ZSTR_LEN(actual);
}
if (fp) {
}
if (actual) {
- fname = actual->val;
- fname_len = actual->len;
+ fname = ZSTR_VAL(actual);
+ fname_len = ZSTR_LEN(actual);
}
ret = phar_open_from_fp(fp, fname, fname_len, alias, alias_len, options, pphar, is_data, error);
HASH_KEY_NON_EXISTENT != zend_hash_get_current_key(&(PHAR_G(phar_fname_map)), &str_key, &unused);
zend_hash_move_forward(&(PHAR_G(phar_fname_map)))
) {
- if (str_key->len > (uint) filename_len) {
+ if (ZSTR_LEN(str_key) > (uint) filename_len) {
continue;
}
- if (!memcmp(filename, str_key->val, str_key->len) && ((uint)filename_len == str_key->len
- || filename[str_key->len] == '/' || filename[str_key->len] == '\0')) {
+ if (!memcmp(filename, ZSTR_VAL(str_key), ZSTR_LEN(str_key)) && ((uint)filename_len == ZSTR_LEN(str_key)
+ || filename[ZSTR_LEN(str_key)] == '/' || filename[ZSTR_LEN(str_key)] == '\0')) {
if (NULL == (pphar = zend_hash_get_current_data_ptr(&(PHAR_G(phar_fname_map))))) {
break;
}
- *ext_str = filename + (str_key->len - pphar->ext_len);
+ *ext_str = filename + (ZSTR_LEN(str_key) - pphar->ext_len);
goto woohoo;
}
}
HASH_KEY_NON_EXISTENT != zend_hash_get_current_key(&cached_phars, &str_key, &unused);
zend_hash_move_forward(&cached_phars)
) {
- if (str_key->len > (uint) filename_len) {
+ if (ZSTR_LEN(str_key) > (uint) filename_len) {
continue;
}
- if (!memcmp(filename, str_key->val, str_key->len) && ((uint)filename_len == str_key->len
- || filename[str_key->len] == '/' || filename[str_key->len] == '\0')) {
+ if (!memcmp(filename, ZSTR_VAL(str_key), ZSTR_LEN(str_key)) && ((uint)filename_len == ZSTR_LEN(str_key)
+ || filename[ZSTR_LEN(str_key)] == '/' || filename[ZSTR_LEN(str_key)] == '\0')) {
if (NULL == (pphar = zend_hash_get_current_data_ptr(&cached_phars))) {
break;
}
- *ext_str = filename + (str_key->len - pphar->ext_len);
+ *ext_str = filename + (ZSTR_LEN(str_key) - pphar->ext_len);
goto woohoo;
}
}
}
if (actual) {
- fname = actual->val;
- fname_len = actual->len;
+ fname = ZSTR_VAL(actual);
+ fname_len = ZSTR_LEN(actual);
}
ret = phar_open_from_fp(fp, fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, 0, error);
return EOF;
}
free_user_stub = 1;
- user_stub = suser_stub->val;
- len = suser_stub->len;
+ user_stub = ZSTR_VAL(suser_stub);
+ len = ZSTR_LEN(suser_stub);
} else {
free_user_stub = 0;
}
}
/* 32 bits for filename length, length of filename, manifest + metadata, and add 1 for trailing / if a directory */
- offset += 4 + entry->filename_len + sizeof(entry_buffer) + (entry->metadata_str.s ? entry->metadata_str.s->len : 0) + (entry->is_dir ? 1 : 0);
+ offset += 4 + entry->filename_len + sizeof(entry_buffer) + (entry->metadata_str.s ? ZSTR_LEN(entry->metadata_str.s) : 0) + (entry->is_dir ? 1 : 0);
/* compress and rehash as necessary */
if ((oldfile && !entry->is_modified) || entry->is_dir) {
phar->alias_len = 0;
}
- manifest_len = offset + phar->alias_len + sizeof(manifest) + (main_metadata_str.s ? main_metadata_str.s->len : 0);
+ manifest_len = offset + phar->alias_len + sizeof(manifest) + (main_metadata_str.s ? ZSTR_LEN(main_metadata_str.s) : 0);
phar_set_32(manifest, manifest_len);
/* Hack - see bug #65028, add padding byte to the end of the manifest */
if(manifest[0] == '\r' || manifest[0] == '\n') {
phar->alias_len = restore_alias_len;
- phar_set_32(manifest, main_metadata_str.s ? main_metadata_str.s->len : 0);
- if (4 != php_stream_write(newfile, manifest, 4) || ((main_metadata_str.s ? main_metadata_str.s->len : 0)
- && main_metadata_str.s->len != php_stream_write(newfile, main_metadata_str.s->val, main_metadata_str.s->len))) {
+ phar_set_32(manifest, main_metadata_str.s ? ZSTR_LEN(main_metadata_str.s) : 0);
+ if (4 != php_stream_write(newfile, manifest, 4) || ((main_metadata_str.s ? ZSTR_LEN(main_metadata_str.s) : 0)
+ && ZSTR_LEN(main_metadata_str.s) != php_stream_write(newfile, ZSTR_VAL(main_metadata_str.s), ZSTR_LEN(main_metadata_str.s)))) {
smart_str_free(&main_metadata_str);
if (closeoldfile) {
phar_set_32(entry_buffer+8, entry->compressed_filesize);
phar_set_32(entry_buffer+12, entry->crc32);
phar_set_32(entry_buffer+16, entry->flags);
- phar_set_32(entry_buffer+20, entry->metadata_str.s ? entry->metadata_str.s->len : 0);
+ phar_set_32(entry_buffer+20, entry->metadata_str.s ? ZSTR_LEN(entry->metadata_str.s) : 0);
if (sizeof(entry_buffer) != php_stream_write(newfile, entry_buffer, sizeof(entry_buffer))
|| (entry->metadata_str.s &&
- entry->metadata_str.s->len != php_stream_write(newfile, entry->metadata_str.s->val, entry->metadata_str.s->len))) {
+ ZSTR_LEN(entry->metadata_str.s) != php_stream_write(newfile, ZSTR_VAL(entry->metadata_str.s), ZSTR_LEN(entry->metadata_str.s)))) {
if (closeoldfile) {
php_stream_close(oldfile);
}
if (!value) {
/* failure in get_current_data */
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned no value", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned no value", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
php_stream_from_zval_no_verify(fp, value);
if (!fp) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Iterator %v returned an invalid stream handle", ce->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Iterator %v returned an invalid stream handle", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
if (Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
save = str_key;
zval_dtor(&key);
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
spl_filesystem_object *intern = (spl_filesystem_object*)((char*)Z_OBJ_P(value) - Z_OBJ_P(value)->handlers->offset);
if (!base_len) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Iterator %v returns an SplFileInfo object, so base directory must be specified", ce->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Iterator %v returns an SplFileInfo object, so base directory must be specified", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
}
/* fall-through */
default:
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid value (must return a string)", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid value (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
}
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that is not in the base directory \"%s\"", ce->name->val, fname, base);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that is not in the base directory \"%s\"", ZSTR_VAL(ce->name), fname, base);
if (save) {
efree(save);
if (Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
save = str_key;
zval_dtor(&key);
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
}
#if PHP_API_VERSION < 20100412
if (PG(safe_mode) && (!php_checkuid(fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that safe mode prevents opening", ce->name->val, fname);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that safe mode prevents opening", ZSTR_VAL(ce->name), fname);
if (save) {
efree(save);
#endif
if (php_check_open_basedir(fname)) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that open_basedir prevents opening", ce->name->val, fname);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that open_basedir prevents opening", ZSTR_VAL(ce->name), fname);
if (save) {
efree(save);
fp = php_stream_open_wrapper(fname, "rb", STREAM_MUST_SEEK|0, &opened);
if (!fp) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a file that could not be opened \"%s\"", ce->name->val, fname);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a file that could not be opened \"%s\"", ZSTR_VAL(ce->name), fname);
if (save) {
efree(save);
carry_on:
buf = zend_string_alloc(len, 0);
- if (len != php_stream_read(fp, buf->val, len)) {
+ if (len != php_stream_read(fp, ZSTR_VAL(buf), len)) {
if (fp != phar_obj->archive->fp) {
php_stream_close(fp);
}
php_stream_close(fp);
}
- buf->val[len] = '\0';
- buf->len = len;
+ ZSTR_VAL(buf)[len] = '\0';
+ ZSTR_LEN(buf) = len;
RETVAL_STR(buf);
}
/* }}}*/
zend_string *str_key;
ZEND_HASH_FOREACH_STR_KEY(&phar->mounted_dirs, str_key) {
- if ((int)str_key->len >= internal_file_len || strncmp(str_key->val, internal_file, str_key->len)) {
+ if ((int)ZSTR_LEN(str_key) >= internal_file_len || strncmp(ZSTR_VAL(str_key), internal_file, ZSTR_LEN(str_key))) {
continue;
} else {
char *test;
if (!entry->tmp || !entry->is_mounted) {
goto free_resource;
}
- test_len = spprintf(&test, MAXPATHLEN, "%s%s", entry->tmp, internal_file + str_key->len);
+ test_len = spprintf(&test, MAXPATHLEN, "%s%s", entry->tmp, internal_file + ZSTR_LEN(str_key));
if (SUCCESS != php_stream_stat_path(test, &ssbi)) {
efree(test);
continue;
str_key = b->key;
entry = Z_PTR(b->val);
if (!entry->is_deleted &&
- str_key->len > from_len &&
- memcmp(str_key->val, resource_from->path+1, from_len) == 0 &&
- IS_SLASH(str_key->val[from_len])) {
+ ZSTR_LEN(str_key) > from_len &&
+ memcmp(ZSTR_VAL(str_key), resource_from->path+1, from_len) == 0 &&
+ IS_SLASH(ZSTR_VAL(str_key)[from_len])) {
- new_str_key = zend_string_alloc(str_key->len + to_len - from_len, 0);
- memcpy(new_str_key->val, resource_to->path + 1, to_len);
- memcpy(new_str_key->val + to_len, str_key->val + from_len, str_key->len - from_len);
- new_str_key->val[new_str_key->len] = 0;
+ new_str_key = zend_string_alloc(ZSTR_LEN(str_key) + to_len - from_len, 0);
+ memcpy(ZSTR_VAL(new_str_key), resource_to->path + 1, to_len);
+ memcpy(ZSTR_VAL(new_str_key) + to_len, ZSTR_VAL(str_key) + from_len, ZSTR_LEN(str_key) - from_len);
+ ZSTR_VAL(new_str_key)[ZSTR_LEN(new_str_key)] = 0;
is_modified = 1;
entry->is_modified = 1;
efree(entry->filename);
// TODO: avoid reallocation (make entry->filename zend_string*)
- entry->filename = estrndup(new_str_key->val, new_str_key->len);
- entry->filename_len = new_str_key->len;
+ entry->filename = estrndup(ZSTR_VAL(new_str_key), ZSTR_LEN(new_str_key));
+ entry->filename_len = ZSTR_LEN(new_str_key);
zend_string_release(str_key);
b->h = zend_string_hash_val(new_str_key);
ZEND_HASH_FOREACH_BUCKET(&phar->virtual_dirs, b) {
str_key = b->key;
- if (str_key->len >= from_len &&
- memcmp(str_key->val, resource_from->path+1, from_len) == 0 &&
- (str_key->len == from_len || IS_SLASH(str_key->val[from_len]))) {
+ if (ZSTR_LEN(str_key) >= from_len &&
+ memcmp(ZSTR_VAL(str_key), resource_from->path+1, from_len) == 0 &&
+ (ZSTR_LEN(str_key) == from_len || IS_SLASH(ZSTR_VAL(str_key)[from_len]))) {
- new_str_key = zend_string_alloc(str_key->len + to_len - from_len, 0);
- memcpy(new_str_key->val, resource_to->path + 1, to_len);
- memcpy(new_str_key->val + to_len, str_key->val + from_len, str_key->len - from_len);
- new_str_key->val[new_str_key->len] = 0;
+ new_str_key = zend_string_alloc(ZSTR_LEN(str_key) + to_len - from_len, 0);
+ memcpy(ZSTR_VAL(new_str_key), resource_to->path + 1, to_len);
+ memcpy(ZSTR_VAL(new_str_key) + to_len, ZSTR_VAL(str_key) + from_len, ZSTR_LEN(str_key) - from_len);
+ ZSTR_VAL(new_str_key)[ZSTR_LEN(new_str_key)] = 0;
zend_string_release(str_key);
b->h = zend_string_hash_val(new_str_key);
ZEND_HASH_FOREACH_BUCKET(&phar->mounted_dirs, b) {
str_key = b->key;
- if (str_key->len >= from_len &&
- memcmp(str_key->val, resource_from->path+1, from_len) == 0 &&
- (str_key->len == from_len || IS_SLASH(str_key->val[from_len]))) {
-
- new_str_key = zend_string_alloc(str_key->len + to_len - from_len, 0);
- memcpy(new_str_key->val, resource_to->path + 1, to_len);
- memcpy(new_str_key->val + to_len, str_key->val + from_len, str_key->len - from_len);
- new_str_key->val[new_str_key->len] = 0;
+ if (ZSTR_LEN(str_key) >= from_len &&
+ memcmp(ZSTR_VAL(str_key), resource_from->path+1, from_len) == 0 &&
+ (ZSTR_LEN(str_key) == from_len || IS_SLASH(ZSTR_VAL(str_key)[from_len]))) {
+
+ new_str_key = zend_string_alloc(ZSTR_LEN(str_key) + to_len - from_len, 0);
+ memcpy(ZSTR_VAL(new_str_key), resource_to->path + 1, to_len);
+ memcpy(ZSTR_VAL(new_str_key) + to_len, ZSTR_VAL(str_key) + from_len, ZSTR_LEN(str_key) - from_len);
+ ZSTR_VAL(new_str_key)[ZSTR_LEN(new_str_key)] = 0;
zend_string_release(str_key);
b->h = zend_string_hash_val(new_str_key);
PHP_VAR_SERIALIZE_INIT(metadata_hash);
php_var_serialize(&entry->metadata_str, metadata, &metadata_hash);
PHP_VAR_SERIALIZE_DESTROY(metadata_hash);
- entry->uncompressed_filesize = entry->compressed_filesize = entry->metadata_str.s ? entry->metadata_str.s->len : 0;
+ entry->uncompressed_filesize = entry->compressed_filesize = entry->metadata_str.s ? ZSTR_LEN(entry->metadata_str.s) : 0;
if (entry->fp && entry->fp_type == PHAR_MOD) {
php_stream_close(entry->fp);
spprintf(error, 0, "phar error: unable to create temporary file");
return -1;
}
- if (entry->metadata_str.s->len != php_stream_write(entry->fp, entry->metadata_str.s->val, entry->metadata_str.s->len)) {
+ if (ZSTR_LEN(entry->metadata_str.s) != php_stream_write(entry->fp, ZSTR_VAL(entry->metadata_str.s), ZSTR_LEN(entry->metadata_str.s))) {
spprintf(error, 0, "phar tar error: unable to write metadata to magic metadata file \"%s\"", entry->filename);
zend_hash_str_del(&(entry->phar->manifest), entry->filename, entry->filename_len);
return ZEND_HASH_APPLY_STOP;
{
zend_string *str = php_stream_copy_to_mem(stubfile, len, 0);
if (str) {
- len = str->len;
- user_stub = estrndup(str->val, str->len);
+ len = ZSTR_LEN(str);
+ user_stub = estrndup(ZSTR_VAL(str), ZSTR_LEN(str));
zend_string_release(str);
} else {
user_stub = NULL;
ret = php_resolve_path(filename, filename_len, path);
efree(path);
- if (ret && ret->len > 8 && !strncmp(ret->val, "phar://", 7)) {
+ if (ret && ZSTR_LEN(ret) > 8 && !strncmp(ZSTR_VAL(ret), "phar://", 7)) {
/* found phar:// */
- if (SUCCESS != phar_split_fname(ret->val, ret->len, &arch, &arch_len, &entry, &entry_len, 1, 0)) {
+ if (SUCCESS != phar_split_fname(ZSTR_VAL(ret), ZSTR_LEN(ret), &arch, &arch_len, &entry, &entry_len, 1, 0)) {
return ret;
}
zend_string *str_key;
ZEND_HASH_FOREACH_STR_KEY(&phar->mounted_dirs, str_key) {
- if ((int)str_key->len >= path_len || strncmp(str_key->val, path, str_key->len)) {
+ if ((int)ZSTR_LEN(str_key) >= path_len || strncmp(ZSTR_VAL(str_key), path, ZSTR_LEN(str_key))) {
continue;
} else {
char *test;
if (NULL == (entry = zend_hash_find_ptr(&phar->manifest, str_key))) {
if (error) {
- spprintf(error, 4096, "phar internal error: mounted path \"%s\" could not be retrieved from manifest", str_key->val);
+ spprintf(error, 4096, "phar internal error: mounted path \"%s\" could not be retrieved from manifest", ZSTR_VAL(str_key));
}
return NULL;
}
if (!entry->tmp || !entry->is_mounted) {
if (error) {
- spprintf(error, 4096, "phar internal error: mounted path \"%s\" is not properly initialized as a mounted path", str_key->val);
+ spprintf(error, 4096, "phar internal error: mounted path \"%s\" is not properly initialized as a mounted path", ZSTR_VAL(str_key));
}
return NULL;
}
- test_len = spprintf(&test, MAXPATHLEN, "%s%s", entry->tmp, path + str_key->len);
+ test_len = spprintf(&test, MAXPATHLEN, "%s%s", entry->tmp, path + ZSTR_LEN(str_key));
if (SUCCESS != php_stream_stat_path(test, &ssb)) {
efree(test);
pfp = php_stream_open_wrapper(pfile, "rb", 0, NULL);
efree(pfile);
- if (!pfp || !(pubkey = php_stream_copy_to_mem(pfp, PHP_STREAM_COPY_ALL, 0)) || !pubkey->len) {
+ if (!pfp || !(pubkey = php_stream_copy_to_mem(pfp, PHP_STREAM_COPY_ALL, 0)) || !ZSTR_LEN(pubkey)) {
if (pfp) {
php_stream_close(pfp);
}
#ifndef PHAR_HAVE_OPENSSL
tempsig = sig_len;
- if (FAILURE == phar_call_openssl_signverify(0, fp, end_of_phar, pubkey ? pubkey->val : NULL, pubkey ? pubkey->len : 0, &sig, &tempsig)) {
+ if (FAILURE == phar_call_openssl_signverify(0, fp, end_of_phar, pubkey ? ZSTR_VAL(pubkey) : NULL, pubkey ? ZSTR_LEN(pubkey) : 0, &sig, &tempsig)) {
if (pubkey) {
zend_string_release(pubkey);
}
sig_len = tempsig;
#else
- in = BIO_new_mem_buf(pubkey ? pubkey->val : NULL, pubkey ? pubkey->len : 0);
+ in = BIO_new_mem_buf(pubkey ? ZSTR_VAL(pubkey) : NULL, pubkey ? ZSTR_LEN(pubkey) : 0);
if (NULL == in) {
zend_string_release(pubkey);
{
zend_string *str = php_stream_copy_to_mem(fp, entry.uncompressed_filesize, 0);
if (str) {
- entry.uncompressed_filesize = str->len;
- actual_alias = estrndup(str->val, str->len);
+ entry.uncompressed_filesize = ZSTR_LEN(str);
+ actual_alias = estrndup(ZSTR_VAL(str), ZSTR_LEN(str));
zend_string_release(str);
} else {
actual_alias = NULL;
{
zend_string *str = php_stream_copy_to_mem(fp, entry.uncompressed_filesize, 0);
if (str) {
- entry.uncompressed_filesize = str->len;
- actual_alias = estrndup(str->val, str->len);
+ entry.uncompressed_filesize = ZSTR_LEN(str);
+ actual_alias = estrndup(ZSTR_VAL(str), ZSTR_LEN(str));
zend_string_release(str);
} else {
actual_alias = NULL;
{
zend_string *str = php_stream_copy_to_mem(fp, entry.uncompressed_filesize, 0);
if (str) {
- entry.uncompressed_filesize = str->len;
- actual_alias = estrndup(str->val, str->len);
+ entry.uncompressed_filesize = ZSTR_LEN(str);
+ actual_alias = estrndup(ZSTR_VAL(str), ZSTR_LEN(str));
zend_string_release(str);
} else {
actual_alias = NULL;
PHP_VAR_SERIALIZE_INIT(metadata_hash);
php_var_serialize(&entry->metadata_str, &entry->metadata, &metadata_hash);
PHP_VAR_SERIALIZE_DESTROY(metadata_hash);
- PHAR_SET_16(central.comment_len, entry->metadata_str.s->len);
+ PHAR_SET_16(central.comment_len, ZSTR_LEN(entry->metadata_str.s));
}
entry->header_offset = php_stream_tell(p->filefp);
entry->fp_type = PHAR_FP;
if (entry->metadata_str.s) {
- if (entry->metadata_str.s->len != php_stream_write(p->centralfp, entry->metadata_str.s->val, entry->metadata_str.s->len)) {
+ if (ZSTR_LEN(entry->metadata_str.s) != php_stream_write(p->centralfp, ZSTR_VAL(entry->metadata_str.s), ZSTR_LEN(entry->metadata_str.s))) {
spprintf(p->error, 0, "unable to write metadata as file comment for file \"%s\" while creating zip-based phar \"%s\"", entry->filename, entry->phar->fname);
smart_str_free(&entry->metadata_str);
return ZEND_HASH_APPLY_STOP;
php_stream_seek(pass->centralfp, 0, SEEK_SET);
php_stream_copy_to_stream_ex(pass->centralfp, newfile, tell, NULL);
if (metadata->s) {
- php_stream_write(newfile, metadata->s->val, metadata->s->len);
+ php_stream_write(newfile, ZSTR_VAL(metadata->s), ZSTR_LEN(metadata->s));
}
if (FAILURE == phar_create_signature(phar, newfile, &signature, &signature_length, pass->error)) {
{
zend_string *str = php_stream_copy_to_mem(stubfile, len, 0);
if (str) {
- len = str->len;
- user_stub = estrndup(str->val, str->len);
+ len = ZSTR_LEN(str);
+ user_stub = estrndup(ZSTR_VAL(str), ZSTR_LEN(str));
zend_string_release(str);
} else {
user_stub = NULL;
if (Z_TYPE(phar->metadata) != IS_UNDEF) {
/* set phar metadata */
- PHAR_SET_16(eocd.comment_len, main_metadata_str.s->len);
+ PHAR_SET_16(eocd.comment_len, ZSTR_LEN(main_metadata_str.s));
if (sizeof(eocd) != php_stream_write(pass.filefp, (char *)&eocd, sizeof(eocd))) {
if (error) {
goto nocentralerror;
}
- if (main_metadata_str.s->len != php_stream_write(pass.filefp, main_metadata_str.s->val, main_metadata_str.s->len)) {
+ if (ZSTR_LEN(main_metadata_str.s) != php_stream_write(pass.filefp, ZSTR_VAL(main_metadata_str.s), ZSTR_LEN(main_metadata_str.s))) {
if (error) {
spprintf(error, 4096, "phar zip flush of \"%s\" failed: unable to write metadata to zip comment", phar->fname);
}
}
if (!zend_is_callable(arg, 0, &name)) {
- php_error_docref(NULL, E_WARNING, "%s is not callable", name->val);
+ php_error_docref(NULL, E_WARNING, "%s is not callable", ZSTR_VAL(name));
zend_string_release(name);
RETURN_FALSE;
}
}
if (!zend_is_callable(callback, 0, &name)) {
- php_error_docref(NULL, E_WARNING, "%s is not callable", name->val);
+ php_error_docref(NULL, E_WARNING, "%s is not callable", ZSTR_VAL(name));
zend_string_release(name);
RETURN_FALSE;
}
}
while(zend_hash_has_more_elements(ht) == SUCCESS) {
zend_hash_get_current_key(ht, &name, &number);
- if (!textlen || !strncmp(name->val, text, textlen)) {
+ if (!textlen || !strncmp(ZSTR_VAL(name), text, textlen)) {
if (pData) {
*pData = zend_hash_get_current_data_ptr(ht);
}
zend_hash_move_forward(ht);
- return name->val;
+ return ZSTR_VAL(name);
}
if (zend_hash_move_forward(ht) == FAILURE) {
break;
char *retval = cli_completion_generator_ht(text, textlen, state, ht, (void**)&func);
if (retval) {
rl_completion_append_character = '(';
- retval = strdup(func->common.function_name->val);
+ retval = strdup(ZSTR_VAL(func->common.function_name));
}
return retval;
char *retval = cli_completion_generator_ht(text, textlen, state, EG(class_table), (void**)&ce);
if (retval) {
rl_completion_append_character = '\0';
- retval = strdup(ce->name->val);
+ retval = strdup(ZSTR_VAL(ce->name));
}
return retval;
if (class_name_end) {
class_name_len = class_name_end - text;
class_name = zend_string_alloc(class_name_len, 0);
- zend_str_tolower_copy(class_name->val, text, class_name_len);
+ zend_str_tolower_copy(ZSTR_VAL(class_name), text, class_name_len);
if ((ce = zend_lookup_class(class_name)) == NULL) {
zend_string_release(class_name);
return NULL;
int len = class_name_len + 2 + strlen(retval) + 1;
char *tmp = malloc(len);
- snprintf(tmp, len, "%s::%s", ce->name->val, retval);
+ snprintf(tmp, len, "%s::%s", ZSTR_VAL(ce->name), retval);
free(retval);
retval = tmp;
}
read_history(history_file);
EG(exit_status) = 0;
- while ((line = readline(prompt->val)) != NULL) {
+ while ((line = readline(ZSTR_VAL(prompt))) != NULL) {
if (strcmp(line, "exit") == 0 || strcmp(line, "quit") == 0) {
free(line);
break;
{
str->buf= zend_string_alloc(1024, 0);
str->alloced = 1024;
- str->buf->val[0] = '\0';
- str->buf->len = 0;
+ ZSTR_VAL(str->buf)[0] = '\0';
+ ZSTR_LEN(str->buf) = 0;
}
static string *string_printf(string *str, const char *format, ...)
va_start(arg, format);
len = zend_vspprintf(&s_tmp, 0, format, arg);
if (len) {
- register size_t nlen = (str->buf->len + 1 + len + (1024 - 1)) & ~(1024 - 1);
+ register size_t nlen = (ZSTR_LEN(str->buf) + 1 + len + (1024 - 1)) & ~(1024 - 1);
if (str->alloced < nlen) {
- size_t old_len = str->buf->len;
+ size_t old_len = ZSTR_LEN(str->buf);
str->alloced = nlen;
str->buf = zend_string_extend(str->buf, str->alloced, 0);
- str->buf->len = old_len;
+ ZSTR_LEN(str->buf) = old_len;
}
- memcpy(str->buf->val + str->buf->len, s_tmp, len + 1);
- str->buf->len += len;
+ memcpy(ZSTR_VAL(str->buf) + ZSTR_LEN(str->buf), s_tmp, len + 1);
+ ZSTR_LEN(str->buf) += len;
}
efree(s_tmp);
va_end(arg);
static string *string_write(string *str, char *buf, size_t len)
{
- register size_t nlen = (str->buf->len + 1 + len + (1024 - 1)) & ~(1024 - 1);
+ register size_t nlen = (ZSTR_LEN(str->buf) + 1 + len + (1024 - 1)) & ~(1024 - 1);
if (str->alloced < nlen) {
- size_t old_len = str->buf->len;
+ size_t old_len = ZSTR_LEN(str->buf);
str->alloced = nlen;
str->buf = zend_string_extend(str->buf, str->alloced, 0);
- str->buf->len = old_len;
+ ZSTR_LEN(str->buf) = old_len;
}
- memcpy(str->buf->val + str->buf->len, buf, len);
- str->buf->len += len;
- str->buf->val[str->buf->len] = '\0';
+ memcpy(ZSTR_VAL(str->buf) + ZSTR_LEN(str->buf), buf, len);
+ ZSTR_LEN(str->buf) += len;
+ ZSTR_VAL(str->buf)[ZSTR_LEN(str->buf)] = '\0';
return str;
}
static string *string_append(string *str, string *append)
{
- if (append->buf->len > 0) {
- string_write(str, append->buf->val, append->buf->len);
+ if (ZSTR_LEN(append->buf) > 0) {
+ string_write(str, ZSTR_VAL(append->buf), ZSTR_LEN(append->buf));
}
return str;
}
}
string_printf(str, "class ");
}
- string_printf(str, "%s", ce->name->val);
+ string_printf(str, "%s", ZSTR_VAL(ce->name));
if (ce->parent) {
- string_printf(str, " extends %s", ce->parent->name->val);
+ string_printf(str, " extends %s", ZSTR_VAL(ce->parent->name));
}
if (ce->num_interfaces) {
uint32_t i;
if (ce->ce_flags & ZEND_ACC_INTERFACE) {
- string_printf(str, " extends %s", ce->interfaces[0]->name->val);
+ string_printf(str, " extends %s", ZSTR_VAL(ce->interfaces[0]->name));
} else {
- string_printf(str, " implements %s", ce->interfaces[0]->name->val);
+ string_printf(str, " implements %s", ZSTR_VAL(ce->interfaces[0]->name));
}
for (i = 1; i < ce->num_interfaces; ++i) {
- string_printf(str, ", %s", ce->interfaces[i]->name->val);
+ string_printf(str, ", %s", ZSTR_VAL(ce->interfaces[i]->name));
}
}
string_printf(str, " ] {\n");
/* The information where a class is declared is only available for user classes */
if (ce->type == ZEND_USER_CLASS) {
- string_printf(str, "%s @@ %s %d-%d\n", indent, ce->info.user.filename->val,
+ string_printf(str, "%s @@ %s %d-%d\n", indent, ZSTR_VAL(ce->info.user.filename),
ce->info.user.line_start, ce->info.user.line_end);
}
ZEND_HASH_FOREACH_STR_KEY_VAL(&ce->constants_table, key, value) {
zval_update_constant_ex(value, 1, NULL);
- _const_string(str, key->val, value, indent);
+ _const_string(str, ZSTR_VAL(key), value, indent);
} ZEND_HASH_FOREACH_END();
}
string_printf(str, "%s }\n", indent);
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
if ((prop->flags & ZEND_ACC_STATIC) && !(prop->flags & ZEND_ACC_SHADOW)) {
- _property_string(str, prop, NULL, sub_indent.buf->val);
+ _property_string(str, prop, NULL, ZSTR_VAL(sub_indent.buf));
}
} ZEND_HASH_FOREACH_END();
}
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
string_printf(str, "\n");
- _function_string(str, mptr, ce, sub_indent.buf->val);
+ _function_string(str, mptr, ce, ZSTR_VAL(sub_indent.buf));
}
} ZEND_HASH_FOREACH_END();
} else {
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
if (!(prop->flags & (ZEND_ACC_STATIC|ZEND_ACC_SHADOW))) {
- _property_string(str, prop, NULL, sub_indent.buf->val);
+ _property_string(str, prop, NULL, ZSTR_VAL(sub_indent.buf));
}
} ZEND_HASH_FOREACH_END();
}
if (properties && zend_hash_num_elements(properties)) {
ZEND_HASH_FOREACH_STR_KEY(properties, prop_name) {
- if (prop_name && prop_name->len && prop_name->val[0]) { /* skip all private and protected properties */
+ if (prop_name && ZSTR_LEN(prop_name) && ZSTR_VAL(prop_name)[0]) { /* skip all private and protected properties */
if (!zend_hash_exists(&ce->properties_info, prop_name)) {
count++;
- _property_string(&dyn, NULL, prop_name->val, sub_indent.buf->val);
+ _property_string(&dyn, NULL, ZSTR_VAL(prop_name), ZSTR_VAL(sub_indent.buf));
}
}
} ZEND_HASH_FOREACH_END();
if ((mptr->common.fn_flags & ZEND_ACC_STATIC) == 0
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
- size_t len = mptr->common.function_name->len;
+ size_t len = ZSTR_LEN(mptr->common.function_name);
/* Do not display old-style inherited constructors */
if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0
|| mptr->common.scope == ce
|| !key
- || zend_binary_strcasecmp(key->val, key->len, mptr->common.function_name->val, len) == 0)
+ || zend_binary_strcasecmp(ZSTR_VAL(key), ZSTR_LEN(key), ZSTR_VAL(mptr->common.function_name), len) == 0)
{
zend_function *closure;
/* see if this is a closure */
if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
- && memcmp(mptr->common.function_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
+ && memcmp(ZSTR_VAL(mptr->common.function_name), ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
&& (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj))) != NULL)
{
mptr = closure;
closure = NULL;
}
string_printf(&dyn, "\n");
- _function_string(&dyn, mptr, ce, sub_indent.buf->val);
+ _function_string(&dyn, mptr, ce, ZSTR_VAL(sub_indent.buf));
count++;
_free_function(closure);
}
zend_string *value_str = zval_get_string(value);
string_printf(str, "%s Constant [ %s %s ] { %s }\n",
- indent, type, name, value_str->val);
+ indent, type, name, ZSTR_VAL(value_str));
zend_string_release(value_str);
}
(fptr->type == ZEND_INTERNAL_FUNCTION &&
!(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) ?
((zend_internal_arg_info*)arg_info)->class_name :
- arg_info->class_name->val);
+ ZSTR_VAL(arg_info->class_name));
if (arg_info->allow_null) {
string_printf(str, "or NULL ");
}
(fptr->type == ZEND_INTERNAL_FUNCTION &&
!(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) ?
((zend_internal_arg_info*)arg_info)->name :
- arg_info->name->val);
+ ZSTR_VAL(arg_info->name));
} else {
string_printf(str, "$param%d", offset);
}
string_write(str, "Array", sizeof("Array")-1);
} else {
zend_string *zv_str = zval_get_string(&zv);
- string_write(str, zv_str->val, zv_str->len);
+ string_write(str, ZSTR_VAL(zv_str), ZSTR_LEN(zv_str));
zend_string_release(zv_str);
}
zval_ptr_dtor(&zv);
string_printf(str, "%s- Bound Variables [%d] {\n", indent, zend_hash_num_elements(static_variables));
i = 0;
ZEND_HASH_FOREACH_STR_KEY(static_variables, key) {
- string_printf(str, "%s Variable #%d [ $%s ]\n", indent, i++, key->val);
+ string_printf(str, "%s Variable #%d [ $%s ]\n", indent, i++, ZSTR_VAL(key));
} ZEND_HASH_FOREACH_END();
string_printf(str, "%s}\n", indent);
}
* swallowed, leading to an unaligned comment.
*/
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
- string_printf(str, "%s%s\n", indent, fptr->op_array.doc_comment->val);
+ string_printf(str, "%s%s\n", indent, ZSTR_VAL(fptr->op_array.doc_comment));
}
string_write(str, indent, strlen(indent));
if (scope && fptr->common.scope) {
if (fptr->common.scope != scope) {
- string_printf(str, ", inherits %s", fptr->common.scope->name->val);
+ string_printf(str, ", inherits %s", ZSTR_VAL(fptr->common.scope->name));
} else if (fptr->common.scope->parent) {
- lc_name_len = fptr->common.function_name->len;
+ lc_name_len = ZSTR_LEN(fptr->common.function_name);
lc_name = zend_string_alloc(lc_name_len, 0);
- zend_str_tolower_copy(lc_name->val, fptr->common.function_name->val, lc_name_len);
+ zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(fptr->common.function_name), lc_name_len);
if ((overwrites = zend_hash_find_ptr(&fptr->common.scope->parent->function_table, lc_name)) != NULL) {
if (fptr->common.scope != overwrites->common.scope) {
- string_printf(str, ", overwrites %s", overwrites->common.scope->name->val);
+ string_printf(str, ", overwrites %s", ZSTR_VAL(overwrites->common.scope->name));
}
}
efree(lc_name);
}
}
if (fptr->common.prototype && fptr->common.prototype->common.scope) {
- string_printf(str, ", prototype %s", fptr->common.prototype->common.scope->name->val);
+ string_printf(str, ", prototype %s", ZSTR_VAL(fptr->common.prototype->common.scope->name));
}
if (fptr->common.fn_flags & ZEND_ACC_CTOR) {
string_printf(str, ", ctor");
if (fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
string_printf(str, "&");
}
- string_printf(str, "%s ] {\n", fptr->common.function_name->val);
+ string_printf(str, "%s ] {\n", ZSTR_VAL(fptr->common.function_name));
/* The information where a function is declared is only available for user classes */
if (fptr->type == ZEND_USER_FUNCTION) {
string_printf(str, "%s @@ %s %d - %d\n", indent,
- fptr->op_array.filename->val,
+ ZSTR_VAL(fptr->op_array.filename),
fptr->op_array.line_start,
fptr->op_array.line_end);
}
string_init(¶m_indent);
string_printf(¶m_indent, "%s ", indent);
if (fptr->common.fn_flags & ZEND_ACC_CLOSURE) {
- _function_closure_string(str, fptr, param_indent.buf->val);
+ _function_closure_string(str, fptr, ZSTR_VAL(param_indent.buf));
}
- _function_parameter_string(str, fptr, param_indent.buf->val);
+ _function_parameter_string(str, fptr, ZSTR_VAL(param_indent.buf));
string_free(¶m_indent);
if (fptr->op_array.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
string_printf(str, " %s- Return [ ", indent);
(fptr->type == ZEND_INTERNAL_FUNCTION &&
!(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) ?
((zend_internal_arg_info*)(fptr->common.arg_info - 1))->class_name :
- fptr->common.arg_info[-1].class_name->val);
+ ZSTR_VAL(fptr->common.arg_info[-1].class_name));
if (fptr->common.arg_info[-1].allow_null) {
string_printf(str, "or NULL ");
}
char *comma = "";
if (number == ini_entry->module_number) {
- string_printf(str, " %sEntry [ %s <", indent, ini_entry->name->val);
+ string_printf(str, " %sEntry [ %s <", indent, ZSTR_VAL(ini_entry->name));
if (ini_entry->modifiable == ZEND_INI_ALL) {
string_printf(str, "ALL");
} else {
}
string_printf(str, "> ]\n");
- string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value->val : "");
+ string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ZSTR_VAL(ini_entry->value) : "");
if (ini_entry->modified) {
- string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value->val : "");
+ string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ZSTR_VAL(ini_entry->orig_value) : "");
}
string_printf(str, " %s}\n", indent);
}
if ((ce->type == ZEND_INTERNAL_CLASS) && ce->info.internal.module && !strcasecmp(ce->info.internal.module->name, module->name)) {
/* dump class if it is not an alias */
- if (!zend_binary_strcasecmp(ce->name->val, ce->name->len, hash_key->key->val, hash_key->key->len)) {
+ if (!zend_binary_strcasecmp(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(hash_key->key), ZSTR_LEN(hash_key->key))) {
string_printf(str, "\n");
_class_string(str, ce, NULL, indent);
(*num_classes)++;
int *num_classes = va_arg(args, int*);
if (constant->module_number == module->module_number) {
- _const_string(str, constant->name->val, &constant->value, indent);
+ _const_string(str, ZSTR_VAL(constant->name), &constant->value, indent);
(*num_classes)++;
}
return ZEND_HASH_APPLY_KEEP;
string str_ini;
string_init(&str_ini);
zend_hash_apply_with_arguments(EG(ini_directives), (apply_func_args_t) _extension_ini_string, 3, &str_ini, indent, module->module_number);
- if (str_ini.buf->len > 0) {
+ if (ZSTR_LEN(str_ini.buf) > 0) {
string_printf(str, "\n - INI {\n");
string_append(str, &str_ini);
string_printf(str, "%s }\n", indent);
string_init(&sub_indent);
string_printf(&sub_indent, "%s ", indent);
string_init(&str_classes);
- zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t) _extension_class_string, 4, &str_classes, sub_indent.buf->val, module, &num_classes);
+ zend_hash_apply_with_arguments(EG(class_table), (apply_func_args_t) _extension_class_string, 4, &str_classes, ZSTR_VAL(sub_indent.buf), module, &num_classes);
if (num_classes) {
string_printf(str, "\n - Classes [%d] {", num_classes);
string_append(str, &str_classes);
struct _zend_module_entry *module;
lcname = zend_string_alloc(name_len, 0);
- zend_str_tolower_copy(lcname->val, name_str, name_len);
+ zend_str_tolower_copy(ZSTR_VAL(lcname), name_str, name_len);
module = zend_hash_find_ptr(&module_registry, lcname);
zend_string_free(lcname);
if (!module) {
}
if (Z_TYPE(retval) == IS_UNDEF) {
- php_error_docref(NULL, E_WARNING, "%s::__toString() did not return anything", Z_OBJCE_P(object)->name->val);
+ php_error_docref(NULL, E_WARNING, "%s::__toString() did not return anything", ZSTR_VAL(Z_OBJCE_P(object)->name));
RETURN_FALSE;
}
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Invocation of function %s() failed", fptr->common.function_name->val);
+ "Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
return;
}
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Invocation of function %s() failed", fptr->common.function_name->val);
+ "Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
return;
}
} else if ((fptr = zend_hash_str_find_ptr(&ce->function_table, lcname, lcname_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Method %s::%s() does not exist", ce->name->val, Z_STRVAL_P(method));
+ "Method %s::%s() does not exist", ZSTR_VAL(ce->name), Z_STRVAL_P(method));
return;
}
efree(lcname);
is_closure = 1;
} else if ((fptr = zend_hash_str_find_ptr(&ce->function_table, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Method %s::%s() does not exist", ce->name->val, ZEND_INVOKE_FUNC_NAME);
+ "Method %s::%s() does not exist", ZSTR_VAL(ce->name), ZEND_INVOKE_FUNC_NAME);
return;
}
}
} else {
for (i = 0; i < num_args; i++) {
if (arg_info[i].name) {
- if (strcmp(arg_info[i].name->val, Z_STRVAL_P(parameter)) == 0) {
+ if (strcmp(ZSTR_VAL(arg_info[i].name), Z_STRVAL_P(parameter)) == 0) {
position= i;
break;
}
class_name = ((zend_internal_arg_info*)param->arg_info)->class_name;
class_name_len = strlen(class_name);
} else {
- class_name = param->arg_info->class_name->val;
- class_name_len = param->arg_info->class_name->len;
+ class_name = ZSTR_VAL(param->arg_info->class_name);
+ class_name_len = ZSTR_LEN(param->arg_info->class_name);
}
if (0 == zend_binary_strcasecmp(class_name, class_name_len, "self", sizeof("self")- 1)) {
ce = param->fptr->common.scope;
} else if ((mptr = zend_hash_str_find_ptr(&ce->function_table, lcname, name_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Method %s::%s() does not exist", ce->name->val, name_str);
+ "Method %s::%s() does not exist", ZSTR_VAL(ce->name), name_str);
return;
}
efree(lcname);
if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke abstract method %s::%s()",
- mptr->common.scope->name->val, mptr->common.function_name->val);
+ ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
} else {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke %s method %s::%s() from scope %s",
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
- mptr->common.scope->name->val, mptr->common.function_name->val,
- Z_OBJCE_P(getThis())->name->val);
+ ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name),
+ ZSTR_VAL(Z_OBJCE_P(getThis())->name));
}
return;
}
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Invocation of method %s::%s() failed", mptr->common.scope->name->val, mptr->common.function_name->val);
+ "Invocation of method %s::%s() failed", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
return;
}
if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke abstract method %s::%s()",
- mptr->common.scope->name->val, mptr->common.function_name->val);
+ ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
} else {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke %s method %s::%s() from scope %s",
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
- mptr->common.scope->name->val, mptr->common.function_name->val,
- Z_OBJCE_P(getThis())->name->val);
+ ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name),
+ ZSTR_VAL(Z_OBJCE_P(getThis())->name));
}
return;
}
efree(params);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke non static method %s::%s() without an object",
- mptr->common.scope->name->val, mptr->common.function_name->val);
+ ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
return;
}
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Invocation of method %s::%s() failed", mptr->common.scope->name->val, mptr->common.function_name->val);
+ "Invocation of method %s::%s() failed", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
return;
}
if (!mptr->common.prototype) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Method %s::%s does not have a prototype", intern->ce->name->val, mptr->common.function_name->val);
+ "Method %s::%s does not have a prototype", ZSTR_VAL(intern->ce->name), ZSTR_VAL(mptr->common.function_name));
return;
}
ZVAL_COPY(return_value, def_value);
} else {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Class %s does not have a property named %s", ce->name->val, name->val);
+ "Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
}
return;
} else {
variable_ptr = zend_std_get_static_property(ce, name, 1);
if (!variable_ptr) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Class %s does not have a property named %s", ce->name->val, name->val);
+ "Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
return;
}
zval_ptr_dtor(variable_ptr);
static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, zend_long filter, zval *obj)
{
zval method;
- size_t len = mptr->common.function_name->len;
+ size_t len = ZSTR_LEN(mptr->common.function_name);
zend_function *closure;
if (mptr->common.fn_flags & filter) {
if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
- && memcmp(mptr->common.function_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
+ && memcmp(ZSTR_VAL(mptr->common.function_name), ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
&& (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj))) != NULL)
{
mptr = closure;
return;
}
}
- str_name = name->val;
- str_name_len = name->len;
- if ((tmp = strstr(name->val, "::")) != NULL) {
- classname_len = tmp - name->val;
+ str_name = ZSTR_VAL(name);
+ str_name_len = ZSTR_LEN(name);
+ if ((tmp = strstr(ZSTR_VAL(name), "::")) != NULL) {
+ classname_len = tmp - ZSTR_VAL(name);
classname = zend_string_alloc(classname_len, 0);
- zend_str_tolower_copy(classname->val, name->val, classname_len);
- classname->val[classname_len] = '\0';
- str_name_len = name->len - (classname_len + 2);
+ zend_str_tolower_copy(ZSTR_VAL(classname), ZSTR_VAL(name), classname_len);
+ ZSTR_VAL(classname)[classname_len] = '\0';
+ str_name_len = ZSTR_LEN(name) - (classname_len + 2);
str_name = tmp + 2;
ce2 = zend_lookup_class(classname);
if (!ce2) {
if (!EG(exception)) {
- zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", classname->val);
+ zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", ZSTR_VAL(classname));
}
zend_string_release(classname);
return;
zend_string_release(classname);
if (!instanceof_function(ce, ce2)) {
- zend_throw_exception_ex(reflection_exception_ptr, -1, "Fully qualified property name %s::%s does not specify a base class of %s", ce2->name->val, str_name, ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, -1, "Fully qualified property name %s::%s does not specify a base class of %s", ZSTR_VAL(ce2->name), str_name, ZSTR_VAL(ce->name));
return;
}
ce = ce2;
return 0;
}
- if (hash_key->key->val[0] == '\0') {
+ if (ZSTR_VAL(hash_key->key)[0] == '\0') {
return 0; /* non public cannot be dynamic */
}
zend_fcall_info_cache fcc;
if (!(constructor->common.fn_flags & ZEND_ACC_PUBLIC)) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Access to non-public constructor of class %s", ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Access to non-public constructor of class %s", ZSTR_VAL(ce->name));
zval_dtor(return_value);
RETURN_NULL();
}
zval_ptr_dtor(¶ms[i]);
}
if (ret == FAILURE) {
- php_error_docref(NULL, E_WARNING, "Invocation of %s's constructor failed", ce->name->val);
+ php_error_docref(NULL, E_WARNING, "Invocation of %s's constructor failed", ZSTR_VAL(ce->name));
zval_dtor(return_value);
RETURN_NULL();
}
} else if (ZEND_NUM_ARGS()) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ZSTR_VAL(ce->name));
}
}
/* }}} */
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->create_object != NULL && ce->ce_flags & ZEND_ACC_FINAL) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ZSTR_VAL(ce->name));
return;
}
zend_fcall_info_cache fcc;
if (!(constructor->common.fn_flags & ZEND_ACC_PUBLIC)) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Access to non-public constructor of class %s", ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Access to non-public constructor of class %s", ZSTR_VAL(ce->name));
zval_dtor(return_value);
RETURN_NULL();
}
}
if (ret == FAILURE) {
zval_ptr_dtor(&retval);
- php_error_docref(NULL, E_WARNING, "Invocation of %s's constructor failed", ce->name->val);
+ php_error_docref(NULL, E_WARNING, "Invocation of %s's constructor failed", ZSTR_VAL(ce->name));
zval_dtor(return_value);
RETURN_NULL();
}
} else if (argc) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ce->name->val);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ZSTR_VAL(ce->name));
}
}
/* }}} */
if (ce->trait_aliases[i]->alias) {
- mname = zend_string_alloc(cur_ref->ce->name->len + cur_ref->method_name->len + 2, 0);
- snprintf(mname->val, mname->len + 1, "%s::%s", cur_ref->ce->name->val, cur_ref->method_name->val);
- add_assoc_str_ex(return_value, ce->trait_aliases[i]->alias->val, ce->trait_aliases[i]->alias->len, mname);
+ mname = zend_string_alloc(ZSTR_LEN(cur_ref->ce->name) + ZSTR_LEN(cur_ref->method_name) + 2, 0);
+ snprintf(ZSTR_VAL(mname), ZSTR_LEN(mname) + 1, "%s::%s", ZSTR_VAL(cur_ref->ce->name), ZSTR_VAL(cur_ref->method_name));
+ add_assoc_str_ex(return_value, ZSTR_VAL(ce->trait_aliases[i]->alias), ZSTR_LEN(ce->trait_aliases[i]->alias), mname);
}
i++;
}
if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Interface %s is a Class", interface_ce->name->val);
+ "Interface %s is a Class", ZSTR_VAL(interface_ce->name));
return;
}
RETURN_BOOL(instanceof_function(ce, interface_ce));
}
}
if (dynam_prop == 0) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Property %s::$%s does not exist", ce->name->val, name_str);
+ zend_throw_exception_ex(reflection_exception_ptr, 0, "Property %s::$%s does not exist", ZSTR_VAL(ce->name), name_str);
return;
}
}
if (!(ref->prop.flags & (ZEND_ACC_PUBLIC | ZEND_ACC_IMPLICIT_PUBLIC)) && intern->ignore_visibility == 0) {
name = _default_load_entry(getThis(), "name", sizeof("name")-1);
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot access non-public member %s::%s", intern->ce->name->val, Z_STRVAL_P(name));
+ "Cannot access non-public member %s::%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
return;
}
return;
}
if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) {
- php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name->val, ref->prop.name->val);
+ php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name));
/* Bails out */
}
ZVAL_DUP(return_value, &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]);
if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
name = _default_load_entry(getThis(), "name", sizeof("name")-1);
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot access non-public member %s::%s", intern->ce->name->val, Z_STRVAL_P(name));
+ "Cannot access non-public member %s::%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
return;
}
}
if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) {
- php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name->val, ref->prop.name->val);
+ php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name));
/* Bails out */
}
variable_ptr = &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset];
if ((ce->type == ZEND_INTERNAL_CLASS) && ce->info.internal.module && !strcasecmp(ce->info.internal.module->name, module->name)) {
zend_string *name;
- if (zend_binary_strcasecmp(ce->name->val, ce->name->len, hash_key->key->val, hash_key->key->len)) {
+ if (zend_binary_strcasecmp(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(hash_key->key), ZSTR_LEN(hash_key->key))) {
/* This is an class alias, use alias name */
name = hash_key->key;
} else {
}
relation = zend_string_alloc(len, 0);
- snprintf(relation->val, relation->len + 1, "%s%s%s%s%s",
+ snprintf(ZSTR_VAL(relation), ZSTR_LEN(relation) + 1, "%s%s%s%s%s",
rel_type,
dep->rel ? " " : "",
dep->rel ? dep->rel : "",
|| (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
{
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name->val, Z_STRVAL_P(member));
+ "Cannot set read-only property %s::$%s", ZSTR_VAL(Z_OBJCE_P(object)->name), Z_STRVAL_P(member));
}
else
{
/* PS(id) may be changed by calling session_regenerate_id().
Re-initialization should be tried here. ps_files_open() checks
data->lastkey and reopen when it is needed. */
- ps_files_open(data, key->val);
+ ps_files_open(data, ZSTR_VAL(key));
if (data->fd < 0) {
return FAILURE;
}
/* Truncate file if the amount of new data is smaller than the existing data set. */
- if (val->len < data->st_size) {
+ if (ZSTR_LEN(val) < data->st_size) {
php_ignore_value(ftruncate(data->fd, 0));
}
#if defined(HAVE_PWRITE)
- n = pwrite(data->fd, val->val, val->len, 0);
+ n = pwrite(data->fd, ZSTR_VAL(val), ZSTR_LEN(val), 0);
#else
lseek(data->fd, 0, SEEK_SET);
#ifdef PHP_WIN32
{
- unsigned int to_write = val->len > UINT_MAX ? UINT_MAX : (unsigned int)val->len;
- char *buf = val->val;
+ unsigned int to_write = ZSTR_LEN(val) > UINT_MAX ? UINT_MAX : (unsigned int)ZSTR_LEN(val);
+ char *buf = ZSTR_VAL(val);
int wrote;
do {
n += wrote;
buf = wrote > -1 ? buf + wrote : 0;
- to_write = wrote > -1 ? (val->len - n > UINT_MAX ? UINT_MAX : (unsigned int)(val->len - n)): 0;
+ to_write = wrote > -1 ? (ZSTR_LEN(val) - n > UINT_MAX ? UINT_MAX : (unsigned int)(ZSTR_LEN(val) - n)): 0;
} while(wrote > 0);
}
#else
- n = write(data->fd, val->val, val->len);
+ n = write(data->fd, ZSTR_VAL(val), ZSTR_LEN(val));
#endif
#endif
- if (n != val->len) {
+ if (n != ZSTR_LEN(val)) {
if (n == -1) {
php_error_docref(NULL, E_WARNING, "write failed: %s (%d)", strerror(errno), errno);
} else {
zend_stat_t sbuf;
PS_FILES_DATA;
- ps_files_open(data, key->val);
+ ps_files_open(data, ZSTR_VAL(key));
if (data->fd < 0) {
return FAILURE;
}
*val = zend_string_alloc(sbuf.st_size, 0);
#if defined(HAVE_PREAD)
- n = pread(data->fd, (*val)->val, (*val)->len, 0);
+ n = pread(data->fd, ZSTR_VAL(*val), ZSTR_LEN(*val), 0);
#else
lseek(data->fd, 0, SEEK_SET);
#ifdef PHP_WIN32
{
- unsigned int to_read = (*val)->len > UINT_MAX ? UINT_MAX : (unsigned int)(*val)->len;
- char *buf = (*val)->val;
+ unsigned int to_read = ZSTR_LEN(*val) > UINT_MAX ? UINT_MAX : (unsigned int)ZSTR_LEN(*val);
+ char *buf = ZSTR_VAL(*val);
int read_in;
do {
n += read_in;
buf = read_in > -1 ? buf + read_in : 0;
- to_read = read_in > -1 ? ((*val)->len - n > UINT_MAX ? UINT_MAX : (unsigned int)((*val)->len - n)): 0;
+ to_read = read_in > -1 ? (ZSTR_LEN(*val) - n > UINT_MAX ? UINT_MAX : (unsigned int)(ZSTR_LEN(*val) - n)): 0;
} while(read_in > 0);
}
#else
- n = read(data->fd, (*val)->val, (*val)->len);
+ n = read(data->fd, ZSTR_VAL(*val), ZSTR_LEN(*val));
#endif
#endif
int ret;
PS_FILES_DATA;
- if (!ps_files_path_create(buf, sizeof(buf), data, key->val)) {
+ if (!ps_files_path_create(buf, sizeof(buf), data, ZSTR_VAL(key))) {
return FAILURE;
}
char buf[MAXPATHLEN];
PS_FILES_DATA;
- if (!ps_files_path_create(buf, sizeof(buf), data, key->val)) {
+ if (!ps_files_path_create(buf, sizeof(buf), data, ZSTR_VAL(key))) {
return FAILURE;
}
}
/* Check collision */
/* FIXME: mod_data(data) should not be NULL (User handler could be NULL) */
- if (data && ps_files_key_exists(data, sid->val) == SUCCESS) {
+ if (data && ps_files_key_exists(data, ZSTR_VAL(sid)) == SUCCESS) {
if (sid) {
zend_string_release(sid);
sid = NULL;
{
PS_FILES_DATA;
- return ps_files_key_exists(data, key->val);
+ return ps_files_key_exists(data, ZSTR_VAL(key));
}
/*
php_error_docref(NULL, E_WARNING, "Unknown session.serialize_handler. Failed to decode session object");
return FAILURE;
}
- if (PS(serializer)->decode(data->val, data->len) == FAILURE) {
+ if (PS(serializer)->decode(ZSTR_VAL(data), ZSTR_LEN(data)) == FAILURE) {
php_session_destroy();
php_error_docref(NULL, E_WARNING, "Failed to decode session object. Session has been destroyed");
return FAILURE;
}
outid = zend_string_alloc((digest_len + 2) * ((8.0f / PS(hash_bits_per_character) + 0.5)), 0);
- outid->len = (size_t)(bin_to_readable((char *)digest, digest_len, outid->val, (char)PS(hash_bits_per_character)) - (char *)&outid->val);
+ ZSTR_LEN(outid) = (size_t)(bin_to_readable((char *)digest, digest_len, ZSTR_VAL(outid), (char)PS(hash_bits_per_character)) - (char *)&ZSTR_VAL(outid));
efree(digest);
return outid;
if (PS(lazy_write) && PS(session_vars)
&& PS(mod)->s_update_timestamp
&& PS(mod)->s_update_timestamp != php_session_update_timestamp
- && val->len == PS(session_vars)->len
- && !memcmp(val->val, PS(session_vars)->val, val->len)
+ && ZSTR_LEN(val) == ZSTR_LEN(PS(session_vars))
+ && !memcmp(ZSTR_VAL(val), ZSTR_VAL(PS(session_vars)), ZSTR_LEN(val))
) {
ret = PS(mod)->s_update_timestamp(&PS(mod_data), PS(id), val, PS(gc_maxlifetime));
} else {
ps_module *tmp;
SESSION_CHECK_ACTIVE_STATE;
- tmp = _php_find_ps_module(new_value->val);
+ tmp = _php_find_ps_module(ZSTR_VAL(new_value));
if (PG(modules_activated) && !tmp) {
int err_type;
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL, err_type, "Cannot find save handler '%s'", new_value->val);
+ php_error_docref(NULL, err_type, "Cannot find save handler '%s'", ZSTR_VAL(new_value));
}
return FAILURE;
}
const ps_serializer *tmp;
SESSION_CHECK_ACTIVE_STATE;
- tmp = _php_find_ps_serializer(new_value->val);
+ tmp = _php_find_ps_serializer(ZSTR_VAL(new_value));
if (PG(modules_activated) && !tmp) {
int err_type;
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL, err_type, "Cannot find serialization handler '%s'", new_value->val);
+ php_error_docref(NULL, err_type, "Cannot find serialization handler '%s'", ZSTR_VAL(new_value));
}
return FAILURE;
}
{
SESSION_CHECK_ACTIVE_STATE;
- if (!strncasecmp(new_value->val, "on", sizeof("on"))) {
+ if (!strncasecmp(ZSTR_VAL(new_value), "on", sizeof("on"))) {
PS(use_trans_sid) = (zend_bool) 1;
} else {
- PS(use_trans_sid) = (zend_bool) atoi(new_value->val);
+ PS(use_trans_sid) = (zend_bool) atoi(ZSTR_VAL(new_value));
}
return SUCCESS;
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) {
char *p;
- if (memchr(new_value->val, '\0', new_value->len) != NULL) {
+ if (memchr(ZSTR_VAL(new_value), '\0', ZSTR_LEN(new_value)) != NULL) {
return FAILURE;
}
/* we do not use zend_memrchr() since path can contain ; itself */
- if ((p = strchr(new_value->val, ';'))) {
+ if ((p = strchr(ZSTR_VAL(new_value), ';'))) {
char *p2;
p++;
if ((p2 = strchr(p, ';'))) {
p = p2 + 1;
}
} else {
- p = new_value->val;
+ p = ZSTR_VAL(new_value);
}
if (PG(open_basedir) && *p && php_check_open_basedir(p)) {
static PHP_INI_MH(OnUpdateName) /* {{{ */
{
/* Numeric session.name won't work at all */
- if ((!new_value->len || is_numeric_string(new_value->val, new_value->len, NULL, NULL, 0))) {
+ if ((!ZSTR_LEN(new_value) || is_numeric_string(ZSTR_VAL(new_value), ZSTR_LEN(new_value), NULL, NULL, 0))) {
int err_type;
if (stage == ZEND_INI_STAGE_RUNTIME || stage == ZEND_INI_STAGE_ACTIVATE || stage == ZEND_INI_STAGE_STARTUP) {
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL, err_type, "session.name cannot be a numeric or empty '%s'", new_value->val);
+ php_error_docref(NULL, err_type, "session.name cannot be a numeric or empty '%s'", ZSTR_VAL(new_value));
}
return FAILURE;
}
PS(hash_ops) = NULL;
#endif
- val = ZEND_STRTOL(new_value->val, &endptr, 10);
+ val = ZEND_STRTOL(ZSTR_VAL(new_value), &endptr, 10);
if (endptr && (*endptr == '\0')) {
/* Numeric value */
PS(hash_func) = val ? 1 : 0;
return SUCCESS;
}
- if (new_value->len == (sizeof("md5") - 1) &&
- strncasecmp(new_value->val, "md5", sizeof("md5") - 1) == 0) {
+ if (ZSTR_LEN(new_value) == (sizeof("md5") - 1) &&
+ strncasecmp(ZSTR_VAL(new_value), "md5", sizeof("md5") - 1) == 0) {
PS(hash_func) = PS_HASH_FUNC_MD5;
return SUCCESS;
}
- if (new_value->len == (sizeof("sha1") - 1) &&
- strncasecmp(new_value->val, "sha1", sizeof("sha1") - 1) == 0) {
+ if (ZSTR_LEN(new_value) == (sizeof("sha1") - 1) &&
+ strncasecmp(ZSTR_VAL(new_value), "sha1", sizeof("sha1") - 1) == 0) {
PS(hash_func) = PS_HASH_FUNC_SHA1;
return SUCCESS;
#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) /* {{{ */
{
- php_hash_ops *ops = (php_hash_ops*)php_hash_fetch_ops(new_value->val, new_value->len);
+ php_hash_ops *ops = (php_hash_ops*)php_hash_fetch_ops(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
if (ops) {
PS(hash_func) = PS_HASH_FUNC_OTHER;
}
#endif /* HAVE_HASH_EXT }}} */
- php_error_docref(NULL, E_WARNING, "session.configuration 'session.hash_function' must be existing hash function. %s does not exist.", new_value->val);
+ php_error_docref(NULL, E_WARNING, "session.configuration 'session.hash_function' must be existing hash function. %s does not exist.", ZSTR_VAL(new_value));
return FAILURE;
}
/* }}} */
static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
{
int tmp;
- tmp = zend_atoi(new_value->val, (int)new_value->len);
+ tmp = zend_atoi(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value));
if(tmp < 0) {
php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be greater than or equal to zero");
return FAILURE;
}
- if(new_value->len > 0 && new_value->val[new_value->len-1] == '%') {
+ if(ZSTR_LEN(new_value) > 0 && ZSTR_VAL(new_value)[ZSTR_LEN(new_value)-1] == '%') {
if(tmp > 100) {
php_error_docref(NULL, E_WARNING, "session.upload_progress.freq cannot be over 100%%");
return FAILURE;
PHP_VAR_SERIALIZE_INIT(var_hash);
PS_ENCODE_LOOP(
- if (key->len > PS_BIN_MAX) continue;
- smart_str_appendc(&buf, (unsigned char)key->len);
- smart_str_appendl(&buf, key->val, key->len);
+ if (ZSTR_LEN(key) > PS_BIN_MAX) continue;
+ smart_str_appendc(&buf, (unsigned char)ZSTR_LEN(key));
+ smart_str_appendl(&buf, ZSTR_VAL(key), ZSTR_LEN(key));
php_var_serialize(&buf, struc, &var_hash);
} else {
- if (key->len > PS_BIN_MAX) continue;
- smart_str_appendc(&buf, (unsigned char) (key->len & PS_BIN_UNDEF));
- smart_str_appendl(&buf, key->val, key->len);
+ if (ZSTR_LEN(key) > PS_BIN_MAX) continue;
+ smart_str_appendc(&buf, (unsigned char) (ZSTR_LEN(key) & PS_BIN_UNDEF));
+ smart_str_appendl(&buf, ZSTR_VAL(key), ZSTR_LEN(key));
);
smart_str_0(&buf);
PHP_VAR_SERIALIZE_INIT(var_hash);
PS_ENCODE_LOOP(
- smart_str_appendl(&buf, key->val, key->len);
- if (memchr(key->val, PS_DELIMITER, key->len) || memchr(key->val, PS_UNDEF_MARKER, key->len)) {
+ smart_str_appendl(&buf, ZSTR_VAL(key), ZSTR_LEN(key));
+ if (memchr(ZSTR_VAL(key), PS_DELIMITER, ZSTR_LEN(key)) || memchr(ZSTR_VAL(key), PS_UNDEF_MARKER, ZSTR_LEN(key))) {
PHP_VAR_SERIALIZE_DESTROY(var_hash);
smart_str_free(&buf);
return NULL;
php_var_serialize(&buf, struc, &var_hash);
} else {
smart_str_appendc(&buf, PS_UNDEF_MARKER);
- smart_str_appendl(&buf, key->val, key->len);
+ smart_str_appendl(&buf, ZSTR_VAL(key), ZSTR_LEN(key));
smart_str_appendc(&buf, PS_DELIMITER);
);
size_t len = sizeof("Set-Cookie")-1;
e_session_name = php_url_encode(PS(session_name), strlen(PS(session_name)));
- spprintf(&session_cookie, 0, "Set-Cookie: %s=", e_session_name->val);
+ spprintf(&session_cookie, 0, "Set-Cookie: %s=", ZSTR_VAL(e_session_name));
zend_string_free(e_session_name);
session_cookie_len = strlen(session_cookie);
/* URL encode session_name and id because they might be user supplied */
e_session_name = php_url_encode(PS(session_name), strlen(PS(session_name)));
- e_id = php_url_encode(PS(id)->val, PS(id)->len);
+ e_id = php_url_encode(ZSTR_VAL(PS(id)), ZSTR_LEN(PS(id)));
smart_str_appendl(&ncookie, "Set-Cookie: ", sizeof("Set-Cookie: ")-1);
- smart_str_appendl(&ncookie, e_session_name->val, e_session_name->len);
+ smart_str_appendl(&ncookie, ZSTR_VAL(e_session_name), ZSTR_LEN(e_session_name));
smart_str_appendc(&ncookie, '=');
- smart_str_appendl(&ncookie, e_id->val, e_id->len);
+ smart_str_appendl(&ncookie, ZSTR_VAL(e_id), ZSTR_LEN(e_id));
zend_string_release(e_session_name);
zend_string_release(e_id);
if (t > 0) {
date_fmt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, t, 0);
smart_str_appends(&ncookie, COOKIE_EXPIRES);
- smart_str_appendl(&ncookie, date_fmt->val, date_fmt->len);
+ smart_str_appendl(&ncookie, ZSTR_VAL(date_fmt), ZSTR_LEN(date_fmt));
zend_string_release(date_fmt);
smart_str_appends(&ncookie, COOKIE_MAX_AGE);
php_session_remove_cookie(); /* remove already sent session ID cookie */
/* 'replace' must be 0 here, else a previous Set-Cookie
header, probably sent with setcookie() will be replaced! */
- sapi_add_header_ex(estrndup(ncookie.s->val, ncookie.s->len), ncookie.s->len, 0, 0);
+ sapi_add_header_ex(estrndup(ZSTR_VAL(ncookie.s), ZSTR_LEN(ncookie.s)), ZSTR_LEN(ncookie.s), 0, 0);
smart_str_free(&ncookie);
}
/* }}} */
smart_str_appends(&var, PS(session_name));
smart_str_appendc(&var, '=');
- smart_str_appends(&var, PS(id)->val);
+ smart_str_appends(&var, ZSTR_VAL(PS(id)));
smart_str_0(&var);
if (sid) {
zend_string_release(Z_STR_P(sid));
ZVAL_NEW_STR(sid, var.s);
} else {
- REGISTER_STRINGL_CONSTANT("SID", var.s->val, var.s->len, 0);
+ REGISTER_STRINGL_CONSTANT("SID", ZSTR_VAL(var.s), ZSTR_LEN(var.s), 0);
smart_str_free(&var);
}
} else {
if (APPLY_TRANS_SID) {
/* php_url_scanner_reset_vars(); */
- php_url_scanner_add_var(PS(session_name), strlen(PS(session_name)), PS(id)->val, PS(id)->len, 1);
+ php_url_scanner_add_var(PS(session_name), strlen(PS(session_name)), ZSTR_VAL(PS(id)), ZSTR_LEN(PS(id)), 1);
}
}
/* }}} */
/* Finally check session id for dangerous characters
* Security note: session id may be embedded in HTML pages.*/
- if (PS(id) && strpbrk(PS(id)->val, "\r\n\t <>'\"\\")) {
+ if (PS(id) && strpbrk(ZSTR_VAL(PS(id)), "\r\n\t <>'\"\\")) {
zend_string_release(PS(id));
PS(id) = NULL;
}
PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t *newlen) /* {{{ */
{
if (APPLY_TRANS_SID && (PS(session_status) == php_session_active)) {
- *new = php_url_scanner_adapt_single_url(url, urllen, PS(session_name), PS(id)->val, newlen, 1);
+ *new = php_url_scanner_adapt_single_url(url, urllen, PS(session_name), ZSTR_VAL(PS(id)), newlen, 1);
}
}
/* }}} */
}
if (name) {
- if (!_php_find_ps_module(name->val)) {
- php_error_docref(NULL, E_WARNING, "Cannot find named PHP session module (%s)", name->val);
+ if (!_php_find_ps_module(ZSTR_VAL(name))) {
+ php_error_docref(NULL, E_WARNING, "Cannot find named PHP session module (%s)", ZSTR_VAL(name));
zval_dtor(return_value);
RETURN_FALSE;
RETVAL_STRING(PS(save_path));
if (name) {
- if (memchr(name->val, '\0', name->len) != NULL) {
+ if (memchr(ZSTR_VAL(name), '\0', ZSTR_LEN(name)) != NULL) {
php_error_docref(NULL, E_WARNING, "The save_path cannot contain NULL characters");
zval_dtor(return_value);
RETURN_FALSE;
if (PS(id)) {
/* keep compatibility for "\0" characters ???
* see: ext/session/tests/session_id_error3.phpt */
- size_t len = strlen(PS(id)->val);
- if (UNEXPECTED(len != PS(id)->len)) {
- RETVAL_NEW_STR(zend_string_init(PS(id)->val, len, 0));
+ size_t len = strlen(ZSTR_VAL(PS(id)));
+ if (UNEXPECTED(len != ZSTR_LEN(PS(id)))) {
+ RETVAL_NEW_STR(zend_string_init(ZSTR_VAL(PS(id)), len, 0));
} else {
RETVAL_STR_COPY(PS(id));
}
return;
}
- if (prefix && prefix->len) {
- if (php_session_valid_key(prefix->val) == FAILURE) {
+ if (prefix && ZSTR_LEN(prefix)) {
+ if (php_session_valid_key(ZSTR_VAL(prefix)) == FAILURE) {
/* E_ERROR raised for security reason. */
php_error_docref(NULL, E_WARNING, "Prefix cannot contain special characters. Only aphanumeric, ',', '-' are allowed");
RETURN_FALSE;
RETURN_FALSE;
}
- if (PS(id) && !(PS(id)->len)) {
+ if (PS(id) && !(ZSTR_LEN(PS(id)))) {
php_error_docref(NULL, E_WARNING, "Cannot start session with empty session ID");
RETURN_FALSE;
}
} else {
zend_string *val = zval_get_string(value);
if (php_session_start_set_ini(str_idx, val) == FAILURE) {
- php_error_docref(NULL, E_WARNING, "Setting option '%s' failed", str_idx->val);
+ php_error_docref(NULL, E_WARNING, "Setting option '%s' failed", ZSTR_VAL(str_idx));
}
zend_string_release(val);
}
break;
default:
- php_error_docref(NULL, E_WARNING, "Option(%s) value must be string, boolean or long", str_idx->val);
+ php_error_docref(NULL, E_WARNING, "Option(%s) value must be string, boolean or long", ZSTR_VAL(str_idx));
break;
}
}
if (save_handlers.s) {
smart_str_0(&save_handlers);
- php_info_print_table_row(2, "Registered save handlers", save_handlers.s->val);
+ php_info_print_table_row(2, "Registered save handlers", ZSTR_VAL(save_handlers.s));
smart_str_free(&save_handlers);
} else {
php_info_print_table_row(2, "Registered save handlers", "none");
if (ser_handlers.s) {
smart_str_0(&ser_handlers);
- php_info_print_table_row(2, "Registered serializer handlers", ser_handlers.s->val);
+ php_info_print_table_row(2, "Registered serializer handlers", ZSTR_VAL(ser_handlers.s));
smart_str_free(&ser_handlers);
} else {
php_info_print_table_row(2, "Registered serializer handlers", "none");
RETURN_FALSE;
}
- writesize = (data->len < shmop->size - offset) ? data->len : shmop->size - offset;
- memcpy(shmop->addr + offset, data->val, writesize);
+ writesize = (ZSTR_LEN(data) < shmop->size - offset) ? ZSTR_LEN(data) : shmop->size - offset;
+ memcpy(shmop->addr + offset, ZSTR_VAL(data), writesize);
RETURN_LONG(writesize);
}
smart_str_appendc(&prefix, '#');
smart_str_appends(&prefix, id);
smart_str_0(&prefix);
- id = prefix.s->val;
+ id = ZSTR_VAL(prefix.s);
} else {
SOAP_GLOBAL(cur_uniq_ref)++;
smart_str_appendl(&prefix, "#ref", 4);
smart_str_append_long(&prefix, SOAP_GLOBAL(cur_uniq_ref));
smart_str_0(&prefix);
- id = prefix.s->val;
+ id = ZSTR_VAL(prefix.s);
xmlSetProp(node_ptr, BAD_CAST("id"), BAD_CAST(id+1));
}
xmlSetProp(node, BAD_CAST("href"), BAD_CAST(id));
smart_str_appendc(&prefix, '#');
smart_str_appends(&prefix, id);
smart_str_0(&prefix);
- id = prefix.s->val;
+ id = ZSTR_VAL(prefix.s);
} else {
SOAP_GLOBAL(cur_uniq_ref)++;
smart_str_appendl(&prefix, "#ref", 4);
smart_str_append_long(&prefix, SOAP_GLOBAL(cur_uniq_ref));
smart_str_0(&prefix);
- id = prefix.s->val;
+ id = ZSTR_VAL(prefix.s);
set_ns_prop(node_ptr, SOAP_1_2_ENC_NAMESPACE, "id", id+1);
}
set_ns_prop(node, SOAP_1_2_ENC_NAMESPACE, "ref", id);
ZEND_HASH_FOREACH_STR_KEY_VAL(SOAP_GLOBAL(class_map), type_name, tmp) {
if (Z_TYPE_P(tmp) == IS_STRING &&
- ce->name->len == Z_STRLEN_P(tmp) &&
- zend_binary_strncasecmp(ce->name->val, ce->name->len, Z_STRVAL_P(tmp), ce->name->len, ce->name->len) == 0 &&
+ ZSTR_LEN(ce->name) == Z_STRLEN_P(tmp) &&
+ zend_binary_strncasecmp(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), Z_STRVAL_P(tmp), ZSTR_LEN(ce->name), ZSTR_LEN(ce->name)) == 0 &&
type_name) {
/* TODO: namespace isn't stored */
encodePtr enc = NULL;
if (SOAP_GLOBAL(sdl)) {
- enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name->val);
+ enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, ZSTR_VAL(type_name));
if (!enc) {
- enc = find_encoder_by_type_name(SOAP_GLOBAL(sdl), type_name->val);
+ enc = find_encoder_by_type_name(SOAP_GLOBAL(sdl), ZSTR_VAL(type_name));
}
}
if (enc) {
return ret;
}
str = zend_string_alloc(strlen((char*)data->children->content) / 2, 0);
- for (i = j = 0; i < str->len; i++) {
+ for (i = j = 0; i < ZSTR_LEN(str); i++) {
c = data->children->content[j++];
if (c >= '0' && c <= '9') {
- str->val[i] = (c - '0') << 4;
+ ZSTR_VAL(str)[i] = (c - '0') << 4;
} else if (c >= 'a' && c <= 'f') {
- str->val[i] = (c - 'a' + 10) << 4;
+ ZSTR_VAL(str)[i] = (c - 'a' + 10) << 4;
} else if (c >= 'A' && c <= 'F') {
- str->val[i] = (c - 'A' + 10) << 4;
+ ZSTR_VAL(str)[i] = (c - 'A' + 10) << 4;
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}
c = data->children->content[j++];
if (c >= '0' && c <= '9') {
- str->val[i] |= c - '0';
+ ZSTR_VAL(str)[i] |= c - '0';
} else if (c >= 'a' && c <= 'f') {
- str->val[i] |= c - 'a' + 10;
+ ZSTR_VAL(str)[i] |= c - 'a' + 10;
} else if (c >= 'A' && c <= 'F') {
- str->val[i] |= c - 'A' + 10;
+ ZSTR_VAL(str)[i] |= c - 'A' + 10;
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}
}
- str->val[str->len] = '\0';
+ ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
ZVAL_NEW_STR(ret, str);
} else {
ZVAL_EMPTY_STRING(ret);
new_len = Z_STRLEN_P(data);
} else {
zend_string *tmp = zval_get_string(data);
- str = estrndup(tmp->val, tmp->len);
- new_len = tmp->len;
+ str = estrndup(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
+ new_len = ZSTR_LEN(tmp);
zend_string_release(tmp);
}
str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRLEN_P(data));
} else {
zend_string *tmp = zval_get_string(data);
- str = php_base64_encode((unsigned char*) tmp->val, tmp->len);
+ str = php_base64_encode((unsigned char*) ZSTR_VAL(tmp), ZSTR_LEN(tmp));
zend_string_release(tmp);
}
- text = xmlNewTextLen(BAD_CAST(str->val), str->len);
+ text = xmlNewTextLen(BAD_CAST(ZSTR_VAL(str)), ZSTR_LEN(str));
xmlAddChild(ret, text);
zend_string_release(str);
xmlNodeSetContent(ret, BAD_CAST(s));
} else {
zend_string *str = zend_long_to_str(zval_get_long(data));
- xmlNodeSetContentLen(ret, BAD_CAST(str->val), str->len);
+ xmlNodeSetContentLen(ret, BAD_CAST(ZSTR_VAL(str)), ZSTR_LEN(str));
zend_string_release(str);
}
zend_unmangle_property_name(str_key, &class_name, &prop_name);
} else {
- prop_name = str_key->val;
+ prop_name = ZSTR_VAL(str_key);
}
if (prop_name) {
xmlNodeSetName(property, BAD_CAST(prop_name));
if (style == SOAP_ENCODED) {
if (soap_version == SOAP_1_1) {
smart_str_0(&array_type);
- if (strcmp(array_type.s->val,"xsd:anyType") == 0) {
+ if (strcmp(ZSTR_VAL(array_type.s),"xsd:anyType") == 0) {
smart_str_free(&array_type);
smart_str_appendl(&array_type,"xsd:ur-type",sizeof("xsd:ur-type")-1);
}
smart_str_append_smart_str(&array_type, &array_size);
smart_str_appendc(&array_type, ']');
smart_str_0(&array_type);
- set_ns_prop(xmlParam, SOAP_1_1_ENC_NAMESPACE, "arrayType", array_type.s->val);
+ set_ns_prop(xmlParam, SOAP_1_1_ENC_NAMESPACE, "arrayType", ZSTR_VAL(array_type.s));
} else {
int i = 0;
- while (i < array_size.s->len) {
- if (array_size.s->val[i] == ',') {array_size.s->val[i] = ' ';}
+ while (i < ZSTR_LEN(array_size.s)) {
+ if (ZSTR_VAL(array_size.s)[i] == ',') {ZSTR_VAL(array_size.s)[i] = ' ';}
++i;
}
smart_str_0(&array_type);
smart_str_0(&array_size);
- set_ns_prop(xmlParam, SOAP_1_2_ENC_NAMESPACE, "itemType", array_type.s->val);
- set_ns_prop(xmlParam, SOAP_1_2_ENC_NAMESPACE, "arraySize", array_size.s->val);
+ set_ns_prop(xmlParam, SOAP_1_2_ENC_NAMESPACE, "itemType", ZSTR_VAL(array_type.s));
+ set_ns_prop(xmlParam, SOAP_1_2_ENC_NAMESPACE, "arraySize", ZSTR_VAL(array_size.s));
}
}
smart_str_free(&array_type);
if (style == SOAP_ENCODED) {
set_xsi_type(key, "xsd:string");
}
- xmlNodeSetContent(key, BAD_CAST(key_val->val));
+ xmlNodeSetContent(key, BAD_CAST(ZSTR_VAL(key_val)));
} else {
smart_str tmp = {0};
smart_str_append_long(&tmp, int_val);
if (style == SOAP_ENCODED) {
set_xsi_type(key, "xsd:int");
}
- xmlNodeSetContentLen(key, BAD_CAST(tmp.s->val), tmp.s->len);
+ xmlNodeSetContentLen(key, BAD_CAST(ZSTR_VAL(tmp.s)), ZSTR_LEN(tmp.s));
smart_str_free(&tmp);
}
ZEND_HASH_FOREACH_VAL(ht, tmp) {
xmlNodePtr dummy = master_to_xml(list_enc, tmp, SOAP_LITERAL, ret);
if (dummy && dummy->children && dummy->children->content) {
- if (list.s && list.s->len != 0) {
+ if (list.s && ZSTR_LEN(list.s) != 0) {
smart_str_appendc(&list, ' ');
}
smart_str_appends(&list, (char*)dummy->children->content);
xmlFreeNode(dummy);
} ZEND_HASH_FOREACH_END();
smart_str_0(&list);
- xmlNodeSetContentLen(ret, BAD_CAST(list.s->val), list.s->len);
+ xmlNodeSetContentLen(ret, BAD_CAST(ZSTR_VAL(list.s)), ZSTR_LEN(list.s));
smart_str_free(&list);
} else {
zval tmp;
dummy = master_to_xml(list_enc, &dummy_zval, SOAP_LITERAL, ret);
zval_ptr_dtor(&dummy_zval);
if (dummy && dummy->children && dummy->children->content) {
- if (list.s && list.s->len != 0) {
+ if (list.s && ZSTR_LEN(list.s) != 0) {
smart_str_appendc(&list, ' ');
}
smart_str_appends(&list, (char*)dummy->children->content);
start = next;
}
smart_str_0(&list);
- xmlNodeSetContentLen(ret, BAD_CAST(list.s->val), list.s->len);
+ xmlNodeSetContentLen(ret, BAD_CAST(ZSTR_VAL(list.s)), ZSTR_LEN(list.s));
smart_str_free(&list);
efree(str);
if (data == &tmp) {zval_dtor(&tmp);}
ret = master_to_xml(enc, el, style, parent);
if (ret &&
ret->name != xmlStringTextNoenc) {
- xmlNodeSetName(ret, BAD_CAST(name->val));
+ xmlNodeSetName(ret, BAD_CAST(ZSTR_VAL(name)));
}
} ZEND_HASH_FOREACH_END();
return ret;
ret = xmlNewTextLen(BAD_CAST(Z_STRVAL_P(data)), Z_STRLEN_P(data));
} else {
zend_string *tmp = zval_get_string(data);
- ret = xmlNewTextLen(BAD_CAST(tmp->val), tmp->len);
+ ret = xmlNewTextLen(BAD_CAST(ZSTR_VAL(tmp)), ZSTR_LEN(tmp));
zend_string_release(tmp);
}
{
smart_str nstype = {0};
get_type_str(node, ns, type, &nstype);
- set_xsi_type(node, nstype.s->val);
+ set_xsi_type(node, ZSTR_VAL(nstype.s));
smart_str_free(&nstype);
}
smart_str_appendl(&prefix, "ns", 2);
smart_str_append_long(&prefix, num);
smart_str_0(&prefix);
- if (xmlSearchNs(node->doc, node, BAD_CAST(prefix.s->val)) == NULL) {
+ if (xmlSearchNs(node->doc, node, BAD_CAST(ZSTR_VAL(prefix.s))) == NULL) {
break;
}
smart_str_free(&prefix);
num = ++SOAP_GLOBAL(cur_uniq_ns);
}
- xmlns = xmlNewNs(node->doc->children, BAD_CAST(ns), BAD_CAST(prefix.s ? prefix.s->val : ""));
+ xmlns = xmlNewNs(node->doc->children, BAD_CAST(ns), BAD_CAST(prefix.s ? ZSTR_VAL(prefix.s) : ""));
smart_str_free(&prefix);
}
}
smart_str_appends(&array_type, cur_stype);
smart_str_0(&array_type);
- enc = get_encoder_ex(SOAP_GLOBAL(sdl), array_type.s->val, array_type.s->len);
+ enc = get_encoder_ex(SOAP_GLOBAL(sdl), ZSTR_VAL(array_type.s), ZSTR_LEN(array_type.s));
smart_str_free(&array_type);
return enc;
} else {
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
}
smart_str_0(&auth);
- buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len);
+ buf = php_base64_encode((unsigned char*)ZSTR_VAL(auth.s), ZSTR_LEN(auth.s));
smart_str_append_const(soap_headers, "Proxy-Authorization: Basic ");
- smart_str_appendl(soap_headers, (char*)buf->val, buf->len);
+ smart_str_appendl(soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf));
smart_str_append_const(soap_headers, "\r\n");
zend_string_release(buf);
smart_str_free(&auth);
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
}
smart_str_0(&auth);
- buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len);
+ buf = php_base64_encode((unsigned char*)ZSTR_VAL(auth.s), ZSTR_LEN(auth.s));
smart_str_append_const(soap_headers, "Authorization: Basic ");
- smart_str_appendl(soap_headers, (char*)buf->val, buf->len);
+ smart_str_appendl(soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf));
smart_str_append_const(soap_headers, "\r\n");
zend_string_release(buf);
smart_str_free(&auth);
smart_str_append_const(&soap_headers, "\r\n");
proxy_authentication(this_ptr, &soap_headers);
smart_str_append_const(&soap_headers, "\r\n");
- if (php_stream_write(stream, soap_headers.s->val, soap_headers.s->len) != soap_headers.s->len) {
+ if (php_stream_write(stream, ZSTR_VAL(soap_headers.s), ZSTR_LEN(soap_headers.s)) != ZSTR_LEN(soap_headers.s)) {
php_stream_close(stream);
stream = NULL;
}
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
}
smart_str_0(&auth);
- buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len);
+ buf = php_base64_encode((unsigned char*)ZSTR_VAL(auth.s), ZSTR_LEN(auth.s));
smart_str_append_const(&soap_headers, "Authorization: Basic ");
- smart_str_appendl(&soap_headers, (char*)buf->val, buf->len);
+ smart_str_appendl(&soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf));
smart_str_append_const(&soap_headers, "\r\n");
zend_string_release(buf);
smart_str_free(&auth);
smart_str_0(&soap_headers);
if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
(Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) {
- add_property_stringl(this_ptr, "__last_request_headers", soap_headers.s->val, soap_headers.s->len);
+ add_property_stringl(this_ptr, "__last_request_headers", ZSTR_VAL(soap_headers.s), ZSTR_LEN(soap_headers.s));
}
smart_str_appendl(&soap_headers, request, request_size);
smart_str_0(&soap_headers);
- err = php_stream_write(stream, soap_headers.s->val, soap_headers.s->len);
- if (err != soap_headers.s->len) {
+ err = php_stream_write(stream, ZSTR_VAL(soap_headers.s), ZSTR_LEN(soap_headers.s));
+ if (err != ZSTR_LEN(soap_headers.s)) {
if (request != buf) {efree(request);}
php_stream_close(stream);
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl")-1);
/* Check to see what HTTP status was sent */
http_1_1 = 0;
http_status = 0;
- http_version = get_http_header_value(http_headers->val, "HTTP/");
+ http_version = get_http_header_value(ZSTR_VAL(http_headers), "HTTP/");
if (http_version) {
char *tmp;
we shouldn't be changing urls so path dont
matter too much
*/
- cookie_itt = strstr(http_headers->val, "Set-Cookie: ");
+ cookie_itt = strstr(ZSTR_VAL(http_headers), "Set-Cookie: ");
while (cookie_itt) {
char *cookie;
char *eqpos, *sempos;
if (http_1_1) {
http_close = FALSE;
if (use_proxy && !use_ssl) {
- connection = get_http_header_value(http_headers->val, "Proxy-Connection: ");
+ connection = get_http_header_value(ZSTR_VAL(http_headers), "Proxy-Connection: ");
if (connection) {
if (strncasecmp(connection, "close", sizeof("close")-1) == 0) {
http_close = TRUE;
}
}
if (http_close == FALSE) {
- connection = get_http_header_value(http_headers->val, "Connection: ");
+ connection = get_http_header_value(ZSTR_VAL(http_headers), "Connection: ");
if (connection) {
if (strncasecmp(connection, "close", sizeof("close")-1) == 0) {
http_close = TRUE;
} else {
http_close = TRUE;
if (use_proxy && !use_ssl) {
- connection = get_http_header_value(http_headers->val, "Proxy-Connection: ");
+ connection = get_http_header_value(ZSTR_VAL(http_headers), "Proxy-Connection: ");
if (connection) {
if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
http_close = FALSE;
}
}
if (http_close == TRUE) {
- connection = get_http_header_value(http_headers->val, "Connection: ");
+ connection = get_http_header_value(ZSTR_VAL(http_headers), "Connection: ");
if (connection) {
if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
http_close = FALSE;
}
}
- if (!get_http_body(stream, http_close, http_headers->val, &http_body, &http_body_size)) {
+ if (!get_http_body(stream, http_close, ZSTR_VAL(http_headers), &http_body, &http_body_size)) {
if (request != buf) {efree(request);}
php_stream_close(stream);
zend_string_release(http_headers);
if (http_status >= 300 && http_status < 400) {
char *loc;
- if ((loc = get_http_header_value(http_headers->val, "Location: ")) != NULL) {
+ if ((loc = get_http_header_value(ZSTR_VAL(http_headers), "Location: ")) != NULL) {
php_url *new_url = php_url_parse(loc);
if (new_url != NULL) {
} else if (http_status == 401) {
/* Digest authentication */
zval *digest, *login, *password;
- char *auth = get_http_header_value(http_headers->val, "WWW-Authenticate: ");
+ char *auth = get_http_header_value(ZSTR_VAL(http_headers), "WWW-Authenticate: ");
if (auth &&
strstr(auth, "Digest") == auth &&
smart_str_free(&soap_headers_z);
/* Check and see if the server even sent a xml document */
- content_type = get_http_header_value(http_headers->val, "Content-Type: ");
+ content_type = get_http_header_value(ZSTR_VAL(http_headers), "Content-Type: ");
if (content_type) {
char *pos = NULL;
int cmplen;
}
/* Decompress response */
- content_encoding = get_http_header_value(http_headers->val, "Content-Encoding: ");
+ content_encoding = get_http_header_value(ZSTR_VAL(http_headers), "Content-Encoding: ");
if (content_encoding) {
zval func;
zval retval;
master_to_zval(&details, NULL, tmp);
}
}
- add_soap_fault(this_ptr, faultcode, faultstring ? faultstring->val : NULL, faultactor ? faultactor->val : NULL, &details);
+ add_soap_fault(this_ptr, faultcode, faultstring ? ZSTR_VAL(faultstring) : NULL, faultactor ? ZSTR_VAL(faultactor) : NULL, &details);
if (faultstring) {
zend_string_release(faultstring);
}
smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
smart_str_0(&anonymous);
// TODO: avoid reallocation ???
- newType->name = estrndup(anonymous.s->val, anonymous.s->len);
+ newType->name = estrndup(ZSTR_VAL(anonymous.s), ZSTR_LEN(anonymous.s));
smart_str_free(&anonymous);
}
newType->namens = estrdup((char*)tns->children->content);
smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
smart_str_0(&anonymous);
// TODO: avoid reallocation ???
- newType->name = estrndup(anonymous.s->val, anonymous.s->len);
+ newType->name = estrndup(ZSTR_VAL(anonymous.s), ZSTR_LEN(anonymous.s));
smart_str_free(&anonymous);
}
newType->namens = estrdup((char*)tns->children->content);
newModel = emalloc(sizeof(sdlContentModel));
newModel->kind = XSD_CONTENT_GROUP_REF;
- newModel->u.group_ref = estrndup(key.s->val, key.s->len);
+ newModel->u.group_ref = estrndup(ZSTR_VAL(key.s), ZSTR_LEN(key.s));
if (type) {efree(type);}
if (ns) {efree(ns);}
zend_hash_init(sdl->groups, 0, NULL, delete_type, 0);
}
if (zend_hash_add_ptr(sdl->groups, key.s, newType) == NULL) {
- soap_error1(E_ERROR, "Parsing Schema: group '%s' already defined", key.s->val);
+ soap_error1(E_ERROR, "Parsing Schema: group '%s' already defined", ZSTR_VAL(key.s));
}
cur_type = newType;
smart_str_0(&nscat);
if (type) {efree(type);}
if (ns) {efree(ns);}
- newType->ref = estrndup(nscat.s->val, nscat.s->len);
+ newType->ref = estrndup(ZSTR_VAL(nscat.s), ZSTR_LEN(nscat.s));
smart_str_free(&nscat);
} else {
newType->name = estrdup((char*)name->children->content);
smart_str_0(&key);
if (zend_hash_add_ptr(addHash, key.s, newType) == NULL) {
if (cur_type == NULL) {
- soap_error1(E_ERROR, "Parsing Schema: element '%s' already defined", key.s->val);
+ soap_error1(E_ERROR, "Parsing Schema: element '%s' already defined", ZSTR_VAL(key.s));
} else {
zend_hash_next_index_insert_ptr(addHash, newType);
}
smart_str_appendc(&key, ':');
smart_str_appends(&key, attr_name);
smart_str_0(&key);
- newAttr->ref = estrndup(key.s->val, key.s->len);
+ newAttr->ref = estrndup(ZSTR_VAL(key.s), ZSTR_LEN(key.s));
if (attr_name) {efree(attr_name);}
if (ns) {efree(ns);}
} else {
}
if (zend_hash_add_ptr(addHash, key.s, newAttr) == NULL) {
- soap_error1(E_ERROR, "Parsing Schema: attribute '%s' already defined", key.s->val);
+ soap_error1(E_ERROR, "Parsing Schema: attribute '%s' already defined", ZSTR_VAL(key.s));
}
smart_str_free(&key);
} else{
smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
smart_str_0(&anonymous);
// TODO: avoid reallocation ???
- dummy_type->name = estrndup(anonymous.s->val, anonymous.s->len);
+ dummy_type->name = estrndup(ZSTR_VAL(anonymous.s), ZSTR_LEN(anonymous.s));
smart_str_free(&anonymous);
}
dummy_type->namens = estrdup((char*)tns->children->content);
smart_str_0(&key);
if (zend_hash_add_ptr(ctx->attributeGroups, key.s, newType) == NULL) {
- soap_error1(E_ERROR, "Parsing Schema: attributeGroup '%s' already defined", key.s->val);
+ soap_error1(E_ERROR, "Parsing Schema: attributeGroup '%s' already defined", ZSTR_VAL(key.s));
}
cur_type = newType;
smart_str_free(&key);
smart_str_appendc(&key, ':');
smart_str_appends(&key, group_name);
smart_str_0(&key);
- newAttr->ref = estrndup(key.s->val, key.s->len);
+ newAttr->ref = estrndup(ZSTR_VAL(key.s), ZSTR_LEN(key.s));
if (group_name) {efree(group_name);}
if (ns) {efree(ns);}
smart_str_free(&key);
static void sdl_serialize_key(zend_string *key, smart_str *out)
{
if (key) {
- WSDL_CACHE_PUT_INT(key->len, out);
- WSDL_CACHE_PUT_N(key->val, key->len, out);
+ WSDL_CACHE_PUT_INT(ZSTR_LEN(key), out);
+ WSDL_CACHE_PUT_N(ZSTR_VAL(key), ZSTR_LEN(key), out);
} else {
WSDL_CACHE_PUT_INT(0, out);
}
} ZEND_HASH_FOREACH_END();
}
- php_ignore_value(write(f, buf.s->val, buf.s->len));
+ php_ignore_value(write(f, ZSTR_VAL(buf.s), ZSTR_LEN(buf.s)));
close(f);
smart_str_free(&buf);
zend_hash_destroy(&tmp_functions);
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(pheaders, key->val, key->len, pheader);
+ zend_hash_str_add_ptr(pheaders, ZSTR_VAL(key), ZSTR_LEN(key), pheader);
} else {
zend_hash_next_index_insert_ptr(pheaders, pheader);
}
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(pparams, key->val, key->len, pparam);
+ zend_hash_str_add_ptr(pparams, ZSTR_VAL(key), ZSTR_LEN(key), pparam);
} else {
zend_hash_next_index_insert_ptr(pparams, pparam);
}
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(pfaults, key->val, key->len, pfault);
+ zend_hash_str_add_ptr(pfaults, ZSTR_VAL(key), ZSTR_LEN(key), pfault);
} else {
zend_hash_next_index_insert_ptr(pfaults, pfault);
}
}
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(pattr->extraAttributes, key->val, key->len, pextra);
+ zend_hash_str_add_ptr(pattr->extraAttributes, ZSTR_VAL(key), ZSTR_LEN(key), pextra);
}
} ZEND_HASH_FOREACH_END();
}
pelem = make_persistent_sdl_type(tmp, ptr_map, bp_types, bp_encoders);
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(ptype->elements, key->val, key->len, pelem);
+ zend_hash_str_add_ptr(ptype->elements, ZSTR_VAL(key), ZSTR_LEN(key), pelem);
} else {
zend_hash_next_index_insert_ptr(ptype->elements, pelem);
}
pattr = make_persistent_sdl_attribute(tmp, ptr_map, bp_types, bp_encoders);
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(ptype->attributes, key->val, key->len, pattr);
+ zend_hash_str_add_ptr(ptype->attributes, ZSTR_VAL(key), ZSTR_LEN(key), pattr);
} else {
zend_hash_next_index_insert_ptr(ptype->attributes, pattr);
}
ptype = make_persistent_sdl_type(tmp, &ptr_map, &bp_types, &bp_encoders);
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(psdl->groups, key->val, key->len, ptype);
+ zend_hash_str_add_ptr(psdl->groups, ZSTR_VAL(key), ZSTR_LEN(key), ptype);
} else {
zend_hash_next_index_insert_ptr(psdl->groups, ptype);
}
ptype = make_persistent_sdl_type(tmp, &ptr_map, &bp_types, &bp_encoders);
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(psdl->types, key->val, key->len, ptype);
+ zend_hash_str_add_ptr(psdl->types, ZSTR_VAL(key), ZSTR_LEN(key), ptype);
} else {
zend_hash_next_index_insert_ptr(psdl->types, ptype);
}
ptype = make_persistent_sdl_type(tmp, &ptr_map, &bp_types, &bp_encoders);
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(psdl->elements, key->val, key->len, ptype);
+ zend_hash_str_add_ptr(psdl->elements, ZSTR_VAL(key), ZSTR_LEN(key), ptype);
} else {
zend_hash_next_index_insert_ptr(psdl->elements, ptype);
}
penc = make_persistent_sdl_encoder(tmp, &ptr_map, &bp_types, &bp_encoders);
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(psdl->encoders, key->val, key->len, penc);
+ zend_hash_str_add_ptr(psdl->encoders, ZSTR_VAL(key), ZSTR_LEN(key), penc);
} else {
zend_hash_next_index_insert_ptr(psdl->encoders, penc);
}
pbind = make_persistent_sdl_binding(tmp, &ptr_map);
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(psdl->bindings, key->val, key->len, pbind);
+ zend_hash_str_add_ptr(psdl->bindings, ZSTR_VAL(key), ZSTR_LEN(key), pbind);
} else {
zend_hash_next_index_insert_ptr(psdl->bindings, pbind);
}
pfunc = make_persistent_sdl_function(tmp, &ptr_map);
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(&psdl->functions, key->val, key->len, pfunc);
+ zend_hash_str_add_ptr(&psdl->functions, ZSTR_VAL(key), ZSTR_LEN(key), pfunc);
} else {
zend_hash_next_index_insert_ptr(&psdl->functions, pfunc);
}
Z_PTR_P(zv) = preq;
if (key) {
/* We have to duplicate key emalloc->malloc */
- zend_hash_str_add_ptr(psdl->requests, key->val, key->len, preq);
+ zend_hash_str_add_ptr(psdl->requests, ZSTR_VAL(key), ZSTR_LEN(key), preq);
}
} ZEND_HASH_FOREACH_END();
}
smart_str_appendl(&headers, "Connection: close\r\n", sizeof("Connection: close\r\n")-1);
}
- if (headers.s && headers.s->len > 0) {
+ if (headers.s && ZSTR_LEN(headers.s) > 0) {
zval str_headers;
if (!context) {
p = (char*) (base+(size_t) mh_arg1);
- *p = (char)atoi(new_value->val);
+ *p = (char)atoi(ZSTR_VAL(new_value));
return SUCCESS;
}
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) {
char *p;
- if (memchr(new_value->val, '\0', new_value->len) != NULL) {
+ if (memchr(ZSTR_VAL(new_value), '\0', ZSTR_LEN(new_value)) != NULL) {
return FAILURE;
}
/* we do not use zend_memrchr() since path can contain ; itself */
- if ((p = strchr(new_value->val, ';'))) {
+ if ((p = strchr(ZSTR_VAL(new_value), ';'))) {
char *p2;
p++;
if ((p2 = strchr(p, ';'))) {
p = p2 + 1;
}
} else {
- p = new_value->val;
+ p = ZSTR_VAL(new_value);
}
if (PG(open_basedir) && *p && php_check_open_basedir(p)) {
ZEND_HASH_FOREACH_STR_KEY_VAL(ht2, name, tmp) {
if (name) {
- if (name->len == sizeof("type_name")-1 &&
- strncmp(name->val, "type_name", sizeof("type_name")-1) == 0) {
+ if (ZSTR_LEN(name) == sizeof("type_name")-1 &&
+ strncmp(ZSTR_VAL(name), "type_name", sizeof("type_name")-1) == 0) {
if (Z_TYPE_P(tmp) == IS_STRING) {
type_name = Z_STRVAL_P(tmp);
} else if (Z_TYPE_P(tmp) != IS_NULL) {
}
- } else if (name->len == sizeof("type_ns")-1 &&
- strncmp(name->val, "type_ns", sizeof("type_ns")-1) == 0) {
+ } else if (ZSTR_LEN(name) == sizeof("type_ns")-1 &&
+ strncmp(ZSTR_VAL(name), "type_ns", sizeof("type_ns")-1) == 0) {
if (Z_TYPE_P(tmp) == IS_STRING) {
type_ns = Z_STRVAL_P(tmp);
} else if (Z_TYPE_P(tmp) != IS_NULL) {
}
- } else if (name->len == sizeof("to_xml")-1 &&
- strncmp(name->val, "to_xml", sizeof("to_xml")-1) == 0) {
+ } else if (ZSTR_LEN(name) == sizeof("to_xml")-1 &&
+ strncmp(ZSTR_VAL(name), "to_xml", sizeof("to_xml")-1) == 0) {
to_xml = tmp;
- } else if (name->len == sizeof("from_xml")-1 &&
- strncmp(name->val, "from_xml", sizeof("from_xml")-1) == 0) {
+ } else if (ZSTR_LEN(name) == sizeof("from_xml")-1 &&
+ strncmp(ZSTR_VAL(name), "from_xml", sizeof("from_xml")-1) == 0) {
to_zval = tmp;
}
}
}
}
} else {
- php_error_docref(NULL, E_WARNING, "Tried to set a non existent class (%s)", classname->val);
+ php_error_docref(NULL, E_WARNING, "Tried to set a non existent class (%s)", ZSTR_VAL(classname));
return;
}
}
key = zend_string_alloc(Z_STRLEN_P(tmp_function), 0);
- zend_str_tolower_copy(key->val, Z_STRVAL_P(tmp_function), Z_STRLEN_P(tmp_function));
+ zend_str_tolower_copy(ZSTR_VAL(key), Z_STRVAL_P(tmp_function), Z_STRLEN_P(tmp_function));
if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) {
php_error_docref(NULL, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(tmp_function));
zend_function *f;
key = zend_string_alloc(Z_STRLEN_P(function_name), 0);
- zend_str_tolower_copy(key->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
+ zend_str_tolower_copy(ZSTR_VAL(key), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) {
php_error_docref(NULL, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(function_name));
if (service->send_errors) {
zval rv;
zend_string *msg = zval_get_string(zend_read_property(zend_get_error(), &exception_object, "message", sizeof("message")-1, 0, &rv));
- add_soap_fault_ex(&exception_object, this_ptr, "Server", msg->val, NULL, NULL);
+ add_soap_fault_ex(&exception_object, this_ptr, "Server", ZSTR_VAL(msg), NULL, NULL);
zend_string_release(msg);
} else {
add_soap_fault_ex(&exception_object, this_ptr, "Server", "Internal Error", NULL, NULL);
zval_dtor(&constructor);
zval_dtor(&c_ret);
} else {
- int class_name_len = service->soap_class.ce->name->len;
+ int class_name_len = ZSTR_LEN(service->soap_class.ce->name);
char *class_name = emalloc(class_name_len+1);
- memcpy(class_name, service->soap_class.ce->name->val, class_name_len+1);
+ memcpy(class_name, ZSTR_VAL(service->soap_class.ce->name), class_name_len+1);
if (zend_hash_str_exists(&Z_OBJCE(tmp_soap)->function_table, php_strtolower(class_name, class_name_len), class_name_len)) {
zval c_ret, constructor;
msg = zval_get_string(zend_read_property(zend_get_error(), &exception_object, "message", sizeof("message")-1, 0, &rv));
/* change class */
EG(exception)->ce = soap_fault_class_entry;
- set_soap_fault(&exception_object, NULL, "Client", msg->val, NULL, NULL, NULL);
+ set_soap_fault(&exception_object, NULL, "Client", ZSTR_VAL(msg), NULL, NULL, NULL);
zend_string_release(msg);
} else if ((fault = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault")-1)) == NULL) {
add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() returned non string value", NULL, NULL);
smart_str_appends(&error,function);
smart_str_appends(&error,"\") is not a valid method for this service");
smart_str_0(&error);
- add_soap_fault(this_ptr, "Client", error.s->val, NULL, NULL);
+ add_soap_fault(this_ptr, "Client", ZSTR_VAL(error.s), NULL, NULL);
smart_str_free(&error);
}
} else {
}
smart_str_0(&action);
- ret = do_request(this_ptr, request, location, action.s->val, soap_version, 0, &response);
+ ret = do_request(this_ptr, request, location, ZSTR_VAL(action.s), soap_version, 0, &response);
smart_str_free(&action);
xmlFreeDoc(request);
array_init(return_value);
ZEND_HASH_FOREACH_PTR(&sdl->functions, function) {
function_to_string(function, &buf);
- add_next_index_stringl(return_value, buf.s->val, buf.s->len);
+ add_next_index_stringl(return_value, ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));
smart_str_free(&buf);
} ZEND_HASH_FOREACH_END();
}
if (sdl->types) {
ZEND_HASH_FOREACH_PTR(sdl->types, type) {
type_to_string(type, &buf, 0);
- add_next_index_stringl(return_value, buf.s->val, buf.s->len);
+ add_next_index_stringl(return_value, ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));
smart_str_free(&buf);
} ZEND_HASH_FOREACH_END();
}
zend_ulong param_index = i;
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(ret), param_index, param_name, data) {
- parameter = get_param(function, param_name->val, param_index, TRUE);
+ parameter = get_param(function, ZSTR_VAL(param_name), param_index, TRUE);
if (style == SOAP_RPC) {
- param = serialize_parameter(parameter, data, i, param_name->val, use, method);
+ param = serialize_parameter(parameter, data, i, ZSTR_VAL(param_name), use, method);
} else {
- param = serialize_parameter(parameter, data, i, param_name->val, use, body);
+ param = serialize_parameter(parameter, data, i, ZSTR_VAL(param_name), use, body);
if (function && function->binding->bindingType == BINDING_SOAP) {
if (parameter && parameter->element) {
ns = encode_add_ns(param, parameter->element->namens);
xmlAddChild(param, node);
if (fault_ns) {
xmlNsPtr nsptr = encode_add_ns(node, fault_ns);
- xmlChar *code = xmlBuildQName(BAD_CAST(str->val), nsptr->prefix, NULL, 0);
+ xmlChar *code = xmlBuildQName(BAD_CAST(ZSTR_VAL(str)), nsptr->prefix, NULL, 0);
xmlNodeSetContent(node, code);
xmlFree(code);
} else {
- xmlNodeSetContentLen(node, BAD_CAST(str->val), (int)str->len);
+ xmlNodeSetContentLen(node, BAD_CAST(ZSTR_VAL(str)), (int)ZSTR_LEN(str));
}
zend_string_release(str);
}
node = xmlNewChild(node, ns, BAD_CAST("Value"), NULL);
if (fault_ns) {
xmlNsPtr nsptr = encode_add_ns(node, fault_ns);
- xmlChar *code = xmlBuildQName(BAD_CAST(str->val), nsptr->prefix, NULL, 0);
+ xmlChar *code = xmlBuildQName(BAD_CAST(ZSTR_VAL(str)), nsptr->prefix, NULL, 0);
xmlNodeSetContent(node, code);
xmlFree(code);
} else {
- xmlNodeSetContentLen(node, BAD_CAST(str->val), (int)str->len);
+ xmlNodeSetContentLen(node, BAD_CAST(ZSTR_VAL(str)), (int)ZSTR_LEN(str));
}
zend_string_release(str);
}
smart_str_appendc(&spaces, ' ');
}
if (spaces.s) {
- smart_str_appendl(buf, spaces.s->val, spaces.s->len);
+ smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s));
}
switch (type->kind) {
case XSD_TYPEKIND_SIMPLE:
if (end == NULL) {
len = strlen(ext->val);
} else {
- len = end-ext->val;
+ len = end - ext->val;
}
if (len == 0) {
smart_str_appendl(buf, "anyType", sizeof("anyType")-1);
enc = enc->details.sdl_type->encode;
}
if (enc) {
- smart_str_appendl(buf, spaces.s->val, spaces.s->len);
+ smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s));
smart_str_appendc(buf, ' ');
smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str));
smart_str_appendl(buf, " _;\n", 4);
sdlAttributePtr attr;
ZEND_HASH_FOREACH_PTR(type->attributes, attr) {
- smart_str_appendl(buf, spaces.s->val, spaces.s->len);
+ smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s));
smart_str_appendc(buf, ' ');
if (attr->encode && attr->encode->details.type_str) {
smart_str_appends(buf, attr->encode->details.type_str);
} ZEND_HASH_FOREACH_END();
}
if (spaces.s) {
- smart_str_appendl(buf, spaces.s->val, spaces.s->len);
+ smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s));
}
smart_str_appendc(buf, '}');
}
smart_str_appends(&path, " > ");
}
- if (path.s && path.s->len > 3) {
- path.s->len -= 3;
+ if (path.s && ZSTR_LEN(path.s) > 3) {
+ ZSTR_LEN(path.s) -= 3;
}
smart_str_0(&path);
err->level = E_WARNING;
spprintf(&err->msg, 0, "error converting %s data (path: %s): %.*s",
what_conv,
- path.s && *path.s->val != '\0' ? path.s->val : "unavailable",
+ path.s && *ZSTR_VAL(path.s) != '\0' ? ZSTR_VAL(path.s) : "unavailable",
user_msg_size, user_msg);
err->should_free = 1;
zend_string *addr_str;
addr_str = zval_get_string((zval *) zaddr_str);
- res = php_set_inet_addr(&saddr, addr_str->val, ctx->sock);
+ res = php_set_inet_addr(&saddr, ZSTR_VAL(addr_str), ctx->sock);
if (res) {
memcpy(inaddr, &saddr.sin_addr, sizeof saddr.sin_addr);
} else {
/* error already emitted, but let's emit another more relevant */
do_from_zval_err(ctx, "could not resolve address '%s' to get an AF_INET "
- "address", addr_str->val);
+ "address", ZSTR_VAL(addr_str));
}
zend_string_release(addr_str);
const struct in_addr *addr = (const struct in_addr *)data;
socklen_t size = INET_ADDRSTRLEN;
zend_string *str = zend_string_alloc(size - 1, 0);
- memset(str->val, '\0', size);
+ memset(ZSTR_VAL(str), '\0', size);
ZVAL_NEW_STR(zv, str);
zend_string *addr_str;
addr_str = zval_get_string((zval *) zaddr_str);
- res = php_set_inet6_addr(&saddr6, addr_str->val, ctx->sock);
+ res = php_set_inet6_addr(&saddr6, ZSTR_VAL(addr_str), ctx->sock);
if (res) {
memcpy(addr6, &saddr6.sin6_addr, sizeof saddr6.sin6_addr);
} else {
socklen_t size = INET6_ADDRSTRLEN;
zend_string *str = zend_string_alloc(size - 1, 0);
- memset(str->val, '\0', size);
+ memset(ZSTR_VAL(str), '\0', size);
ZVAL_NEW_STR(zv, str);
/* code in this file relies on the path being nul terminated, even though
* this is not required, at least on linux for abstract paths. It also
* assumes that the path is not empty */
- if (path_str->len == 0) {
+ if (ZSTR_LEN(path_str) == 0) {
do_from_zval_err(ctx, "%s", "the path is cannot be empty");
return;
}
- if (path_str->len >= sizeof(saddr->sun_path)) {
+ if (ZSTR_LEN(path_str) >= sizeof(saddr->sun_path)) {
do_from_zval_err(ctx, "the path is too long, the maximum permitted "
"length is %ld", sizeof(saddr->sun_path) - 1);
return;
}
- memcpy(&saddr->sun_path, path_str->val, path_str->len);
- saddr->sun_path[path_str->len] = '\0';
+ memcpy(&saddr->sun_path, ZSTR_VAL(path_str), ZSTR_LEN(path_str));
+ saddr->sun_path[ZSTR_LEN(path_str)] = '\0';
zend_string_release(path_str);
}
size_t len = MIN(msghdr->msg_iov[i].iov_len, (size_t)bytes_left);
zend_string *buf = zend_string_alloc(len, 0);
- memcpy(buf->val, msghdr->msg_iov[i].iov_base, buf->len);
- buf->val[buf->len] = '\0';
+ memcpy(ZSTR_VAL(buf), msghdr->msg_iov[i].iov_base, ZSTR_LEN(buf));
+ ZSTR_VAL(buf)[ZSTR_LEN(buf)] = '\0';
ZVAL_NEW_STR(&elem, buf);
add_next_index_zval(zv, &elem);
str = zval_get_string((zval *) zv);
#if HAVE_IF_NAMETOINDEX
- ret = if_nametoindex(str->val);
+ ret = if_nametoindex(ZSTR_VAL(str));
if (ret == 0) {
- do_from_zval_err(ctx, "no interface with name \"%s\" could be found", str->val);
+ do_from_zval_err(ctx, "no interface with name \"%s\" could be found", ZSTR_VAL(str));
}
#elif defined(SIOCGIFINDEX)
{
struct ifreq ifr;
- if (strlcpy(ifr.ifr_name, str->val, sizeof(ifr.ifr_name))
+ if (strlcpy(ifr.ifr_name, ZSTR_VAL(str), sizeof(ifr.ifr_name))
>= sizeof(ifr.ifr_name)) {
- do_from_zval_err(ctx, "the interface name \"%s\" is too large ", str->val);
+ do_from_zval_err(ctx, "the interface name \"%s\" is too large ", ZSTR_VAL(str));
} else if (ioctl(ctx->sock->bsd_socket, SIOCGIFINDEX, &ifr) < 0) {
if (errno == ENODEV) {
do_from_zval_err(ctx, "no interface with name \"%s\" could be "
- "found", str->val);
+ "found", ZSTR_VAL(str));
} else {
do_from_zval_err(ctx, "error fetching interface index for "
"interface with name \"%s\" (errno %d)",
- str->val, errno);
+ ZSTR_VAL(str), errno);
}
} else {
ret = (unsigned)ifr.ifr_ifindex;
}
if (type == PHP_NORMAL_READ) {
- retval = php_read(php_sock, tmpbuf->val, length, 0);
+ retval = php_read(php_sock, ZSTR_VAL(tmpbuf), length, 0);
} else {
- retval = recv(php_sock->bsd_socket, tmpbuf->val, length, 0);
+ retval = recv(php_sock->bsd_socket, ZSTR_VAL(tmpbuf), length, 0);
}
if (retval == -1) {
}
tmpbuf = zend_string_truncate(tmpbuf, retval, 0);
- tmpbuf->len = retval;
- tmpbuf->val[tmpbuf->len] = '\0' ;
+ ZSTR_LEN(tmpbuf) = retval;
+ ZSTR_VAL(tmpbuf)[ZSTR_LEN(tmpbuf)] = '\0' ;
RETURN_NEW_STR(tmpbuf);
}
recv_buf = zend_string_alloc(len, 0);
- if ((retval = recv(php_sock->bsd_socket, recv_buf->val, len, flags)) < 1) {
+ if ((retval = recv(php_sock->bsd_socket, ZSTR_VAL(recv_buf), len, flags)) < 1) {
efree(recv_buf);
zval_dtor(buf);
ZVAL_NULL(buf);
} else {
- recv_buf->len = retval;
- recv_buf->val[recv_buf->len] = '\0';
+ ZSTR_LEN(recv_buf) = retval;
+ ZSTR_VAL(recv_buf)[ZSTR_LEN(recv_buf)] = '\0';
/* Rebuild buffer zval */
zval_dtor(buf);
case AF_UNIX:
slen = sizeof(s_un);
s_un.sun_family = AF_UNIX;
- retval = recvfrom(php_sock->bsd_socket, recv_buf->val, arg3, arg4, (struct sockaddr *)&s_un, (socklen_t *)&slen);
+ retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&s_un, (socklen_t *)&slen);
if (retval < 0) {
PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
zend_string_free(recv_buf);
RETURN_FALSE;
}
- recv_buf->len = retval;
- recv_buf->val[recv_buf->len] = '\0';
+ ZSTR_LEN(recv_buf) = retval;
+ ZSTR_VAL(recv_buf)[ZSTR_LEN(recv_buf)] = '\0';
zval_dtor(arg2);
zval_dtor(arg5);
WRONG_PARAM_COUNT;
}
- retval = recvfrom(php_sock->bsd_socket, recv_buf->val, arg3, arg4, (struct sockaddr *)&sin, (socklen_t *)&slen);
+ retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&sin, (socklen_t *)&slen);
if (retval < 0) {
PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
zend_string_free(recv_buf);
RETURN_FALSE;
}
- recv_buf->len = retval;
- recv_buf->val[recv_buf->len] = '\0';
+ ZSTR_LEN(recv_buf) = retval;
+ ZSTR_VAL(recv_buf)[ZSTR_LEN(recv_buf)] = '\0';
zval_dtor(arg2);
zval_dtor(arg5);
WRONG_PARAM_COUNT;
}
- retval = recvfrom(php_sock->bsd_socket, recv_buf->val, arg3, arg4, (struct sockaddr *)&sin6, (socklen_t *)&slen);
+ retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&sin6, (socklen_t *)&slen);
if (retval < 0) {
PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
zend_string_free(recv_buf);
RETURN_FALSE;
}
- recv_buf->len = retval;
- recv_buf->val[recv_buf->len] = '\0';
+ ZSTR_LEN(recv_buf) = retval;
+ ZSTR_VAL(recv_buf)[ZSTR_LEN(recv_buf)] = '\0';
zval_dtor(arg2);
zval_dtor(arg5);
zend_class_entry *ce;
if (!autoload) {
- zend_string *lc_name = zend_string_alloc(name->len, 0);
- zend_str_tolower_copy(lc_name->val, name->val, name->len);
+ zend_string *lc_name = zend_string_alloc(ZSTR_LEN(name), 0);
+ zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(name), ZSTR_LEN(name));
ce = zend_hash_find_ptr(EG(class_table), lc_name);
zend_string_free(lc_name);
ce = zend_lookup_class(name);
}
if (ce == NULL) {
- php_error_docref(NULL, E_WARNING, "Class %s does not exist%s", name->val, autoload ? " and could not be loaded" : "");
+ php_error_docref(NULL, E_WARNING, "Class %s does not exist%s", ZSTR_VAL(name), autoload ? " and could not be loaded" : "");
return NULL;
}
zval result;
int ret;
- class_file_len = (int)spprintf(&class_file, 0, "%s%.*s", lc_name->val, ext_len, ext);
+ class_file_len = (int)spprintf(&class_file, 0, "%s%.*s", ZSTR_VAL(lc_name), ext_len, ext);
#if DEFAULT_SLASH != '\\'
{
pos = SPL_DEFAULT_FILE_EXTENSIONS;
pos_len = sizeof(SPL_DEFAULT_FILE_EXTENSIONS) - 1;
} else {
- pos = file_exts->val;
- pos_len = (int)file_exts->len;
+ pos = ZSTR_VAL(file_exts);
+ pos_len = (int)ZSTR_LEN(file_exts);
}
- lc_name = zend_string_alloc(class_name->len, 0);
- zend_str_tolower_copy(lc_name->val, class_name->val, class_name->len);
+ lc_name = zend_string_alloc(ZSTR_LEN(class_name), 0);
+ zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(class_name), ZSTR_LEN(class_name));
while (pos && *pos && !EG(exception)) {
pos1 = strchr(pos, ',');
if (pos1) {
if (ex &&
ex->opline->opcode != ZEND_FETCH_CLASS &&
ex->opline->opcode != ZEND_NEW) {
- zend_throw_exception_ex(spl_ce_LogicException, 0, "Class %s could not be loaded", class_name->val);
+ zend_throw_exception_ex(spl_ce_LogicException, 0, "Class %s could not be loaded", ZSTR_VAL(class_name));
} else {
- php_error_docref(NULL, E_ERROR, "Class %s could not be loaded", class_name->val);
+ php_error_docref(NULL, E_ERROR, "Class %s could not be loaded", ZSTR_VAL(class_name));
}
}
} /* }}} */
int l_autoload_running = SPL_G(autoload_running);
SPL_G(autoload_running) = 1;
lc_name = zend_string_alloc(Z_STRLEN_P(class_name), 0);
- zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name));
+ zend_str_tolower_copy(ZSTR_VAL(lc_name), Z_STRVAL_P(class_name), Z_STRLEN_P(class_name));
ZEND_HASH_FOREACH_STR_KEY_PTR(SPL_G(autoload_functions), func_name, alfi) {
- zend_call_method(Z_ISUNDEF(alfi->obj)? NULL : &alfi->obj, alfi->ce, &alfi->func_ptr, func_name->val, func_name->len, retval, 1, class_name, NULL);
+ zend_call_method(Z_ISUNDEF(alfi->obj)? NULL : &alfi->obj, alfi->ce, &alfi->func_ptr, ZSTR_VAL(func_name), ZSTR_LEN(func_name), retval, 1, class_name, NULL);
zend_exception_save();
if (retval) {
zval_ptr_dtor(retval);
RETURN_FALSE;
} else if (Z_TYPE_P(zcallable) == IS_STRING) {
if (do_throw) {
- zend_throw_exception_ex(spl_ce_LogicException, 0, "Function '%s' not %s (%s)", func_name->val, alfi.func_ptr ? "callable" : "found", error);
+ zend_throw_exception_ex(spl_ce_LogicException, 0, "Function '%s' not %s (%s)", ZSTR_VAL(func_name), alfi.func_ptr ? "callable" : "found", error);
}
if (error) {
efree(error);
if (Z_TYPE_P(zcallable) == IS_OBJECT) {
ZVAL_COPY(&alfi.closure, zcallable);
- lc_name = zend_string_alloc(func_name->len + sizeof(uint32_t), 0);
- zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len);
- memcpy(lc_name->val + func_name->len, &Z_OBJ_HANDLE_P(zcallable), sizeof(uint32_t));
- lc_name->val[lc_name->len] = '\0';
+ lc_name = zend_string_alloc(ZSTR_LEN(func_name) + sizeof(uint32_t), 0);
+ zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(func_name), ZSTR_LEN(func_name));
+ memcpy(ZSTR_VAL(lc_name) + ZSTR_LEN(func_name), &Z_OBJ_HANDLE_P(zcallable), sizeof(uint32_t));
+ ZSTR_VAL(lc_name)[ZSTR_LEN(lc_name)] = '\0';
} else {
ZVAL_UNDEF(&alfi.closure);
- lc_name = zend_string_alloc(func_name->len, 0);
- zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len);
+ lc_name = zend_string_alloc(ZSTR_LEN(func_name), 0);
+ zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(func_name), ZSTR_LEN(func_name));
}
zend_string_release(func_name);
if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
/* add object id to the hash to ensure uniqueness, for more reference look at bug #40091 */
- lc_name = zend_string_extend(lc_name, lc_name->len + sizeof(uint32_t), 0);
- memcpy(lc_name->val + lc_name->len - sizeof(uint32_t), &obj_ptr->handle, sizeof(uint32_t));
- lc_name->val[lc_name->len] = '\0';
+ lc_name = zend_string_extend(lc_name, ZSTR_LEN(lc_name) + sizeof(uint32_t), 0);
+ memcpy(ZSTR_VAL(lc_name) + ZSTR_LEN(lc_name) - sizeof(uint32_t), &obj_ptr->handle, sizeof(uint32_t));
+ ZSTR_VAL(lc_name)[ZSTR_LEN(lc_name)] = '\0';
ZVAL_OBJ(&alfi.obj, obj_ptr);
Z_ADDREF(alfi.obj);
} else {
}
if (Z_TYPE_P(zcallable) == IS_OBJECT) {
- lc_name = zend_string_alloc(func_name->len + sizeof(uint32_t), 0);
- zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len);
- memcpy(lc_name->val + func_name->len, &Z_OBJ_HANDLE_P(zcallable), sizeof(uint32_t));
- lc_name->val[lc_name->len] = '\0';
+ lc_name = zend_string_alloc(ZSTR_LEN(func_name) + sizeof(uint32_t), 0);
+ zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(func_name), ZSTR_LEN(func_name));
+ memcpy(ZSTR_VAL(lc_name) + ZSTR_LEN(func_name), &Z_OBJ_HANDLE_P(zcallable), sizeof(uint32_t));
+ ZSTR_VAL(lc_name)[ZSTR_LEN(lc_name)] = '\0';
} else {
- lc_name = zend_string_alloc(func_name->len, 0);
- zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len);
+ lc_name = zend_string_alloc(ZSTR_LEN(func_name), 0);
+ zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(func_name), ZSTR_LEN(func_name));
}
zend_string_release(func_name);
if (SPL_G(autoload_functions)) {
- if (lc_name->len == sizeof("spl_autoload_call") - 1 && !strcmp(lc_name->val, "spl_autoload_call")) {
+ if (ZSTR_LEN(lc_name) == sizeof("spl_autoload_call") - 1 && !strcmp(ZSTR_VAL(lc_name), "spl_autoload_call")) {
/* remove all */
zend_hash_destroy(SPL_G(autoload_functions));
FREE_HASHTABLE(SPL_G(autoload_functions));
/* remove specific */
success = zend_hash_del(SPL_G(autoload_functions), lc_name);
if (success != SUCCESS && obj_ptr) {
- lc_name = zend_string_extend(lc_name, lc_name->len + sizeof(uint32_t), 0);
- memcpy(lc_name->val + lc_name->len - sizeof(uint32_t), &obj_ptr->handle, sizeof(uint32_t));
- lc_name->val[lc_name->len] = '\0';
+ lc_name = zend_string_extend(lc_name, ZSTR_LEN(lc_name) + sizeof(uint32_t), 0);
+ memcpy(ZSTR_VAL(lc_name) + ZSTR_LEN(lc_name) - sizeof(uint32_t), &obj_ptr->handle, sizeof(uint32_t));
+ ZSTR_VAL(lc_name)[ZSTR_LEN(lc_name)] = '\0';
success = zend_hash_del(SPL_G(autoload_functions), lc_name);
}
}
- } else if (lc_name->len == sizeof("spl_autoload")-1 && !strcmp(lc_name->val, "spl_autoload")) {
+ } else if (ZSTR_LEN(lc_name) == sizeof("spl_autoload")-1 && !strcmp(ZSTR_VAL(lc_name), "spl_autoload")) {
/* register single spl_autoload() */
spl_func_ptr = zend_hash_str_find_ptr(EG(function_table), "spl_autoload", sizeof("spl_autoload") - 1);
add_next_index_str(&tmp, zend_string_copy(alfi->func_ptr->common.function_name));
add_next_index_zval(return_value, &tmp);
} else {
- if (strncmp(alfi->func_ptr->common.function_name->val, "__lambda_func", sizeof("__lambda_func") - 1)) {
+ if (strncmp(ZSTR_VAL(alfi->func_ptr->common.function_name), "__lambda_func", sizeof("__lambda_func") - 1)) {
add_next_index_str(return_value, zend_string_copy(alfi->func_ptr->common.function_name));
} else {
add_next_index_str(return_value, zend_string_copy(key));
if (Z_TYPE_P(retval) == IS_UNDEF) {
switch (type) {
case BP_VAR_R:
- zend_error(E_NOTICE, "Undefined index: %s", offset_key->val);
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
case BP_VAR_UNSET:
case BP_VAR_IS:
retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined index: %s", offset_key->val);
+ zend_error(E_NOTICE,"Undefined index: %s", ZSTR_VAL(offset_key));
case BP_VAR_W: {
ZVAL_NULL(retval);
}
} else {
switch (type) {
case BP_VAR_R:
- zend_error(E_NOTICE, "Undefined index: %s", offset_key->val);
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
case BP_VAR_UNSET:
case BP_VAR_IS:
retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined index: %s", offset_key->val);
+ zend_error(E_NOTICE,"Undefined index: %s", ZSTR_VAL(offset_key));
case BP_VAR_W: {
zval value;
ZVAL_NULL(&value);
}
if (spl_array_is_object(intern)) {
- php_error_docref(NULL, E_RECOVERABLE_ERROR, "Cannot append properties to objects, use %s::offsetSet() instead", Z_OBJCE_P(object)->name->val);
+ php_error_docref(NULL, E_RECOVERABLE_ERROR, "Cannot append properties to objects, use %s::offsetSet() instead", ZSTR_VAL(Z_OBJCE_P(object)->name));
return;
}
if (data && Z_TYPE_P(data) == IS_INDIRECT &&
Z_TYPE_P(data = Z_INDIRECT_P(data)) == IS_UNDEF) {
/* skip */
- } else if (!string_key->len || string_key->val[0]) {
+ } else if (!ZSTR_LEN(string_key) || ZSTR_VAL(string_key)[0]) {
return SUCCESS;
}
} else {
intern->u.dir.index = index;
break;
case SPL_FS_FILE:
- php_error_docref(NULL, E_ERROR, "An object of class %s cannot be cloned", old_object->ce->name->val);
+ php_error_docref(NULL, E_ERROR, "An object of class %s cannot be cloned", ZSTR_VAL(old_object->ce->name));
break;
}
ret = php_basename(fname, flen, NULL, 0);
- p = zend_memrchr(ret->val, '.', ret->len);
+ p = zend_memrchr(ZSTR_VAL(ret), '.', ZSTR_LEN(ret));
if (p) {
- assert(p > ret->val);
- idx = (int)(p - ret->val);
- RETVAL_STRINGL(ret->val + idx + 1, ret->len - idx - 1);
+ assert(p > ZSTR_VAL(ret));
+ idx = (int)(p - ZSTR_VAL(ret));
+ RETVAL_STRINGL(ZSTR_VAL(ret) + idx + 1, ZSTR_LEN(ret) - idx - 1);
zend_string_release(ret);
return;
} else {
fname = php_basename(intern->u.dir.entry.d_name, strlen(intern->u.dir.entry.d_name), NULL, 0);
- p = zend_memrchr(fname->val, '.', fname->len);
+ p = zend_memrchr(ZSTR_VAL(fname), '.', ZSTR_LEN(fname));
if (p) {
- idx = (int)(p - fname->val);
- RETVAL_STRINGL(fname->val + idx + 1, fname->len - idx - 1);
+ idx = (int)(p - ZSTR_VAL(fname));
+ RETVAL_STRINGL(ZSTR_VAL(fname) + idx + 1, ZSTR_LEN(fname) - idx - 1);
zend_string_release(fname);
} else {
zend_string_release(fname);
zend_function *func = pce->constructor;
spl_instantiate(pce, retval);
- zend_call_method(retval, pce, &func, func->common.function_name->val, func->common.function_name->len, NULL, 1, arg1, NULL);
+ zend_call_method(retval, pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL);
return 0;
}
/* }}} */
zend_function *func = pce->constructor;
spl_instantiate(pce, retval);
- zend_call_method(retval, pce, &func, func->common.function_name->val, func->common.function_name->len, NULL, 2, arg1, arg2);
+ zend_call_method(retval, pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2);
return 0;
}
/* }}} */
zend_string * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len) /* {{{ */
{
- return zend_mangle_property_name(ce->name->val, ce->name->len, prop_name, prop_len, 0);
+ return zend_mangle_property_name(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), prop_name, prop_len, 0);
}
/* }}} */
zval *zobj;
if (!object->iterators) {
- php_error_docref(NULL, E_ERROR, "The %s instance wasn't initialized properly", (*zobject)->ce->name->val);
+ php_error_docref(NULL, E_ERROR, "The %s instance wasn't initialized properly", ZSTR_VAL((*zobject)->ce->name));
}
zobj = &object->iterators[level].zobject;
zval has_next;
int level;
- smart_str_appendl(&str, object->prefix[0].s->val, object->prefix[0].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[0].s), ZSTR_LEN(object->prefix[0].s));
for (level = 0; level < object->level; ++level) {
zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
if (Z_TYPE(has_next) != IS_UNDEF) {
if (Z_TYPE(has_next) == IS_TRUE) {
- smart_str_appendl(&str, object->prefix[1].s->val, object->prefix[1].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[1].s), ZSTR_LEN(object->prefix[1].s));
} else {
- smart_str_appendl(&str, object->prefix[2].s->val, object->prefix[2].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[2].s), ZSTR_LEN(object->prefix[2].s));
}
zval_ptr_dtor(&has_next);
}
zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
if (Z_TYPE(has_next) != IS_UNDEF) {
if (Z_TYPE(has_next) == IS_TRUE) {
- smart_str_appendl(&str, object->prefix[3].s->val, object->prefix[3].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[3].s), ZSTR_LEN(object->prefix[3].s));
} else {
- smart_str_appendl(&str, object->prefix[4].s->val, object->prefix[4].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[4].s), ZSTR_LEN(object->prefix[4].s));
}
zval_ptr_dtor(&has_next);
}
- smart_str_appendl(&str, object->prefix[5].s->val, object->prefix[5].s->len);
+ smart_str_appendl(&str, ZSTR_VAL(object->prefix[5].s), ZSTR_LEN(object->prefix[5].s));
smart_str_0(&str);
RETURN_NEW_STR(str.s);
spl_recursive_tree_iterator_get_postfix(object, &postfix);
str = zend_string_alloc(Z_STRLEN(prefix) + Z_STRLEN(entry) + Z_STRLEN(postfix), 0);
- ptr = str->val;
+ ptr = ZSTR_VAL(str);
memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix));
ptr += Z_STRLEN(prefix);
spl_recursive_tree_iterator_get_postfix(object, &postfix);
str = zend_string_alloc(Z_STRLEN(prefix) + Z_STRLEN(key) + Z_STRLEN(postfix), 0);
- ptr = str->val;
+ ptr = ZSTR_VAL(str);
memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix));
ptr += Z_STRLEN(prefix);
#define SPL_CHECK_CTOR(intern, classname) \
if (intern->dit_type == DIT_Unknown) { \
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Classes derived from %s must call %s::__construct()", \
- (spl_ce_##classname)->name->val, (spl_ce_##classname)->name->val); \
+ ZSTR_VAL((spl_ce_##classname)->name), ZSTR_VAL((spl_ce_##classname)->name)); \
return; \
}
intern = Z_SPLDUAL_IT_P(getThis());
if (intern->dit_type != DIT_Unknown) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s::getIterator() must be called exactly once per instance", ce_base->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s::getIterator() must be called exactly once per instance", ZSTR_VAL(ce_base->name));
return NULL;
}
return NULL;
}
if (Z_TYPE(retval) != IS_OBJECT || !instanceof_function(Z_OBJCE(retval), zend_ce_traversable)) {
- zend_throw_exception_ex(spl_ce_LogicException, 0, "%s::getIterator() must return an object that implements Traversable", ce->name->val);
+ zend_throw_exception_ex(spl_ce_LogicException, 0, "%s::getIterator() must return an object that implements Traversable", ZSTR_VAL(ce->name));
return NULL;
}
zobject = &retval;
{
case REGIT_MODE_MAX: /* won't happen but makes compiler happy */
case REGIT_MODE_MATCH:
- count = pcre_exec(intern->u.regex.pce->re, intern->u.regex.pce->extra, subject->val, subject->len, 0, 0, NULL, 0);
+ count = pcre_exec(intern->u.regex.pce->re, intern->u.regex.pce->extra, ZSTR_VAL(subject), ZSTR_LEN(subject), 0, 0, NULL, 0);
RETVAL_BOOL(count >= 0);
break;
//??? }
zval_ptr_dtor(&intern->current.data);
ZVAL_UNDEF(&intern->current.data);
- php_pcre_match_impl(intern->u.regex.pce, subject->val, subject->len, &zcount,
+ php_pcre_match_impl(intern->u.regex.pce, ZSTR_VAL(subject), ZSTR_LEN(subject), &zcount,
&intern->current.data, intern->u.regex.mode == REGIT_MODE_ALL_MATCHES, intern->u.regex.use_flags, intern->u.regex.preg_flags, 0);
RETVAL_BOOL(Z_LVAL(zcount) > 0);
break;
//??? }
zval_ptr_dtor(&intern->current.data);
ZVAL_UNDEF(&intern->current.data);
- php_pcre_split_impl(intern->u.regex.pce, subject->val, subject->len, &intern->current.data, -1, intern->u.regex.preg_flags);
+ php_pcre_split_impl(intern->u.regex.pce, ZSTR_VAL(subject), ZSTR_LEN(subject), &intern->current.data, -1, intern->u.regex.preg_flags);
count = zend_hash_num_elements(Z_ARRVAL(intern->current.data));
RETVAL_BOOL(count > 1);
break;
convert_to_string(&tmp_replacement);
replacement = &tmp_replacement;
}
- result = php_pcre_replace_impl(intern->u.regex.pce, subject, subject->val, subject->len, replacement, 0, -1, &count);
+ result = php_pcre_replace_impl(intern->u.regex.pce, subject, ZSTR_VAL(subject), ZSTR_LEN(subject), replacement, 0, -1, &count);
if (intern->u.regex.flags & REGIT_USE_KEY) {
zval_ptr_dtor(&intern->current.key);
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT|CIT_TOSTRING_USE_INNER))) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not fetch string value (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) {
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
}
if ((value = zend_symtable_find(HASH_OF(&intern->u.caching.zcache), key)) == NULL) {
- zend_error(E_NOTICE, "Undefined index: %s", key->val);
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(key));
return;
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%v does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%v does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
}
} else {
zend_string *hash = zend_string_alloc(sizeof(zend_object*), 0);
- memcpy(hash->val, (void*)&Z_OBJ_P(obj), sizeof(zend_object*));
- hash->val[hash->len] = '\0';
+ memcpy(ZSTR_VAL(hash), (void*)&Z_OBJ_P(obj), sizeof(zend_object*));
+ ZSTR_VAL(hash)[ZSTR_LEN(hash)] = '\0';
return hash;
/* !!! FIXME
int hash_len = sizeof(zend_object_value);
return;
}
- if (sqlite3_exec(db_obj->db, sql->val, NULL, NULL, &errtext) != SQLITE_OK) {
+ if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) {
php_sqlite3_error(db_obj, "%s", errtext);
sqlite3_free(errtext);
RETURN_FALSE;
return;
}
- if (sql->len) {
- ret = sqlite3_mprintf("%q", sql->val);
+ if (ZSTR_LEN(sql)) {
+ ret = sqlite3_mprintf("%q", ZSTR_VAL(sql));
if (ret) {
RETVAL_STRING(ret);
sqlite3_free(ret);
return;
}
- if (!sql->len) {
+ if (!ZSTR_LEN(sql)) {
RETURN_FALSE;
}
stmt_obj->db_obj = db_obj;
ZVAL_COPY(&stmt_obj->db_obj_zval, object);
- errcode = sqlite3_prepare_v2(db_obj->db, sql->val, sql->len, &(stmt_obj->stmt), NULL);
+ errcode = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL);
if (errcode != SQLITE_OK) {
php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->db));
zval_dtor(return_value);
return;
}
- if (!sql->len) {
+ if (!ZSTR_LEN(sql)) {
RETURN_FALSE;
}
/* If there was no return value then just execute the query */
if (!USED_RET()) {
- if (sqlite3_exec(db_obj->db, sql->val, NULL, NULL, &errtext) != SQLITE_OK) {
+ if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) {
php_sqlite3_error(db_obj, "%s", errtext);
sqlite3_free(errtext);
}
stmt_obj->db_obj = db_obj;
ZVAL_COPY(&stmt_obj->db_obj_zval, object);
- return_code = sqlite3_prepare_v2(db_obj->db, sql->val, sql->len, &(stmt_obj->stmt), NULL);
+ return_code = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL);
if (return_code != SQLITE_OK) {
php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", return_code, sqlite3_errmsg(db_obj->db));
zval_ptr_dtor(&stmt);
return;
}
- if (!sql->len) {
+ if (!ZSTR_LEN(sql)) {
RETURN_FALSE;
}
/* If there was no return value then just execute the query */
if (!USED_RET()) {
- if (sqlite3_exec(db_obj->db, sql->val, NULL, NULL, &errtext) != SQLITE_OK) {
+ if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) {
php_sqlite3_error(db_obj, "%s", errtext);
sqlite3_free(errtext);
}
return;
}
- return_code = sqlite3_prepare_v2(db_obj->db, sql->val, sql->len, &stmt, NULL);
+ return_code = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &stmt, NULL);
if (return_code != SQLITE_OK) {
php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", return_code, sqlite3_errmsg(db_obj->db));
RETURN_FALSE;
}
if (!zend_is_callable(callback_func, 0, &callback_name)) {
- php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val);
+ php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
RETURN_FALSE;
}
}
if (!zend_is_callable(step_callback, 0, &callback_name)) {
- php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val);
+ php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
RETURN_FALSE;
}
zend_string_release(callback_name);
if (!zend_is_callable(fini_callback, 0, &callback_name)) {
- php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val);
+ php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
RETURN_FALSE;
}
}
if (!zend_is_callable(callback_func, 0, &callback_name)) {
- php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val);
+ php_sqlite3_error(db_obj, "Not a valid callback function %s", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
RETURN_FALSE;
}
/* We need a : prefix to resolve a name to a parameter number */
if (param->name) {
- if (param->name->val[0] != ':') {
+ if (ZSTR_VAL(param->name)[0] != ':') {
/* pre-increment for character + 1 for null */
- zend_string *temp = zend_string_alloc(param->name->len + 1, 0);
- temp->val[0] = ':';
- memmove(temp->val + 1, param->name->val, param->name->len + 1);
+ zend_string *temp = zend_string_alloc(ZSTR_LEN(param->name) + 1, 0);
+ ZSTR_VAL(temp)[0] = ':';
+ memmove(ZSTR_VAL(temp) + 1, ZSTR_VAL(param->name), ZSTR_LEN(param->name) + 1);
param->name = temp;
} else {
- param->name = zend_string_init(param->name->val, param->name->len, 0);
+ param->name = zend_string_init(ZSTR_VAL(param->name), ZSTR_LEN(param->name), 0);
}
/* do lookup*/
- param->param_number = sqlite3_bind_parameter_index(stmt->stmt, param->name->val);
+ param->param_number = sqlite3_bind_parameter_index(stmt->stmt, ZSTR_VAL(param->name));
}
if (param->param_number < 1) {
buffer = Z_STR_P(parameter);
}
- sqlite3_bind_blob(stmt_obj->stmt, param->param_number, buffer->val, buffer->len, SQLITE_TRANSIENT);
+ sqlite3_bind_blob(stmt_obj->stmt, param->param_number, ZSTR_VAL(buffer), ZSTR_LEN(buffer), SQLITE_TRANSIENT);
if (stream) {
zend_string_release(buffer);
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
zend_restore_error_handling(&error_handling);
- if (!sql->len) {
+ if (!ZSTR_LEN(sql)) {
RETURN_FALSE;
}
stmt_obj->db_obj = db_obj;
ZVAL_COPY(&stmt_obj->db_obj_zval, db_zval);
- errcode = sqlite3_prepare_v2(db_obj->db, sql->val, sql->len, &(stmt_obj->stmt), NULL);
+ errcode = sqlite3_prepare_v2(db_obj->db, ZSTR_VAL(sql), ZSTR_LEN(sql), &(stmt_obj->stmt), NULL);
if (errcode != SQLITE_OK) {
php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->db));
zval_dtor(return_value);
zend_string *str1 = zval_get_string(&f->val);
zend_string *str2 = zval_get_string(&s->val);
- int result = strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, fold_case);
+ int result = strnatcmp_ex(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str2), fold_case);
zend_string_release(str1);
zend_string_release(str2);
var_exists = zend_hash_exists_ind(symbol_table, var_name);
} else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) {
zend_string *str = zend_long_to_str(num_key);
- php_prefix_varname(&final_name, prefix, str->val, str->len, 1);
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(str), ZSTR_LEN(str), 1);
zend_string_release(str);
} else {
continue;
case EXTR_OVERWRITE:
/* GLOBALS protection */
- if (var_exists && var_name->len == sizeof("GLOBALS")-1 && !strcmp(var_name->val, "GLOBALS")) {
+ if (var_exists && ZSTR_LEN(var_name) == sizeof("GLOBALS")-1 && !strcmp(ZSTR_VAL(var_name), "GLOBALS")) {
break;
}
- if (var_exists && var_name->len == sizeof("this")-1 && !strcmp(var_name->val, "this") && EG(scope) && EG(scope)->name->len != 0) {
+ if (var_exists && ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this") && EG(scope) && ZSTR_LEN(EG(scope)->name) != 0) {
break;
}
ZVAL_STR_COPY(&final_name, var_name);
case EXTR_PREFIX_IF_EXISTS:
if (var_exists) {
- php_prefix_varname(&final_name, prefix, var_name->val, var_name->len, 1);
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
}
break;
case EXTR_PREFIX_SAME:
- if (!var_exists && var_name->len != 0) {
+ if (!var_exists && ZSTR_LEN(var_name) != 0) {
ZVAL_STR_COPY(&final_name, var_name);
}
/* break omitted intentionally */
case EXTR_PREFIX_ALL:
- if (Z_TYPE(final_name) == IS_NULL && var_name->len != 0) {
- php_prefix_varname(&final_name, prefix, var_name->val, var_name->len, 1);
+ if (Z_TYPE(final_name) == IS_NULL && ZSTR_LEN(var_name) != 0) {
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
}
break;
case EXTR_PREFIX_INVALID:
if (Z_TYPE(final_name) == IS_NULL) {
- if (!php_valid_var_name(var_name->val, var_name->len)) {
- php_prefix_varname(&final_name, prefix, var_name->val, var_name->len, 1);
+ if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name))) {
+ php_prefix_varname(&final_name, prefix, ZSTR_VAL(var_name), ZSTR_LEN(var_name), 1);
} else {
ZVAL_STR_COPY(&final_name, var_name);
}
zend_string *key = zval_get_string(name);
if (!Z_OBJ_HANDLER_P(data, has_property) || Z_OBJ_HANDLER_P(data, has_property)(data, name, 1, NULL)) {
- prop = zend_read_property(Z_OBJCE_P(data), data, key->val, key->len, 1, rv);
+ prop = zend_read_property(Z_OBJCE_P(data), data, ZSTR_VAL(key), ZSTR_LEN(key), 1, rv);
}
zend_string_release(key);
} else if (Z_TYPE_P(data) == IS_ARRAY) {
zval_ptr_dtor(&ASSERTG(callback));
ZVAL_UNDEF(&ASSERTG(callback));
}
- if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || new_value->len)) {
+ if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || ZSTR_LEN(new_value))) {
ZVAL_STR_COPY(&ASSERTG(callback), new_value);
}
} else {
if (ASSERTG(cb)) {
pefree(ASSERTG(cb), 1);
}
- if (new_value && new_value->len) {
- ASSERTG(cb) = pemalloc(new_value->len + 1, 1);
- memcpy(ASSERTG(cb), new_value->val, new_value->len);
- ASSERTG(cb)[new_value->len] = '\0';
+ if (new_value && ZSTR_LEN(new_value)) {
+ ASSERTG(cb) = pemalloc(ZSTR_LEN(new_value) + 1, 1);
+ memcpy(ASSERTG(cb), ZSTR_VAL(new_value), ZSTR_LEN(new_value));
+ ASSERTG(cb)[ZSTR_LEN(new_value)] = '\0';
} else {
ASSERTG(cb) = NULL;
}
php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval);
} else {
zend_string *str = zval_get_string(description);
- php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, str->val, myeval);
+ php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval);
zend_string_release(str);
}
if (ASSERTG(bail)) {
zend_throw_exception_object(description);
} else {
zend_string *str = zval_get_string(description);
- zend_throw_exception(assertion_error_ce, str->val, E_ERROR);
+ zend_throw_exception(assertion_error_ce, ZSTR_VAL(str), E_ERROR);
zend_string_release(str);
}
} else if (ASSERTG(warning)) {
} else {
zend_string *str = zval_get_string(description);
if (myeval) {
- php_error_docref(NULL, E_WARNING, "%s: \"%s\" failed", str->val, myeval);
+ php_error_docref(NULL, E_WARNING, "%s: \"%s\" failed", ZSTR_VAL(str), myeval);
} else {
- php_error_docref(NULL, E_WARNING, "%s failed", str->val);
+ php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str));
}
zend_string_release(str);
}
zend_string *result;
result = zend_string_alloc(((length + 2) / 3) * 4 * sizeof(char), 0);
- p = (unsigned char *)result->val;
+ p = (unsigned char *)ZSTR_VAL(result);
while (length > 2) { /* keep going until we have less than 24 bits */
*p++ = base64_table[current[0] >> 2];
}
*p = '\0';
- result->len = (p - (unsigned char *)result->val);
+ ZSTR_LEN(result) = (p - (unsigned char *)ZSTR_VAL(result));
return result;
}
switch(i % 4) {
case 0:
- result->val[j] = ch << 2;
+ ZSTR_VAL(result)[j] = ch << 2;
break;
case 1:
- result->val[j++] |= ch >> 4;
- result->val[j] = (ch & 0x0f) << 4;
+ ZSTR_VAL(result)[j++] |= ch >> 4;
+ ZSTR_VAL(result)[j] = (ch & 0x0f) << 4;
break;
case 2:
- result->val[j++] |= ch >>2;
- result->val[j] = (ch & 0x03) << 6;
+ ZSTR_VAL(result)[j++] |= ch >>2;
+ ZSTR_VAL(result)[j] = (ch & 0x03) << 6;
break;
case 3:
- result->val[j++] |= ch;
+ ZSTR_VAL(result)[j++] |= ch;
break;
}
i++;
case 2:
k++;
case 3:
- result->val[k] = 0;
+ ZSTR_VAL(result)[k] = 0;
}
}
- result->len = j;
- result->val[result->len] = '\0';
+ ZSTR_LEN(result) = j;
+ ZSTR_VAL(result)[ZSTR_LEN(result)] = '\0';
return result;
}
}
zval_copy_ctor(return_value);
} else {
- php_error_docref(NULL, E_WARNING, "Couldn't find constant %s", const_name->val);
+ php_error_docref(NULL, E_WARNING, "Couldn't find constant %s", ZSTR_VAL(const_name));
RETURN_NULL();
}
}
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(args), entry) {
zend_string *arg_str = zval_get_string(entry);
- argv[pos++] = estrdup(arg_str->val);
+ argv[pos++] = estrdup(ZSTR_VAL(arg_str));
zend_string_release(arg_str);
} ZEND_HASH_FOREACH_END();
zend_string *arg_str = zval_get_string(entry);
opts->need_param = 0;
- opts->opt_name = estrdup(arg_str->val);
+ opts->opt_name = estrdup(ZSTR_VAL(arg_str));
len = (int)strlen(opts->opt_name);
if ((len > 0) && (opts->opt_name[len - 1] == ':')) {
opts->need_param++;
if (Z_TYPE_P(entry) == IS_STRING) {
if (hash_key->key) {
- add_assoc_str_ex(retval, hash_key->key->val, hash_key->key->len, zend_string_copy(Z_STR_P(entry)));
+ add_assoc_str_ex(retval, ZSTR_VAL(hash_key->key), ZSTR_LEN(hash_key->key), zend_string_copy(Z_STR_P(entry)));
} else {
add_index_str(retval, hash_key->h, zend_string_copy(Z_STR_P(entry)));
}
if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, &function_name)) {
if (function_name) {
- php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", function_name->val);
+ php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name));
zend_string_release(function_name);
} else {
php_error(E_WARNING, "(Registered shutdown functions) Unable to call - function does not exist");
&& (method = zend_hash_index_find(Z_ARRVAL_P(function), 1)) != NULL
&& Z_TYPE_P(obj) == IS_OBJECT
&& Z_TYPE_P(method) == IS_STRING) {
- php_error_docref(NULL, E_WARNING, "Unable to call %s::%s() - function does not exist", Z_OBJCE_P(obj)->name->val, Z_STRVAL_P(method));
+ php_error_docref(NULL, E_WARNING, "Unable to call %s::%s() - function does not exist", ZSTR_VAL(Z_OBJCE_P(obj)->name), Z_STRVAL_P(method));
} else {
php_error_docref(NULL, E_WARNING, "Unable to call tick function");
}
/* Prevent entering of anything but valid callback (syntax check only!) */
if (!zend_is_callable(&shutdown_function_entry.arguments[0], 0, &callback_name)) {
if (callback_name) {
- php_error_docref(NULL, E_WARNING, "Invalid shutdown callback '%s' passed", callback_name->val);
+ php_error_docref(NULL, E_WARNING, "Invalid shutdown callback '%s' passed", ZSTR_VAL(callback_name));
} else {
php_error_docref(NULL, E_WARNING, "Invalid shutdown callback passed");
}
}
if (hash_key->key == NULL ||
- hash_key->key->val[0] != 0
+ ZSTR_VAL(hash_key->key)[0] != 0
) {
if (details) {
array_init(&option);
return;
}
- old_value = zend_ini_string(varname->val, (int)varname->len, 0);
+ old_value = zend_ini_string(ZSTR_VAL(varname), (int)ZSTR_LEN(varname), 0);
/* copy to return here, because alter might free it! */
if (old_value) {
#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, (int)var_len, ini, sizeof(ini))
/* open basedir check */
if (PG(open_basedir)) {
- if (_CHECK_PATH(varname->val, varname->len, "error_log") ||
- _CHECK_PATH(varname->val, varname->len, "java.class.path") ||
- _CHECK_PATH(varname->val, varname->len, "java.home") ||
- _CHECK_PATH(varname->val, varname->len, "mail.log") ||
- _CHECK_PATH(varname->val, varname->len, "java.library.path") ||
- _CHECK_PATH(varname->val, varname->len, "vpopmail.directory")) {
- if (php_check_open_basedir(new_value->val)) {
+ if (_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "error_log") ||
+ _CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.class.path") ||
+ _CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.home") ||
+ _CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "mail.log") ||
+ _CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.library.path") ||
+ _CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "vpopmail.directory")) {
+ if (php_check_open_basedir(ZSTR_VAL(new_value))) {
zval_dtor(return_value);
RETURN_FALSE;
}
if (!zend_is_callable(&tick_fe.arguments[0], 0, &function_name)) {
efree(tick_fe.arguments);
- php_error_docref(NULL, E_WARNING, "Invalid tick callback '%s' passed", function_name->val);
+ php_error_docref(NULL, E_WARNING, "Invalid tick callback '%s' passed", ZSTR_VAL(function_name));
zend_string_release(function_name);
RETURN_FALSE;
} else if (function_name) {
char *lc_pattern;
res = zend_string_safe_alloc(Z_STRLEN_P(pattern), 2, 4, persistent);
- t = res->val;
+ t = ZSTR_VAL(res);
lc_pattern = zend_str_tolower_dup(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern));
t[j++] = '~';
t[j]=0;
- res->len = j;
+ ZSTR_LEN(res) = j;
Z_STR_P(pattern) = res;
efree(lc_pattern);
}
ZVAL_STR(&new_property, zend_string_dup(Z_STR_P(arg2), persistent));
}
new_key = zend_string_dup(Z_STR_P(arg1), persistent);
- zend_str_tolower(new_key->val, new_key->len);
+ zend_str_tolower(ZSTR_VAL(new_key), ZSTR_LEN(new_key));
zend_hash_update(Z_ARRVAL(bdata->current_section), new_key, &new_property);
zend_string_release(new_key);
}
if (bdata->filename[0] != '\0') {
browscap_bdata_dtor(bdata, 0);
}
- if (VCWD_REALPATH(new_value->val, bdata->filename) == NULL) {
+ if (VCWD_REALPATH(ZSTR_VAL(new_value), bdata->filename) == NULL) {
return FAILURE;
}
return SUCCESS;
str = zend_string_init(input, input_len, 0);
- php_convert_cyr_string((unsigned char *) str->val, str->len, fr_cs[0], to_cs[0]);
+ php_convert_cyr_string((unsigned char *) ZSTR_VAL(str), ZSTR_LEN(str), fr_cs[0], to_cs[0]);
RETVAL_NEW_STR(str);
}
/* }}} */
n = dlen - (l1 + 1);
}
if (n) {
- memcpy(tp->val + l2 , cp + l1 + 1, n);
+ memcpy(ZSTR_VAL(tp) + l2 , cp + l1 + 1, n);
add_next_index_stringl(&entries, (char *) cp + l1 + 1, n);
}
l1 = l1 + n + 1;
l2 = l2 + n;
}
- tp->val[l2] = '\0';
- tp->len = l2;
+ ZSTR_VAL(tp)[l2] = '\0';
+ ZSTR_LEN(tp) = l2;
cp += dlen;
add_assoc_str(subarray, "txt", tp);
if (mb_len < 0) {
continue;
} else if (mb_len > 1) {
- memcpy(cmd->val + y, str + x, mb_len);
+ memcpy(ZSTR_VAL(cmd) + y, str + x, mb_len);
y += mb_len;
x += mb_len - 1;
continue;
} else if (p && *p == str[x]) {
p = NULL;
} else {
- cmd->val[y++] = '\\';
+ ZSTR_VAL(cmd)[y++] = '\\';
}
- cmd->val[y++] = str[x];
+ ZSTR_VAL(cmd)[y++] = str[x];
break;
#else
/* % is Windows specific for environmental variables, ^%PATH% will
case '\x0A': /* excluding these two */
case '\xFF':
#ifdef PHP_WIN32
- cmd->val[y++] = '^';
+ ZSTR_VAL(cmd)[y++] = '^';
#else
- cmd->val[y++] = '\\';
+ ZSTR_VAL(cmd)[y++] = '\\';
#endif
/* fall-through */
default:
- cmd->val[y++] = str[x];
+ ZSTR_VAL(cmd)[y++] = str[x];
}
}
- cmd->val[y] = '\0';
+ ZSTR_VAL(cmd)[y] = '\0';
if ((estimate - y) > 4096) {
/* realloc if the estimate was way overill
cmd = zend_string_truncate(cmd, y, 0);
}
- cmd->len = y;
+ ZSTR_LEN(cmd) = y;
return cmd;
}
cmd = zend_string_alloc(4 * l + 2, 0); /* worst case */
#ifdef PHP_WIN32
- cmd->val[y++] = '"';
+ ZSTR_VAL(cmd)[y++] = '"';
#else
- cmd->val[y++] = '\'';
+ ZSTR_VAL(cmd)[y++] = '\'';
#endif
for (x = 0; x < l; x++) {
if (mb_len < 0) {
continue;
} else if (mb_len > 1) {
- memcpy(cmd->val + y, str + x, mb_len);
+ memcpy(ZSTR_VAL(cmd) + y, str + x, mb_len);
y += mb_len;
x += mb_len - 1;
continue;
case '"':
case '%':
case '!':
- cmd->val[y++] = ' ';
+ ZSTR_VAL(cmd)[y++] = ' ';
break;
#else
case '\'':
- cmd->val[y++] = '\'';
- cmd->val[y++] = '\\';
- cmd->val[y++] = '\'';
+ ZSTR_VAL(cmd)[y++] = '\'';
+ ZSTR_VAL(cmd)[y++] = '\\';
+ ZSTR_VAL(cmd)[y++] = '\'';
#endif
/* fall-through */
default:
- cmd->val[y++] = str[x];
+ ZSTR_VAL(cmd)[y++] = str[x];
}
}
#ifdef PHP_WIN32
- if (y > 0 && '\\' == cmd->val[y - 1]) {
+ if (y > 0 && '\\' == ZSTR_VAL(cmd)[y - 1]) {
int k = 0, n = y - 1;
- for (; n >= 0 && '\\' == cmd->val[n]; n--, k++);
+ for (; n >= 0 && '\\' == ZSTR_VAL(cmd)[n]; n--, k++);
if (k % 2) {
- cmd->val[y++] = '\\';
+ ZSTR_VAL(cmd)[y++] = '\\';
}
}
- cmd->val[y++] = '"';
+ ZSTR_VAL(cmd)[y++] = '"';
#else
- cmd->val[y++] = '\'';
+ ZSTR_VAL(cmd)[y++] = '\'';
#endif
- cmd->val[y] = '\0';
+ ZSTR_VAL(cmd)[y] = '\0';
if ((estimate - y) > 4096) {
/* realloc if the estimate was way overill
* Arbitrary cutoff point of 4096 */
cmd = zend_string_truncate(cmd, y, 0);
}
- cmd->len = y;
+ ZSTR_LEN(cmd) = y;
return cmd;
}
/* }}} */
ret = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0);
php_stream_close(stream);
- if (ret && ret->len > 0) {
+ if (ret && ZSTR_LEN(ret) > 0) {
RETVAL_STR(ret);
}
}
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(data), tmp) {
zend_string *str = zval_get_string(tmp);
- if (str->len) {
- numbytes += str->len;
- bytes_written = php_stream_write(stream, str->val, str->len);
- if (bytes_written != str->len) {
- php_error_docref(NULL, E_WARNING, "Failed to write %zd bytes to %s", str->len, filename);
+ if (ZSTR_LEN(str)) {
+ numbytes += ZSTR_LEN(str);
+ bytes_written = php_stream_write(stream, ZSTR_VAL(str), ZSTR_LEN(str));
+ if (bytes_written != ZSTR_LEN(str)) {
+ php_error_docref(NULL, E_WARNING, "Failed to write %zd bytes to %s", ZSTR_LEN(str), filename);
ret_ok = 0;
zend_string_release(str);
break;
array_init(return_value);
if ((target_buf = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) {
- s = target_buf->val;
- e = target_buf->val + target_buf->len;
+ s = ZSTR_VAL(target_buf);
+ e = ZSTR_VAL(target_buf) + ZSTR_LEN(target_buf);
if (!(p = (char*)php_stream_locate_eol(stream, target_buf))) {
p = e;
} else {
do {
int windows_eol = 0;
- if (p != target_buf->val && eol_marker == '\n' && *(p - 1) == '\r') {
+ if (p != ZSTR_VAL(target_buf) && eol_marker == '\n' && *(p - 1) == '\r') {
windows_eol++;
}
if (skip_blank_lines && !(p-s-windows_eol)) {
}
p = php_basename(prefix, prefix_len, NULL, 0);
- if (p->len > 64) {
- p->val[63] = '\0';
+ if (ZSTR_LEN(p) > 64) {
+ ZSTR_VAL(p)[63] = '\0';
}
RETVAL_FALSE;
- if ((fd = php_open_temporary_fd_ex(dir, p->val, &opened_path, 1)) >= 0) {
+ if ((fd = php_open_temporary_fd_ex(dir, ZSTR_VAL(p), &opened_path, 1)) >= 0) {
close(fd);
RETVAL_STR(opened_path);
}
if (allowed != NULL) {
// TODO: reimplement to avoid reallocation ???
if (ZSTR_IS_INTERNED(allowed)) {
- allowed_tags = estrndup(allowed->val, allowed->len);
- allowed_tags_len = allowed->len;
+ allowed_tags = estrndup(ZSTR_VAL(allowed), ZSTR_LEN(allowed));
+ allowed_tags_len = ZSTR_LEN(allowed);
} else {
- allowed_tags = allowed->val;
- allowed_tags_len = allowed->len;
+ allowed_tags = ZSTR_VAL(allowed);
+ allowed_tags_len = ZSTR_LEN(allowed);
}
}
}
/* }}} */
-#define FPUTCSV_FLD_CHK(c) memchr(field_str->val, c, field_str->len)
+#define FPUTCSV_FLD_CHK(c) memchr(ZSTR_VAL(field_str), c, ZSTR_LEN(field_str))
/* {{{ proto int fputcsv(resource fp, array fields [, string delimiter [, string enclosure [, string escape_char]]])
Format line as CSV and write to file pointer */
FPUTCSV_FLD_CHK('\t') ||
FPUTCSV_FLD_CHK(' ')
) {
- char *ch = field_str->val;
- char *end = ch + field_str->len;
+ char *ch = ZSTR_VAL(field_str);
+ char *end = ch + ZSTR_LEN(field_str);
int escaped = 0;
smart_str_appendc(&csvline, enclosure);
smart_str_appendc(&csvline, '\n');
smart_str_0(&csvline);
- ret = php_stream_write(stream, csvline.s->val, csvline.s->len);
+ ret = php_stream_write(stream, ZSTR_VAL(csvline.s), ZSTR_LEN(csvline.s));
smart_str_free(&csvline);
}
}
- if (php_strip_tags_filter_ctor(inst, tags_ss.s->val, tags_ss.s->len, persistent) != SUCCESS) {
+ if (php_strip_tags_filter_ctor(inst, ZSTR_VAL(tags_ss.s), ZSTR_LEN(tags_ss.s), persistent) != SUCCESS) {
smart_str_free(&tags_ss);
pefree(inst, persistent);
return NULL;
if ((tmpval = zend_hash_str_find((HashTable *)ht, field_name, field_name_len-1)) != NULL) {
zend_string *str = zval_get_string(tmpval);
- if (NULL == (*pretval = pemalloc(str->len + 1, persistent))) {
+ if (NULL == (*pretval = pemalloc(ZSTR_LEN(str) + 1, persistent))) {
return PHP_CONV_ERR_ALLOC;
}
- *pretval_len = str->len;
- memcpy(*pretval, str->val, str->len + 1);
+ *pretval_len = ZSTR_LEN(str);
+ memcpy(*pretval, ZSTR_VAL(str), ZSTR_LEN(str) + 1);
zend_string_release(str);
} else {
return PHP_CONV_ERR_NOT_FOUND;
inline static void
php_sprintf_appendchar(zend_string **buffer, size_t *pos, char add)
{
- if (!*buffer || (*pos + 1) >= (*buffer)->len) {
- PRINTF_DEBUG(("%s(): ereallocing buffer to %d bytes\n", get_active_function_name(), (*buffer)->len));
- *buffer = zend_string_extend(*buffer, (*buffer)->len << 1, 0);
+ if (!*buffer || (*pos + 1) >= ZSTR_LEN(*buffer)) {
+ PRINTF_DEBUG(("%s(): ereallocing buffer to %d bytes\n", get_active_function_name(), ZSTR_LEN(*buffer)));
+ *buffer = zend_string_extend(*buffer, ZSTR_LEN(*buffer) << 1, 0);
}
PRINTF_DEBUG(("sprintf: appending '%c', pos=\n", add, *pos));
- (*buffer)->val[(*pos)++] = add;
+ ZSTR_VAL(*buffer)[(*pos)++] = add;
}
/* }}} */
npad = (min_width < copy_len) ? 0 : min_width - copy_len;
PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n",
- *buffer, *pos, (*buffer)->len, add, min_width, padding, alignment));
+ *buffer, *pos, ZSTR_LEN(*buffer), add, min_width, padding, alignment));
m_width = MAX(min_width, copy_len);
if(m_width > INT_MAX - *pos - 1) {
req_size = *pos + m_width + 1;
- if (!*buffer || req_size > (*buffer)->len) {
- size_t size = (*buffer)->len;
+ if (!*buffer || req_size > ZSTR_LEN(*buffer)) {
+ size_t size = ZSTR_LEN(*buffer);
while (req_size > size) {
if (size > ZEND_SIZE_MAX/2) {
zend_error_noreturn(E_ERROR, "Field width %zd is too long", req_size);
}
if (alignment == ALIGN_RIGHT) {
if ((neg || always_sign) && padding=='0') {
- (*buffer)->val[(*pos)++] = (neg) ? '-' : '+';
+ ZSTR_VAL(*buffer)[(*pos)++] = (neg) ? '-' : '+';
add++;
len--;
copy_len--;
}
while (npad-- > 0) {
- (*buffer)->val[(*pos)++] = padding;
+ ZSTR_VAL(*buffer)[(*pos)++] = padding;
}
}
PRINTF_DEBUG(("sprintf: appending \"%s\"\n", add));
- memcpy(&(*buffer)->val[*pos], add, copy_len + 1);
+ memcpy(&ZSTR_VAL(*buffer)[*pos], add, copy_len + 1);
*pos += copy_len;
if (alignment == ALIGN_LEFT) {
while (npad--) {
- (*buffer)->val[(*pos)++] = padding;
+ ZSTR_VAL(*buffer)[(*pos)++] = padding;
}
}
}
register unsigned int i = NUM_BUF_SIZE - 1, neg = 0;
PRINTF_DEBUG(("sprintf: appendint(%x, %x, %x, %d, %d, '%c', %d)\n",
- *buffer, pos, &(*buffer)->len, number, width, padding, alignment));
+ *buffer, pos, &ZSTR_LEN(*buffer), number, width, padding, alignment));
if (number < 0) {
neg = 1;
magn = ((zend_ulong) -(number + 1)) + 1;
register unsigned int i = NUM_BUF_SIZE - 1;
PRINTF_DEBUG(("sprintf: appenduint(%x, %x, %x, %d, %d, '%c', %d)\n",
- *buffer, pos, &(*buffer)->len, number, width, padding, alignment));
+ *buffer, pos, &ZSTR_LEN(*buffer), number, width, padding, alignment));
magn = (zend_ulong) number;
/* Can't right-pad 0's on integers */
#endif
PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n",
- *buffer, pos, &(*buffer)->len, number, width, padding, alignment, fmt));
+ *buffer, pos, &ZSTR_LEN(*buffer), number, width, padding, alignment, fmt));
if ((adjust & ADJ_PRECISION) == 0) {
precision = FLOAT_PRECISION;
} else if (precision > MAX_FLOAT_PRECISION) {
register int andbits = (1 << n) - 1;
PRINTF_DEBUG(("sprintf: append2n(%x, %x, %x, %d, %d, '%c', %d, %d, %x)\n",
- *buffer, pos, &(*buffer)->len, number, width, padding, alignment, n,
+ *buffer, pos, &ZSTR_LEN(*buffer), number, width, padding, alignment, n,
chartable));
PRINTF_DEBUG(("sprintf: append2n 2^%d andbits=%x\n", n, andbits));
case 's': {
zend_string *str = zval_get_string(tmp);
php_sprintf_appendstring(&result, &outpos,
- str->val,
+ ZSTR_VAL(str),
width, precision, padding,
alignment,
- str->len,
+ ZSTR_LEN(str),
0, expprec, 0);
zend_string_release(str);
break;
}
/* possibly, we have to make sure we have room for the terminating null? */
- result->val[outpos]=0;
- result->len = outpos;
+ ZSTR_VAL(result)[outpos]=0;
+ ZSTR_LEN(result) = outpos;
return result;
}
/* }}} */
if ((result=php_formatted_print(execute_data, 0, 0))==NULL) {
RETURN_FALSE;
}
- rlen = PHPWRITE(result->val, result->len);
+ rlen = PHPWRITE(ZSTR_VAL(result), ZSTR_LEN(result));
zend_string_free(result);
RETURN_LONG(rlen);
}
if ((result=php_formatted_print(execute_data, 1, 0))==NULL) {
RETURN_FALSE;
}
- rlen = PHPWRITE(result->val, result->len);
+ rlen = PHPWRITE(ZSTR_VAL(result), ZSTR_LEN(result));
zend_string_free(result);
RETURN_LONG(rlen);
}
RETURN_FALSE;
}
- php_stream_write(stream, result->val, result->len);
+ php_stream_write(stream, ZSTR_VAL(result), ZSTR_LEN(result));
- RETVAL_LONG(result->len);
+ RETVAL_LONG(ZSTR_LEN(result));
zend_string_free(result);
}
/* }}} */
RETURN_FALSE;
}
- php_stream_write(stream, result->val, result->len);
+ php_stream_write(stream, ZSTR_VAL(result), ZSTR_LEN(result));
- RETVAL_LONG(result->len);
+ RETVAL_LONG(ZSTR_LEN(result));
zend_string_free(result);
}
/* }}} */
efree(hostname);
}
if (stream == NULL) {
- php_error_docref(NULL, E_WARNING, "unable to connect to %s:" ZEND_LONG_FMT " (%s)", host, port, errstr == NULL ? "Unknown error" : errstr->val);
+ php_error_docref(NULL, E_WARNING, "unable to connect to %s:" ZEND_LONG_FMT " (%s)", host, port, errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr));
}
if (hashkey) {
basename = php_basename(ent->d_name, tmp_len, NULL, 0);
- tmp_len = MIN(sizeof(ent->d_name), basename->len - 1);
- memcpy(ent->d_name, basename->val, tmp_len);
+ tmp_len = MIN(sizeof(ent->d_name), ZSTR_LEN(basename) - 1);
+ memcpy(ent->d_name, ZSTR_VAL(basename), tmp_len);
ent->d_name[tmp_len - 1] = '\0';
zend_string_release(basename);
len += name_len;
if (value && url_encode) {
encoded_value = php_url_encode(value, value_len);
- len += encoded_value->len;
+ len += ZSTR_LEN(encoded_value);
} else if (value) {
encoded_value = zend_string_init(value, value_len, 0);
- len += encoded_value->len;
+ len += ZSTR_LEN(encoded_value);
}
if (path) {
* pick an expiry date in the past
*/
dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, 1, 0);
- snprintf(cookie, len + 100, "Set-Cookie: %s=deleted; expires=%s; Max-Age=0", name, dt->val);
+ snprintf(cookie, len + 100, "Set-Cookie: %s=deleted; expires=%s; Max-Age=0", name, ZSTR_VAL(dt));
zend_string_free(dt);
} else {
- snprintf(cookie, len + 100, "Set-Cookie: %s=%s", name, value ? encoded_value->val : "");
+ snprintf(cookie, len + 100, "Set-Cookie: %s=%s", name, value ? ZSTR_VAL(encoded_value) : "");
if (expires > 0) {
const char *p;
char tsdelta[13];
strlcat(cookie, COOKIE_EXPIRES, len + 100);
dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, expires, 0);
/* check to make sure that the year does not exceed 4 digits in length */
- p = zend_memrchr(dt->val, '-', dt->len);
+ p = zend_memrchr(ZSTR_VAL(dt), '-', ZSTR_LEN(dt));
if (!p || *(p + 5) != ' ') {
zend_string_free(dt);
efree(cookie);
zend_error(E_WARNING, "Expiry date cannot have a year greater than 9999");
return FAILURE;
}
- strlcat(cookie, dt->val, len + 100);
+ strlcat(cookie, ZSTR_VAL(dt), len + 100);
zend_string_free(dt);
snprintf(tsdelta, sizeof(tsdelta), ZEND_LONG_FMT, (zend_long) difftime(expires, time(NULL)));
lim = old + oldlen; /* terminator address */
assert(*lim == '\0');
- for (p = old, q = ret->val; p < lim;) {
+ for (p = old, q = ZSTR_VAL(ret); p < lim;) {
unsigned code, code2 = 0;
const char *next = NULL; /* when set, next > p, otherwise possible inf loop */
}
*q = '\0';
- ret->len = (size_t)(q - ret->val);
+ ZSTR_LEN(ret) = (size_t)(q - ZSTR_VAL(ret));
}
/* }}} */
goto empty_source;
}
ret = zend_string_alloc(new_size, 0);
- ret->val[0] = '\0';
- ret->len = oldlen;
+ ZSTR_VAL(ret)[0] = '\0';
+ ZSTR_LEN(ret) = oldlen;
retlen = oldlen;
if (retlen == 0) {
goto empty_source;
if (flags & ENT_HTML_IGNORE_ERRORS) {
continue;
} else if (flags & ENT_HTML_SUBSTITUTE_ERRORS) {
- memcpy(&replaced->val[len], replacement, replacement_len);
+ memcpy(&ZSTR_VAL(replaced)[len], replacement, replacement_len);
len += replacement_len;
continue;
} else {
}
if (rep != NULL) {
- replaced->val[len++] = '&';
- memcpy(&replaced->val[len], rep, rep_len);
+ ZSTR_VAL(replaced)[len++] = '&';
+ memcpy(&ZSTR_VAL(replaced)[len], rep, rep_len);
len += rep_len;
- replaced->val[len++] = ';';
+ ZSTR_VAL(replaced)[len++] = ';';
} else {
/* we did not find an entity for this char.
* check for its validity, if its valid pass it unchanged */
}
pass_char_through:
if (mbseqlen > 1) {
- memcpy(replaced->val + len, mbsequence, mbseqlen);
+ memcpy(ZSTR_VAL(replaced) + len, mbsequence, mbseqlen);
len += mbseqlen;
} else {
- replaced->val[len++] = mbsequence[0];
+ ZSTR_VAL(replaced)[len++] = mbsequence[0];
}
}
} else { /* this_char == '&' */
if (double_encode) {
encode_amp:
- memcpy(&replaced->val[len], "&", sizeof("&") - 1);
+ memcpy(&ZSTR_VAL(replaced)[len], "&", sizeof("&") - 1);
len += sizeof("&") - 1;
} else { /* no double encode */
/* check if entity is valid */
replaced = zend_string_safe_realloc(replaced, maxlen, 1, ent_len + 128, 0);
maxlen += ent_len + 128;
}
- replaced->val[len++] = '&';
- memcpy(&replaced->val[len], &old[cursor], ent_len);
+ ZSTR_VAL(replaced)[len++] = '&';
+ memcpy(&ZSTR_VAL(replaced)[len], &old[cursor], ent_len);
len += ent_len;
- replaced->val[len++] = ';';
+ ZSTR_VAL(replaced)[len++] = ';';
cursor += ent_len + 1;
}
}
}
- replaced->val[len] = '\0';
- replaced->len = len;
+ ZSTR_VAL(replaced)[len] = '\0';
+ ZSTR_LEN(replaced) = len;
return replaced;
}
if (!hint_charset) {
default_charset = get_default_charset();
}
- replaced = php_escape_html_entities_ex((unsigned char*)str->val, str->len, all, (int) flags, (hint_charset ? hint_charset->val : default_charset), double_encode);
+ replaced = php_escape_html_entities_ex((unsigned char*)ZSTR_VAL(str), ZSTR_LEN(str), all, (int) flags, (hint_charset ? ZSTR_VAL(hint_charset) : default_charset), double_encode);
RETVAL_STR(replaced);
}
/* }}} */
if (!hint_charset) {
default_charset = get_default_charset();
}
- replaced = php_unescape_html_entities((unsigned char*)str->val, str->len, 1 /*all*/, (int)quote_style, (hint_charset ? hint_charset->val : default_charset));
+ replaced = php_unescape_html_entities((unsigned char*)ZSTR_VAL(str), ZSTR_LEN(str), 1 /*all*/, (int)quote_style, (hint_charset ? ZSTR_VAL(hint_charset) : default_charset));
if (replaced) {
RETURN_STR(replaced);
ZEND_HASH_FOREACH_KEY_VAL_IND(ht, idx, key, zdata) {
/* handling for private & protected object properties */
if (key) {
- if (key->val[0] == '\0' && type != NULL) {
+ if (ZSTR_VAL(key)[0] == '\0' && type != NULL) {
const char *tmp;
zend_object *zobj = Z_OBJ_P(type);
}
zend_unmangle_property_name_ex(key, &tmp, &prop_name, &prop_len);
} else {
- prop_name = key->val;
- prop_len = key->len;
+ prop_name = ZSTR_VAL(key);
+ prop_len = ZSTR_LEN(key);
}
} else {
prop_name = NULL;
} else {
ekey = php_url_encode(prop_name, prop_len);
}
- newprefix_len = key_suffix_len + ekey->len + key_prefix_len + 3 /* %5B */;
+ newprefix_len = key_suffix_len + ZSTR_LEN(ekey) + key_prefix_len + 3 /* %5B */;
newprefix = emalloc(newprefix_len + 1);
p = newprefix;
p += key_prefix_len;
}
- memcpy(p, ekey->val, ekey->len);
- p += ekey->len;
+ memcpy(p, ZSTR_VAL(ekey), ZSTR_LEN(ekey));
+ p += ZSTR_LEN(ekey);
zend_string_free(ekey);
if (key_suffix) {
zend_string *ekey;
zend_string *tmp = zval_get_string(zdata);
if (enc_type == PHP_QUERY_RFC3986) {
- ekey = php_raw_url_encode(tmp->val, tmp->len);
+ ekey = php_raw_url_encode(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
} else {
- ekey = php_url_encode(tmp->val, tmp->len);
+ ekey = php_url_encode(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
}
smart_str_append(formstr, ekey);
zend_string_release(tmp);
}
if (errstr) {
- php_stream_wrapper_log_error(wrapper, options, "%s", errstr->val);
+ php_stream_wrapper_log_error(wrapper, options, "%s", ZSTR_VAL(errstr));
zend_string_release(errstr);
errstr = NULL;
}
finish:
smart_str_appendl(&header, "\r\n", sizeof("\r\n")-1);
- if (php_stream_write(stream, header.s->val, header.s->len) != header.s->len) {
+ if (php_stream_write(stream, ZSTR_VAL(header.s), ZSTR_LEN(header.s)) != ZSTR_LEN(header.s)) {
php_stream_wrapper_log_error(wrapper, options, "Cannot connect to HTTPS server through proxy");
php_stream_close(stream);
stream = NULL;
/* Remove newlines and spaces from start and end php_trim will estrndup() */
tmp = php_trim(Z_STR_P(tmpzval), NULL, 0, 3);
}
- if (tmp && tmp->len) {
+ if (tmp && ZSTR_LEN(tmp)) {
char *s;
char *t;
- user_headers = estrndup(tmp->val, tmp->len);
+ user_headers = estrndup(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
if (ZSTR_IS_INTERNED(tmp)) {
- tmp = zend_string_init(tmp->val, tmp->len, 0);
+ tmp = zend_string_init(ZSTR_VAL(tmp), ZSTR_LEN(tmp), 0);
} else if (GC_REFCOUNT(tmp) > 1) {
GC_REFCOUNT(tmp)--;
- tmp = zend_string_init(tmp->val, tmp->len, 0);
+ tmp = zend_string_init(ZSTR_VAL(tmp), ZSTR_LEN(tmp), 0);
}
/* Make lowercase for easy comparison against 'standard' headers */
- php_strtolower(tmp->val, tmp->len);
- t = tmp->val;
+ php_strtolower(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
+ t = ZSTR_VAL(tmp);
if (!header_init) {
/* strip POST headers on redirect */
stmp = php_base64_encode((unsigned char*)scratch, strlen(scratch));
- if (snprintf(scratch, scratch_len, "Authorization: Basic %s\r\n", stmp->val) > 0) {
+ if (snprintf(scratch, scratch_len, "Authorization: Basic %s\r\n", ZSTR_VAL(stmp)) > 0) {
php_stream_write(stream, scratch, strlen(scratch));
php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, NULL, 0);
}
*/
do {
- szlength = bufz->len * (1<<factor++);
+ szlength = ZSTR_LEN(bufz) * (1<<factor++);
buf = (char *) erealloc(buf, szlength);
- status = uncompress(buf, &szlength, bufz->val, bufz->len);
+ status = uncompress(buf, &szlength, ZSTR_VAL(bufz), ZSTR_LEN(bufz));
} while ((status==Z_BUF_ERROR)&&(factor<maxfactor));
if (bufz) {
class_name = php_lookup_class_name(object);
if (class_name) {
- php_error_docref(NULL, error_type, INCOMPLETE_CLASS_MSG, class_name->val);
+ php_error_docref(NULL, error_type, INCOMPLETE_CLASS_MSG, ZSTR_VAL(class_name));
zend_string_release(class_name);
} else {
php_error_docref(NULL, error_type, INCOMPLETE_CLASS_MSG, "unknown");
zend_string *new_str;
new_str = php_escape_html_entities((unsigned char *) str, len, 0, ENT_QUOTES, "utf-8");
- written = php_output_write(new_str->val, new_str->len);
+ written = php_output_write(ZSTR_VAL(new_str), ZSTR_LEN(new_str));
zend_string_free(new_str);
return written;
}
php_info_print(", ");
}
if (!sapi_module.phpinfo_as_text) {
- php_info_print_html_esc(key->val, key->len);
+ php_info_print_html_esc(ZSTR_VAL(key), ZSTR_LEN(key));
} else {
- php_info_print(key->val);
+ php_info_print(ZSTR_VAL(key));
}
}
} ZEND_HASH_FOREACH_END();
if (!sapi_module.phpinfo_as_text) {
zend_string *url_name = php_url_encode(zend_module->name, strlen(zend_module->name));
- php_strtolower(url_name->val, url_name->len);
- php_info_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", url_name->val, zend_module->name);
+ php_strtolower(ZSTR_VAL(url_name), ZSTR_LEN(url_name));
+ php_info_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", ZSTR_VAL(url_name), zend_module->name);
efree(url_name);
} else {
if (string_key != NULL) {
if (!sapi_module.phpinfo_as_text) {
- php_info_print_html_esc(string_key->val, string_key->len);
+ php_info_print_html_esc(ZSTR_VAL(string_key), ZSTR_LEN(string_key));
} else {
- php_info_print(string_key->val);
+ php_info_print(ZSTR_VAL(string_key));
}
} else {
php_info_printf(ZEND_ULONG_FMT, num_key);
}
php_info_print_box_end();
php_info_print_table_start();
- php_info_print_table_row(2, "System", php_uname->val);
+ php_info_print_table_row(2, "System", ZSTR_VAL(php_uname));
php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__);
#ifdef COMPILER
php_info_print_table_row(2, "Compiler", COMPILER);
MAIL_ASCIIZ_CHECK(subject, subject_len);
MAIL_ASCIIZ_CHECK(message, message_len);
if (headers) {
- MAIL_ASCIIZ_CHECK(headers->val, headers->len);
+ MAIL_ASCIIZ_CHECK(ZSTR_VAL(headers), ZSTR_LEN(headers));
headers_trimmed = php_trim(headers, NULL, 0, 2);
}
if (extra_cmd) {
- MAIL_ASCIIZ_CHECK(extra_cmd->val, extra_cmd->len);
+ MAIL_ASCIIZ_CHECK(ZSTR_VAL(extra_cmd), ZSTR_LEN(extra_cmd));
}
if (to_len > 0) {
if (force_extra_parameters) {
extra_cmd = php_escape_shell_cmd(force_extra_parameters);
} else if (extra_cmd) {
- extra_cmd = php_escape_shell_cmd(extra_cmd->val);
+ extra_cmd = php_escape_shell_cmd(ZSTR_VAL(extra_cmd));
}
- if (php_mail(to_r, subject_r, message, headers_trimmed ? headers_trimmed->val : NULL, extra_cmd ? extra_cmd->val : NULL)) {
+ if (php_mail(to_r, subject_r, message, headers_trimmed ? ZSTR_VAL(headers_trimmed) : NULL, extra_cmd ? ZSTR_VAL(extra_cmd) : NULL)) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
time(&curtime);
date_str = php_format_date("d-M-Y H:i:s e", 13, curtime, 1);
- l = spprintf(&tmp, 0, "[%s] mail() on [%s:%d]: To: %s -- Headers: %s\n", date_str->val, zend_get_executed_filename(), zend_get_executed_lineno(), to, hdr ? hdr : "");
+ l = spprintf(&tmp, 0, "[%s] mail() on [%s:%d]: To: %s -- Headers: %s\n", ZSTR_VAL(date_str), zend_get_executed_filename(), zend_get_executed_lineno(), to, hdr ? hdr : "");
zend_string_free(date_str);
f = php_basename(tmp, strlen(tmp), NULL, 0);
if (headers != NULL && *headers) {
- spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s\n%s", php_getuid(), f->val, headers);
+ spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s\n%s", php_getuid(), ZSTR_VAL(f), headers);
} else {
- spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s", php_getuid(), f->val);
+ spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s", php_getuid(), ZSTR_VAL(f));
}
zend_string_release(f);
}
tmpbuf = strpprintf(0, "%.*F", dec, d);
if (tmpbuf == NULL) {
return NULL;
- } else if (!isdigit((int)tmpbuf->val[0])) {
+ } else if (!isdigit((int)ZSTR_VAL(tmpbuf)[0])) {
return tmpbuf;
}
/* find decimal point, if expected */
if (dec) {
- dp = strpbrk(tmpbuf->val, ".,");
+ dp = strpbrk(ZSTR_VAL(tmpbuf), ".,");
} else {
dp = NULL;
}
/* calculate the length of the return buffer */
if (dp) {
- integral = (int)(dp - tmpbuf->val);
+ integral = (int)(dp - ZSTR_VAL(tmpbuf));
} else {
/* no decimal point was found */
- integral = (int)tmpbuf->len;
+ integral = (int)ZSTR_LEN(tmpbuf);
}
/* allow for thousand separators */
}
res = zend_string_alloc(reslen, 0);
- s = tmpbuf->val + tmpbuf->len - 1;
- t = res->val + reslen;
+ s = ZSTR_VAL(tmpbuf) + ZSTR_LEN(tmpbuf) - 1;
+ t = ZSTR_VAL(res) + reslen;
*t-- = '\0';
/* copy the decimal places.
/* copy the numbers before the decimal point, adding thousand
* separator every three digits */
- while (s >= tmpbuf->val) {
+ while (s >= ZSTR_VAL(tmpbuf)) {
*t-- = *s--;
- if (thousand_sep && (++count%3)==0 && s>=tmpbuf->val) {
+ if (thousand_sep && (++count%3)==0 && s >= ZSTR_VAL(tmpbuf)) {
t -= thousand_sep_len;
memcpy(t + 1, thousand_sep, thousand_sep_len);
}
*t-- = '-';
}
- res->len = reslen;
+ ZSTR_LEN(res) = reslen;
zend_string_release(tmpbuf);
return res;
}
md5str[0] = '\0';
PHP_MD5Init(&context);
- PHP_MD5Update(&context, arg->val, arg->len);
+ PHP_MD5Update(&context, ZSTR_VAL(arg), ZSTR_LEN(arg));
PHP_MD5Final(digest, &context);
if (raw_output) {
RETURN_STRINGL((char *) digest, 16);
return;
}
- if (metaphone((unsigned char *)str->val, str->len, phones, &result, 1) == 0) {
+ if (metaphone((unsigned char *)ZSTR_VAL(str), ZSTR_LEN(str), phones, &result, 1) == 0) {
RETVAL_STR(result);
} else {
if (result) {
*phoned_word = zend_string_extend(*phoned_word, 2 * sizeof(char) + max_buffer_len, 0); \
max_buffer_len += 2; \
} \
- (*phoned_word)->val[p_idx++] = c; \
- (*phoned_word)->len = p_idx; \
+ ZSTR_VAL(*phoned_word)[p_idx++] = c; \
+ ZSTR_LEN(*phoned_word) = p_idx; \
}
/* Slap a null character on the end of the phoned word */
#define End_Phoned_Word { \
*phoned_word = zend_string_extend(*phoned_word, 1 * sizeof(char) + max_buffer_len, 0); \
max_buffer_len += 1; \
} \
- (*phoned_word)->val[p_idx] = '\0'; \
- (*phoned_word)->len = p_idx; \
+ ZSTR_VAL(*phoned_word)[p_idx] = '\0'; \
+ ZSTR_LEN(*phoned_word) = p_idx; \
}
/* How long is the phoned word? */
#define Phone_Len (p_idx)
zend_string *str = zval_get_string(&argv[currentarg++]);
memset(&output[outputpos], (code == 'a' || code == 'Z') ? '\0' : ' ', arg);
- memcpy(&output[outputpos], str->val,
- (str->len < arg_cp) ? str->len : arg_cp);
+ memcpy(&output[outputpos], ZSTR_VAL(str),
+ (ZSTR_LEN(str) < arg_cp) ? ZSTR_LEN(str) : arg_cp);
outputpos += arg;
zend_string_release(str);
int first = 1;
zend_string *str = zval_get_string(&argv[currentarg++]);
- char *v = str->val;
+ char *v = ZSTR_VAL(str);
outputpos--;
- if(arg > str->len) {
+ if(arg > ZSTR_LEN(str)) {
php_error_docref(NULL, E_WARNING, "Type %c: not enough characters in string", code);
- arg = str->len;
+ arg = ZSTR_LEN(str);
}
while (arg-- > 0) {
return;
}
- format = formatarg->val;
- formatlen = formatarg->len;
- input = inputarg->val;
- inputlen = inputarg->len;
+ format = ZSTR_VAL(formatarg);
+ formatlen = ZSTR_LEN(formatarg);
+ input = ZSTR_VAL(inputarg);
+ inputlen = ZSTR_LEN(inputarg);
inputpos = 0;
array_init(return_value);
return FAILURE;
}
buffer = php_base64_encode((unsigned char*) str, str_len);
- if (buffer->len < out_len) {
+ if (ZSTR_LEN(buffer) < out_len) {
/* Too short of an encoded string generated */
zend_string_release(buffer);
return FAILURE;
}
for (pos = 0; pos < out_len; pos++) {
- if (buffer->val[pos] == '+') {
+ if (ZSTR_VAL(buffer)[pos] == '+') {
ret[pos] = '.';
- } else if (buffer->val[pos] == '=') {
+ } else if (ZSTR_VAL(buffer)[pos] == '=') {
zend_string_free(buffer);
return FAILURE;
} else {
- ret[pos] = buffer->val[pos];
+ ret[pos] = ZSTR_VAL(buffer)[pos];
}
}
zend_string_free(buffer);
RETURN_FALSE;
}
- if (ret->len != hash_len || hash_len < 13) {
+ if (ZSTR_LEN(ret) != hash_len || hash_len < 13) {
zend_string_free(ret);
RETURN_FALSE;
}
* equality check that will always check every byte of both
* values. */
for (i = 0; i < hash_len; i++) {
- status |= (ret->val[i] ^ hash[i]);
+ status |= (ZSTR_VAL(ret)[i] ^ hash[i]);
}
zend_string_free(ret);
case IS_OBJECT:
{
zend_string *tmp = zval_get_string(option_buffer);
- buffer = estrndup(tmp->val, tmp->len);
- buffer_len = tmp->len;
+ buffer = estrndup(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
+ buffer_len = ZSTR_LEN(tmp);
zend_string_release(tmp);
break;
}
efree(hash);
- if (result->len < 13) {
+ if (ZSTR_LEN(result) < 13) {
zend_string_free(result);
RETURN_FALSE;
}
/* first, we have to get the size of all the elements in the hash */
ZEND_HASH_FOREACH_STR_KEY_VAL(target_hash, string_key, element) {
zend_string *str = zval_get_string(element);
- size_t el_len = str->len;
+ size_t el_len = ZSTR_LEN(str);
zend_string_release(str);
if (el_len == 0) {
sizeenv += el_len + 1;
if (string_key) {
- if (string_key->len == 0) {
+ if (ZSTR_LEN(string_key) == 0) {
continue;
}
- sizeenv += string_key->len + 1;
+ sizeenv += ZSTR_LEN(string_key) + 1;
}
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_STR_KEY_VAL(target_hash, string_key, element) {
zend_string *str = zval_get_string(element);
- if (str->len == 0) {
+ if (ZSTR_LEN(str) == 0) {
goto next_element;
}
if (string_key) {
- if (string_key->len == 0) {
+ if (ZSTR_LEN(string_key) == 0) {
goto next_element;
}
- l = string_key->len + str->len + 2;
- memcpy(p, string_key->val, string_key->len);
+ l = ZSTR_LEN(string_key) + ZSTR_LEN(str) + 2;
+ memcpy(p, ZSTR_VAL(string_key), ZSTR_LEN(string_key));
strncat(p, "=", 1);
- strncat(p, str->val, str->len);
+ strncat(p, ZSTR_VAL(str), ZSTR_LEN(str));
#ifndef PHP_WIN32
*ep = p;
#endif
p += l;
} else {
- memcpy(p, str->val, str->len);
+ memcpy(p, ZSTR_VAL(str), ZSTR_LEN(str));
#ifndef PHP_WIN32
*ep = p;
++ep;
#endif
- p += str->len + 1;
+ p += ZSTR_LEN(str) + 1;
}
next_element:
zend_string_release(str);
}
retval = zend_string_alloc(buf_size, 0);
- i = length; p1 = str; p2 = (unsigned char*)retval->val;
+ i = length; p1 = str; p2 = (unsigned char*)ZSTR_VAL(retval);
decoded_len = 0;
while (i > 0 && *p1 != '\0') {
}
*p2 = '\0';
- retval->len = decoded_len;
+ ZSTR_LEN(retval) = decoded_len;
return retval;
}
/* }}} */
zend_string *ret;
ret = zend_string_safe_alloc(3, (length + (((3 * length)/(PHP_QPRINT_MAXL-9)) + 1)), 0, 0);
- d = (unsigned char*)ret->val;
+ d = (unsigned char*)ZSTR_VAL(ret);
while (length--) {
if (((c = *str++) == '\015') && (*str == '\012') && length > 0) {
}
}
*d = '\0';
- ret = zend_string_truncate(ret, d - (unsigned char*)ret->val, 0);
+ ret = zend_string_truncate(ret, d - (unsigned char*)ZSTR_VAL(ret), 0);
return ret;
}
/* }}} */
return;
}
- if (arg1->len == 0) {
+ if (ZSTR_LEN(arg1) == 0) {
/* shortcut */
RETURN_EMPTY_STRING();
}
- str_in = arg1->val;
- str_out = zend_string_alloc(arg1->len, 0);
+ str_in = ZSTR_VAL(arg1);
+ str_out = zend_string_alloc(ZSTR_LEN(arg1), 0);
while (str_in[i]) {
switch (str_in[i]) {
case '=':
isxdigit((int) str_in[i + 1]) &&
isxdigit((int) str_in[i + 2]))
{
- str_out->val[j++] = (php_hex2int((int) str_in[i + 1]) << 4)
+ ZSTR_VAL(str_out)[j++] = (php_hex2int((int) str_in[i + 1]) << 4)
+ php_hex2int((int) str_in[i + 2]);
i += 3;
} else /* check for soft line break according to RFC 2045*/ {
i += k + 1;
}
else {
- str_out->val[j++] = str_in[i++];
+ ZSTR_VAL(str_out)[j++] = str_in[i++];
}
}
break;
default:
- str_out->val[j++] = str_in[i++];
+ ZSTR_VAL(str_out)[j++] = str_in[i++];
}
}
- str_out->val[j] = '\0';
- str_out->len = j;
+ ZSTR_VAL(str_out)[j] = '\0';
+ ZSTR_LEN(str_out) = j;
RETVAL_NEW_STR(str_out);
}
return;
}
- if (!str->len) {
+ if (!ZSTR_LEN(str)) {
RETURN_EMPTY_STRING();
}
- new_str = php_quot_print_encode((unsigned char *)str->val, (size_t)str->len);
+ new_str = php_quot_print_encode((unsigned char *)ZSTR_VAL(str), (size_t)ZSTR_LEN(str));
RETURN_STR(new_str);
}
/* }}} */
bytes = zend_string_alloc(size, 0);
- if (php_random_bytes(bytes->val, size) == FAILURE) {
+ if (php_random_bytes(ZSTR_VAL(bytes), size) == FAILURE) {
zend_string_release(bytes);
RETURN_FALSE;
}
- bytes->val[size] = '\0';
+ ZSTR_VAL(bytes)[size] = '\0';
RETURN_STR(bytes);
}
sha1str[0] = '\0';
PHP_SHA1Init(&context);
- PHP_SHA1Update(&context, (unsigned char *) arg->val, arg->len);
+ PHP_SHA1Update(&context, (unsigned char *) ZSTR_VAL(arg), ZSTR_LEN(arg));
PHP_SHA1Final(digest, &context);
if (raw_output) {
RETURN_STRINGL((char *) digest, 20);
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
if (flags & PHP_STREAM_CLIENT_PERSISTENT) {
- spprintf(&hashkey, 0, "stream_socket_client__%s", host->val);
+ spprintf(&hashkey, 0, "stream_socket_client__%s", ZSTR_VAL(host));
}
/* prepare the timeout value for use */
ZVAL_EMPTY_STRING(zerrstr);
}
- stream = php_stream_xport_create(host->val, host->len, REPORT_ERRORS,
+ stream = php_stream_xport_create(ZSTR_VAL(host), ZSTR_LEN(host), REPORT_ERRORS,
STREAM_XPORT_CLIENT | (flags & PHP_STREAM_CLIENT_CONNECT ? STREAM_XPORT_CONNECT : 0) |
(flags & PHP_STREAM_CLIENT_ASYNC_CONNECT ? STREAM_XPORT_CONNECT_ASYNC : 0),
hashkey, &tv, context, &errstr, &err);
/* host might contain binary characters */
zend_string *quoted_host = php_addslashes(host, 0);
- php_error_docref(NULL, E_WARNING, "unable to connect to %s (%s)", quoted_host->val, errstr == NULL ? "Unknown error" : errstr->val);
+ php_error_docref(NULL, E_WARNING, "unable to connect to %s (%s)", ZSTR_VAL(quoted_host), errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr));
zend_string_release(quoted_host);
}
NULL, NULL, context, &errstr, &err);
if (stream == NULL) {
- php_error_docref(NULL, E_WARNING, "unable to connect to %s (%s)", host, errstr == NULL ? "Unknown error" : errstr->val);
+ php_error_docref(NULL, E_WARNING, "unable to connect to %s (%s)", host, errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr));
}
if (stream == NULL) {
}
php_stream_to_zval(clistream, return_value);
} else {
- php_error_docref(NULL, E_WARNING, "accept failed: %s", errstr ? errstr->val : "Unknown error");
+ php_error_docref(NULL, E_WARNING, "accept failed: %s", errstr ? ZSTR_VAL(errstr) : "Unknown error");
RETVAL_FALSE;
}
read_buf = zend_string_alloc(to_read, 0);
- recvd = php_stream_xport_recvfrom(stream, read_buf->val, to_read, (int)flags, NULL, NULL,
+ recvd = php_stream_xport_recvfrom(stream, ZSTR_VAL(read_buf), to_read, (int)flags, NULL, NULL,
zremote ? &remote_addr : NULL
);
if (zremote) {
ZVAL_STR(zremote, remote_addr);
}
- read_buf->val[recvd] = '\0';
- read_buf->len = recvd;
+ ZSTR_VAL(read_buf)[recvd] = '\0';
+ ZSTR_LEN(read_buf) = recvd;
RETURN_NEW_STR(read_buf);
}
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(wval), okey, oval) {
if (okey) {
- php_stream_context_set_option(context, wkey->val, okey->val, oval);
+ php_stream_context_set_option(context, ZSTR_VAL(wkey), ZSTR_VAL(okey), oval);
}
} ZEND_HASH_FOREACH_END();
result = zend_string_safe_alloc(oldlen, 2 * sizeof(char), 0, 0);
for (i = j = 0; i < oldlen; i++) {
- result->val[j++] = hexconvtab[old[i] >> 4];
- result->val[j++] = hexconvtab[old[i] & 15];
+ ZSTR_VAL(result)[j++] = hexconvtab[old[i] >> 4];
+ ZSTR_VAL(result)[j++] = hexconvtab[old[i] & 15];
}
- result->val[j] = '\0';
+ ZSTR_VAL(result)[j] = '\0';
return result;
}
{
size_t target_length = oldlen >> 1;
zend_string *str = zend_string_alloc(target_length, 0);
- unsigned char *ret = (unsigned char *)str->val;
+ unsigned char *ret = (unsigned char *)ZSTR_VAL(str);
size_t i, j;
for (i = j = 0; i < target_length; i++) {
return;
}
- result = php_bin2hex((unsigned char *)data->val, data->len);
+ result = php_bin2hex((unsigned char *)ZSTR_VAL(data), ZSTR_LEN(data));
if (!result) {
RETURN_FALSE;
return;
}
- if (data->len % 2 != 0) {
+ if (ZSTR_LEN(data) % 2 != 0) {
php_error_docref(NULL, E_WARNING, "Hexadecimal input string must have an even length");
RETURN_FALSE;
}
- result = php_hex2bin((unsigned char *)data->val, data->len);
+ result = php_hex2bin((unsigned char *)ZSTR_VAL(data), ZSTR_LEN(data));
if (!result) {
php_error_docref(NULL, E_WARNING, "Input string must be hexadecimal string");
}
if (ZEND_NUM_ARGS() < 4) {
- len = s11->len;
+ len = ZSTR_LEN(s11);
}
/* look at substr() function for more information */
if (start < 0) {
- start += (zend_long)s11->len;
+ start += (zend_long)ZSTR_LEN(s11);
if (start < 0) {
start = 0;
}
- } else if ((size_t)start > s11->len) {
+ } else if ((size_t)start > ZSTR_LEN(s11)) {
RETURN_FALSE;
}
if (len < 0) {
- len += (s11->len - start);
+ len += (ZSTR_LEN(s11) - start);
if (len < 0) {
len = 0;
}
}
- if (len > (zend_long)s11->len - start) {
- len = s11->len - start;
+ if (len > (zend_long)ZSTR_LEN(s11) - start) {
+ len = ZSTR_LEN(s11) - start;
}
if(len == 0) {
}
if (behavior == STR_STRSPN) {
- RETURN_LONG(php_strspn(s11->val + start /*str1_start*/,
- s22->val /*str2_start*/,
- s11->val + start + len /*str1_end*/,
- s22->val + s22->len /*str2_end*/));
+ RETURN_LONG(php_strspn(ZSTR_VAL(s11) + start /*str1_start*/,
+ ZSTR_VAL(s22) /*str2_start*/,
+ ZSTR_VAL(s11) + start + len /*str1_end*/,
+ ZSTR_VAL(s22) + ZSTR_LEN(s22) /*str2_end*/));
} else if (behavior == STR_STRCSPN) {
- RETURN_LONG(php_strcspn(s11->val + start /*str1_start*/,
- s22->val /*str2_start*/,
- s11->val + start + len /*str1_end*/,
- s22->val + s22->len /*str2_end*/));
+ RETURN_LONG(php_strcspn(ZSTR_VAL(s11) + start /*str1_start*/,
+ ZSTR_VAL(s22) /*str2_start*/,
+ ZSTR_VAL(s11) + start + len /*str1_end*/,
+ ZSTR_VAL(s22) + ZSTR_LEN(s22) /*str2_end*/));
}
}
return;
}
- RETURN_LONG(strcoll((const char *) s1->val,
- (const char *) s2->val));
+ RETURN_LONG(strcoll((const char *) ZSTR_VAL(s1),
+ (const char *) ZSTR_VAL(s2)));
}
/* }}} */
#endif
*/
PHPAPI zend_string *php_trim(zend_string *str, char *what, size_t what_len, int mode)
{
- const char *c = str->val;
- size_t len = str->len;
+ const char *c = ZSTR_VAL(str);
+ size_t len = ZSTR_LEN(str);
register size_t i;
size_t trimmed = 0;
char mask[256];
}
}
- if (str->len == len) {
+ if (ZSTR_LEN(str) == len) {
return zend_string_copy(str);
} else {
return zend_string_init(c, len, 0);
ZEND_PARSE_PARAMETERS_END();
#endif
- ZVAL_STR(return_value, php_trim(str, (what ? what->val : NULL), (what ? what->len : 0), mode));
+ ZVAL_STR(return_value, php_trim(str, (what ? ZSTR_VAL(what) : NULL), (what ? ZSTR_LEN(what) : 0), mode));
}
/* }}} */
return;
}
- if (text->len == 0) {
+ if (ZSTR_LEN(text) == 0) {
RETURN_EMPTY_STRING();
}
/* Special case for a single-character break as it needs no
additional storage space */
if (breakchar_len == 1 && !docut) {
- newtext = zend_string_init(text->val, text->len, 0);
+ newtext = zend_string_init(ZSTR_VAL(text), ZSTR_LEN(text), 0);
laststart = lastspace = 0;
- for (current = 0; current < text->len; current++) {
- if (text->val[current] == breakchar[0]) {
+ for (current = 0; current < ZSTR_LEN(text); current++) {
+ if (ZSTR_VAL(text)[current] == breakchar[0]) {
laststart = lastspace = current + 1;
- } else if (text->val[current] == ' ') {
+ } else if (ZSTR_VAL(text)[current] == ' ') {
if (current - laststart >= linelength) {
- newtext->val[current] = breakchar[0];
+ ZSTR_VAL(newtext)[current] = breakchar[0];
laststart = current + 1;
}
lastspace = current;
} else if (current - laststart >= linelength && laststart != lastspace) {
- newtext->val[lastspace] = breakchar[0];
+ ZSTR_VAL(newtext)[lastspace] = breakchar[0];
laststart = lastspace + 1;
}
}
} else {
/* Multiple character line break or forced cut */
if (linelength > 0) {
- chk = (size_t)(text->len/linelength + 1);
- newtext = zend_string_alloc(chk * breakchar_len + text->len, 0);
- alloced = text->len + chk * breakchar_len + 1;
+ chk = (size_t)(ZSTR_LEN(text)/linelength + 1);
+ newtext = zend_string_alloc(chk * breakchar_len + ZSTR_LEN(text), 0);
+ alloced = ZSTR_LEN(text) + chk * breakchar_len + 1;
} else {
- chk = text->len;
- alloced = text->len * (breakchar_len + 1) + 1;
- newtext = zend_string_alloc(text->len * (breakchar_len + 1), 0);
+ chk = ZSTR_LEN(text);
+ alloced = ZSTR_LEN(text) * (breakchar_len + 1) + 1;
+ newtext = zend_string_alloc(ZSTR_LEN(text) * (breakchar_len + 1), 0);
}
/* now keep track of the actual new text length */
newtextlen = 0;
laststart = lastspace = 0;
- for (current = 0; current < text->len; current++) {
+ for (current = 0; current < ZSTR_LEN(text); current++) {
if (chk <= 0) {
- alloced += (size_t) (((text->len - current + 1)/linelength + 1) * breakchar_len) + 1;
+ alloced += (size_t) (((ZSTR_LEN(text) - current + 1)/linelength + 1) * breakchar_len) + 1;
newtext = zend_string_extend(newtext, alloced, 0);
- chk = (size_t) ((text->len - current)/linelength) + 1;
+ chk = (size_t) ((ZSTR_LEN(text) - current)/linelength) + 1;
}
/* when we hit an existing break, copy to new buffer, and
* fix up laststart and lastspace */
- if (text->val[current] == breakchar[0]
- && current + breakchar_len < text->len
- && !strncmp(text->val+current, breakchar, breakchar_len)) {
- memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart + breakchar_len);
+ if (ZSTR_VAL(text)[current] == breakchar[0]
+ && current + breakchar_len < ZSTR_LEN(text)
+ && !strncmp(ZSTR_VAL(text) + current, breakchar, breakchar_len)) {
+ memcpy(ZSTR_VAL(newtext) + newtextlen, ZSTR_VAL(text) + laststart, current - laststart + breakchar_len);
newtextlen += current - laststart + breakchar_len;
current += breakchar_len - 1;
laststart = lastspace = current + 1;
}
/* if it is a space, check if it is at the line boundary,
* copy and insert a break, or just keep track of it */
- else if (text->val[current] == ' ') {
+ else if (ZSTR_VAL(text)[current] == ' ') {
if (current - laststart >= linelength) {
- memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart);
+ memcpy(ZSTR_VAL(newtext) + newtextlen, ZSTR_VAL(text) + laststart, current - laststart);
newtextlen += current - laststart;
- memcpy(newtext->val + newtextlen, breakchar, breakchar_len);
+ memcpy(ZSTR_VAL(newtext) + newtextlen, breakchar, breakchar_len);
newtextlen += breakchar_len;
laststart = current + 1;
chk--;
* copy and insert a break. */
else if (current - laststart >= linelength
&& docut && laststart >= lastspace) {
- memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart);
+ memcpy(ZSTR_VAL(newtext) + newtextlen, ZSTR_VAL(text) + laststart, current - laststart);
newtextlen += current - laststart;
- memcpy(newtext->val + newtextlen, breakchar, breakchar_len);
+ memcpy(ZSTR_VAL(newtext) + newtextlen, breakchar, breakchar_len);
newtextlen += breakchar_len;
laststart = lastspace = current;
chk--;
* up the laststart */
else if (current - laststart >= linelength
&& laststart < lastspace) {
- memcpy(newtext->val + newtextlen, text->val + laststart, lastspace - laststart);
+ memcpy(ZSTR_VAL(newtext) + newtextlen, ZSTR_VAL(text) + laststart, lastspace - laststart);
newtextlen += lastspace - laststart;
- memcpy(newtext->val + newtextlen, breakchar, breakchar_len);
+ memcpy(ZSTR_VAL(newtext) + newtextlen, breakchar, breakchar_len);
newtextlen += breakchar_len;
laststart = lastspace = lastspace + 1;
chk--;
/* copy over any stragglers */
if (laststart != current) {
- memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart);
+ memcpy(ZSTR_VAL(newtext) + newtextlen, ZSTR_VAL(text) + laststart, current - laststart);
newtextlen += current - laststart;
}
- newtext->val[newtextlen] = '\0';
+ ZSTR_VAL(newtext)[newtextlen] = '\0';
/* free unused memory */
newtext = zend_string_truncate(newtext, newtextlen, 0);
*/
PHPAPI void php_explode(const zend_string *delim, zend_string *str, zval *return_value, zend_long limit)
{
- char *p1 = str->val;
- char *endp = str->val + str->len;
- char *p2 = (char *) php_memnstr(str->val, delim->val, delim->len, endp);
+ char *p1 = ZSTR_VAL(str);
+ char *endp = ZSTR_VAL(str) + ZSTR_LEN(str);
+ char *p2 = (char *) php_memnstr(ZSTR_VAL(str), ZSTR_VAL(delim), ZSTR_LEN(delim), endp);
zval tmp;
if (p2 == NULL) {
do {
ZVAL_STRINGL(&tmp, p1, p2 - p1);
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
- p1 = p2 + delim->len;
- p2 = (char *) php_memnstr(p1, delim->val, delim->len, endp);
+ p1 = p2 + ZSTR_LEN(delim);
+ p2 = (char *) php_memnstr(p1, ZSTR_VAL(delim), ZSTR_LEN(delim), endp);
} while (p2 != NULL && --limit > 1);
if (p1 <= endp) {
PHPAPI void php_explode_negative_limit(const zend_string *delim, zend_string *str, zval *return_value, zend_long limit)
{
#define EXPLODE_ALLOC_STEP 64
- char *p1 = str->val;
- char *endp = str->val + str->len;
- char *p2 = (char *) php_memnstr(str->val, delim->val, delim->len, endp);
+ char *p1 = ZSTR_VAL(str);
+ char *endp = ZSTR_VAL(str) + ZSTR_LEN(str);
+ char *p2 = (char *) php_memnstr(ZSTR_VAL(str), ZSTR_VAL(delim), ZSTR_LEN(delim), endp);
zval tmp;
if (p2 == NULL) {
allocated = found + EXPLODE_ALLOC_STEP;/* make sure we have enough memory */
positions = erealloc(positions, allocated*sizeof(char *));
}
- positions[found++] = p1 = p2 + delim->len;
- p2 = (char *) php_memnstr(p1, delim->val, delim->len, endp);
+ positions[found++] = p1 = p2 + ZSTR_LEN(delim);
+ p2 = (char *) php_memnstr(p1, ZSTR_VAL(delim), ZSTR_LEN(delim), endp);
} while (p2 != NULL);
to_return = limit + found;
/* limit is at least -1 therefore no need of bounds checking : i will be always less than found */
for (i = 0; i < to_return; i++) { /* this checks also for to_return > 0 */
- ZVAL_STRINGL(&tmp, positions[i], (positions[i+1] - delim->len) - positions[i]);
+ ZVAL_STRINGL(&tmp, positions[i], (positions[i+1] - ZSTR_LEN(delim)) - positions[i]);
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
}
efree(positions);
ZEND_PARSE_PARAMETERS_END();
#endif
- if (delim->len == 0) {
+ if (ZSTR_LEN(delim) == 0) {
php_error_docref(NULL, E_WARNING, "Empty delimiter");
RETURN_FALSE;
}
array_init(return_value);
- if (str->len == 0) {
+ if (ZSTR_LEN(str) == 0) {
if (limit >= 0) {
ZVAL_EMPTY_STRING(&tmp);
zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp);
}
} else {
*++strptr = zval_get_string(tmp);
- len += (*strptr)->len;
+ len += ZSTR_LEN(*strptr);
}
} ZEND_HASH_FOREACH_END();
- str = zend_string_alloc(len + (numelems - 1) * delim->len, 0);
- cptr = str->val + str->len;
+ str = zend_string_alloc(len + (numelems - 1) * ZSTR_LEN(delim), 0);
+ cptr = ZSTR_VAL(str) + ZSTR_LEN(str);
*cptr = 0;
do {
if (*strptr) {
- cptr -= (*strptr)->len;
- memcpy(cptr, (*strptr)->val, (*strptr)->len);
+ cptr -= ZSTR_LEN(*strptr);
+ memcpy(cptr, ZSTR_VAL(*strptr), ZSTR_LEN(*strptr));
zend_string_release(*strptr);
} else {
char *oldPtr = cptr;
*oldPtr = oldVal;
}
- cptr -= delim->len;
- memcpy(cptr, delim->val, delim->len);
+ cptr -= ZSTR_LEN(delim);
+ memcpy(cptr, ZSTR_VAL(delim), ZSTR_LEN(delim));
} while (--strptr > strings);
if (*strptr) {
- memcpy(str->val, (*strptr)->val, (*strptr)->len);
+ memcpy(ZSTR_VAL(str), ZSTR_VAL(*strptr), ZSTR_LEN(*strptr));
zend_string_release(*strptr);
} else {
char *oldPtr = cptr;
tok = str;
} else {
zval_ptr_dtor(&BG(strtok_zval));
- ZVAL_STRINGL(&BG(strtok_zval), str->val, str->len);
+ ZVAL_STRINGL(&BG(strtok_zval), ZSTR_VAL(str), ZSTR_LEN(str));
BG(strtok_last) = BG(strtok_string) = Z_STRVAL(BG(strtok_zval));
- BG(strtok_len) = str->len;
+ BG(strtok_len) = ZSTR_LEN(str);
}
p = BG(strtok_last); /* Where we start to search */
RETURN_FALSE;
}
- token = tok->val;
- token_end = token + tok->len;
+ token = ZSTR_VAL(tok);
+ token_end = token + ZSTR_LEN(tok);
while (token < token_end) {
STRTOK_TABLE(token++) = 1;
/* Restore table -- usually faster then memset'ing the table on every invocation */
restore:
- token = tok->val;
+ token = ZSTR_VAL(tok);
while (token < token_end) {
STRTOK_TABLE(token++) = 0;
{
unsigned char *c, *e;
- c = (unsigned char *)s->val;
- e = c + s->len;
+ c = (unsigned char *)ZSTR_VAL(s);
+ e = c + ZSTR_LEN(s);
while (c < e) {
if (!isupper(*c)) {
register unsigned char *r;
- zend_string *res = zend_string_alloc(s->len, 0);
+ zend_string *res = zend_string_alloc(ZSTR_LEN(s), 0);
- if (c != (unsigned char*)s->val) {
- memcpy(res->val, s->val, c - (unsigned char*)s->val);
+ if (c != (unsigned char*)ZSTR_VAL(s)) {
+ memcpy(ZSTR_VAL(res), ZSTR_VAL(s), c - (unsigned char*)ZSTR_VAL(s));
}
- r = c + (res->val - s->val);
+ r = c + (ZSTR_VAL(res) - ZSTR_VAL(s));
while (c < e) {
*r = toupper(*c);
r++;
{
unsigned char *c, *e;
- c = (unsigned char *)s->val;
- e = c + s->len;
+ c = (unsigned char *)ZSTR_VAL(s);
+ e = c + ZSTR_LEN(s);
while (c < e) {
if (!islower(*c)) {
register unsigned char *r;
- zend_string *res = zend_string_alloc(s->len, 0);
+ zend_string *res = zend_string_alloc(ZSTR_LEN(s), 0);
- if (c != (unsigned char*)s->val) {
- memcpy(res->val, s->val, c - (unsigned char*)s->val);
+ if (c != (unsigned char*)ZSTR_VAL(s)) {
+ memcpy(ZSTR_VAL(res), ZSTR_VAL(s), c - (unsigned char*)ZSTR_VAL(s));
}
- r = c + (res->val - s->val);
+ r = c + (ZSTR_VAL(res) - ZSTR_VAL(s));
while (c < e) {
*r = tolower(*c);
r++;
}
ret = zend_string_init(str, str_len, 0);
- ret->len = zend_dirname(ret->val, str_len);
+ ZSTR_LEN(ret) = zend_dirname(ZSTR_VAL(ret), str_len);
RETURN_NEW_STR(ret);
}
ret = php_basename(path, path_len, NULL, 0);
}
- p = zend_memrchr(ret->val, '.', ret->len);
+ p = zend_memrchr(ZSTR_VAL(ret), '.', ZSTR_LEN(ret));
if (p) {
- idx = p - ret->val;
- add_assoc_stringl(&tmp, "extension", ret->val + idx + 1, ret->len - idx - 1);
+ idx = p - ZSTR_VAL(ret);
+ add_assoc_stringl(&tmp, "extension", ZSTR_VAL(ret) + idx + 1, ZSTR_LEN(ret) - idx - 1);
}
}
ret = php_basename(path, path_len, NULL, 0);
}
- p = zend_memrchr(ret->val, '.', ret->len);
+ p = zend_memrchr(ZSTR_VAL(ret), '.', ZSTR_LEN(ret));
- idx = p ? (p - ret->val) : ret->len;
- add_assoc_stringl(&tmp, "filename", ret->val, idx);
+ idx = p ? (p - ZSTR_VAL(ret)) : ZSTR_LEN(ret);
+ add_assoc_stringl(&tmp, "filename", ZSTR_VAL(ret), idx);
}
if (ret) {
return;
}
- haystack_dup = estrndup(haystack->val, haystack->len);
+ haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack));
if (Z_TYPE_P(needle) == IS_STRING) {
char *orig_needle;
RETURN_FALSE;
}
orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle));
- found = php_stristr(haystack_dup, orig_needle, haystack->len, Z_STRLEN_P(needle));
+ found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), Z_STRLEN_P(needle));
efree(orig_needle);
} else {
if (php_needle_char(needle, needle_char) != SUCCESS) {
}
needle_char[1] = 0;
- found = php_stristr(haystack_dup, needle_char, haystack->len, 1);
+ found = php_stristr(haystack_dup, needle_char, ZSTR_LEN(haystack), 1);
}
if (found) {
found_offset = found - haystack_dup;
if (part) {
- RETVAL_STRINGL(haystack->val, found_offset);
+ RETVAL_STRINGL(ZSTR_VAL(haystack), found_offset);
} else {
- RETVAL_STRINGL(haystack->val + found_offset, haystack->len - found_offset);
+ RETVAL_STRINGL(ZSTR_VAL(haystack) + found_offset, ZSTR_LEN(haystack) - found_offset);
}
} else {
RETVAL_FALSE;
RETURN_FALSE;
}
- found = (char*)php_memnstr(haystack->val, Z_STRVAL_P(needle), Z_STRLEN_P(needle), haystack->val + haystack->len);
+ found = (char*)php_memnstr(ZSTR_VAL(haystack), Z_STRVAL_P(needle), Z_STRLEN_P(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
} else {
if (php_needle_char(needle, needle_char) != SUCCESS) {
RETURN_FALSE;
}
needle_char[1] = 0;
- found = (char*)php_memnstr(haystack->val, needle_char, 1, haystack->val + haystack->len);
+ found = (char*)php_memnstr(ZSTR_VAL(haystack), needle_char, 1, ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
}
if (found) {
- found_offset = found - haystack->val;
+ found_offset = found - ZSTR_VAL(haystack);
if (part) {
- RETURN_STRINGL(haystack->val, found_offset);
+ RETURN_STRINGL(ZSTR_VAL(haystack), found_offset);
} else {
- RETURN_STRINGL(found, haystack->len - found_offset);
+ RETURN_STRINGL(found, ZSTR_LEN(haystack) - found_offset);
}
}
RETURN_FALSE;
ZEND_PARSE_PARAMETERS_END();
#endif
- if (offset < 0 || (size_t)offset > haystack->len) {
+ if (offset < 0 || (size_t)offset > ZSTR_LEN(haystack)) {
php_error_docref(NULL, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
RETURN_FALSE;
}
- found = (char*)php_memnstr(haystack->val + offset,
+ found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset,
Z_STRVAL_P(needle),
Z_STRLEN_P(needle),
- haystack->val + haystack->len);
+ ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
} else {
if (php_needle_char(needle, needle_char) != SUCCESS) {
RETURN_FALSE;
}
needle_char[1] = 0;
- found = (char*)php_memnstr(haystack->val + offset,
+ found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset,
needle_char,
1,
- haystack->val + haystack->len);
+ ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
}
if (found) {
- RETURN_LONG(found - haystack->val);
+ RETURN_LONG(found - ZSTR_VAL(haystack));
} else {
RETURN_FALSE;
}
return;
}
- if (offset < 0 || (size_t)offset > haystack->len) {
+ if (offset < 0 || (size_t)offset > ZSTR_LEN(haystack)) {
php_error_docref(NULL, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
- if (haystack->len == 0) {
+ if (ZSTR_LEN(haystack) == 0) {
RETURN_FALSE;
}
if (Z_TYPE_P(needle) == IS_STRING) {
- if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > haystack->len) {
+ if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > ZSTR_LEN(haystack)) {
RETURN_FALSE;
}
haystack_dup = php_string_tolower(haystack);
needle_dup = php_string_tolower(Z_STR_P(needle));
- found = (char*)php_memnstr(haystack_dup->val + offset,
- needle_dup->val, needle_dup->len, haystack_dup->val + haystack->len);
+ found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset,
+ ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack));
} else {
if (php_needle_char(needle, needle_char) != SUCCESS) {
RETURN_FALSE;
haystack_dup = php_string_tolower(haystack);
needle_char[0] = tolower(needle_char[0]);
needle_char[1] = '\0';
- found = (char*)php_memnstr(haystack_dup->val + offset,
+ found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset,
needle_char,
sizeof(needle_char) - 1,
- haystack_dup->val + haystack->len);
+ ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack));
}
if (found) {
- RETVAL_LONG(found - haystack_dup->val);
+ RETVAL_LONG(found - ZSTR_VAL(haystack_dup));
} else {
RETVAL_FALSE;
}
needle_len = 1;
}
- if ((haystack->len == 0) || (needle_len == 0)) {
+ if ((ZSTR_LEN(haystack) == 0) || (needle_len == 0)) {
RETURN_FALSE;
}
if (offset >= 0) {
- if ((size_t)offset > haystack->len) {
+ if ((size_t)offset > ZSTR_LEN(haystack)) {
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
- p = haystack->val + (size_t)offset;
- e = haystack->val + haystack->len;
+ p = ZSTR_VAL(haystack) + (size_t)offset;
+ e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
} else {
- if (offset < -INT_MAX || (size_t)(-offset) > haystack->len) {
+ if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
- p = haystack->val;
+ p = ZSTR_VAL(haystack);
if (-offset < needle_len) {
- e = haystack->val + haystack->len;
+ e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
} else {
- e = haystack->val + haystack->len + offset + needle_len;
+ e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + offset + needle_len;
}
}
if ((found = (char *)zend_memnrstr(p, needle, needle_len, e))) {
- RETURN_LONG(found - haystack->val);
+ RETURN_LONG(found - ZSTR_VAL(haystack));
}
RETURN_FALSE;
if (Z_TYPE_P(zneedle) == IS_STRING) {
needle = Z_STR_P(zneedle);
} else {
- if (php_needle_char(zneedle, ord_needle->val) != SUCCESS) {
+ if (php_needle_char(zneedle, ZSTR_VAL(ord_needle)) != SUCCESS) {
ZSTR_ALLOCA_FREE(ord_needle, use_heap);
RETURN_FALSE;
}
- ord_needle->val[1] = '\0';
+ ZSTR_VAL(ord_needle)[1] = '\0';
needle = ord_needle;
}
- if ((haystack->len == 0) || (needle->len == 0)) {
+ if ((ZSTR_LEN(haystack) == 0) || (ZSTR_LEN(needle) == 0)) {
ZSTR_ALLOCA_FREE(ord_needle, use_heap);
RETURN_FALSE;
}
- if (needle->len == 1) {
+ if (ZSTR_LEN(needle) == 1) {
/* Single character search can shortcut memcmps
Can also avoid tolower emallocs */
if (offset >= 0) {
- if ((size_t)offset > haystack->len) {
+ if ((size_t)offset > ZSTR_LEN(haystack)) {
ZSTR_ALLOCA_FREE(ord_needle, use_heap);
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
- p = haystack->val + (size_t)offset;
- e = haystack->val + haystack->len - 1;
+ p = ZSTR_VAL(haystack) + (size_t)offset;
+ e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) - 1;
} else {
- p = haystack->val;
- if (offset < -INT_MAX || (size_t)(-offset) > haystack->len) {
+ p = ZSTR_VAL(haystack);
+ if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
ZSTR_ALLOCA_FREE(ord_needle, use_heap);
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
- e = haystack->val + haystack->len + (size_t)offset;
+ e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + (size_t)offset;
}
/* Borrow that ord_needle buffer to avoid repeatedly tolower()ing needle */
- *ord_needle->val = tolower(*needle->val);
+ *ZSTR_VAL(ord_needle) = tolower(*ZSTR_VAL(needle));
while (e >= p) {
- if (tolower(*e) == *ord_needle->val) {
+ if (tolower(*e) == *ZSTR_VAL(ord_needle)) {
ZSTR_ALLOCA_FREE(ord_needle, use_heap);
RETURN_LONG(e - p + (offset > 0 ? offset : 0));
}
haystack_dup = php_string_tolower(haystack);
if (offset >= 0) {
- if ((size_t)offset > haystack->len) {
+ if ((size_t)offset > ZSTR_LEN(haystack)) {
zend_string_release(haystack_dup);
ZSTR_ALLOCA_FREE(ord_needle, use_heap);
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
- p = haystack_dup->val + offset;
- e = haystack_dup->val + haystack->len;
+ p = ZSTR_VAL(haystack_dup) + offset;
+ e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack);
} else {
- if (offset < -INT_MAX || (size_t)(-offset) > haystack->len) {
+ if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
zend_string_release(haystack_dup);
ZSTR_ALLOCA_FREE(ord_needle, use_heap);
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
- p = haystack_dup->val;
- if (-offset < needle->len) {
- e = haystack_dup->val + haystack->len;
+ p = ZSTR_VAL(haystack_dup);
+ if (-offset < ZSTR_LEN(needle)) {
+ e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack);
} else {
- e = haystack_dup->val + haystack->len + offset + needle->len;
+ e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack) + offset + ZSTR_LEN(needle);
}
}
needle_dup = php_string_tolower(needle);
- if ((found = (char *)zend_memnrstr(p, needle_dup->val, needle_dup->len, e))) {
- RETVAL_LONG(found - haystack_dup->val);
+ if ((found = (char *)zend_memnrstr(p, ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), e))) {
+ RETVAL_LONG(found - ZSTR_VAL(haystack_dup));
zend_string_release(needle_dup);
zend_string_release(haystack_dup);
ZSTR_ALLOCA_FREE(ord_needle, use_heap);
}
if (Z_TYPE_P(needle) == IS_STRING) {
- found = zend_memrchr(haystack->val, *Z_STRVAL_P(needle), haystack->len);
+ found = zend_memrchr(ZSTR_VAL(haystack), *Z_STRVAL_P(needle), ZSTR_LEN(haystack));
} else {
char needle_chr;
if (php_needle_char(needle, &needle_chr) != SUCCESS) {
RETURN_FALSE;
}
- found = zend_memrchr(haystack->val, needle_chr, haystack->len);
+ found = zend_memrchr(ZSTR_VAL(haystack), needle_chr, ZSTR_LEN(haystack));
}
if (found) {
- found_offset = found - haystack->val;
- RETURN_STRINGL(found, haystack->len - found_offset);
+ found_offset = found - ZSTR_VAL(haystack);
+ RETURN_STRINGL(found, ZSTR_LEN(haystack) - found_offset);
} else {
RETURN_FALSE;
}
dest = zend_string_alloc(out_len * sizeof(char), 0);
- for (p = src, q = dest->val; p < (src + srclen - chunklen + 1); ) {
+ for (p = src, q = ZSTR_VAL(dest); p < (src + srclen - chunklen + 1); ) {
memcpy(q, p, chunklen);
q += chunklen;
memcpy(q, end, endlen);
}
*q = '\0';
- dest->len = q - dest->val;
+ ZSTR_LEN(dest) = q - ZSTR_VAL(dest);
return dest;
}
RETURN_FALSE;
}
- if ((size_t)chunklen > str->len) {
+ if ((size_t)chunklen > ZSTR_LEN(str)) {
/* to maintain BC, we must return original string + ending */
- result = zend_string_alloc(endlen + str->len, 0);
- memcpy(result->val, str->val, str->len);
- memcpy(result->val + str->len, end, endlen);
- result->val[result->len] = '\0';
+ result = zend_string_alloc(endlen + ZSTR_LEN(str), 0);
+ memcpy(ZSTR_VAL(result), ZSTR_VAL(str), ZSTR_LEN(str));
+ memcpy(ZSTR_VAL(result) + ZSTR_LEN(str), end, endlen);
+ ZSTR_VAL(result)[ZSTR_LEN(result)] = '\0';
RETURN_NEW_STR(result);
}
- if (!str->len) {
+ if (!ZSTR_LEN(str)) {
RETURN_EMPTY_STRING();
}
- result = php_chunk_split(str->val, str->len, end, endlen, (size_t)chunklen);
+ result = php_chunk_split(ZSTR_VAL(str), ZSTR_LEN(str), end, endlen, (size_t)chunklen);
if (result) {
RETURN_STR(result);
#endif
if (argc > 2) {
- if ((l < 0 && (size_t)(-l) > str->len)) {
+ if ((l < 0 && (size_t)(-l) > ZSTR_LEN(str))) {
RETURN_FALSE;
- } else if (l > (zend_long)str->len) {
- l = str->len;
+ } else if (l > (zend_long)ZSTR_LEN(str)) {
+ l = ZSTR_LEN(str);
}
} else {
- l = str->len;
+ l = ZSTR_LEN(str);
}
- if (f > (zend_long)str->len) {
+ if (f > (zend_long)ZSTR_LEN(str)) {
RETURN_FALSE;
- } else if (f < 0 && -f > str->len) {
+ } else if (f < 0 && -f > ZSTR_LEN(str)) {
f = 0;
}
- if (l < 0 && (l + (zend_long)str->len - f) < 0) {
+ if (l < 0 && (l + (zend_long)ZSTR_LEN(str) - f) < 0) {
RETURN_FALSE;
}
* of the string
*/
if (f < 0) {
- f = (zend_long)str->len + f;
+ f = (zend_long)ZSTR_LEN(str) + f;
if (f < 0) {
f = 0;
}
* needed to stop that many chars from the end of the string
*/
if (l < 0) {
- l = ((zend_long)str->len - f) + l;
+ l = ((zend_long)ZSTR_LEN(str) - f) + l;
if (l < 0) {
l = 0;
}
}
- if (f > (zend_long)str->len) {
+ if (f > (zend_long)ZSTR_LEN(str)) {
RETURN_FALSE;
}
- if ((f + l) > (zend_long)str->len) {
- l = str->len - f;
+ if ((f + l) > (zend_long)ZSTR_LEN(str)) {
+ l = ZSTR_LEN(str) - f;
}
- RETURN_STRINGL(str->val + f, l);
+ RETURN_STRINGL(ZSTR_VAL(str) + f, l);
}
/* }}} */
result = zend_string_alloc(Z_STRLEN_P(str) - l + repl_len, 0);
- memcpy(result->val, Z_STRVAL_P(str), f);
+ memcpy(ZSTR_VAL(result), Z_STRVAL_P(str), f);
if (repl_len) {
- memcpy((result->val + f), (Z_TYPE_P(repl) == IS_ARRAY ? Z_STRVAL_P(tmp_repl) : Z_STRVAL_P(repl)), repl_len);
+ memcpy((ZSTR_VAL(result) + f), (Z_TYPE_P(repl) == IS_ARRAY ? Z_STRVAL_P(tmp_repl) : Z_STRVAL_P(repl)), repl_len);
}
- memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRLEN_P(str) - f - l);
- result->val[result->len] = '\0';
+ memcpy((ZSTR_VAL(result) + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRLEN_P(str) - f - l);
+ ZSTR_VAL(result)[ZSTR_LEN(result)] = '\0';
RETURN_NEW_STR(result);
} else {
php_error_docref(NULL, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented");
f = zval_get_long(tmp_from);
if (f < 0) {
- f = (zend_long)orig_str->len + f;
+ f = (zend_long)ZSTR_LEN(orig_str) + f;
if (f < 0) {
f = 0;
}
- } else if (f > (zend_long)orig_str->len) {
- f = orig_str->len;
+ } else if (f > (zend_long)ZSTR_LEN(orig_str)) {
+ f = ZSTR_LEN(orig_str);
}
from_idx++;
} else {
} else {
f = Z_LVAL_P(from);
if (f < 0) {
- f = (zend_long)orig_str->len + f;
+ f = (zend_long)ZSTR_LEN(orig_str) + f;
if (f < 0) {
f = 0;
}
- } else if (f > (zend_long)orig_str->len) {
- f = orig_str->len;
+ } else if (f > (zend_long)ZSTR_LEN(orig_str)) {
+ f = ZSTR_LEN(orig_str);
}
}
l = zval_get_long(tmp_len);
len_idx++;
} else {
- l = orig_str->len;
+ l = ZSTR_LEN(orig_str);
}
} else if (argc > 3) {
l = Z_LVAL_P(len);
} else {
- l = orig_str->len;
+ l = ZSTR_LEN(orig_str);
}
if (l < 0) {
- l = (orig_str->len - f) + l;
+ l = (ZSTR_LEN(orig_str) - f) + l;
if (l < 0) {
l = 0;
}
}
- if ((f + l) > (zend_long)orig_str->len) {
- l = orig_str->len - f;
+ if ((f + l) > (zend_long)ZSTR_LEN(orig_str)) {
+ l = ZSTR_LEN(orig_str) - f;
}
- result_len = orig_str->len - l;
+ result_len = ZSTR_LEN(orig_str) - l;
if (Z_TYPE_P(repl) == IS_ARRAY) {
while (repl_idx < Z_ARRVAL_P(repl)->nNumUsed) {
if (repl_idx < Z_ARRVAL_P(repl)->nNumUsed) {
zend_string *repl_str = zval_get_string(tmp_repl);
- result_len += repl_str->len;
+ result_len += ZSTR_LEN(repl_str);
repl_idx++;
result = zend_string_alloc(result_len, 0);
- memcpy(result->val, orig_str->val, f);
- memcpy((result->val + f), repl_str->val, repl_str->len);
- memcpy((result->val + f + repl_str->len), orig_str->val + f + l, orig_str->len - f - l);
+ memcpy(ZSTR_VAL(result), ZSTR_VAL(orig_str), f);
+ memcpy((ZSTR_VAL(result) + f), ZSTR_VAL(repl_str), ZSTR_LEN(repl_str));
+ memcpy((ZSTR_VAL(result) + f + ZSTR_LEN(repl_str)), ZSTR_VAL(orig_str) + f + l, ZSTR_LEN(orig_str) - f - l);
zend_string_release(repl_str);
} else {
result = zend_string_alloc(result_len, 0);
- memcpy(result->val, orig_str->val, f);
- memcpy((result->val + f), orig_str->val + f + l, orig_str->len - f - l);
+ memcpy(ZSTR_VAL(result), ZSTR_VAL(orig_str), f);
+ memcpy((ZSTR_VAL(result) + f), ZSTR_VAL(orig_str) + f + l, ZSTR_LEN(orig_str) - f - l);
}
} else {
result_len += Z_STRLEN_P(repl);
result = zend_string_alloc(result_len, 0);
- memcpy(result->val, orig_str->val, f);
- memcpy((result->val + f), Z_STRVAL_P(repl), Z_STRLEN_P(repl));
- memcpy((result->val + f + Z_STRLEN_P(repl)), orig_str->val + f + l, orig_str->len - f - l);
+ memcpy(ZSTR_VAL(result), ZSTR_VAL(orig_str), f);
+ memcpy((ZSTR_VAL(result) + f), Z_STRVAL_P(repl), Z_STRLEN_P(repl));
+ memcpy((ZSTR_VAL(result) + f + Z_STRLEN_P(repl)), ZSTR_VAL(orig_str) + f + l, ZSTR_LEN(orig_str) - f - l);
}
- result->val[result->len] = '\0';
+ ZSTR_VAL(result)[ZSTR_LEN(result)] = '\0';
if (str_index) {
zval tmp;
return;
}
- old_end = old->val + old->len;
+ old_end = ZSTR_VAL(old) + ZSTR_LEN(old);
- if (old->val == old_end) {
+ if (ZSTR_VAL(old) == old_end) {
RETURN_FALSE;
}
- str = zend_string_alloc(2 * old->len, 0);
+ str = zend_string_alloc(2 * ZSTR_LEN(old), 0);
- for (p = old->val, q = str->val; p != old_end; p++) {
+ for (p = ZSTR_VAL(old), q = ZSTR_VAL(str); p != old_end; p++) {
c = *p;
switch (c) {
case '.':
*q = '\0';
- RETURN_NEW_STR(zend_string_truncate(str, q - str->val, 0));
+ RETURN_NEW_STR(zend_string_truncate(str, q - ZSTR_VAL(str), 0));
}
/* }}} */
ZEND_PARSE_PARAMETERS_END();
#endif
- if (!str->len) {
+ if (!ZSTR_LEN(str)) {
RETURN_EMPTY_STRING();
}
- ZVAL_STRINGL(return_value, str->val, str->len);
+ ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str));
php_ucfirst(Z_STRVAL_P(return_value));
}
/* }}} */
return;
}
- if (!str->len) {
+ if (!ZSTR_LEN(str)) {
RETURN_EMPTY_STRING();
}
- ZVAL_STRINGL(return_value, str->val, str->len);
+ ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str));
php_lcfirst(Z_STRVAL_P(return_value));
}
/* }}} */
ZEND_PARSE_PARAMETERS_END();
#endif
- if (!str->len) {
+ if (!ZSTR_LEN(str)) {
RETURN_EMPTY_STRING();
}
php_charmask((unsigned char *)delims, delims_len, mask);
- ZVAL_STRINGL(return_value, str->val, str->len);
+ ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str));
r = Z_STRVAL_P(return_value);
*r = toupper((unsigned char) *r);
char ch_from = *str_from;
char ch_to = *str_to;
- for (i = 0; i < str->len; i++) {
- if (str->val[i] == ch_from) {
- new_str = zend_string_alloc(str->len, 0);
- memcpy(new_str->val, str->val, i);
- new_str->val[i] = ch_to;
+ for (i = 0; i < ZSTR_LEN(str); i++) {
+ if (ZSTR_VAL(str)[i] == ch_from) {
+ new_str = zend_string_alloc(ZSTR_LEN(str), 0);
+ memcpy(ZSTR_VAL(new_str), ZSTR_VAL(str), i);
+ ZSTR_VAL(new_str)[i] = ch_to;
break;
}
}
- for (; i < str->len; i++) {
- new_str->val[i] = (str->val[i] != ch_from) ? str->val[i] : ch_to;
+ for (; i < ZSTR_LEN(str); i++) {
+ ZSTR_VAL(new_str)[i] = (ZSTR_VAL(str)[i] != ch_from) ? ZSTR_VAL(str)[i] : ch_to;
}
} else {
unsigned char xlat[256], j = 0;
xlat[(size_t)(unsigned char) str_from[i]] = str_to[i];
}
- for (i = 0; i < str->len; i++) {
- if (str->val[i] != xlat[(size_t)(unsigned char) str->val[i]]) {
- new_str = zend_string_alloc(str->len, 0);
- memcpy(new_str->val, str->val, i);
- new_str->val[i] = xlat[(size_t)(unsigned char) str->val[i]];
+ for (i = 0; i < ZSTR_LEN(str); i++) {
+ if (ZSTR_VAL(str)[i] != xlat[(size_t)(unsigned char) ZSTR_VAL(str)[i]]) {
+ new_str = zend_string_alloc(ZSTR_LEN(str), 0);
+ memcpy(ZSTR_VAL(new_str), ZSTR_VAL(str), i);
+ ZSTR_VAL(new_str)[i] = xlat[(size_t)(unsigned char) ZSTR_VAL(str)[i]];
break;
}
}
- for (;i < str->len; i++) {
- new_str->val[i] = xlat[(size_t)(unsigned char) str->val[i]];
+ for (;i < ZSTR_LEN(str); i++) {
+ ZSTR_VAL(new_str)[i] = xlat[(size_t)(unsigned char) ZSTR_VAL(str)[i]];
}
}
return zend_string_copy(str);
}
- new_str->val[new_str->len] = 0;
+ ZSTR_VAL(new_str)[ZSTR_LEN(new_str)] = 0;
return new_str;
}
/* }}} */
/* {{{ php_strtr_array */
static void php_strtr_array(zval *return_value, zend_string *input, HashTable *pats)
{
- char *str = input->val;
- size_t slen = input->len;
+ char *str = ZSTR_VAL(input);
+ size_t slen = ZSTR_LEN(input);
zend_ulong num_key;
zend_string *str_key;
size_t len, pos, old_pos;
if (UNEXPECTED(!str_key)) {
num_keys = 1;
} else {
- len = str_key->len;
+ len = ZSTR_LEN(str_key);
if (UNEXPECTED(len < 1)) {
RETURN_FALSE;
} else if (UNEXPECTED(len > slen)) {
}
/* remember possible key length */
num_bitset[len / sizeof(zend_ulong)] |= Z_UL(1) << (len % sizeof(zend_ulong));
- bitset[((unsigned char)str_key->val[0]) / sizeof(zend_ulong)] |= Z_UL(1) << (((unsigned char)str_key->val[0]) % sizeof(zend_ulong));
+ bitset[((unsigned char)ZSTR_VAL(str_key)[0]) / sizeof(zend_ulong)] |= Z_UL(1) << (((unsigned char)ZSTR_VAL(str_key)[0]) % sizeof(zend_ulong));
}
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_KEY_VAL(pats, num_key, str_key, entry) {
if (UNEXPECTED(!str_key)) {
key_used = zend_long_to_str(num_key);
- len = key_used->len;
+ len = ZSTR_LEN(key_used);
if (UNEXPECTED(len > slen)) {
/* skip long patterns */
continue;
}
/* remember possible key length */
num_bitset[len / sizeof(zend_ulong)] |= Z_UL(1) << (len % sizeof(zend_ulong));
- bitset[((unsigned char)key_used->val[0]) / sizeof(zend_ulong)] |= Z_UL(1) << (((unsigned char)key_used->val[0]) % sizeof(zend_ulong));
+ bitset[((unsigned char)ZSTR_VAL(key_used)[0]) / sizeof(zend_ulong)] |= Z_UL(1) << (((unsigned char)ZSTR_VAL(key_used)[0]) % sizeof(zend_ulong));
} else {
key_used = str_key;
- len = key_used->len;
+ len = ZSTR_LEN(key_used);
if (UNEXPECTED(len > slen)) {
/* skip long patterns */
continue;
zend_string *result;
size_t char_count = 0;
char lc_from = 0;
- char *source, *target, *source_end= str->val + str->len;
+ char *source, *target, *source_end= ZSTR_VAL(str) + ZSTR_LEN(str);
if (case_sensitivity) {
- char *p = str->val, *e = p + str->len;
+ char *p = ZSTR_VAL(str), *e = p + ZSTR_LEN(str);
while ((p = memchr(p, from, (e - p)))) {
char_count++;
p++;
}
} else {
lc_from = tolower(from);
- for (source = str->val; source < source_end; source++) {
+ for (source = ZSTR_VAL(str); source < source_end; source++) {
if (tolower(*source) == lc_from) {
char_count++;
}
}
if (to_len > 0) {
- result = zend_string_safe_alloc(char_count, to_len - 1, str->len, 0);
+ result = zend_string_safe_alloc(char_count, to_len - 1, ZSTR_LEN(str), 0);
} else {
- result = zend_string_alloc(str->len - char_count, 0);
+ result = zend_string_alloc(ZSTR_LEN(str) - char_count, 0);
}
- target = result->val;
+ target = ZSTR_VAL(result);
if (case_sensitivity) {
- char *p = str->val, *e = p + str->len, *s = str->val;
+ char *p = ZSTR_VAL(str), *e = p + ZSTR_LEN(str), *s = ZSTR_VAL(str);
while ((p = memchr(p, from, (e - p)))) {
memcpy(target, s, (p - s));
target += p - s;
target += e - s;
}
} else {
- for (source = str->val; source < source_end; source++) {
+ for (source = ZSTR_VAL(str); source < source_end; source++) {
if (tolower(*source) == lc_from) {
if (replace_count) {
*replace_count += 1;
{
zend_string *new_str;
- if (needle_len < haystack->len) {
+ if (needle_len < ZSTR_LEN(haystack)) {
char *end;
char *e, *s, *p, *r;
if (needle_len == str_len) {
new_str = NULL;
- end = haystack->val + haystack->len;
- for (p = haystack->val; (r = (char*)php_memnstr(p, needle, needle_len, end)); p = r + needle_len) {
+ end = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
+ for (p = ZSTR_VAL(haystack); (r = (char*)php_memnstr(p, needle, needle_len, end)); p = r + needle_len) {
if (!new_str) {
- new_str = zend_string_init(haystack->val, haystack->len, 0);
+ new_str = zend_string_init(ZSTR_VAL(haystack), ZSTR_LEN(haystack), 0);
}
- memcpy(new_str->val + (r - haystack->val), str, str_len);
+ memcpy(ZSTR_VAL(new_str) + (r - ZSTR_VAL(haystack)), str, str_len);
(*replace_count)++;
}
if (!new_str) {
return new_str;
} else {
size_t count = 0;
- char *o = haystack->val;
+ char *o = ZSTR_VAL(haystack);
char *n = needle;
- char *endp = o + haystack->len;
+ char *endp = o + ZSTR_LEN(haystack);
while ((o = (char*)php_memnstr(o, n, needle_len, endp))) {
o += needle_len;
/* Needle doesn't occur, shortcircuit the actual replacement. */
goto nothing_todo;
}
- new_str = zend_string_alloc(count * (str_len - needle_len) + haystack->len, 0);
+ new_str = zend_string_alloc(count * (str_len - needle_len) + ZSTR_LEN(haystack), 0);
- e = s = new_str->val;
- end = haystack->val + haystack->len;
- for (p = haystack->val; (r = (char*)php_memnstr(p, needle, needle_len, end)); p = r + needle_len) {
+ e = s = ZSTR_VAL(new_str);
+ end = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
+ for (p = ZSTR_VAL(haystack); (r = (char*)php_memnstr(p, needle, needle_len, end)); p = r + needle_len) {
memcpy(e, p, r - p);
e += r - p;
memcpy(e, str, str_len);
*e = '\0';
return new_str;
}
- } else if (needle_len > haystack->len || memcmp(haystack->val, needle, haystack->len)) {
+ } else if (needle_len > ZSTR_LEN(haystack) || memcmp(ZSTR_VAL(haystack), needle, ZSTR_LEN(haystack))) {
nothing_todo:
return zend_string_copy(haystack);
} else {
zend_string *new_str = NULL;
zend_string *lc_needle;
- if (needle->len < haystack->len) {
+ if (ZSTR_LEN(needle) < ZSTR_LEN(haystack)) {
char *end;
char *e, *s, *p, *r;
- if (needle->len == str_len) {
+ if (ZSTR_LEN(needle) == str_len) {
lc_needle = php_string_tolower(needle);
- end = lc_haystack + haystack->len;
- for (p = lc_haystack; (r = (char*)php_memnstr(p, lc_needle->val, lc_needle->len, end)); p = r + lc_needle->len) {
+ end = lc_haystack + ZSTR_LEN(haystack);
+ for (p = lc_haystack; (r = (char*)php_memnstr(p, ZSTR_VAL(lc_needle), ZSTR_LEN(lc_needle), end)); p = r + ZSTR_LEN(lc_needle)) {
if (!new_str) {
- new_str = zend_string_init(haystack->val, haystack->len, 0);
+ new_str = zend_string_init(ZSTR_VAL(haystack), ZSTR_LEN(haystack), 0);
}
- memcpy(new_str->val + (r - lc_haystack), str, str_len);
+ memcpy(ZSTR_VAL(new_str) + (r - lc_haystack), str, str_len);
(*replace_count)++;
}
zend_string_release(lc_needle);
size_t count = 0;
char *o = lc_haystack;
char *n;
- char *endp = o + haystack->len;
+ char *endp = o + ZSTR_LEN(haystack);
lc_needle = php_string_tolower(needle);
- n = lc_needle->val;
+ n = ZSTR_VAL(lc_needle);
- while ((o = (char*)php_memnstr(o, n, lc_needle->len, endp))) {
- o += lc_needle->len;
+ while ((o = (char*)php_memnstr(o, n, ZSTR_LEN(lc_needle), endp))) {
+ o += ZSTR_LEN(lc_needle);
count++;
}
if (count == 0) {
goto nothing_todo;
}
- new_str = zend_string_alloc(count * (str_len - lc_needle->len) + haystack->len, 0);
+ new_str = zend_string_alloc(count * (str_len - ZSTR_LEN(lc_needle)) + ZSTR_LEN(haystack), 0);
- e = s = new_str->val;
- end = lc_haystack + haystack->len;
+ e = s = ZSTR_VAL(new_str);
+ end = lc_haystack + ZSTR_LEN(haystack);
- for (p = lc_haystack; (r = (char*)php_memnstr(p, lc_needle->val, lc_needle->len, end)); p = r + lc_needle->len) {
- memcpy(e, haystack->val + (p - lc_haystack), r - p);
+ for (p = lc_haystack; (r = (char*)php_memnstr(p, ZSTR_VAL(lc_needle), ZSTR_LEN(lc_needle), end)); p = r + ZSTR_LEN(lc_needle)) {
+ memcpy(e, ZSTR_VAL(haystack) + (p - lc_haystack), r - p);
e += r - p;
memcpy(e, str, str_len);
e += str_len;
}
if (p < end) {
- memcpy(e, haystack->val + (p - lc_haystack), end - p);
+ memcpy(e, ZSTR_VAL(haystack) + (p - lc_haystack), end - p);
e += end - p;
}
*e = '\0';
return new_str;
}
- } else if (needle->len > haystack->len) {
+ } else if (ZSTR_LEN(needle) > ZSTR_LEN(haystack)) {
nothing_todo:
return zend_string_copy(haystack);
} else {
lc_needle = php_string_tolower(needle);
- if (memcmp(lc_haystack, lc_needle->val, lc_needle->len)) {
+ if (memcmp(lc_haystack, ZSTR_VAL(lc_needle), ZSTR_LEN(lc_needle))) {
zend_string_release(lc_needle);
goto nothing_todo;
}
if (needle_len == str_len) {
new_str = zend_string_init(haystack, length, 0);
- end = new_str->val + length;
- for (p = new_str->val; (r = (char*)php_memnstr(p, needle, needle_len, end)); p = r + needle_len) {
+ end = ZSTR_VAL(new_str) + length;
+ for (p = ZSTR_VAL(new_str); (r = (char*)php_memnstr(p, needle, needle_len, end)); p = r + needle_len) {
memcpy(r, str, str_len);
}
return new_str;
}
}
- e = s = new_str->val;
+ e = s = ZSTR_VAL(new_str);
end = haystack + length;
for (p = haystack; (r = (char*)php_memnstr(p, needle, needle_len, end)); p = r + needle_len) {
memcpy(e, p, r - p);
}
/* shortcut for empty string */
- if (str->len == 0) {
+ if (ZSTR_LEN(str) == 0) {
RETURN_EMPTY_STRING();
}
str_key = Z_STR(tmp);
}
replace = zval_get_string(entry);
- if (str_key->len < 1) {
+ if (ZSTR_LEN(str_key) < 1) {
RETVAL_STR_COPY(str);
- } else if (str_key->len == 1) {
+ } else if (ZSTR_LEN(str_key) == 1) {
RETVAL_STR(php_char_to_str_ex(str,
- str_key->val[0],
- replace->val,
- replace->len,
+ ZSTR_VAL(str_key)[0],
+ ZSTR_VAL(replace),
+ ZSTR_LEN(replace),
1,
NULL));
} else {
zend_long dummy;
RETVAL_STR(php_str_to_str_ex(str,
- str_key->val, str_key->len,
- replace->val, replace->len, &dummy));
+ ZSTR_VAL(str_key), ZSTR_LEN(str_key),
+ ZSTR_VAL(replace), ZSTR_LEN(replace), &dummy));
}
zend_string_release(replace);
zval_dtor(&tmp);
return;
}
- n = zend_string_alloc(str->len, 0);
- p = n->val;
+ n = zend_string_alloc(ZSTR_LEN(str), 0);
+ p = ZSTR_VAL(n);
- e = str->val + str->len;
+ e = ZSTR_VAL(str) + ZSTR_LEN(str);
- while (--e>=str->val) {
+ while (--e >= ZSTR_VAL(str)) {
*p++ = *e;
}
convert_to_double_ex(percent);
}
- if (t1->len + t2->len == 0) {
+ if (ZSTR_LEN(t1) + ZSTR_LEN(t2) == 0) {
if (ac > 2) {
Z_DVAL_P(percent) = 0;
}
RETURN_LONG(0);
}
- sim = php_similar_char(t1->val, t1->len, t2->val, t2->len);
+ sim = php_similar_char(ZSTR_VAL(t1), ZSTR_LEN(t1), ZSTR_VAL(t2), ZSTR_LEN(t2));
if (ac > 2) {
- Z_DVAL_P(percent) = sim * 200.0 / (t1->len + t2->len);
+ Z_DVAL_P(percent) = sim * 200.0 / (ZSTR_LEN(t1) + ZSTR_LEN(t2));
}
RETURN_LONG(sim);
char *s, *t;
size_t l;
- s = (char *)str->val;
- t = (char *)str->val;
- l = str->len;
+ s = ZSTR_VAL(str);
+ t = ZSTR_VAL(str);
+ l = ZSTR_LEN(str);
while (l > 0) {
if (*t == '\\') {
t++; /* skip the slash */
- str->len--;
+ ZSTR_LEN(str)--;
l--;
if (l > 0) {
if (*t == '0') {
return;
}
- if (str->len == 0) {
+ if (ZSTR_LEN(str) == 0) {
RETURN_EMPTY_STRING();
}
- if (what->len == 0) {
- RETURN_STRINGL(str->val, str->len);
+ if (ZSTR_LEN(what) == 0) {
+ RETURN_STRINGL(ZSTR_VAL(str), ZSTR_LEN(str));
}
- RETURN_STR(php_addcslashes(str, 0, what->val, what->len));
+ RETURN_STR(php_addcslashes(str, 0, ZSTR_VAL(what), ZSTR_LEN(what)));
}
/* }}} */
ZEND_PARSE_PARAMETERS_END();
#endif
- if (str->len == 0) {
+ if (ZSTR_LEN(str) == 0) {
RETURN_EMPTY_STRING();
}
return;
}
- ZVAL_STRINGL(return_value, str->val, str->len);
+ ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str));
php_stripcslashes(Z_STR_P(return_value));
}
/* }}} */
return;
}
- ZVAL_STRINGL(return_value, str->val, str->len);
+ ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str));
php_stripslashes(Z_STR_P(return_value));
}
/* }}} */
PHPAPI void php_stripcslashes(zend_string *str)
{
char *source, *target, *end;
- size_t nlen = str->len, i;
+ size_t nlen = ZSTR_LEN(str), i;
char numtmp[4];
- for (source = (char*)str->val, end = source + str->len, target = str->val; source < end; source++) {
+ for (source = (char*)ZSTR_VAL(str), end = source + ZSTR_LEN(str), target = ZSTR_VAL(str); source < end; source++) {
if (*source == '\\' && source + 1 < end) {
source++;
switch (*source) {
*target='\0';
}
- str->len = nlen;
+ ZSTR_LEN(str) = nlen;
}
/* }}} */
char *end;
char c;
size_t newlen;
- zend_string *new_str = zend_string_alloc(4 * str->len, 0);
+ zend_string *new_str = zend_string_alloc(4 * ZSTR_LEN(str), 0);
php_charmask((unsigned char *)what, wlength, flags);
- for (source = (char*)str->val, end = source + str->len, target = new_str->val; source < end; source++) {
+ for (source = (char*)ZSTR_VAL(str), end = source + ZSTR_LEN(str), target = ZSTR_VAL(new_str); source < end; source++) {
c = *source;
if (flags[(unsigned char)c]) {
if ((unsigned char) c < 32 || (unsigned char) c > 126) {
*target++ = c;
}
*target = 0;
- newlen = target - new_str->val;
- if (newlen < str->len * 4) {
+ newlen = target - ZSTR_VAL(new_str);
+ if (newlen < ZSTR_LEN(str) * 4) {
new_str = zend_string_truncate(new_str, newlen, 0);
}
if (should_free) {
return ZSTR_EMPTY_ALLOC();
}
- source = str->val;
- end = source + str->len;
+ source = ZSTR_VAL(str);
+ end = source + ZSTR_LEN(str);
while (source < end) {
switch (*source) {
return str;
do_escape:
- offset = source - (char *)str->val;
- new_str = zend_string_alloc(offset + (2 * (str->len - offset)), 0);
- memcpy(new_str->val, str->val, offset);
- target = new_str->val + offset;
+ offset = source - (char *)ZSTR_VAL(str);
+ new_str = zend_string_alloc(offset + (2 * (ZSTR_LEN(str) - offset)), 0);
+ memcpy(ZSTR_VAL(new_str), ZSTR_VAL(str), offset);
+ target = ZSTR_VAL(new_str) + offset;
while (source < end) {
switch (*source) {
zend_string_release(str);
}
- if (new_str->len - (target - new_str->val) > 16) {
- new_str = zend_string_truncate(new_str, target - new_str->val, 0);
+ if (ZSTR_LEN(new_str) - (target - ZSTR_VAL(new_str)) > 16) {
+ new_str = zend_string_truncate(new_str, target - ZSTR_VAL(new_str), 0);
} else {
- new_str->len = target - new_str->val;
+ ZSTR_LEN(new_str) = target - ZSTR_VAL(new_str);
}
return new_str;
/* Make sure we're dealing with strings. */
subject_str = zval_get_string(subject);
- if (subject_str->len == 0) {
+ if (ZSTR_LEN(subject_str) == 0) {
zend_string_release(subject_str);
ZVAL_EMPTY_STRING(result);
return 0;
replace_entry_str = zval_get_string(replace_entry);
/* Set replacement value to the one we got from array */
- replace_value = replace_entry_str->val;
- replace_len = replace_entry_str->len;
+ replace_value = ZSTR_VAL(replace_entry_str);
+ replace_len = ZSTR_LEN(replace_entry_str);
replace_idx++;
} else {
if (!lc_subject_str) {
lc_subject_str = php_string_tolower(Z_STR_P(result));
}
- tmp_result = php_str_to_str_i_ex(Z_STR_P(result), lc_subject_str->val,
+ tmp_result = php_str_to_str_i_ex(Z_STR_P(result), ZSTR_VAL(lc_subject_str),
Z_STR_P(search_entry), replace_value, replace_len, &replace_count);
if (replace_count != old_replace_count) {
zend_string_release(lc_subject_str);
Z_STRVAL_P(replace), Z_STRLEN_P(replace), &replace_count));
} else {
lc_subject_str = php_string_tolower(Z_STR_P(subject));
- ZVAL_STR(result, php_str_to_str_i_ex(subject_str, lc_subject_str->val,
+ ZVAL_STR(result, php_str_to_str_i_ex(subject_str, ZSTR_VAL(lc_subject_str),
Z_STR_P(search),
Z_STRVAL_P(replace), Z_STRLEN_P(replace), &replace_count));
zend_string_release(lc_subject_str);
broken_str = zend_string_alloc(str_len, 0);
begin = end = str_len-1;
- target = broken_str->val;
+ target = ZSTR_VAL(broken_str);
while (1) {
char_count=0;
ZEND_PARSE_PARAMETERS_END();
#endif
- tmp = str->val;
- end = str->val + str->len;
+ tmp = ZSTR_VAL(str);
+ end = ZSTR_VAL(str) + ZSTR_LEN(str);
/* it is really faster to scan twice and allocate mem once instead of scanning once
and constantly reallocing */
}
if (repl_cnt == 0) {
- RETURN_STRINGL(str->val, str->len);
+ RETURN_STRINGL(ZSTR_VAL(str), ZSTR_LEN(str));
}
{
size_t repl_len = is_xhtml ? (sizeof("<br />") - 1) : (sizeof("<br>") - 1);
- result = zend_string_alloc(repl_cnt * repl_len + str->len, 0);
- target = result->val;
+ result = zend_string_alloc(repl_cnt * repl_len + ZSTR_LEN(str), 0);
+ target = ZSTR_VAL(result);
}
- tmp = str->val;
+ tmp = ZSTR_VAL(str);
while (tmp < end) {
switch (*tmp) {
case '\r':
}
}
- buf = zend_string_init(str->val, str->len, 0);
- buf->len = php_strip_tags_ex(buf->val, str->len, NULL, allowed_tags, allowed_tags_len, 0);
+ buf = zend_string_init(ZSTR_VAL(str), ZSTR_LEN(str), 0);
+ ZSTR_LEN(buf) = php_strip_tags_ex(ZSTR_VAL(buf), ZSTR_LEN(str), NULL, allowed_tags, allowed_tags_len, 0);
// TODO: reimplement to avoid reallocation ???
if (allow && !Z_REFCOUNTED_P(allow)) {
loc = zval_get_string(plocale);
- if (!strcmp("0", loc->val)) {
+ if (!strcmp("0", ZSTR_VAL(loc))) {
zend_string_release(loc);
loc = NULL;
} else {
- if (loc->len >= 255) {
+ if (ZSTR_LEN(loc) >= 255) {
php_error_docref(NULL, E_WARNING, "Specified locale name is too long");
zend_string_release(loc);
break;
}
}
- retval = php_my_setlocale(cat, loc ? loc->val : NULL);
+ retval = php_my_setlocale(cat, loc ? ZSTR_VAL(loc) : NULL);
zend_update_current_locale();
if (retval) {
if (loc) {
if (BG(locale_string)) {
zend_string_release(BG(locale_string));
}
- if (len == loc->len && !memcmp(loc->val, retval, len)) {
+ if (len == ZSTR_LEN(loc) && !memcmp(ZSTR_VAL(loc), retval, len)) {
BG(locale_string) = zend_string_copy(loc);
RETURN_STR(BG(locale_string));
} else {
zend_string_release(loc);
RETURN_STR_COPY(BG(locale_string));
}
- } else if (len == loc->len && !memcmp(loc->val, retval, len)) {
+ } else if (len == ZSTR_LEN(loc) && !memcmp(ZSTR_VAL(loc), retval, len)) {
RETURN_STR(loc);
}
zend_string_release(loc);
enc = enc_len ? enc_str[0] : enc;
esc = esc_len ? esc_str[0] : esc;
- php_fgetcsv(NULL, delim, enc, esc, str->len, str->val, return_value);
+ php_fgetcsv(NULL, delim, enc, esc, ZSTR_LEN(str), ZSTR_VAL(str), return_value);
}
/* }}} */
/* Don't waste our time if it's empty */
/* ... or if the multiplier is zero */
- if (input_str->len == 0 || mult == 0)
+ if (ZSTR_LEN(input_str) == 0 || mult == 0)
RETURN_EMPTY_STRING();
/* Initialize the result string */
- result = zend_string_safe_alloc(input_str->len, mult, 0, 0);
- result_len = input_str->len * mult;
+ result = zend_string_safe_alloc(ZSTR_LEN(input_str), mult, 0, 0);
+ result_len = ZSTR_LEN(input_str) * mult;
/* Heavy optimization for situations where input string is 1 byte long */
- if (input_str->len == 1) {
- memset(result->val, *(input_str->val), mult);
+ if (ZSTR_LEN(input_str) == 1) {
+ memset(ZSTR_VAL(result), *ZSTR_VAL(input_str), mult);
} else {
char *s, *e, *ee;
ptrdiff_t l=0;
- memcpy(result->val, input_str->val, input_str->len);
- s = result->val;
- e = result->val + input_str->len;
- ee = result->val + result_len;
+ memcpy(ZSTR_VAL(result), ZSTR_VAL(input_str), ZSTR_LEN(input_str));
+ s = ZSTR_VAL(result);
+ e = ZSTR_VAL(result) + ZSTR_LEN(input_str);
+ ee = ZSTR_VAL(result) + result_len;
while (e<ee) {
l = (e-s) < (ee-e) ? (e-s) : (ee-e);
}
}
- result->val[result_len] = '\0';
+ ZSTR_VAL(result)[result_len] = '\0';
RETURN_NEW_STR(result);
}
RETURN_FALSE;
}
- buf = (unsigned char *) input->val;
+ buf = (unsigned char *) ZSTR_VAL(input);
memset((void*) chars, 0, sizeof(chars));
- while (tmp < input->len) {
+ while (tmp < ZSTR_LEN(input)) {
chars[*buf]++;
buf++;
tmp++;
return;
}
- RETURN_LONG(strnatcmp_ex(s1->val, s1->len,
- s2->val, s2->len,
+ RETURN_LONG(strnatcmp_ex(ZSTR_VAL(s1), ZSTR_LEN(s1),
+ ZSTR_VAL(s2), ZSTR_LEN(s2),
fold_case));
}
/* }}} */
zend_string *str1 = zval_get_string(op1);
zend_string *str2 = zval_get_string(op2);
- ZVAL_LONG(result, strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, case_insensitive));
+ ZVAL_LONG(result, strnatcmp_ex(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str2), case_insensitive));
zend_string_release(str1);
zend_string_release(str2);
/* If resulting string turns out to be shorter than input string,
we simply copy the input and return. */
- if (pad_length < 0 || (size_t)pad_length <= input->len) {
- RETURN_STRINGL(input->val, input->len);
+ if (pad_length < 0 || (size_t)pad_length <= ZSTR_LEN(input)) {
+ RETURN_STRINGL(ZSTR_VAL(input), ZSTR_LEN(input));
}
if (pad_str_len == 0) {
return;
}
- num_pad_chars = pad_length - input->len;
+ num_pad_chars = pad_length - ZSTR_LEN(input);
if (num_pad_chars >= INT_MAX) {
php_error_docref(NULL, E_WARNING, "Padding length is too long");
return;
}
- result = zend_string_alloc(input->len + num_pad_chars, 0);
- result->len = 0;
+ result = zend_string_alloc(ZSTR_LEN(input) + num_pad_chars, 0);
+ ZSTR_LEN(result) = 0;
/* We need to figure out the left/right padding lengths. */
switch (pad_type_val) {
/* First we pad on the left. */
for (i = 0; i < left_pad; i++)
- result->val[result->len++] = pad_str[i % pad_str_len];
+ ZSTR_VAL(result)[ZSTR_LEN(result)++] = pad_str[i % pad_str_len];
/* Then we copy the input string. */
- memcpy(result->val + result->len, input->val, input->len);
- result->len += input->len;
+ memcpy(ZSTR_VAL(result) + ZSTR_LEN(result), ZSTR_VAL(input), ZSTR_LEN(input));
+ ZSTR_LEN(result) += ZSTR_LEN(input);
/* Finally, we pad on the right. */
for (i = 0; i < right_pad; i++)
- result->val[result->len++] = pad_str[i % pad_str_len];
+ ZSTR_VAL(result)[ZSTR_LEN(result)++] = pad_str[i % pad_str_len];
- result->val[result->len] = '\0';
+ ZSTR_VAL(result)[ZSTR_LEN(result)] = '\0';
RETURN_NEW_STR(result);
}
return;
}
- if (arg->len == 0) {
+ if (ZSTR_LEN(arg) == 0) {
RETURN_EMPTY_STRING();
} else {
RETURN_STR(php_strtr_ex(arg, rot13_from, rot13_to, 52));
return;
}
- RETVAL_STRINGL(arg->val, arg->len);
+ RETVAL_STRINGL(ZSTR_VAL(arg), ZSTR_LEN(arg));
if (Z_STRLEN_P(return_value) > 1) {
php_string_shuffle(Z_STRVAL_P(return_value), (zend_long) Z_STRLEN_P(return_value));
}
case 1:
case 2:
array_init(return_value);
- if (!str->len) {
+ if (!ZSTR_LEN(str)) {
return;
}
break;
case 0:
- if (!str->len) {
+ if (!ZSTR_LEN(str)) {
RETURN_LONG(0);
}
/* nothing to be done */
php_charmask((unsigned char *)char_list, char_list_len, ch);
}
- p = str->val;
- e = str->val + str->len;
+ p = ZSTR_VAL(str);
+ e = ZSTR_VAL(str) + ZSTR_LEN(str);
/* first character cannot be ' or -, unless explicitly allowed by the user */
if ((*p == '\'' && (!char_list || !ch['\''])) || (*p == '-' && (!char_list || !ch['-']))) {
add_next_index_stringl(return_value, s, p - s);
break;
case 2:
- add_index_stringl(return_value, (s - str->val), s, p - s);
+ add_index_stringl(return_value, (s - ZSTR_VAL(str)), s, p - s);
break;
default:
word_count++;
}
str = zend_string_alloc(format_len + 1024, 0);
- if ((res_len = strfmon(str->val, str->len, format, value)) < 0) {
+ if ((res_len = strfmon(ZSTR_VAL(str), ZSTR_LEN(str), format, value)) < 0) {
zend_string_free(str);
RETURN_FALSE;
}
- str->len = (size_t)res_len;
- str->val[str->len] = '\0';
+ ZSTR_LEN(str) = (size_t)res_len;
+ ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
- RETURN_NEW_STR(zend_string_truncate(str, str->len, 0));
+ RETURN_NEW_STR(zend_string_truncate(str, ZSTR_LEN(str), 0));
}
/* }}} */
#endif
}
- if (0 == str->len || (size_t)split_length >= str->len) {
+ if (0 == ZSTR_LEN(str) || (size_t)split_length >= ZSTR_LEN(str)) {
array_init_size(return_value, 1);
- add_next_index_stringl(return_value, str->val, str->len);
+ add_next_index_stringl(return_value, ZSTR_VAL(str), ZSTR_LEN(str));
return;
}
- array_init_size(return_value, (uint32_t)(((str->len - 1) / split_length) + 1));
+ array_init_size(return_value, (uint32_t)(((ZSTR_LEN(str) - 1) / split_length) + 1));
- n_reg_segments = str->len / split_length;
- p = str->val;
+ n_reg_segments = ZSTR_LEN(str) / split_length;
+ p = ZSTR_VAL(str);
while (n_reg_segments-- > 0) {
add_next_index_stringl(return_value, p, split_length);
p += split_length;
}
- if (p != (str->val + str->len)) {
- add_next_index_stringl(return_value, p, (str->val + str->len - p));
+ if (p != (ZSTR_VAL(str) + ZSTR_LEN(str))) {
+ add_next_index_stringl(return_value, p, (ZSTR_VAL(str) + ZSTR_LEN(str) - p));
}
}
/* }}} */
RETURN_FALSE;
}
- if (!char_list->len) {
+ if (!ZSTR_LEN(char_list)) {
php_error_docref(NULL, E_WARNING, "The character list cannot be empty");
RETURN_FALSE;
}
- for (haystack_ptr = haystack->val; haystack_ptr < (haystack->val + haystack->len); ++haystack_ptr) {
- for (cl_ptr = char_list->val; cl_ptr < (char_list->val + char_list->len); ++cl_ptr) {
+ for (haystack_ptr = ZSTR_VAL(haystack); haystack_ptr < (ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); ++haystack_ptr) {
+ for (cl_ptr = ZSTR_VAL(char_list); cl_ptr < (ZSTR_VAL(char_list) + ZSTR_LEN(char_list)); ++cl_ptr) {
if (*cl_ptr == *haystack_ptr) {
- RETURN_STRINGL(haystack_ptr, (haystack->val + haystack->len - haystack_ptr));
+ RETURN_STRINGL(haystack_ptr, (ZSTR_VAL(haystack) + ZSTR_LEN(haystack) - haystack_ptr));
}
}
}
}
if (offset < 0) {
- offset = s1->len + offset;
+ offset = ZSTR_LEN(s1) + offset;
offset = (offset < 0) ? 0 : offset;
}
- if ((size_t)offset >= s1->len) {
+ if ((size_t)offset >= ZSTR_LEN(s1)) {
php_error_docref(NULL, E_WARNING, "The start position cannot exceed initial string length");
RETURN_FALSE;
}
- cmp_len = (size_t) (len ? len : MAX(s2->len, (s1->len - offset)));
+ cmp_len = (size_t) (len ? len : MAX(ZSTR_LEN(s2), (ZSTR_LEN(s1) - offset)));
if (!cs) {
- RETURN_LONG(zend_binary_strncmp(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len));
+ RETURN_LONG(zend_binary_strncmp(ZSTR_VAL(s1) + offset, (ZSTR_LEN(s1) - offset), ZSTR_VAL(s2), ZSTR_LEN(s2), cmp_len));
} else {
- RETURN_LONG(zend_binary_strncasecmp_l(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len));
+ RETURN_LONG(zend_binary_strncasecmp_l(ZSTR_VAL(s1) + offset, (ZSTR_LEN(s1) - offset), ZSTR_VAL(s2), ZSTR_LEN(s2), cmp_len));
}
}
/* }}} */
if (Z_TYPE_P(arg) == type) {
if (type == IS_OBJECT) {
zend_class_entry *ce = Z_OBJCE_P(arg);
- if (ce->name->len == sizeof(INCOMPLETE_CLASS) - 1
- && !memcmp(ce->name->val, INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1)) {
+ if (ZSTR_LEN(ce->name) == sizeof(INCOMPLETE_CLASS) - 1
+ && !memcmp(ZSTR_VAL(ce->name), INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1)) {
RETURN_FALSE;
}
} else if (type == IS_RESOURCE) {
retval = zend_is_callable_ex(var, NULL, check_flags, &name, NULL, &error);
zval_dtor(callable_name);
//??? is it necessary to be consistent with old PHP ("\0" support)
- if (UNEXPECTED(name->len) != strlen(name->val)) {
- ZVAL_STRINGL(callable_name, name->val, strlen(name->val));
+ if (UNEXPECTED(ZSTR_LEN(name)) != strlen(ZSTR_VAL(name))) {
+ ZVAL_STRINGL(callable_name, ZSTR_VAL(name), strlen(ZSTR_VAL(name)));
zend_string_release(name);
} else {
ZVAL_STR(callable_name, name);
from = (unsigned char *)s;
end = (unsigned char *)s + len;
start = zend_string_alloc(3 * len, 0);
- to = (unsigned char*)start->val;
+ to = (unsigned char*)ZSTR_VAL(start);
while (from < end) {
c = *from++;
}
*to = '\0';
- start = zend_string_truncate(start, to - (unsigned char*)start->val, 0);
+ start = zend_string_truncate(start, to - (unsigned char*)ZSTR_VAL(start), 0);
return start;
}
ZEND_PARSE_PARAMETERS_END();
#endif
- RETURN_STR(php_url_encode(in_str->val, in_str->len));
+ RETURN_STR(php_url_encode(ZSTR_VAL(in_str), ZSTR_LEN(in_str)));
}
/* }}} */
ZEND_PARSE_PARAMETERS_END();
#endif
- out_str = zend_string_init(in_str->val, in_str->len, 0);
- out_str->len = php_url_decode(out_str->val, out_str->len);
+ out_str = zend_string_init(ZSTR_VAL(in_str), ZSTR_LEN(in_str), 0);
+ ZSTR_LEN(out_str) = php_url_decode(ZSTR_VAL(out_str), ZSTR_LEN(out_str));
RETURN_NEW_STR(out_str);
}
str = zend_string_alloc(3 * len, 0);
for (x = 0, y = 0; len--; x++, y++) {
- str->val[y] = (unsigned char) s[x];
+ ZSTR_VAL(str)[y] = (unsigned char) s[x];
#ifndef CHARSET_EBCDIC
- if ((str->val[y] < '0' && str->val[y] != '-' && str->val[y] != '.') ||
- (str->val[y] < 'A' && str->val[y] > '9') ||
- (str->val[y] > 'Z' && str->val[y] < 'a' && str->val[y] != '_') ||
- (str->val[y] > 'z' && str->val[y] != '~')) {
- str->val[y++] = '%';
- str->val[y++] = hexchars[(unsigned char) s[x] >> 4];
- str->val[y] = hexchars[(unsigned char) s[x] & 15];
+ if ((ZSTR_VAL(str)[y] < '0' && ZSTR_VAL(str)[y] != '-' && ZSTR_VAL(str)[y] != '.') ||
+ (ZSTR_VAL(str)[y] < 'A' && ZSTR_VAL(str)[y] > '9') ||
+ (ZSTR_VAL(str)[y] > 'Z' && ZSTR_VAL(str)[y] < 'a' && ZSTR_VAL(str)[y] != '_') ||
+ (ZSTR_VAL(str)[y] > 'z' && ZSTR_VAL(str)[y] != '~')) {
+ ZSTR_VAL(str)[y++] = '%';
+ ZSTR_VAL(str)[y++] = hexchars[(unsigned char) s[x] >> 4];
+ ZSTR_VAL(str)[y] = hexchars[(unsigned char) s[x] & 15];
#else /*CHARSET_EBCDIC*/
- if (!isalnum(str->val[y]) && str->valchr("_-.~", str->val[y]) != NULL) {
- str->val[y++] = '%';
- str->val[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4];
- str->val[y] = hexchars[os_toascii[(unsigned char) s[x]] & 15];
+ if (!isalnum(ZSTR_VAL(str)[y]) && strchr("_-.~", ZSTR_VAL(str)[y]) != NULL) {
+ ZSTR_VAL(str)[y++] = '%';
+ ZSTR_VAL(str)[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4];
+ ZSTR_VAL(str)[y] = hexchars[os_toascii[(unsigned char) s[x]] & 15];
#endif /*CHARSET_EBCDIC*/
}
}
- str->val[y] = '\0';
+ ZSTR_VAL(str)[y] = '\0';
str = zend_string_truncate(str, y, 0);
return str;
ZEND_PARSE_PARAMETERS_END();
#endif
- RETURN_STR(php_raw_url_encode(in_str->val, in_str->len));
+ RETURN_STR(php_raw_url_encode(ZSTR_VAL(in_str), ZSTR_LEN(in_str)));
}
/* }}} */
ZEND_PARSE_PARAMETERS_END();
#endif
- out_str = zend_string_init(in_str->val, in_str->len, 0);
- out_str->len = php_raw_url_decode(out_str->val, out_str->len);
+ out_str = zend_string_init(ZSTR_VAL(in_str), ZSTR_LEN(in_str), 0);
+ ZSTR_LEN(out_str) = php_raw_url_decode(ZSTR_VAL(out_str), ZSTR_LEN(out_str));
RETURN_NEW_STR(out_str);
}
ctx = &BG(url_adapt_state_ex);
- tmp = estrndup(new_value->val, new_value->len);
+ tmp = estrndup(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
if (ctx->tags)
zend_hash_destroy(ctx->tags);
const char *bash = NULL;
const char *sep = "?";
- q = (p = url->s->val) + url->s->len;
+ q = (p = ZSTR_VAL(url->s)) + ZSTR_LEN(url->s);
scan:
done:
/* Don't modify URLs of the format "#mark" */
- if (bash && bash - url->s->val == 0) {
+ if (bash && bash - ZSTR_VAL(url->s) == 0) {
smart_str_append_smart_str(dest, url);
return;
}
if (bash)
- smart_str_appendl(dest, url->s->val, bash - url->s->val);
+ smart_str_appendl(dest, ZSTR_VAL(url->s), bash - ZSTR_VAL(url->s));
else
smart_str_append_smart_str(dest, url);
{
char f = 0;
- if (strncasecmp(ctx->arg.s->val, ctx->lookup_data, ctx->arg.s->len) == 0)
+ if (strncasecmp(ZSTR_VAL(ctx->arg.s), ctx->lookup_data, ZSTR_LEN(ctx->arg.s)) == 0)
f = 1;
if (quotes)
{
int doit = 0;
- if (ctx->form_app.s->len > 0) {
- switch (ctx->tag.s->len) {
+ if (ZSTR_LEN(ctx->form_app.s) > 0) {
+ switch (ZSTR_LEN(ctx->tag.s)) {
case sizeof("form") - 1:
- if (!strncasecmp(ctx->tag.s->val, "form", sizeof("form") - 1)) {
+ if (!strncasecmp(ZSTR_VAL(ctx->tag.s), "form", sizeof("form") - 1)) {
doit = 1;
}
if (doit && ctx->val.s && ctx->lookup_data && *ctx->lookup_data) {
- char *e, *p = (char *)zend_memnstr(ctx->val.s->val, "://", sizeof("://") - 1, ctx->val.s->val + ctx->val.s->len);
+ char *e, *p = (char *)zend_memnstr(ZSTR_VAL(ctx->val.s), "://", sizeof("://") - 1, ZSTR_VAL(ctx->val.s) + ZSTR_LEN(ctx->val.s));
if (p) {
- e = memchr(p, '/', (ctx->val.s->val + ctx->val.s->len) - p);
+ e = memchr(p, '/', (ZSTR_VAL(ctx->val.s) + ZSTR_LEN(ctx->val.s)) - p);
if (!e) {
- e = ctx->val.s->val + ctx->val.s->len;
+ e = ZSTR_VAL(ctx->val.s) + ZSTR_LEN(ctx->val.s);
}
if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) {
doit = 0;
break;
case sizeof("fieldset") - 1:
- if (!strncasecmp(ctx->tag.s->val, "fieldset", sizeof("fieldset") - 1)) {
+ if (!strncasecmp(ZSTR_VAL(ctx->tag.s), "fieldset", sizeof("fieldset") - 1)) {
doit = 1;
}
break;
unsigned int i;
if (ctx->tag.s) {
- ctx->tag.s->len = 0;
+ ZSTR_LEN(ctx->tag.s) = 0;
}
smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
- for (i = 0; i < ctx->tag.s->len; i++)
- ctx->tag.s->val[i] = tolower((int)(unsigned char)ctx->tag.s->val[i]);
+ for (i = 0; i < ZSTR_LEN(ctx->tag.s); i++)
+ ZSTR_VAL(ctx->tag.s)[i] = tolower((int)(unsigned char)ZSTR_VAL(ctx->tag.s)[i]);
/* intentionally using str_find here, in case the hash value is set, but the string val is changed later */
- if ((ctx->lookup_data = zend_hash_str_find_ptr(ctx->tags, ctx->tag.s->val, ctx->tag.s->len)) != NULL)
+ if ((ctx->lookup_data = zend_hash_str_find_ptr(ctx->tags, ZSTR_VAL(ctx->tag.s), ZSTR_LEN(ctx->tag.s))) != NULL)
ok = 1;
STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
}
static inline void handle_arg(STD_PARA)
{
if (ctx->arg.s) {
- ctx->arg.s->len = 0;
+ ZSTR_LEN(ctx->arg.s) = 0;
}
smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
}
smart_str_appendl(&ctx->buf, newdata, newlen);
- YYCURSOR = ctx->buf.s->val;
- YYLIMIT = ctx->buf.s->val + ctx->buf.s->len;
+ YYCURSOR = ZSTR_VAL(ctx->buf.s);
+ YYLIMIT = ZSTR_VAL(ctx->buf.s) + ZSTR_LEN(ctx->buf.s);
switch (STATE) {
case STATE_PLAIN: goto state_plain;
scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR, rest));
}
- if (rest) memmove(ctx->buf.s->val, start, rest);
- ctx->buf.s->len = rest;
+ if (rest) memmove(ZSTR_VAL(ctx->buf.s), start, rest);
+ ZSTR_LEN(ctx->buf.s) = rest;
}
if (urlencode) {
encoded = php_raw_url_encode(name, strlen(name));
- smart_str_appendl(&url_app, encoded->val, encoded->len);
+ smart_str_appendl(&url_app, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
zend_string_free(encoded);
} else {
smart_str_appends(&url_app, name);
smart_str_appendc(&url_app, '=');
if (urlencode) {
encoded = php_raw_url_encode(value, strlen(value));
- smart_str_appendl(&url_app, encoded->val, encoded->len);
+ smart_str_appendl(&url_app, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
zend_string_free(encoded);
} else {
smart_str_appends(&url_app, value);
append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output);
smart_str_0(&buf);
- if (newlen) *newlen = buf.s->len;
- result = estrndup(buf.s->val, buf.s->len);
+ if (newlen) *newlen = ZSTR_LEN(buf.s);
+ result = estrndup(ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));
smart_str_free(&url_app);
smart_str_free(&buf);
smart_str_appendl(&ctx->result, "", 0);
*newlen = 0;
} else {
- *newlen = ctx->result.s->len;
+ *newlen = ZSTR_LEN(ctx->result.s);
}
smart_str_0(&ctx->result);
if (do_flush) {
smart_str_append(&ctx->result, ctx->buf.s);
- *newlen += ctx->buf.s->len;
+ *newlen += ZSTR_LEN(ctx->buf.s);
smart_str_free(&ctx->buf);
smart_str_free(&ctx->val);
}
- retval = estrndup(ctx->result.s->val, ctx->result.s->len);
+ retval = estrndup(ZSTR_VAL(ctx->result.s), ZSTR_LEN(ctx->result.s));
smart_str_free(&ctx->result);
return retval;
}
{
size_t len;
- if (BG(url_adapt_state_ex).url_app.s->len != 0) {
+ if (ZSTR_LEN(BG(url_adapt_state_ex).url_app.s) != 0) {
*handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0));
if (sizeof(uint) < sizeof(size_t)) {
if (len > UINT_MAX)
len = UINT_MAX;
}
*handled_output_len = len;
- } else if (BG(url_adapt_state_ex).url_app.s->len == 0) {
+ } else if (ZSTR_LEN(BG(url_adapt_state_ex).url_app.s) == 0) {
url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex);
- if (ctx->buf.s && ctx->buf.s->len) {
+ if (ctx->buf.s && ZSTR_LEN(ctx->buf.s)) {
smart_str_append(&ctx->result, ctx->buf.s);
smart_str_appendl(&ctx->result, output, output_len);
- *handled_output = estrndup(ctx->result.s->val, ctx->result.s->len);
- *handled_output_len = ctx->buf.s->len + output_len;
+ *handled_output = estrndup(ZSTR_VAL(ctx->result.s), ZSTR_LEN(ctx->result.s));
+ *handled_output_len = ZSTR_LEN(ctx->buf.s) + output_len;
smart_str_free(&ctx->buf);
smart_str_free(&ctx->result);
BG(url_adapt_state_ex).active = 1;
}
- if (BG(url_adapt_state_ex).url_app.s && BG(url_adapt_state_ex).url_app.s->len != 0) {
+ if (BG(url_adapt_state_ex).url_app.s && ZSTR_LEN(BG(url_adapt_state_ex).url_app.s) != 0) {
smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output);
}
if (urlencode) {
encoded = php_raw_url_encode(name, name_len);
- smart_str_appendl(&sname, encoded->val, encoded->len);
+ smart_str_appendl(&sname, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
zend_string_free(encoded);
encoded = php_raw_url_encode(value, value_len);
- smart_str_appendl(&svalue, encoded->val, encoded->len);
+ smart_str_appendl(&svalue, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
zend_string_free(encoded);
} else {
smart_str_appendl(&sname, name, name_len);
PHPAPI int php_url_scanner_reset_vars(void)
{
if (BG(url_adapt_state_ex).form_app.s) {
- BG(url_adapt_state_ex).form_app.s->len = 0;
+ ZSTR_LEN(BG(url_adapt_state_ex).form_app.s) = 0;
}
if (BG(url_adapt_state_ex).url_app.s) {
- BG(url_adapt_state_ex).url_app.s->len = 0;
+ ZSTR_LEN(BG(url_adapt_state_ex).url_app.s) = 0;
}
return SUCCESS;
ctx = &BG(url_adapt_state_ex);
- tmp = estrndup(new_value->val, new_value->len);
+ tmp = estrndup(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
if (ctx->tags)
zend_hash_destroy(ctx->tags);
const char *bash = NULL;
const char *sep = "?";
- q = (p = url->s->val) + url->s->len;
+ q = (p = ZSTR_VAL(url->s)) + ZSTR_LEN(url->s);
scan:
/*!re2c
done:
/* Don't modify URLs of the format "#mark" */
- if (bash && bash - url->s->val == 0) {
+ if (bash && bash - ZSTR_VAL(url->s) == 0) {
smart_str_append_smart_str(dest, url);
return;
}
if (bash)
- smart_str_appendl(dest, url->s->val, bash - url->s->val);
+ smart_str_appendl(dest, ZSTR_VAL(url->s), bash - ZSTR_VAL(url->s));
else
smart_str_append_smart_str(dest, url);
{
char f = 0;
- if (strncasecmp(ctx->arg.s->val, ctx->lookup_data, ctx->arg.s->len) == 0)
+ if (strncasecmp(ZSTR_VAL(ctx->arg.s), ctx->lookup_data, ZSTR_LEN(ctx->arg.s)) == 0)
f = 1;
if (quotes)
{
int doit = 0;
- if (ctx->form_app.s->len > 0) {
- switch (ctx->tag.s->len) {
+ if (ZSTR_LEN(ctx->form_app.s) > 0) {
+ switch (ZSTR_LEN(ctx->tag.s)) {
case sizeof("form") - 1:
- if (!strncasecmp(ctx->tag.s->val, "form", sizeof("form") - 1)) {
+ if (!strncasecmp(ZSTR_VAL(ctx->tag.s), "form", sizeof("form") - 1)) {
doit = 1;
}
if (doit && ctx->val.s && ctx->lookup_data && *ctx->lookup_data) {
- char *e, *p = (char *)zend_memnstr(ctx->val.s->val, "://", sizeof("://") - 1, ctx->val.s->val + ctx->val.s->len);
+ char *e, *p = (char *)zend_memnstr(ZSTR_VAL(ctx->val.s), "://", sizeof("://") - 1, ZSTR_VAL(ctx->val.s) + ZSTR_LEN(ctx->val.s));
if (p) {
- e = memchr(p, '/', (ctx->val.s->val + ctx->val.s->len) - p);
+ e = memchr(p, '/', (ZSTR_VAL(ctx->val.s) + ZSTR_LEN(ctx->val.s)) - p);
if (!e) {
- e = ctx->val.s->val + ctx->val.s->len;
+ e = ZSTR_VAL(ctx->val.s) + ZSTR_LEN(ctx->val.s);
}
if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) {
doit = 0;
break;
case sizeof("fieldset") - 1:
- if (!strncasecmp(ctx->tag.s->val, "fieldset", sizeof("fieldset") - 1)) {
+ if (!strncasecmp(ZSTR_VAL(ctx->tag.s), "fieldset", sizeof("fieldset") - 1)) {
doit = 1;
}
break;
unsigned int i;
if (ctx->tag.s) {
- ctx->tag.s->len = 0;
+ ZSTR_LEN(ctx->tag.s) = 0;
}
smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
- for (i = 0; i < ctx->tag.s->len; i++)
- ctx->tag.s->val[i] = tolower((int)(unsigned char)ctx->tag.s->val[i]);
+ for (i = 0; i < ZSTR_LEN(ctx->tag.s); i++)
+ ZSTR_VAL(ctx->tag.s)[i] = tolower((int)(unsigned char)ZSTR_VAL(ctx->tag.s)[i]);
/* intentionally using str_find here, in case the hash value is set, but the string val is changed later */
- if ((ctx->lookup_data = zend_hash_str_find_ptr(ctx->tags, ctx->tag.s->val, ctx->tag.s->len)) != NULL)
+ if ((ctx->lookup_data = zend_hash_str_find_ptr(ctx->tags, ZSTR_VAL(ctx->tag.s), ZSTR_LEN(ctx->tag.s))) != NULL)
ok = 1;
STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
}
static inline void handle_arg(STD_PARA)
{
if (ctx->arg.s) {
- ctx->arg.s->len = 0;
+ ZSTR_LEN(ctx->arg.s) = 0;
}
smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
}
smart_str_appendl(&ctx->buf, newdata, newlen);
- YYCURSOR = ctx->buf.s->val;
- YYLIMIT = ctx->buf.s->val + ctx->buf.s->len;
+ YYCURSOR = ZSTR_VAL(ctx->buf.s);
+ YYLIMIT = ZSTR_VAL(ctx->buf.s) + ZSTR_LEN(ctx->buf.s);
switch (STATE) {
case STATE_PLAIN: goto state_plain;
scdebug(("stopped in state %d at pos %d (%d:%c) %d\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR, rest));
}
- if (rest) memmove(ctx->buf.s->val, start, rest);
- ctx->buf.s->len = rest;
+ if (rest) memmove(ZSTR_VAL(ctx->buf.s), start, rest);
+ ZSTR_LEN(ctx->buf.s) = rest;
}
if (urlencode) {
encoded = php_raw_url_encode(name, strlen(name));
- smart_str_appendl(&url_app, encoded->val, encoded->len);
+ smart_str_appendl(&url_app, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
zend_string_free(encoded);
} else {
smart_str_appends(&url_app, name);
smart_str_appendc(&url_app, '=');
if (urlencode) {
encoded = php_raw_url_encode(value, strlen(value));
- smart_str_appendl(&url_app, encoded->val, encoded->len);
+ smart_str_appendl(&url_app, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
zend_string_free(encoded);
} else {
smart_str_appends(&url_app, value);
append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output);
smart_str_0(&buf);
- if (newlen) *newlen = buf.s->len;
- result = estrndup(buf.s->val, buf.s->len);
+ if (newlen) *newlen = ZSTR_LEN(buf.s);
+ result = estrndup(ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));
smart_str_free(&url_app);
smart_str_free(&buf);
smart_str_appendl(&ctx->result, "", 0);
*newlen = 0;
} else {
- *newlen = ctx->result.s->len;
+ *newlen = ZSTR_LEN(ctx->result.s);
}
smart_str_0(&ctx->result);
if (do_flush) {
smart_str_append(&ctx->result, ctx->buf.s);
- *newlen += ctx->buf.s->len;
+ *newlen += ZSTR_LEN(ctx->buf.s);
smart_str_free(&ctx->buf);
smart_str_free(&ctx->val);
}
- retval = estrndup(ctx->result.s->val, ctx->result.s->len);
+ retval = estrndup(ZSTR_VAL(ctx->result.s), ZSTR_LEN(ctx->result.s));
smart_str_free(&ctx->result);
return retval;
}
{
size_t len;
- if (BG(url_adapt_state_ex).url_app.s->len != 0) {
+ if (ZSTR_LEN(BG(url_adapt_state_ex).url_app.s) != 0) {
*handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0));
if (sizeof(uint) < sizeof(size_t)) {
if (len > UINT_MAX)
len = UINT_MAX;
}
*handled_output_len = len;
- } else if (BG(url_adapt_state_ex).url_app.s->len == 0) {
+ } else if (ZSTR_LEN(BG(url_adapt_state_ex).url_app.s) == 0) {
url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex);
- if (ctx->buf.s && ctx->buf.s->len) {
+ if (ctx->buf.s && ZSTR_LEN(ctx->buf.s)) {
smart_str_append(&ctx->result, ctx->buf.s);
smart_str_appendl(&ctx->result, output, output_len);
- *handled_output = estrndup(ctx->result.s->val, ctx->result.s->len);
- *handled_output_len = ctx->buf.s->len + output_len;
+ *handled_output = estrndup(ZSTR_VAL(ctx->result.s), ZSTR_LEN(ctx->result.s));
+ *handled_output_len = ZSTR_LEN(ctx->buf.s) + output_len;
smart_str_free(&ctx->buf);
smart_str_free(&ctx->result);
BG(url_adapt_state_ex).active = 1;
}
- if (BG(url_adapt_state_ex).url_app.s && BG(url_adapt_state_ex).url_app.s->len != 0) {
+ if (BG(url_adapt_state_ex).url_app.s && ZSTR_LEN(BG(url_adapt_state_ex).url_app.s) != 0) {
smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output);
}
if (urlencode) {
encoded = php_raw_url_encode(name, name_len);
- smart_str_appendl(&sname, encoded->val, encoded->len);
+ smart_str_appendl(&sname, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
zend_string_free(encoded);
encoded = php_raw_url_encode(value, value_len);
- smart_str_appendl(&svalue, encoded->val, encoded->len);
+ smart_str_appendl(&svalue, ZSTR_VAL(encoded), ZSTR_LEN(encoded));
zend_string_free(encoded);
} else {
smart_str_appendl(&sname, name, name_len);
PHPAPI int php_url_scanner_reset_vars(void)
{
if (BG(url_adapt_state_ex).form_app.s) {
- BG(url_adapt_state_ex).form_app.s->len = 0;
+ ZSTR_LEN(BG(url_adapt_state_ex).form_app.s) = 0;
}
if (BG(url_adapt_state_ex).url_app.s) {
- BG(url_adapt_state_ex).url_app.s->len = 0;
+ ZSTR_LEN(BG(url_adapt_state_ex).url_app.s) = 0;
}
return SUCCESS;
if (NULL == (fdat->ce = zend_lookup_class(fdat->classname))) {
php_error_docref(NULL, E_WARNING,
"user-filter \"%s\" requires class \"%s\", but that class is not defined",
- filtername, fdat->classname->val);
+ filtername, ZSTR_VAL(fdat->classname));
return NULL;
}
}
RETVAL_FALSE;
- if (!filtername->len) {
+ if (!ZSTR_LEN(filtername)) {
php_error_docref(NULL, E_WARNING, "Filter name cannot be empty");
return;
}
- if (!classname->len) {
+ if (!ZSTR_LEN(classname)) {
php_error_docref(NULL, E_WARNING, "Class name cannot be empty");
return;
}
fdat->classname = zend_string_copy(classname);
if (zend_hash_add_ptr(BG(user_filter_map), filtername, fdat) != NULL &&
- php_stream_filter_register_factory_volatile(filtername->val, &user_filter_factory) == SUCCESS) {
+ php_stream_filter_register_factory_volatile(ZSTR_VAL(filtername), &user_filter_factory) == SUCCESS) {
RETVAL_TRUE;
} else {
zend_string_release(classname);
/* encoded length is ~ 38% greater than the original */
dest = zend_string_alloc((size_t)ceil(src_len * 1.38) + 46, 0);
- p = dest->val;
+ p = ZSTR_VAL(dest);
s = src;
e = src + src_len;
*p++ = '\n';
*p = '\0';
- dest = zend_string_truncate(dest, p - dest->val, 0);
+ dest = zend_string_truncate(dest, p - ZSTR_VAL(dest), 0);
return dest;
}
/* }}} */
zend_string *dest;
dest = zend_string_alloc((size_t) ceil(src_len * 0.75), 0);
- p = dest->val;
+ p = ZSTR_VAL(dest);
s = src;
e = src + src_len;
s++;
}
- assert(p >= dest->val);
- if ((len = total_len > (size_t)(p - dest->val))) {
+ assert(p >= ZSTR_VAL(dest));
+ if ((len = total_len > (size_t)(p - ZSTR_VAL(dest)))) {
*p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4;
if (len > 1) {
*p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2;
}
}
- dest->len = total_len;
- dest->val[dest->len] = '\0';
+ ZSTR_LEN(dest) = total_len;
+ ZSTR_VAL(dest)[ZSTR_LEN(dest)] = '\0';
return dest;
{
zend_string *src;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &src) == FAILURE || src->len < 1) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &src) == FAILURE || ZSTR_LEN(src) < 1) {
RETURN_FALSE;
}
- RETURN_STR(php_uuencode(src->val, src->len));
+ RETURN_STR(php_uuencode(ZSTR_VAL(src), ZSTR_LEN(src)));
}
/* }}} */
zend_string *src;
zend_string *dest;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &src) == FAILURE || src->len < 1) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &src) == FAILURE || ZSTR_LEN(src) < 1) {
RETURN_FALSE;
}
- if ((dest = php_uudecode(src->val, src->len)) == NULL) {
+ if ((dest = php_uudecode(ZSTR_VAL(src), ZSTR_LEN(src))) == NULL) {
php_error_docref(NULL, E_WARNING, "The given parameter is not a valid uuencoded string");
RETURN_FALSE;
}
php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index);
} else { /* string key */
php_printf("%*c[\"", level + 1, ' ');
- PHPWRITE(key->val, key->len);
+ PHPWRITE(ZSTR_VAL(key), ZSTR_LEN(key));
php_printf("\"]=>\n");
}
php_var_dump(zv, level + 2);
}
} else {
php_printf("\"");
- PHPWRITE(key->val, key->len);
+ PHPWRITE(ZSTR_VAL(key), ZSTR_LEN(key));
php_printf("\"");
}
ZEND_PUTS("]=>\n");
myht = Z_OBJDEBUG_P(struc, is_temp);
class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc));
- php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name->val, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0);
+ php_printf("%sobject(%s)#%d (%d) {\n", COMMON, ZSTR_VAL(class_name), Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0);
zend_string_release(class_name);
if (myht) {
php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index);
} else { /* string key */
php_printf("%*c[\"", level + 1, ' ');
- PHPWRITE(key->val, key->len);
+ PHPWRITE(ZSTR_VAL(key), ZSTR_LEN(key));
php_printf("\"]=>\n");
}
php_debug_zval_dump(zv, level + 2);
}
}
class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc));
- php_printf("%sobject(%s)#%d (%d) refcount(%u){\n", COMMON, class_name->val, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0, Z_REFCOUNT_P(struc));
+ php_printf("%sobject(%s)#%d (%d) refcount(%u){\n", COMMON, ZSTR_VAL(class_name), Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0, Z_REFCOUNT_P(struc));
zend_string_release(class_name);
if (myht) {
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, val) {
} else { /* string key */
zend_string *tmp_str;
zend_string *ckey = php_addcslashes(key, 0, "'\\", 2);
- tmp_str = php_str_to_str(ckey->val, ckey->len, "\0", 1, "' . \"\\0\" . '", 12);
+ tmp_str = php_str_to_str(ZSTR_VAL(ckey), ZSTR_LEN(ckey), "\0", 1, "' . \"\\0\" . '", 12);
buffer_append_spaces(buf, level + 1);
break;
case IS_STRING:
ztmp = php_addcslashes(Z_STR_P(struc), 0, "'\\", 2);
- ztmp2 = php_str_to_str(ztmp->val, ztmp->len, "\0", 1, "' . \"\\0\" . '", 12);
+ ztmp2 = php_str_to_str(ZSTR_VAL(ztmp), ZSTR_LEN(ztmp), "\0", 1, "' . \"\\0\" . '", 12);
smart_str_appendc(buf, '\'');
smart_str_append(buf, ztmp2);
smart_str buf = {0};
php_var_export_ex(struc, level, &buf);
smart_str_0(&buf);
- PHPWRITE(buf.s->val, buf.s->len);
+ PHPWRITE(ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));
smart_str_free(&buf);
}
/* }}} */
if (return_output) {
RETURN_NEW_STR(buf.s);
} else {
- PHPWRITE(buf.s->val, buf.s->len);
+ PHPWRITE(ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));
smart_str_free(&buf);
}
}
PHP_SET_CLASS_ATTRIBUTES(struc);
smart_str_appendl(buf, "O:", 2);
- smart_str_append_unsigned(buf, class_name->len);
+ smart_str_append_unsigned(buf, ZSTR_LEN(class_name));
smart_str_appendl(buf, ":\"", 2);
smart_str_append(buf, class_name);
smart_str_appendl(buf, "\":", 2);
ht = HASH_OF(retval_ptr);
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
- if (incomplete_class && strcmp(key->val, MAGIC_MEMBER) == 0) {
+ if (incomplete_class && strcmp(ZSTR_VAL(key), MAGIC_MEMBER) == 0) {
continue;
}
continue;
}
}
- php_var_serialize_string(buf, name->val, name->len);
+ php_var_serialize_string(buf, ZSTR_VAL(name), ZSTR_LEN(name));
php_var_serialize_intern(buf, d, var_hash);
} else {
zend_class_entry *ce = Z_OBJ_P(struc)->ce;
do {
priv_name = zend_mangle_property_name(
- ce->name->val, ce->name->len, name->val, name->len, ce->type & ZEND_INTERNAL_CLASS);
+ ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(name), ZSTR_LEN(name), ce->type & ZEND_INTERNAL_CLASS);
if ((d = zend_hash_find(propers, priv_name)) != NULL) {
if (Z_TYPE_P(d) == IS_INDIRECT) {
d = Z_INDIRECT_P(d);
break;
}
}
- php_var_serialize_string(buf, priv_name->val, priv_name->len);
+ php_var_serialize_string(buf, ZSTR_VAL(priv_name), ZSTR_LEN(priv_name));
zend_string_free(priv_name);
php_var_serialize_intern(buf, d, var_hash);
break;
}
zend_string_free(priv_name);
prot_name = zend_mangle_property_name(
- "*", 1, name->val, name->len, ce->type & ZEND_INTERNAL_CLASS);
+ "*", 1, ZSTR_VAL(name), ZSTR_LEN(name), ce->type & ZEND_INTERNAL_CLASS);
if ((d = zend_hash_find(propers, prot_name)) != NULL) {
if (Z_TYPE_P(d) == IS_INDIRECT) {
d = Z_INDIRECT_P(d);
break;
}
}
- php_var_serialize_string(buf, prot_name->val, prot_name->len);
+ php_var_serialize_string(buf, ZSTR_VAL(prot_name), ZSTR_LEN(prot_name));
zend_string_free(prot_name);
php_var_serialize_intern(buf, d, var_hash);
break;
}
zend_string_free(prot_name);
- php_var_serialize_string(buf, name->val, name->len);
+ php_var_serialize_string(buf, ZSTR_VAL(name), ZSTR_LEN(name));
php_var_serialize_intern(buf, nvalp, var_hash);
php_error_docref(NULL, E_NOTICE,
- "\"%s\" returned as member variable from __sleep() but does not exist", name->val);
+ "\"%s\" returned as member variable from __sleep() but does not exist", ZSTR_VAL(name));
} while (0);
} else {
- php_var_serialize_string(buf, name->val, name->len);
+ php_var_serialize_string(buf, ZSTR_VAL(name), ZSTR_LEN(name));
php_var_serialize_intern(buf, nvalp, var_hash);
}
}
if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash) == SUCCESS) {
smart_str_appendl(buf, "C:", 2);
- smart_str_append_unsigned(buf, Z_OBJCE_P(struc)->name->len);
+ smart_str_append_unsigned(buf, ZSTR_LEN(Z_OBJCE_P(struc)->name));
smart_str_appendl(buf, ":\"", 2);
smart_str_append(buf, Z_OBJCE_P(struc)->name);
smart_str_appendl(buf, "\":", 2);
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, data) {
- if (incomplete_class && strcmp(key->val, MAGIC_MEMBER) == 0) {
+ if (incomplete_class && strcmp(ZSTR_VAL(key), MAGIC_MEMBER) == 0) {
continue;
}
if (!key) {
php_var_serialize_long(buf, index);
} else {
- php_var_serialize_string(buf, key->val, key->len);
+ php_var_serialize_string(buf, ZSTR_VAL(key), ZSTR_LEN(key));
}
/* we should still add element even if it's not OK,
return NULL;
}
if (**p != '\\') {
- str->val[i] = (char)**p;
+ ZSTR_VAL(str)[i] = (char)**p;
} else {
unsigned char ch = 0;
return NULL;
}
}
- str->val[i] = (char)ch;
+ ZSTR_VAL(str)[i] = (char)ch;
}
(*p)++;
}
- str->val[i] = 0;
- str->len = i;
+ ZSTR_VAL(str)[i] = 0;
+ ZSTR_LEN(str) = i;
return str;
}
return 0;
}
- ZSTR_ALLOCA_ALLOC(lcname, class_name->len, use_heap);
- zend_str_tolower_copy(lcname->val, class_name->val, class_name->len);
+ ZSTR_ALLOCA_ALLOC(lcname, ZSTR_LEN(class_name), use_heap);
+ zend_str_tolower_copy(ZSTR_VAL(lcname), ZSTR_VAL(class_name), ZSTR_LEN(class_name));
res = zend_hash_exists(classes, lcname);
ZSTR_ALLOCA_FREE(lcname, use_heap);
return res;
}
if (ce->unserialize == NULL) {
- zend_error(E_WARNING, "Class %s has no unserializer", ce->name->val);
+ zend_error(E_WARNING, "Class %s has no unserializer", ZSTR_VAL(ce->name));
object_init_ex(rval, ce);
} else if (ce->unserialize(rval, ce, (const unsigned char*)*p, datalen, (zend_unserialize_data *)var_hash) != SUCCESS) {
return 0;
} else {
/* If this class implements Serializable, it should not land here but in object_custom(). The passed string
obviously doesn't descend from the regular serializer. */
- zend_error(E_WARNING, "Erroneous data format for unserializing '%s'", ce->name->val);
+ zend_error(E_WARNING, "Erroneous data format for unserializing '%s'", ZSTR_VAL(ce->name));
return 0;
}
ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
if (ret && incomplete_class) {
- php_store_class_name(rval, class_name->val, len2);
+ php_store_class_name(rval, ZSTR_VAL(class_name), len2);
}
zend_string_release(class_name);
return ret;
elements = object_common1(UNSERIALIZE_PASSTHRU, ce);
if (incomplete_class) {
- php_store_class_name(rval, class_name->val, len2);
+ php_store_class_name(rval, ZSTR_VAL(class_name), len2);
}
zend_string_release(class_name);
return NULL;
}
if (**p != '\\') {
- str->val[i] = (char)**p;
+ ZSTR_VAL(str)[i] = (char)**p;
} else {
unsigned char ch = 0;
return NULL;
}
}
- str->val[i] = (char)ch;
+ ZSTR_VAL(str)[i] = (char)ch;
}
(*p)++;
}
- str->val[i] = 0;
- str->len = i;
+ ZSTR_VAL(str)[i] = 0;
+ ZSTR_LEN(str) = i;
return str;
}
return 0;
}
- ZSTR_ALLOCA_ALLOC(lcname, class_name->len, use_heap);
- zend_str_tolower_copy(lcname->val, class_name->val, class_name->len);
+ ZSTR_ALLOCA_ALLOC(lcname, ZSTR_LEN(class_name), use_heap);
+ zend_str_tolower_copy(ZSTR_VAL(lcname), ZSTR_VAL(class_name), ZSTR_LEN(class_name));
res = zend_hash_exists(classes, lcname);
ZSTR_ALLOCA_FREE(lcname, use_heap);
return res;
}
if (ce->unserialize == NULL) {
- zend_error(E_WARNING, "Class %s has no unserializer", ce->name->val);
+ zend_error(E_WARNING, "Class %s has no unserializer", ZSTR_VAL(ce->name));
object_init_ex(rval, ce);
} else if (ce->unserialize(rval, ce, (const unsigned char*)*p, datalen, (zend_unserialize_data *)var_hash) != SUCCESS) {
return 0;
} else {
/* If this class implements Serializable, it should not land here but in object_custom(). The passed string
obviously doesn't descend from the regular serializer. */
- zend_error(E_WARNING, "Erroneous data format for unserializing '%s'", ce->name->val);
+ zend_error(E_WARNING, "Erroneous data format for unserializing '%s'", ZSTR_VAL(ce->name));
return 0;
}
ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
if (ret && incomplete_class) {
- php_store_class_name(rval, class_name->val, len2);
+ php_store_class_name(rval, ZSTR_VAL(class_name), len2);
}
zend_string_release(class_name);
return ret;
elements = object_common1(UNSERIALIZE_PASSTHRU, ce);
if (incomplete_class) {
- php_store_class_name(rval, class_name->val, len2);
+ php_store_class_name(rval, ZSTR_VAL(class_name), len2);
}
zend_string_release(class_name);
/* NB: php_msgbuf is 1 char bigger than a long, so there is no need to
* allocate the extra byte. */
- messagebuffer = safe_emalloc(msg_var.s->len, 1, sizeof(struct php_msgbuf));
- memcpy(messagebuffer->mtext, msg_var.s->val, msg_var.s->len + 1);
- message_len = msg_var.s->len;
+ messagebuffer = safe_emalloc(ZSTR_LEN(msg_var.s), 1, sizeof(struct php_msgbuf));
+ memcpy(messagebuffer->mtext, ZSTR_VAL(msg_var.s), ZSTR_LEN(msg_var.s) + 1);
+ message_len = ZSTR_LEN(msg_var.s);
smart_str_free(&msg_var);
} else {
char *p;
}
/* insert serialized variable into shared memory */
- ret = php_put_shm_data(shm_list_ptr->ptr, shm_key, shm_var.s? shm_var.s->val : NULL, shm_var.s? shm_var.s->len : 0);
+ ret = php_put_shm_data(shm_list_ptr->ptr, shm_key, shm_var.s? ZSTR_VAL(shm_var.s) : NULL, shm_var.s? ZSTR_LEN(shm_var.s) : 0);
/* free string */
smart_str_free(&shm_var);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|zsb", &arg1, &config, &enc, &enc_len, &use_include_path) == FAILURE) {
RETURN_FALSE;
}
- if (!(data = php_tidy_file_to_mem(arg1->val, use_include_path))) {
+ if (!(data = php_tidy_file_to_mem(ZSTR_VAL(arg1), use_include_path))) {
RETURN_FALSE;
}
} else {
TidyBuffer buf;
tidyBufInit(&buf);
- tidyBufAttach(&buf, (byte *) data->val, data->len);
+ tidyBufAttach(&buf, (byte *) ZSTR_VAL(data), ZSTR_LEN(data));
if (tidyParseBuffer(doc, &buf) < 0) {
php_error_docref(NULL, E_WARNING, "%s", errbuf->bp);
if (opt_name == NULL) {
continue;
}
- _php_tidy_set_tidy_opt(doc, opt_name->val, opt_val);
+ _php_tidy_set_tidy_opt(doc, ZSTR_VAL(opt_name), opt_val);
} ZEND_HASH_FOREACH_END();
return SUCCESS;
int status;
zend_bool value;
- if (new_value->len==2 && strcasecmp("on", new_value->val)==0) {
+ if (ZSTR_LEN(new_value)==2 && strcasecmp("on", ZSTR_VAL(new_value))==0) {
value = (zend_bool) 1;
- } else if (new_value->len==3 && strcasecmp("yes", new_value->val)==0) {
+ } else if (ZSTR_LEN(new_value)==3 && strcasecmp("yes", ZSTR_VAL(new_value))==0) {
value = (zend_bool) 1;
- } else if (new_value->len==4 && strcasecmp("true", new_value->val)==0) {
+ } else if (ZSTR_LEN(new_value)==4 && strcasecmp("true", ZSTR_VAL(new_value))==0) {
value = (zend_bool) 1;
} else {
- value = (zend_bool) atoi(new_value->val);
+ value = (zend_bool) atoi(ZSTR_VAL(new_value));
}
if (stage == PHP_INI_STAGE_RUNTIME) {
TIDY_APPLY_CONFIG_ZVAL(obj->ptdoc->doc, options);
- if (php_tidy_parse_string(obj, input->val, input->len, enc) == FAILURE) {
+ if (php_tidy_parse_string(obj, ZSTR_VAL(input), ZSTR_LEN(input), enc) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_FALSE;
}
tidy_instanciate(tidy_ce_doc, return_value);
obj = Z_TIDY_P(return_value);
- if (!(contents = php_tidy_file_to_mem(inputfile->val, use_include_path))) {
- php_error_docref(NULL, E_WARNING, "Cannot Load '%s' into memory%s", inputfile->val, (use_include_path) ? " (Using include path)" : "");
+ if (!(contents = php_tidy_file_to_mem(ZSTR_VAL(inputfile), use_include_path))) {
+ php_error_docref(NULL, E_WARNING, "Cannot Load '%s' into memory%s", ZSTR_VAL(inputfile), (use_include_path) ? " (Using include path)" : "");
RETURN_FALSE;
}
TIDY_APPLY_CONFIG_ZVAL(obj->ptdoc->doc, options);
- if (php_tidy_parse_string(obj, contents->val, contents->len, enc) == FAILURE) {
+ if (php_tidy_parse_string(obj, ZSTR_VAL(contents), ZSTR_LEN(contents), enc) == FAILURE) {
zval_ptr_dtor(return_value);
RETVAL_FALSE;
}
obj = Z_TIDY_P(object);
if (inputfile) {
- if (!(contents = php_tidy_file_to_mem(inputfile->val, use_include_path))) {
- php_error_docref(NULL, E_WARNING, "Cannot Load '%s' into memory%s", inputfile->val, (use_include_path) ? " (Using include path)" : "");
+ if (!(contents = php_tidy_file_to_mem(ZSTR_VAL(inputfile), use_include_path))) {
+ php_error_docref(NULL, E_WARNING, "Cannot Load '%s' into memory%s", ZSTR_VAL(inputfile), (use_include_path) ? " (Using include path)" : "");
return;
}
TIDY_APPLY_CONFIG_ZVAL(obj->ptdoc->doc, options);
- php_tidy_parse_string(obj, contents->val, contents->len, enc);
+ php_tidy_parse_string(obj, ZSTR_VAL(contents), ZSTR_LEN(contents), enc);
zend_string_release(contents);
}
RETURN_FALSE;
}
- if (!(contents = php_tidy_file_to_mem(inputfile->val, use_include_path))) {
- php_error_docref(NULL, E_WARNING, "Cannot Load '%s' into memory%s", inputfile->val, (use_include_path) ? " (Using include path)" : "");
+ if (!(contents = php_tidy_file_to_mem(ZSTR_VAL(inputfile), use_include_path))) {
+ php_error_docref(NULL, E_WARNING, "Cannot Load '%s' into memory%s", ZSTR_VAL(inputfile), (use_include_path) ? " (Using include path)" : "");
RETURN_FALSE;
}
TIDY_APPLY_CONFIG_ZVAL(obj->ptdoc->doc, options);
- if (php_tidy_parse_string(obj, contents->val, contents->len, enc) == FAILURE) {
+ if (php_tidy_parse_string(obj, ZSTR_VAL(contents), ZSTR_LEN(contents), enc) == FAILURE) {
RETVAL_FALSE;
} else {
RETVAL_TRUE;
TIDY_APPLY_CONFIG_ZVAL(obj->ptdoc->doc, options);
- if(php_tidy_parse_string(obj, input->val, input->len, enc) == SUCCESS) {
+ if(php_tidy_parse_string(obj, ZSTR_VAL(input), ZSTR_LEN(input), enc) == SUCCESS) {
RETURN_TRUE;
}
#define EL_DATETIME "dateTime"
#define php_wddx_deserialize(a,b) \
- php_wddx_deserialize_ex((a)->value.str.val, (a)->value.str.len, (b))
+ php_wddx_deserialize_ex(Z_STRVAL_P(a), Z_STRLEN_P(a), (b))
#define SET_STACK_VARNAME \
if (stack->varname) { \
buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRLEN_P(var), 0, ENT_QUOTES, NULL);
- php_wddx_add_chunk_ex(packet, buf->val, buf->len);
+ php_wddx_add_chunk_ex(packet, ZSTR_VAL(buf), ZSTR_LEN(buf));
zend_string_release(buf);
}
{
char tmp_buf[WDDX_BUF_LEN];
zend_string *str = zval_get_string(var);
- snprintf(tmp_buf, sizeof(tmp_buf), WDDX_NUMBER, str->val);
+ snprintf(tmp_buf, sizeof(tmp_buf), WDDX_NUMBER, ZSTR_VAL(str));
zend_string_release(str);
php_wddx_add_chunk(packet, tmp_buf);
snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
php_wddx_add_chunk(packet, tmp_buf);
php_wddx_add_chunk_static(packet, WDDX_STRING_S);
- php_wddx_add_chunk_ex(packet, class_name->val, class_name->len);
+ php_wddx_add_chunk_ex(packet, ZSTR_VAL(class_name), ZSTR_LEN(class_name));
php_wddx_add_chunk_static(packet, WDDX_STRING_E);
php_wddx_add_chunk_static(packet, WDDX_VAR_E);
snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
php_wddx_add_chunk(packet, tmp_buf);
php_wddx_add_chunk_static(packet, WDDX_STRING_S);
- php_wddx_add_chunk_ex(packet, class_name->val, class_name->len);
+ php_wddx_add_chunk_ex(packet, ZSTR_VAL(class_name), ZSTR_LEN(class_name));
php_wddx_add_chunk_static(packet, WDDX_STRING_E);
php_wddx_add_chunk_static(packet, WDDX_VAR_E);
char *tmp_buf;
zend_string *name_esc;
- name_esc = php_escape_html_entities(name->val, name->len, 0, ENT_QUOTES, NULL);
- tmp_buf = emalloc(name_esc->len + sizeof(WDDX_VAR_S));
- snprintf(tmp_buf, name_esc->len + sizeof(WDDX_VAR_S), WDDX_VAR_S, name_esc->val);
+ name_esc = php_escape_html_entities(ZSTR_VAL(name), ZSTR_LEN(name), 0, ENT_QUOTES, NULL);
+ tmp_buf = emalloc(ZSTR_LEN(name_esc) + sizeof(WDDX_VAR_S));
+ snprintf(tmp_buf, ZSTR_LEN(name_esc) + sizeof(WDDX_VAR_S), WDDX_VAR_S, ZSTR_VAL(name_esc));
php_wddx_add_chunk(packet, tmp_buf);
efree(tmp_buf);
zend_string_release(name_esc);
return;
}
- php_wddx_deserialize_ex(payload->val, payload->len, return_value);
+ php_wddx_deserialize_ex(ZSTR_VAL(payload), ZSTR_LEN(payload), return_value);
if (stream) {
efree(payload);
(method = zend_hash_index_find(Z_ARRVAL_P(handler), 1)) != NULL &&
Z_TYPE_P(obj) == IS_OBJECT &&
Z_TYPE_P(method) == IS_STRING) {
- php_error_docref(NULL, E_WARNING, "Unable to call handler %s::%s()", Z_OBJCE_P(obj)->name->val, Z_STRVAL_P(method));
+ php_error_docref(NULL, E_WARNING, "Unable to call handler %s::%s()", ZSTR_VAL(Z_OBJCE_P(obj)->name), Z_STRVAL_P(method));
} else
php_error_docref(NULL, E_WARNING, "Unable to call handler");
}
/* This is the theoretical max (will never get beyond len * 2 as long
* as we are converting from single-byte characters, though) */
str = zend_string_alloc(len * 4, 0);
- str->len = 0;
+ ZSTR_LEN(str) = 0;
while (pos > 0) {
c = encoder ? encoder((unsigned char)(*s)) : (unsigned short)(*s);
if (c < 0x80) {
- str->val[str->len++] = (char) c;
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (char) c;
} else if (c < 0x800) {
- str->val[str->len++] = (0xc0 | (c >> 6));
- str->val[str->len++] = (0x80 | (c & 0x3f));
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0xc0 | (c >> 6));
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0x80 | (c & 0x3f));
} else if (c < 0x10000) {
- str->val[str->len++] = (0xe0 | (c >> 12));
- str->val[str->len++] = (0xc0 | ((c >> 6) & 0x3f));
- str->val[str->len++] = (0x80 | (c & 0x3f));
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0xe0 | (c >> 12));
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0xc0 | ((c >> 6) & 0x3f));
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0x80 | (c & 0x3f));
} else if (c < 0x200000) {
- str->val[str->len++] = (0xf0 | (c >> 18));
- str->val[str->len++] = (0xe0 | ((c >> 12) & 0x3f));
- str->val[str->len++] = (0xc0 | ((c >> 6) & 0x3f));
- str->val[str->len++] = (0x80 | (c & 0x3f));
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0xf0 | (c >> 18));
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0xe0 | ((c >> 12) & 0x3f));
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0xc0 | ((c >> 6) & 0x3f));
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = (0x80 | (c & 0x3f));
}
pos--;
s++;
}
- str->val[str->len] = '\0';
- str = zend_string_truncate(str, str->len, 0);
+ ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
+ str = zend_string_truncate(str, ZSTR_LEN(str), 0);
return str;
}
/* }}} */
}
str = zend_string_alloc(len, 0);
- str->len = 0;
+ ZSTR_LEN(str) = 0;
while (pos < len) {
int status = FAILURE;
c = php_next_utf8_char((const unsigned char*)s, (size_t) len, &pos, &status);
c = '?';
}
- str->val[str->len++] = decoder ? decoder(c) : c;
+ ZSTR_VAL(str)[ZSTR_LEN(str)++] = decoder ? decoder(c) : c;
}
- str->val[str->len] = '\0';
- if (str->len < len) {
- str = zend_string_truncate(str, str->len, 0);
+ ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
+ if (ZSTR_LEN(str) < len) {
+ str = zend_string_truncate(str, ZSTR_LEN(str), 0);
}
return str;
str = xml_utf8_decode((const XML_Char *)tag, strlen(tag), parser->target_encoding);
if (parser->case_folding) {
- php_strtoupper(str->val, str->len);
+ php_strtoupper(ZSTR_VAL(str), ZSTR_LEN(str));
}
return str;
if (!Z_ISUNDEF(parser->startElementHandler)) {
ZVAL_COPY(&args[0], &parser->index);
- ZVAL_STRING(&args[1], tag_name->val + parser->toffset);
+ ZVAL_STRING(&args[1], ZSTR_VAL(tag_name) + parser->toffset);
array_init(&args[2]);
while (attributes && *attributes) {
array_init(&tag);
array_init(&atr);
- _xml_add_to_info(parser, tag_name->val + parser->toffset);
+ _xml_add_to_info(parser, ZSTR_VAL(tag_name) + parser->toffset);
- add_assoc_string(&tag, "tag", tag_name->val + parser->toffset); /* cast to avoid gcc-warning */
+ add_assoc_string(&tag, "tag", ZSTR_VAL(tag_name) + parser->toffset); /* cast to avoid gcc-warning */
add_assoc_string(&tag, "type", "open");
add_assoc_long(&tag, "level", parser->level);
- parser->ltags[parser->level-1] = estrdup(tag_name->val);
+ parser->ltags[parser->level-1] = estrdup(ZSTR_VAL(tag_name));
parser->lastwasopen = 1;
attributes = (const XML_Char **) attrs;
if (!Z_ISUNDEF(parser->endElementHandler)) {
ZVAL_COPY(&args[0], &parser->index);
- ZVAL_STRING(&args[1], (tag_name->val) + parser->toffset);
+ ZVAL_STRING(&args[1], ZSTR_VAL(tag_name) + parser->toffset);
xml_call_handler(parser, &parser->endElementHandler, parser->endElementPtr, 2, args, &retval);
zval_ptr_dtor(&retval);
} else {
array_init(&tag);
- _xml_add_to_info(parser, tag_name->val + parser->toffset);
+ _xml_add_to_info(parser, ZSTR_VAL(tag_name) + parser->toffset);
- add_assoc_string(&tag, "tag", tag_name->val + parser->toffset); /* cast to avoid gcc-warning */
+ add_assoc_string(&tag, "tag", ZSTR_VAL(tag_name) + parser->toffset); /* cast to avoid gcc-warning */
add_assoc_string(&tag, "type", "close");
add_assoc_long(&tag, "level", parser->level);
zend_string *decoded_value;
decoded_value = xml_utf8_decode(s, len, parser->target_encoding);
- for (i = 0; i < decoded_value->len; i++) {
- switch (decoded_value->val[i]) {
+ for (i = 0; i < ZSTR_LEN(decoded_value); i++) {
+ switch (ZSTR_VAL(decoded_value)[i]) {
case ' ':
case '\t':
case '\n':
/* check if the current tag already has a value - if yes append to that! */
if ((myval = zend_hash_str_find(Z_ARRVAL_P(parser->ctag), "value", sizeof("value") - 1))) {
- int newlen = Z_STRLEN_P(myval) + decoded_value->len;
+ int newlen = Z_STRLEN_P(myval) + ZSTR_LEN(decoded_value);
Z_STR_P(myval) = zend_string_extend(Z_STR_P(myval), newlen, 0);
- strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - decoded_value->len,
- decoded_value->val, decoded_value->len + 1);
+ strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - ZSTR_LEN(decoded_value),
+ ZSTR_VAL(decoded_value), ZSTR_LEN(decoded_value) + 1);
zend_string_release(decoded_value);
} else {
add_assoc_str(parser->ctag, "value", decoded_value);
if ((mytype = zend_hash_str_find(Z_ARRVAL_P(curtag),"type", sizeof("type") - 1))) {
if (!strcmp(Z_STRVAL_P(mytype), "cdata")) {
if ((myval = zend_hash_str_find(Z_ARRVAL_P(curtag), "value", sizeof("value") - 1))) {
- int newlen = Z_STRLEN_P(myval) + decoded_value->len;
+ int newlen = Z_STRLEN_P(myval) + ZSTR_LEN(decoded_value);
Z_STR_P(myval) = zend_string_extend(Z_STR_P(myval), newlen, 0);
- strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - decoded_value->len,
- decoded_value->val, decoded_value->len + 1);
+ strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - ZSTR_LEN(decoded_value),
+ ZSTR_VAL(decoded_value), ZSTR_LEN(decoded_value) + 1);
zend_string_release(decoded_value);
return;
}
options->xmlrpc_out.version = xmlrpc_version_simple;
} else if (!strcmp(Z_STRVAL_P(val), VERSION_VALUE_SOAP11)) {
options->xmlrpc_out.version = xmlrpc_version_soap_1_1;
- } else { /* if(!strcmp((*val)->value.str.val, VERSION_VALUE_AUTO)) { */
+ } else { /* if(!strcmp(Z_STRVAL_P(val), VERSION_VALUE_AUTO)) { */
options->b_auto_version = 1;
}
}
efree(num_str);
}
} else {
- XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(my_key->val, pIter, depth++));
+ XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(ZSTR_VAL(my_key), pIter, depth++));
}
if (ht) {
ht->u.v.nApplyCount--;
if (xData) {
if (!XMLRPC_ServerAddIntrospectionData(server, xData)) {
- php_error_docref(NULL, E_WARNING, "Unable to add introspection data returned from %s(), improper element structure", php_function_name->val);
+ php_error_docref(NULL, E_WARNING, "Unable to add introspection data returned from %s(), improper element structure", ZSTR_VAL(php_function_name));
}
XMLRPC_CleanupValue(xData);
} else {
/* could not create description */
if (err.xml_elem_error.parser_code) {
php_error_docref(NULL, E_WARNING, "xml parse error: [line %ld, column %ld, message: %s] Unable to add introspection data returned from %s()",
- err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, php_function_name->val);
+ err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, ZSTR_VAL(php_function_name));
} else {
- php_error_docref(NULL, E_WARNING, "Unable to add introspection data returned from %s()", php_function_name->val);
+ php_error_docref(NULL, E_WARNING, "Unable to add introspection data returned from %s()", ZSTR_VAL(php_function_name));
}
}
zval_ptr_dtor(&retval);
} else {
/* user func failed */
- php_error_docref(NULL, E_WARNING, "Error calling user introspection callback: %s()", php_function_name->val);
+ php_error_docref(NULL, E_WARNING, "Error calling user introspection callback: %s()", ZSTR_VAL(php_function_name));
}
} else {
- php_error_docref(NULL, E_WARNING, "Invalid callback '%s' passed", php_function_name->val);
+ php_error_docref(NULL, E_WARNING, "Invalid callback '%s' passed", ZSTR_VAL(php_function_name));
}
zend_string_release(php_function_name);
} ZEND_HASH_FOREACH_END();
xpath_expr = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value));
}
if (xpath_expr) {
- params[i++] = estrndup(string_key->val, string_key->len);
+ params[i++] = estrndup(ZSTR_VAL(string_key), ZSTR_LEN(string_key));
params[i++] = xpath_expr;
}
}
fci.no_separation = 0;
/*fci.function_handler_cache = &function_ptr;*/
if (!zend_make_callable(&handler, &callable)) {
- php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", callable->val);
+ php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", ZSTR_VAL(callable));
valuePush(ctxt, xmlXPathNewString(""));
} else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable) == 0) {
- php_error_docref(NULL, E_WARNING, "Not allowed to call handler '%s()'", callable->val);
+ php_error_docref(NULL, E_WARNING, "Not allowed to call handler '%s()'", ZSTR_VAL(callable));
/* Push an empty string, so that we at least have an xslt result... */
valuePush(ctxt, xmlXPathNewString(""));
} else {
if (ce == NULL || !instanceof_function(ce, curce)) {
xmlFreeDoc(newdocp);
php_error_docref(NULL, E_WARNING,
- "Expecting class compatible with %s, '%s' given", curclass_name->val, ret_class->val);
+ "Expecting class compatible with %s, '%s' given", ZSTR_VAL(curclass_name), ZSTR_VAL(ret_class));
RETURN_FALSE;
}
return 1;
}
- len = spprintf(&fullpath, 0, "%s/%s", file_dirname_fullpath, file_basename->val);
+ len = spprintf(&fullpath, 0, "%s/%s", file_dirname_fullpath, ZSTR_VAL(file_basename));
if (!len) {
efree(file_dirname_fullpath);
zend_string_release(file_basename);
char fullpath[MAXPATHLEN];
int ovector[3];
int matches;
- int namelist_len = namelist[i]->len;
+ int namelist_len = ZSTR_LEN(namelist[i]);
- if ((namelist_len == 1 && namelist[i]->val[0] == '.') ||
- (namelist_len == 2 && namelist[i]->val[0] == '.' && namelist[i]->val[1] == '.')) {
+ if ((namelist_len == 1 && ZSTR_VAL(namelist[i])[0] == '.') ||
+ (namelist_len == 2 && ZSTR_VAL(namelist[i])[0] == '.' && ZSTR_VAL(namelist[i])[1] == '.')) {
zend_string_release(namelist[i]);
continue;
}
break;
}
- snprintf(fullpath, MAXPATHLEN, "%s%c%s", path, DEFAULT_SLASH, namelist[i]->val);
+ snprintf(fullpath, MAXPATHLEN, "%s%c%s", path, DEFAULT_SLASH, ZSTR_VAL(namelist[i]));
if (0 != VCWD_STAT(fullpath, &s)) {
php_error_docref(NULL, E_WARNING, "Cannot read <%s>", fullpath);
continue;
}
- matches = pcre_exec(re, NULL, namelist[i]->val, namelist[i]->len, 0, 0, ovector, 3);
+ matches = pcre_exec(re, NULL, ZSTR_VAL(namelist[i]), ZSTR_LEN(namelist[i]), 0, 0, ovector, 3);
/* 0 means that the vector is too small to hold all the captured substring offsets */
if (matches < 0) {
zend_string_release(namelist[i]);
return;
}
- if (filename->len == 0) {
+ if (ZSTR_LEN(filename) == 0) {
php_error_docref(NULL, E_WARNING, "Empty string as source");
RETURN_FALSE;
}
- if (ZIP_OPENBASEDIR_CHECKPATH(filename->val)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(ZSTR_VAL(filename))) {
RETURN_FALSE;
}
- if(!expand_filepath(filename->val, resolved_path)) {
+ if(!expand_filepath(ZSTR_VAL(filename), resolved_path)) {
RETURN_FALSE;
}
if (zr_rsrc->zf) {
buffer = zend_string_alloc(len, 0);
- n = zip_fread(zr_rsrc->zf, buffer->val, buffer->len);
+ n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
- buffer->val[n] = '\0';
- buffer->len = n;
+ ZSTR_VAL(buffer)[n] = '\0';
+ ZSTR_LEN(buffer) = n;
RETURN_NEW_STR(buffer);
} else {
zend_string_free(buffer);
ze_obj = Z_ZIP_P(self);
}
- if (filename->len == 0) {
+ if (ZSTR_LEN(filename) == 0) {
php_error_docref(NULL, E_WARNING, "Empty string as source");
RETURN_FALSE;
}
- if (ZIP_OPENBASEDIR_CHECKPATH(filename->val)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(ZSTR_VAL(filename))) {
RETURN_FALSE;
}
- if (!(resolved_path = expand_filepath(filename->val, NULL))) {
+ if (!(resolved_path = expand_filepath(ZSTR_VAL(filename), NULL))) {
RETURN_FALSE;
}
}
}
- if (pattern->len == 0) {
+ if (ZSTR_LEN(pattern) == 0) {
php_error_docref(NULL, E_NOTICE, "Empty string as pattern");
RETURN_FALSE;
}
}
if (type == 1) {
- found = php_zip_glob(pattern->val, pattern->len, flags, return_value);
+ found = php_zip_glob(ZSTR_VAL(pattern), ZSTR_LEN(pattern), flags, return_value);
} else {
found = php_zip_pcre(pattern, path, path_len, return_value);
}
if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(return_value), i)) != NULL) {
if (remove_all_path) {
basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0);
- file_stripped = basename->val;
- file_stripped_len = basename->len;
+ file_stripped = ZSTR_VAL(basename);
+ file_stripped_len = ZSTR_LEN(basename);
} else if (remove_path && strstr(Z_STRVAL_P(zval_file), remove_path) != NULL) {
file_stripped = Z_STRVAL_P(zval_file) + remove_path_len + 1;
file_stripped_len = Z_STRLEN_P(zval_file) - remove_path_len - 1;
return;
}
- if (filename->len == 0) {
+ if (ZSTR_LEN(filename) == 0) {
php_error_docref(NULL, E_NOTICE, "Empty string as filename");
RETURN_FALSE;
}
if (entry_name_len == 0) {
- entry_name = filename->val;
- entry_name_len = filename->len;
+ entry_name = ZSTR_VAL(filename);
+ entry_name_len = ZSTR_LEN(filename);
}
- if (php_zip_add_file(intern, filename->val, filename->len, entry_name, entry_name_len, 0, 0) < 0) {
+ if (php_zip_add_file(intern, ZSTR_VAL(filename), ZSTR_LEN(filename), entry_name, entry_name_len, 0, 0) < 0) {
RETURN_FALSE;
} else {
RETURN_TRUE;
ze_obj->buffers_cnt++;
pos = 0;
}
- ze_obj->buffers[pos] = (char *)emalloc(buffer->len + 1);
- memcpy(ze_obj->buffers[pos], buffer->val, buffer->len + 1);
+ ze_obj->buffers[pos] = (char *)emalloc(ZSTR_LEN(buffer) + 1);
+ memcpy(ze_obj->buffers[pos], ZSTR_VAL(buffer), ZSTR_LEN(buffer) + 1);
- zs = zip_source_buffer(intern, ze_obj->buffers[pos], buffer->len, 0);
+ zs = zip_source_buffer(intern, ze_obj->buffers[pos], ZSTR_LEN(buffer), 0);
if (zs == NULL) {
RETURN_FALSE;
return;
}
- PHP_ZIP_STAT_PATH(intern, name->val, name->len, flags, sb);
+ PHP_ZIP_STAT_PATH(intern, ZSTR_VAL(name), ZSTR_LEN(name), flags, sb);
RETURN_SB(&sb);
}
return;
}
- if (name->len < 1) {
+ if (ZSTR_LEN(name) < 1) {
RETURN_FALSE;
}
- idx = (zend_long)zip_name_locate(intern, (const char *)name->val, flags);
+ idx = (zend_long)zip_name_locate(intern, (const char *)ZSTR_VAL(name), flags);
if (idx >= 0) {
RETURN_LONG(idx);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|ll", &filename, &len, &flags) == FAILURE) {
return;
}
- PHP_ZIP_STAT_PATH(intern, filename->val, filename->len, flags, sb);
+ PHP_ZIP_STAT_PATH(intern, ZSTR_VAL(filename), ZSTR_LEN(filename), flags, sb);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|ll", &index, &len, &flags) == FAILURE) {
return;
if (index >= 0) {
zf = zip_fopen_index(intern, index, flags);
} else {
- zf = zip_fopen(intern, filename->val, flags);
+ zf = zip_fopen(intern, ZSTR_VAL(filename), flags);
}
if (zf == NULL) {
}
buffer = zend_string_alloc(len, 0);
- n = zip_fread(zf, buffer->val, buffer->len);
+ n = zip_fread(zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n < 1) {
zend_string_free(buffer);
RETURN_EMPTY_STRING();
}
zip_fclose(zf);
- buffer->val[n] = '\0';
- buffer->len = n;
+ ZSTR_VAL(buffer)[n] = '\0';
+ ZSTR_LEN(buffer) = n;
RETURN_NEW_STR(buffer);
}
/* }}} */
return;
}
- if (zip_stat(intern, filename->val, 0, &sb) != 0) {
+ if (zip_stat(intern, ZSTR_VAL(filename), 0, &sb) != 0) {
RETURN_FALSE;
}
obj = Z_ZIP_P(self);
- stream = php_stream_zip_open(obj->filename, filename->val, mode STREAMS_CC);
+ stream = php_stream_zip_open(obj->filename, ZSTR_VAL(filename), mode STREAMS_CC);
if (stream) {
php_stream_to_zval(stream, return_value);
} else {
out = zend_string_alloc(PHP_ZLIB_BUFFER_SIZE_GUESS(in_len), 0);
Z.next_in = (Bytef *) in_buf;
- Z.next_out = (Bytef *) out->val;
+ Z.next_out = (Bytef *) ZSTR_VAL(out);
Z.avail_in = in_len;
- Z.avail_out = out->len;
+ Z.avail_out = ZSTR_LEN(out);
status = deflate(&Z, Z_FINISH);
deflateEnd(&Z);
if (Z_STREAM_END == status) {
/* size buffer down to actual length */
out = zend_string_truncate(out, Z.total_out, 0);
- out->val[out->len] = '\0';
+ ZSTR_VAL(out)[ZSTR_LEN(out)] = '\0';
return out;
} else {
zend_string_free(out);
php_error_docref(NULL, E_WARNING, "encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE"); \
RETURN_FALSE; \
} \
- if ((out = php_zlib_encode(in->val, in->len, encoding, level)) == NULL) { \
+ if ((out = php_zlib_encode(ZSTR_VAL(in), ZSTR_LEN(in), encoding, level)) == NULL) { \
RETURN_FALSE; \
} \
RETURN_STR(out); \
int i;
zend_bool last_null = 1;
- for (i = 0; i < str->len; i++) {
- if (str->val[i]) {
+ for (i = 0; i < ZSTR_LEN(str); i++) {
+ if (ZSTR_VAL(str)[i]) {
last_null = 0;
} else {
if (last_null) {
php_error_docref(NULL, E_WARNING, "dictionary string must be NULL-byte terminated (each dictionary entry has to be NULL-terminated)");
}
- *dict = emalloc(str->len);
- memcpy(*dict, str->val, str->len);
- *dictlen = str->len;
+ *dict = emalloc(ZSTR_LEN(str));
+ memcpy(*dict, ZSTR_VAL(str), ZSTR_LEN(str));
+ *dictlen = ZSTR_LEN(str);
} break;
case IS_ARRAY: {
int i;
*++ptr = zval_get_string(cur);
- if (!*ptr || (*ptr)->len == 0) {
+ if (!*ptr || ZSTR_LEN(*ptr) == 0) {
if (*ptr) {
efree(*ptr);
}
php_error_docref(NULL, E_WARNING, "dictionary entries must be non-empty strings");
return 0;
}
- for (i = 0; i < (*ptr)->len; i++) {
- if ((*ptr)->val[i] == 0) {
+ for (i = 0; i < ZSTR_LEN(*ptr); i++) {
+ if (ZSTR_VAL(*ptr)[i] == 0) {
do {
efree(ptr);
} while (--ptr >= strings);
}
}
- *dictlen += (*ptr)->len + 1;
+ *dictlen += ZSTR_LEN(*ptr) + 1;
} ZEND_HASH_FOREACH_END();
dictptr = *dict = emalloc(*dictlen);
ptr = strings;
end = strings + zend_hash_num_elements(dictionary);
do {
- memcpy(dictptr, (*ptr)->val, (*ptr)->len);
- dictptr += (*ptr)->len;
+ memcpy(dictptr, ZSTR_VAL(*ptr), ZSTR_LEN(*ptr));
+ dictptr += ZSTR_LEN(*ptr);
*dictptr++ = 0;
zend_string_release(*ptr);
} while (++ptr != end);
out = zend_string_alloc((in_len > CHUNK_SIZE) ? in_len : CHUNK_SIZE, 0);
ctx->next_in = (Bytef *) in_buf;
- ctx->next_out = (Bytef *) out->val;
+ ctx->next_out = (Bytef *) ZSTR_VAL(out);
ctx->avail_in = in_len;
- ctx->avail_out = out->len;
+ ctx->avail_out = ZSTR_LEN(out);
do {
status = inflate(ctx, flush_type);
- buffer_used = out->len - ctx->avail_out;
+ buffer_used = ZSTR_LEN(out) - ctx->avail_out;
switch (status) {
case Z_OK:
if (ctx->avail_out == 0) {
/* more output buffer space needed; realloc and try again */
- out = zend_string_realloc(out, out->len + CHUNK_SIZE, 0);
+ out = zend_string_realloc(out, ZSTR_LEN(out) + CHUNK_SIZE, 0);
ctx->avail_out = CHUNK_SIZE;
- ctx->next_out = (Bytef *) out->val + buffer_used;
+ ctx->next_out = (Bytef *) ZSTR_VAL(out) + buffer_used;
break;
} else {
goto complete;
case Z_BUF_ERROR:
if (flush_type == Z_FINISH && ctx->avail_out == 0) {
/* more output buffer space needed; realloc and try again */
- out = zend_string_realloc(out, out->len + CHUNK_SIZE, 0);
+ out = zend_string_realloc(out, ZSTR_LEN(out) + CHUNK_SIZE, 0);
ctx->avail_out = CHUNK_SIZE;
- ctx->next_out = (Bytef *) out->val + buffer_used;
+ ctx->next_out = (Bytef *) ZSTR_VAL(out) + buffer_used;
break;
} else {
/* No more input data; we're finished */
complete: {
out = zend_string_realloc(out, buffer_used, 0);
- out->val[buffer_used] = 0;
+ ZSTR_VAL(out)[buffer_used] = 0;
RETURN_STR(out);
}
}
out = zend_string_alloc(out_size, 0);
ctx->next_in = (Bytef *) in_buf;
- ctx->next_out = (Bytef *) out->val;
+ ctx->next_out = (Bytef *) ZSTR_VAL(out);
ctx->avail_in = in_len;
- ctx->avail_out = out->len;
+ ctx->avail_out = ZSTR_LEN(out);
status = deflate(ctx, flush_type);
switch (status) {
case Z_OK:
- out->len = (char *) ctx->next_out - out->val;
- out->val[out->len] = 0;
+ ZSTR_LEN(out) = (char *) ctx->next_out - ZSTR_VAL(out);
+ ZSTR_VAL(out)[ZSTR_LEN(out)] = 0;
RETURN_STR(out);
break;
case Z_STREAM_END:
- out->len = (char *) ctx->next_out - out->val;
- out->val[out->len] = 0;
+ ZSTR_LEN(out) = (char *) ctx->next_out - ZSTR_VAL(out);
+ ZSTR_VAL(out)[ZSTR_LEN(out)] = 0;
deflateReset(ctx);
RETURN_STR(out);
break;
return FAILURE;
}
- if (!strncasecmp(new_value->val, "off", sizeof("off"))) {
+ if (!strncasecmp(ZSTR_VAL(new_value), "off", sizeof("off"))) {
int_value = 0;
- } else if (!strncasecmp(new_value->val, "on", sizeof("on"))) {
+ } else if (!strncasecmp(ZSTR_VAL(new_value), "on", sizeof("on"))) {
int_value = 1;
} else {
- int_value = zend_atoi(new_value->val, new_value->len);
+ int_value = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
}
ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0);