return SUCCESS;
}
+ZEND_API int add_property_ascii_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC)
+{
+ zval *tmp;
+ zval z_key;
+
+ MAKE_STD_ZVAL(tmp);
+ ZVAL_ASCII_STRING(tmp, str, duplicate);
+
+ ZVAL_STRINGL(&z_key, key, key_len-1, 0);
+
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
+ zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
+ return SUCCESS;
+}
+
+ZEND_API int add_property_ascii_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC)
+{
+ zval *tmp;
+ zval z_key;
+
+ MAKE_STD_ZVAL(tmp);
+ ZVAL_ASCII_STRINGL(tmp, str, length, duplicate);
+
+ ZVAL_STRINGL(&z_key, key, key_len-1, 0);
+
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
+ zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
+ return SUCCESS;
+}
+
+ZEND_API int add_property_rt_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC)
+{
+ zval *tmp;
+ zval z_key;
+
+ MAKE_STD_ZVAL(tmp);
+ ZVAL_RT_STRING(tmp, str, duplicate);
+
+ ZVAL_STRINGL(&z_key, key, key_len-1, 0);
+
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
+ zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
+ return SUCCESS;
+}
+
+ZEND_API int add_property_rt_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC)
+{
+ zval *tmp;
+ zval z_key;
+
+ MAKE_STD_ZVAL(tmp);
+ ZVAL_RT_STRINGL(tmp, str, length, duplicate);
+
+ ZVAL_STRINGL(&z_key, key, key_len-1, 0);
+
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
+ zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
+ return SUCCESS;
+}
+
ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC)
{
zval z_key;
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
+ZEND_API void zend_update_property_ascii_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC)
+{
+ zval *tmp;
+
+ ALLOC_ZVAL(tmp);
+ tmp->is_ref = 0;
+ tmp->refcount = 0;
+ ZVAL_ASCII_STRING(tmp, value, 1);
+ zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+}
+
+ZEND_API void zend_update_property_ascii_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_len TSRMLS_DC)
+{
+ zval *tmp;
+
+ ALLOC_ZVAL(tmp);
+ tmp->is_ref = 0;
+ tmp->refcount = 0;
+ ZVAL_ASCII_STRINGL(tmp, value, value_len, 1);
+ zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+}
+
+ZEND_API void zend_update_property_rt_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC)
+{
+ zval *tmp;
+
+ ALLOC_ZVAL(tmp);
+ tmp->is_ref = 0;
+ tmp->refcount = 0;
+ ZVAL_RT_STRING(tmp, value, 1);
+ zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+}
+
+ZEND_API void zend_update_property_rt_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_len TSRMLS_DC)
+{
+ zval *tmp;
+
+ ALLOC_ZVAL(tmp);
+ tmp->is_ref = 0;
+ tmp->refcount = 0;
+ ZVAL_RT_STRINGL(tmp, value, value_len, 1);
+ zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+}
+
ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value TSRMLS_DC)
{
zval *tmp;
ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC);
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
+ZEND_API void zend_update_property_ascii_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
+ZEND_API void zend_update_property_ascii_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
+ZEND_API void zend_update_property_rt_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
+ZEND_API void zend_update_property_rt_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value TSRMLS_DC);
ZEND_API void zend_update_property_unicodel(zend_class_entry *scope, zval *object, char *name, int name_length, UChar *value, int value_length TSRMLS_DC);
add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, duplicate); \
}
+#define add_assoc_rt_string_ex(arg, key, key_len, str, duplicate) \
+ if (UG(unicode)) { \
+ UErrorCode status = U_ZERO_ERROR; \
+ UChar *u_str; \
+ int32_t u_len; \
+ int length = strlen(str); \
+ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \
+ add_assoc_unicodel_ex(arg, key, key_len, u_str, u_len, 0); \
+ } else { \
+ add_assoc_string_ex(arg, key, key_len, (char*)(str), duplicate); \
+ }
+
+#define add_assoc_rt_stringl_ex(arg, key, key_len, str, length, duplicate) \
+ if (UG(unicode)) { \
+ UErrorCode status = U_ZERO_ERROR; \
+ UChar *u_str; \
+ int32_t u_len; \
+ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \
+ add_assoc_unicodel_ex(arg, key, key_len, u_str, u_len, 0); \
+ } else { \
+ add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, duplicate); \
+ }
+
#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
#define add_assoc_unicode(__arg, __key, __str, __duplicate) add_assoc_unicode_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
#define add_assoc_unicodel(__arg, __key, __str, __length, __duplicate) add_assoc_unicodel_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
+#define add_assoc_rt_string(__arg, __key, __str, __duplicate) add_assoc_rt_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
+#define add_assoc_rt_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_rt_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
#define add_assoc_text(arg, key, str, duplicate) \
if (UG(unicode)) { \
add_next_index_stringl(arg, (char*)(str), length, duplicate); \
}
+#define add_next_index_rt_string(arg, str, duplicate) \
+ if (UG(unicode)) { \
+ UErrorCode status = U_ZERO_ERROR; \
+ UChar *u_str; \
+ int32_t u_len; \
+ int length = strlen(str); \
+ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \
+ add_next_index_unicodel(arg, u_str, u_len, 0); \
+ } else { \
+ add_next_index_string(arg, (char*)(str), duplicate); \
+ }
+
+#define add_next_index_rt_stringl(arg, str, length, duplicate) \
+ if (UG(unicode)) { \
+ UErrorCode status = U_ZERO_ERROR; \
+ UChar *u_str; \
+ int32_t u_len; \
+ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \
+ add_next_index_unicodel(arg, u_str, u_len, 0); \
+ } else { \
+ add_next_index_stringl(arg, (char*)(str), length, duplicate); \
+ }
+
ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate);
ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate);
ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC);
+ZEND_API int add_property_ascii_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
+ZEND_API int add_property_ascii_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
+ZEND_API int add_property_rt_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
+ZEND_API int add_property_rt_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC)
#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC)
#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d TSRMLS_CC)
#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
+#define add_property_ascii_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
+#define add_property_ascii_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
+#define add_property_rt_string(__arg, __key, __str, __duplicate) add_property_ascii_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
+#define add_property_rt_stringl(__arg, __key, __str, __length, __duplicate) add_property_rt_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC)
array_init(return_value);
zend_hash_internal_pointer_reset(&EG(included_files));
- while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 1) == HASH_KEY_IS_STRING) {
- add_next_index_string(return_value, entry, 0);
+ while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 0) == HASH_KEY_IS_STRING) {
+ add_next_index_rt_string(return_value, entry, 1);
zend_hash_move_forward(&EG(included_files));
}
}
if (skip->op_array) {
filename = skip->op_array->filename;
lineno = skip->opline->lineno;
- add_assoc_string_ex(stack_frame, "file", sizeof("file"), filename, 1);
+ add_assoc_rt_string_ex(stack_frame, "file", sizeof("file"), filename, 1);
add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
/* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
if we have called include in the frame above - this is the file we have included.
*/
- add_next_index_string(arg_array, include_filename, 1);
+ add_next_index_rt_string(arg_array, include_filename, 1);
add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array);
}
trace->refcount = 0;
zend_fetch_debug_backtrace(trace, skip_top_traces TSRMLS_CC);
- zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
+ zend_update_property_rt_string(U_CLASS_ENTRY(default_exception_ce), &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
zend_update_property(U_CLASS_ENTRY(default_exception_ce), &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC);
if (message) {
if (message_type == IS_UNICODE) {
zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
+ } else if (UG(unicode)) {
+ UErrorCode status = U_ZERO_ERROR;
+ UChar *u_str;
+ int32_t u_len;
+
+ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status);
+ zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC);
+ efree(u_str);
} else {
zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
}
if (message) {
if (message_type == IS_UNICODE) {
zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
+ } else if (UG(unicode)) {
+ UErrorCode status = U_ZERO_ERROR;
+ UChar *u_str;
+ int32_t u_len;
+
+ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status);
+ zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC);
+ efree(u_str);
} else {
zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
}
#define TRACE_APPEND_STRL(val, vallen) \
{ \
- int l = vallen; \
+ int l = vallen; \
*str = (char*)erealloc(*str, *len + l + 1); \
memcpy((*str) + *len, val, l); \
*len += l; \
}
+#define TRACE_APPEND_ZVAL(zv) \
+ if (Z_TYPE_P((zv)) == IS_UNICODE) { \
+ zval copy; \
+ int use_copy; \
+ zend_make_printable_zval((zv), ©, &use_copy); \
+ TRACE_APPEND_STRL(Z_STRVAL(copy), Z_STRLEN(copy)); \
+ zval_dtor(©); \
+ } else { \
+ TRACE_APPEND_STRL(Z_STRVAL_P((zv)), Z_STRLEN_P((zv))); \
+ }
+
#define TRACE_APPEND_STR(val) \
TRACE_APPEND_STRL(val, sizeof(val)-1)
} else {
line = 0;
}
- s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 2 + 1);
- sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line);
+ TRACE_APPEND_ZVAL(*file);
+ s_tmp = emalloc(MAX_LENGTH_OF_LONG + 2 + 1);
+ sprintf(s_tmp, "(%ld): ", line);
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
efree(s_tmp);
} else {
if (message) {
- zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), ex, "message", sizeof("message")-1, message TSRMLS_CC);
+ zend_update_property_rt_string(U_CLASS_ENTRY(default_exception_ce), ex, "message", sizeof("message")-1, message TSRMLS_CC);
}
if (code) {
zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), ex, "code", sizeof("code")-1, code TSRMLS_CC);
file = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "file", sizeof("file")-1, 1 TSRMLS_CC);
line = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "line", sizeof("line")-1, 1 TSRMLS_CC);
- zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str));
+ if (Z_TYPE_P(file) == IS_UNICODE) {
+ zval copy;
+ int use_copy;
+ zend_make_printable_zval(file, ©, &use_copy);
+ zend_error_va(E_ERROR, Z_STRVAL(copy), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str));
+ zval_dtor(©);
+ } else {
+ zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str));
+ }
} else {
zend_error(E_ERROR, "Uncaught exception '%v'", ce_exception->name);
}
bool(true)
string(54) "The parameter specified by its name could not be found"
===DONE===
+--UEXPECT--
+int(2)
+int(1)
+bool(false)
+bool(true)
+unicode(54) "The parameter specified by its name could not be found"
+===DONE===
php_set_default_dir(dirp->rsrc_id TSRMLS_CC);
if (createobject) {
- object_init_ex(return_value, dir_class_entry_ptr);
- add_property_stringl(return_value, "path", dirname, dir_len, 1);
+ object_init_ex(return_value, U_CLASS_ENTRY(dir_class_entry_ptr));
+ add_property_rt_stringl(return_value, "path", dirname, dir_len, 1);
add_property_resource(return_value, "handle", dirp->rsrc_id);
php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */
} else {
#endif
if (ret) {
- RETURN_STRING(path, 1);
+ RETURN_RT_STRING(path, 1);
} else {
RETURN_FALSE;
}
FETCH_DIRP();
if (php_stream_readdir(dirp, &entry)) {
- RETURN_STRINGL(entry.d_name, strlen(entry.d_name), 1);
+ RETURN_RT_STRINGL(entry.d_name, strlen(entry.d_name), 1);
}
RETURN_FALSE;
}
continue;
}
}
- add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1);
+ add_next_index_rt_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1);
}
globfree(&globbuf);
array_init(return_value);
for (i = 0; i < n; i++) {
- add_next_index_string(return_value, namelist[i], 0);
+ add_next_index_rt_string(return_value, namelist[i], 0);
+ if (UG(unicode)) {
+ efree(namelist[i]);
+ }
}
if (n) {
#endif
RETVAL_FALSE;
} else {
- RETVAL_STRING(addr, 0);
+ RETVAL_RT_STRING(addr, 0);
+ if (UG(unicode)) {
+ efree(addr);
+ }
}
}
/* }}} */
PHP_FUNCTION(gethostbyname)
{
zval **arg;
+ char *tmp;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
convert_to_string_ex(arg);
- RETVAL_STRING(php_gethostbyname(Z_STRVAL_PP(arg)), 0);
+ tmp = php_gethostbyname(Z_STRVAL_PP(arg));
+ RETVAL_RT_STRING(tmp, 0);
+ if (UG(unicode)) {
+ efree(tmp);
+ }
}
/* }}} */
for (i = 0 ; hp->h_addr_list[i] != 0 ; i++) {
in = *(struct in_addr *) hp->h_addr_list[i];
- add_next_index_string(return_value, inet_ntoa(in), 1);
+ add_next_index_rt_string(return_value, inet_ntoa(in), 1);
}
}
/* }}} */
#endif
case FS_TYPE:
if (S_ISLNK(ssb.sb.st_mode)) {
- RETURN_STRING("link", 1);
+ RETURN_ASCII_STRING("link", 1);
}
switch(ssb.sb.st_mode & S_IFMT) {
- case S_IFIFO: RETURN_STRING("fifo", 1);
- case S_IFCHR: RETURN_STRING("char", 1);
- case S_IFDIR: RETURN_STRING("dir", 1);
- case S_IFBLK: RETURN_STRING("block", 1);
- case S_IFREG: RETURN_STRING("file", 1);
+ case S_IFIFO: RETURN_ASCII_STRING("fifo", 1);
+ case S_IFCHR: RETURN_ASCII_STRING("char", 1);
+ case S_IFDIR: RETURN_ASCII_STRING("dir", 1);
+ case S_IFBLK: RETURN_ASCII_STRING("block", 1);
+ case S_IFREG: RETURN_ASCII_STRING("file", 1);
#if defined(S_IFSOCK) && !defined(ZEND_WIN32)&&!defined(__BEOS__)
- case S_IFSOCK: RETURN_STRING("socket", 1);
+ case S_IFSOCK: RETURN_ASCII_STRING("socket", 1);
#endif
}
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown file type (%d)", ssb.sb.st_mode&S_IFMT);
- RETURN_STRING("unknown", 1);
+ RETURN_ASCII_STRING("unknown", 1);
case FS_IS_W:
RETURN_BOOL((ssb.sb.st_mode & wmask) != 0);
case FS_IS_R:
int argc = ZEND_NUM_ARGS();
if (argc == 0) {
- RETURN_STRING(PHP_VERSION, 1);
+ RETURN_ASCII_STRING(PHP_VERSION, 1);
} else if (argc == 1 && zend_get_parameters_ex(1, &arg) == SUCCESS) {
char *version;
convert_to_string_ex(arg);
if (version == NULL) {
RETURN_FALSE;
}
- RETURN_STRING(version, 1);
+ RETURN_ASCII_STRING(version, 1);
} else {
WRONG_PARAM_COUNT;
}
WRONG_PARAM_COUNT;
}
- RETURN_STRING(php_logo_guid(), 0);
+ RETURN_ASCII_STRING(php_logo_guid(), 0);
}
/* }}} */
WRONG_PARAM_COUNT;
}
- RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1);
+ RETURN_ASCII_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1);
}
/* }}} */
WRONG_PARAM_COUNT;
}
- RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1);
+ RETURN_ASCII_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1);
}
/* }}} */
WRONG_PARAM_COUNT;
}
- RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1);
+ RETURN_ASCII_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1);
}
/* }}} */
}
if (sapi_module.name) {
- RETURN_STRING(sapi_module.name, 1);
+ RETURN_ASCII_STRING(sapi_module.name, 1);
} else {
RETURN_FALSE;
}
{
char *mode = "a";
int modelen;
+ char *tmp;
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) {
return;
}
- RETURN_STRING(php_get_uname(*mode), 0);
+ tmp = php_get_uname(*mode);
+ RETVAL_RT_STRING(tmp, 0);
+ if (UG(unicode)) {
+ efree(tmp);
+ }
}
/* }}} */
PHP_FUNCTION(php_ini_scanned_files)
{
if (strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) {
- RETURN_STRING(php_ini_scanned_files, 1);
+ RETURN_RT_STRING(php_ini_scanned_files, 1);
} else {
RETURN_FALSE;
}
/* Append NULL to the end of the string */
buff[ret] = '\0';
- RETURN_STRING(buff, 1);
+ RETURN_RT_STRING(buff, 1);
}
/* }}} */
ret = estrndup(path, path_len);
php_dirname(ret, path_len);
if (*ret) {
- add_assoc_string(tmp, "dirname", ret, 1);
+ add_assoc_rt_string(tmp, "dirname", ret, 1);
}
efree(ret);
}
if ((opt & PHP_PATHINFO_BASENAME) == PHP_PATHINFO_BASENAME) {
php_basename(path, path_len, NULL, 0, &ret, &ret_len TSRMLS_CC);
- add_assoc_stringl(tmp, "basename", ret, ret_len, 0);
+ add_assoc_rt_stringl(tmp, "basename", ret, ret_len, 0);
+ if (UG(unicode)) {
+ efree(ret);
+ }
}
if ((opt & PHP_PATHINFO_EXTENSION) == PHP_PATHINFO_EXTENSION) {
if (p) {
idx = p - ret;
- add_assoc_stringl(tmp, "extension", ret + idx + 1, ret_len - idx - 1, 1);
+ add_assoc_rt_stringl(tmp, "extension", ret + idx + 1, ret_len - idx - 1, 1);
}
if (!have_basename) {
[3]=>
string(5) "third"
}
-
+--UEXPECT--
+Opening
+Closing up!
+array(4) {
+ [0]=>
+ unicode(5) "first"
+ [1]=>
+ unicode(6) "fourth"
+ [2]=>
+ unicode(6) "second"
+ [3]=>
+ unicode(5) "third"
+}
["extension"]=>
string(3) "asa"
}
+--UEXPECT--
+array(3) {
+ [u"dirname"]=>
+ unicode(1) "/"
+ [u"basename"]=>
+ unicode(8) "dsds.asa"
+ [u"extension"]=>
+ unicode(3) "asa"
+}
switch (Z_TYPE_PP(arg)) {
case IS_NULL:
- RETVAL_STRING("NULL", 1);
+ RETVAL_ASCII_STRING("NULL", 1);
break;
case IS_BOOL:
- RETVAL_STRING("boolean", 1);
+ RETVAL_ASCII_STRING("boolean", 1);
break;
case IS_LONG:
- RETVAL_STRING("integer", 1);
+ RETVAL_ASCII_STRING("integer", 1);
break;
case IS_DOUBLE:
- RETVAL_STRING("double", 1);
+ RETVAL_ASCII_STRING("double", 1);
break;
case IS_STRING:
- RETVAL_STRING("string", 1);
+ RETVAL_ASCII_STRING("string", 1);
break;
case IS_BINARY:
- RETVAL_STRING("binary", 1);
+ RETVAL_ASCII_STRING("binary", 1);
break;
case IS_UNICODE:
- RETVAL_STRING("unicode", 1);
+ RETVAL_ASCII_STRING("unicode", 1);
break;
case IS_ARRAY:
- RETVAL_STRING("array", 1);
+ RETVAL_ASCII_STRING("array", 1);
break;
case IS_OBJECT:
- RETVAL_STRING("object", 1);
+ RETVAL_ASCII_STRING("object", 1);
/*
{
char *result;
char *type_name;
type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(arg) TSRMLS_CC);
if (type_name) {
- RETVAL_STRING("resource", 1);
+ RETVAL_ASCII_STRING("resource", 1);
break;
}
}
default:
- RETVAL_STRING("unknown type", 1);
+ RETVAL_ASCII_STRING("unknown type", 1);
}
}
/* }}} */
}
break;
+ case IS_UNICODE:
+ result = is_numeric_unicode(Z_USTRVAL_PP(arg), Z_USTRLEN_PP(arg), NULL, NULL, 0);
+ if (result == IS_LONG || result == IS_DOUBLE) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+ }
+ break;
+
default:
RETURN_FALSE;
break;
spprintf(&uniqid, 0, "%s%08x%05x", prefix, sec, usec);
}
- RETURN_STRING(uniqid, 0);
+ RETURN_RT_STRING(uniqid, 0);
}
#endif
/* }}} */
--
Status: In Progress
debug_backtrace()
- extension_loaded()
- get_extension_funcs()
- get_included_files()
Completed:
class_exists()
create_function()
defined()
each()
error_reporting()
+ extension_loaded()
func_get_arg()
func_get_args()
func_num_args()
get_defined_constants()
get_defined_functions()
get_defined_vars()
+ get_extension_funcs()
+ get_included_files()
get_loaded_extensions()
get_object_vars()
get_parent_class()