summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:34:37 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:34:37 -0400
commit10f5b47dc7c1cf2b9a00991629f43652710322d3 (patch)
tree3b727a16f652b8042d573e90f003868ffb3b56c7 /ext/standard
parent0e920280a2e04b110827bb766b9f29e3d581c4ee (diff)
downloadphp-10f5b47dc7c1cf2b9a00991629f43652710322d3.tar.gz
Imported Upstream version 5.0.5upstream/5.0.5
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/array.c199
-rw-r--r--ext/standard/basic_functions.c122
-rw-r--r--ext/standard/basic_functions.h4
-rw-r--r--ext/standard/credits_ext.h12
-rw-r--r--ext/standard/credits_sapi.h1
-rw-r--r--ext/standard/datetime.c6
-rw-r--r--ext/standard/dl.c20
-rw-r--r--ext/standard/file.c8
-rw-r--r--ext/standard/file.h4
-rw-r--r--ext/standard/filestat.c20
-rw-r--r--ext/standard/flock_compat.c6
-rw-r--r--ext/standard/fsock.h10
-rw-r--r--ext/standard/ftp_fopen_wrapper.c31
-rw-r--r--ext/standard/head.c7
-rw-r--r--ext/standard/html.c16
-rw-r--r--ext/standard/http_fopen_wrapper.c36
-rw-r--r--ext/standard/image.c7
-rw-r--r--ext/standard/info.c37
-rw-r--r--ext/standard/lcg.c8
-rw-r--r--ext/standard/link.c6
-rw-r--r--ext/standard/mail.c6
-rw-r--r--ext/standard/math.c6
-rw-r--r--ext/standard/md5.c29
-rw-r--r--ext/standard/microtime.c8
-rw-r--r--ext/standard/pack.c6
-rw-r--r--ext/standard/pageinfo.c8
-rw-r--r--ext/standard/parsedate.c4
-rw-r--r--ext/standard/parsedate.y4
-rw-r--r--ext/standard/php_incomplete_class.h20
-rw-r--r--ext/standard/php_string.h3
-rw-r--r--ext/standard/proc_open.c57
-rw-r--r--ext/standard/reg.c45
-rw-r--r--ext/standard/sha1.c29
-rw-r--r--ext/standard/string.c54
-rw-r--r--ext/standard/syslog.c6
-rwxr-xr-xext/standard/tests/array/bug29253.phpt13
-rw-r--r--ext/standard/tests/array/bug30833.phpt35
-rwxr-xr-xext/standard/tests/array/bug31158.phpt17
-rw-r--r--ext/standard/tests/array/bug31213.phpt2
-rwxr-xr-xext/standard/tests/array/bug33940.phpt62
-rwxr-xr-xext/standard/tests/array/bug33989.phpt10
-rwxr-xr-xext/standard/tests/array/bug34227.phpt100
-rw-r--r--ext/standard/tests/file/bug30362.phpt26
-rw-r--r--ext/standard/tests/file/bug30362.txt1
-rw-r--r--ext/standard/tests/general_functions/bug32647.phpt55
-rw-r--r--ext/standard/tests/serialize/bug31402.phpt24
-rw-r--r--ext/standard/tests/strings/bug33076.phpt14
-rw-r--r--ext/standard/tests/strings/chunk_split.phpt3
-rw-r--r--ext/standard/tests/strings/strval.phpt24
-rw-r--r--ext/standard/tests/strings/url_t.phpt18
-rw-r--r--ext/standard/type.c6
-rw-r--r--ext/standard/url.c24
-rw-r--r--ext/standard/url_scanner_ex.c131
-rw-r--r--ext/standard/url_scanner_ex.c.orig243
-rw-r--r--ext/standard/url_scanner_ex.re2
-rw-r--r--ext/standard/user_filters.c11
-rw-r--r--ext/standard/var.c20
-rw-r--r--ext/standard/var_unserializer.c33
-rw-r--r--ext/standard/var_unserializer.c.orig55
-rw-r--r--ext/standard/var_unserializer.re5
60 files changed, 1206 insertions, 573 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index b161419ba..b379a2aaf 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.266.2.15 2005/03/12 10:12:49 andrey Exp $ */
+/* $Id: array.c,v 1.266.2.25 2005/09/01 12:01:01 dmitry Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -578,43 +578,66 @@ static int array_user_compare(const void *a, const void *b TSRMLS_DC)
}
}
-/* check is comparison function is valid */
+/* check if comparison function is valid */
#define PHP_ARRAY_CMP_FUNC_CHECK(func_name) \
if (!zend_is_callable(*func_name, 0, NULL)) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid comparison function."); \
+ BG(user_compare_fci_cache) = old_user_compare_fci_cache; \
BG(user_compare_func_name) = old_compare_func; \
RETURN_FALSE; \
} \
+ /* clear FCI cache otherwise : for example the same or other array with
+ (partly) the same key values has been sorted with uasort() or
+ other sorting function the comparison is cached, however the the name
+ of the function for comparison is not respected. see bug #28739 AND #33295
+
+ following defines will assist in backup / restore values.
+ */
+
+#define PHP_ARRAY_CMP_FUNC_VARS \
+ zval **old_compare_func; \
+ zend_fcall_info_cache old_user_compare_fci_cache
+
+#define PHP_ARRAY_CMP_FUNC_BACKUP() \
+ old_compare_func = BG(user_compare_func_name); \
+ old_user_compare_fci_cache = BG(user_compare_fci_cache); \
+ BG(user_compare_fci_cache) = empty_fcall_info_cache
+
+#define PHP_ARRAY_CMP_FUNC_RESTORE() \
+ BG(user_compare_fci_cache) = old_user_compare_fci_cache; \
+ BG(user_compare_func_name) = old_compare_func
+
+
/* {{{ proto bool usort(array array_arg, string cmp_function)
Sort an array by values using a user-defined comparison function */
PHP_FUNCTION(usort)
{
zval **array;
- zval **old_compare_func;
HashTable *target_hash;
+ PHP_ARRAY_CMP_FUNC_VARS;
+
+ PHP_ARRAY_CMP_FUNC_BACKUP();
- old_compare_func = BG(user_compare_func_name);
- BG(user_compare_fci_cache) = empty_fcall_info_cache;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
WRONG_PARAM_COUNT;
}
target_hash = HASH_OF(*array);
if (!target_hash) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
RETURN_FALSE;
}
PHP_ARRAY_CMP_FUNC_CHECK(BG(user_compare_func_name))
if (zend_hash_sort(target_hash, zend_qsort, array_user_compare, 1 TSRMLS_CC) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
RETURN_FALSE;
}
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
RETURN_TRUE;
}
/* }}} */
@@ -624,29 +647,30 @@ PHP_FUNCTION(usort)
PHP_FUNCTION(uasort)
{
zval **array;
- zval **old_compare_func;
HashTable *target_hash;
+ PHP_ARRAY_CMP_FUNC_VARS;
+
+ PHP_ARRAY_CMP_FUNC_BACKUP();
- old_compare_func = BG(user_compare_func_name);
- BG(user_compare_fci_cache) = empty_fcall_info_cache;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
WRONG_PARAM_COUNT;
}
target_hash = HASH_OF(*array);
if (!target_hash) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
RETURN_FALSE;
}
PHP_ARRAY_CMP_FUNC_CHECK(BG(user_compare_func_name))
if (zend_hash_sort(target_hash, zend_qsort, array_user_compare, 0 TSRMLS_CC) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
RETURN_FALSE;
}
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
+
RETURN_TRUE;
}
/* }}} */
@@ -669,7 +693,7 @@ static int array_user_key_compare(const void *a, const void *b TSRMLS_DC)
s = *((Bucket **) b);
if (f->nKeyLength) {
- Z_STRVAL(key1) = estrndup(f->arKey, f->nKeyLength);
+ Z_STRVAL(key1) = estrndup(f->arKey, f->nKeyLength-1);
Z_STRLEN(key1) = f->nKeyLength-1;
Z_TYPE(key1) = IS_STRING;
} else {
@@ -677,7 +701,7 @@ static int array_user_key_compare(const void *a, const void *b TSRMLS_DC)
Z_TYPE(key1) = IS_LONG;
}
if (s->nKeyLength) {
- Z_STRVAL(key2) = estrndup(s->arKey, s->nKeyLength);
+ Z_STRVAL(key2) = estrndup(s->arKey, s->nKeyLength-1);
Z_STRLEN(key2) = s->nKeyLength-1;
Z_TYPE(key2) = IS_STRING;
} else {
@@ -703,28 +727,33 @@ static int array_user_key_compare(const void *a, const void *b TSRMLS_DC)
PHP_FUNCTION(uksort)
{
zval **array;
- zval **old_compare_func;
HashTable *target_hash;
+ PHP_ARRAY_CMP_FUNC_VARS;
+
+
+ PHP_ARRAY_CMP_FUNC_BACKUP();
- old_compare_func = BG(user_compare_func_name);
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
WRONG_PARAM_COUNT;
}
target_hash = HASH_OF(*array);
if (!target_hash) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument should be an array");
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
+
RETURN_FALSE;
}
PHP_ARRAY_CMP_FUNC_CHECK(BG(user_compare_func_name))
if (zend_hash_sort(target_hash, zend_qsort, array_user_key_compare, 0 TSRMLS_CC) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
+
RETURN_FALSE;
}
- BG(user_compare_func_name) = old_compare_func;
+
+ PHP_ARRAY_CMP_FUNC_RESTORE();
RETURN_TRUE;
}
/* }}} */
@@ -1008,6 +1037,7 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive
uint string_key_len;
ulong num_key;
HashPosition pos;
+ zend_fcall_info_cache array_walk_fci_cache = empty_fcall_info_cache;
/* Set up known arguments */
args[1] = &key;
@@ -1051,7 +1081,7 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive
fci.no_separation = 0;
/* Call the userland function */
- if (zend_call_function(&fci, &BG(array_walk_fci_cache) TSRMLS_CC) == SUCCESS) {
+ if (zend_call_function(&fci, &array_walk_fci_cache TSRMLS_CC) == SUCCESS) {
if (retval_ptr) {
zval_ptr_dtor(&retval_ptr);
}
@@ -1094,7 +1124,6 @@ PHP_FUNCTION(array_walk)
HashTable *target_hash;
argc = ZEND_NUM_ARGS();
- BG(array_walk_fci_cache) = empty_fcall_info_cache;
old_walk_func_name = BG(array_walk_func_name);
if (argc < 2 || argc > 3 ||
zend_get_parameters_ex(argc, &array, &BG(array_walk_func_name), &userdata) == FAILURE) {
@@ -1131,7 +1160,6 @@ PHP_FUNCTION(array_walk_recursive)
argc = ZEND_NUM_ARGS();
old_walk_func_name = BG(array_walk_func_name);
- BG(array_walk_fci_cache) = empty_fcall_info_cache;
if (argc < 2 || argc > 3 ||
zend_get_parameters_ex(argc, &array, &BG(array_walk_func_name), &userdata) == FAILURE) {
@@ -1393,14 +1421,18 @@ PHP_FUNCTION(extract)
zval **orig_var;
if (zend_hash_find(EG(active_symbol_table), final_name.c, final_name.len+1, (void **) &orig_var) == SUCCESS) {
- zval_ptr_dtor(orig_var);
-
SEPARATE_ZVAL_TO_MAKE_IS_REF(entry);
zval_add_ref(entry);
+ zval_ptr_dtor(orig_var);
+
*orig_var = *entry;
} else {
- (*entry)->is_ref = 1;
+ if ((*var_array)->refcount > 1) {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(entry);
+ } else {
+ (*entry)->is_ref = 1;
+ }
zval_add_ref(entry);
zend_hash_update(EG(active_symbol_table), final_name.c, final_name.len+1, (void **) entry, sizeof(zval *), NULL);
}
@@ -2005,8 +2037,8 @@ PHP_FUNCTION(array_unshift)
hashtable and replace it with new one */
new_hash = php_splice(Z_ARRVAL_P(stack), 0, 0, &args[1], argc-1, NULL);
zend_hash_destroy(Z_ARRVAL_P(stack));
- efree(Z_ARRVAL_P(stack));
- Z_ARRVAL_P(stack) = new_hash;
+ *Z_ARRVAL_P(stack) = *new_hash;
+ FREE_HASHTABLE(new_hash);
/* Clean up and return the number of elements in the stack */
efree(args);
@@ -2082,8 +2114,8 @@ PHP_FUNCTION(array_splice)
/* Replace input array's hashtable with the new one */
zend_hash_destroy(Z_ARRVAL_P(array));
- efree(Z_ARRVAL_P(array));
- Z_ARRVAL_P(array) = new_hash;
+ *Z_ARRVAL_P(array) = *new_hash;
+ FREE_HASHTABLE(new_hash);
/* Clean up */
if (argc == 4)
@@ -2443,7 +2475,6 @@ PHP_FUNCTION(array_count_values)
zend_hash_internal_pointer_reset_ex(myht, &pos);
while (zend_hash_get_current_data_ex(myht, (void **)&entry, &pos) == SUCCESS) {
if (Z_TYPE_PP(entry) == IS_LONG) {
-int_key:
if (zend_hash_index_find(Z_ARRVAL_P(return_value),
Z_LVAL_PP(entry),
(void**)&tmp) == FAILURE) {
@@ -2458,9 +2489,28 @@ int_key:
} else if (Z_TYPE_PP(entry) == IS_STRING) {
/* make sure our array does not end up with numeric string keys */
if (is_numeric_string(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, NULL, 0) == IS_LONG) {
- SEPARATE_ZVAL(entry);
- convert_to_long_ex(entry);
- goto int_key;
+ zval tmp_entry;
+
+ tmp_entry = **entry;
+ zval_copy_ctor(&tmp_entry);
+
+ convert_to_long(&tmp_entry);
+
+ if (zend_hash_index_find(Z_ARRVAL_P(return_value),
+ Z_LVAL(tmp_entry),
+ (void**)&tmp) == FAILURE) {
+ zval *data;
+ MAKE_STD_ZVAL(data);
+ Z_TYPE_P(data) = IS_LONG;
+ Z_LVAL_P(data) = 1;
+ zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL(tmp_entry), &data, sizeof(data), NULL);
+ } else {
+ Z_LVAL_PP(tmp)++;
+ }
+
+ zval_dtor(&tmp_entry);
+ zend_hash_move_forward_ex(myht, &pos);
+ continue;
}
if (zend_hash_find(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry)+1, (void**)&tmp) == FAILURE) {
@@ -2598,8 +2648,8 @@ PHP_FUNCTION(array_pad)
/* Copy the result hash into return value */
zend_hash_destroy(Z_ARRVAL_P(return_value));
- efree(Z_ARRVAL_P(return_value));
- Z_ARRVAL_P(return_value) = new_hash;
+ *Z_ARRVAL_P(return_value) = *new_hash;
+ FREE_HASHTABLE(new_hash);
/* Clean up */
efree(pads);
@@ -2697,7 +2747,7 @@ PHP_FUNCTION(array_change_key_case)
zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(entry), NULL);
break;
case HASH_KEY_IS_STRING:
- new_key=estrndup(string_key,str_key_len);
+ new_key=estrndup(string_key,str_key_len - 1);
if (change_to_upper)
php_strtoupper(new_key, str_key_len - 1);
else
@@ -2787,7 +2837,8 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
Bucket ***lists, **list, ***ptrs, *p;
char *callback_name;
- zval **old_compare_func;
+ PHP_ARRAY_CMP_FUNC_VARS;
+
int (*intersect_key_compare_func)(const void *, const void * TSRMLS_DC);
int (*intersect_data_compare_func)(const void *, const void * TSRMLS_DC);
@@ -2801,13 +2852,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
WRONG_PARAM_COUNT;
}
- old_compare_func = BG(user_compare_func_name);
- /* clear FCI cache otherwise : for example the same or other array with
- (partly) the same key values has been sorted with uasort() or
- other sorting function the comparison is cached, however the the name
- of the function for comparison is not respected. see bug #28739
- */
- BG(user_compare_fci_cache) = empty_fcall_info_cache;
+ PHP_ARRAY_CMP_FUNC_BACKUP();
if (behavior == INTERSECT_NORMAL) {
intersect_key_compare_func = array_key_compare;
@@ -2962,6 +3007,15 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
/* copy the argument array */
*return_value = **args[0];
zval_copy_ctor(return_value);
+ if (return_value->value.ht == &EG(symbol_table)) {
+ HashTable *ht;
+ zval *tmp;
+
+ ALLOC_HASHTABLE(ht);
+ zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_copy(ht, return_value->value.ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
+ return_value->value.ht = ht;
+ }
if (behavior == INTERSECT_NORMAL && data_compare_type == INTERSECT_COMP_DATA_USER) {
/* array_uintersect() */
@@ -3069,7 +3123,8 @@ out:
pefree(lists[i], hash->persistent);
}
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
+
efree(ptrs);
efree(lists);
@@ -3141,7 +3196,8 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
Bucket ***lists, **list, ***ptrs, *p;
char *callback_name;
- zval **old_compare_func;
+ PHP_ARRAY_CMP_FUNC_VARS;
+
int (*diff_key_compare_func)(const void *, const void * TSRMLS_DC);
int (*diff_data_compare_func)(const void *, const void * TSRMLS_DC);
@@ -3155,13 +3211,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
WRONG_PARAM_COUNT;
}
- old_compare_func = BG(user_compare_func_name);
- /* clear FCI cache otherwise : for example the same or other array with
- (partly) the same key values has been sorted with uasort() or
- other sorting function the comparison is cached, however the the name
- of the function for comparison is not respected. see bug #28739
- */
- BG(user_compare_fci_cache) = empty_fcall_info_cache;
+ PHP_ARRAY_CMP_FUNC_BACKUP();
if (behavior == DIFF_NORMAL) {
diff_key_compare_func = array_key_compare;
@@ -3316,6 +3366,15 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
/* copy the argument array */
*return_value = **args[0];
zval_copy_ctor(return_value);
+ if (return_value->value.ht == &EG(symbol_table)) {
+ HashTable *ht;
+ zval *tmp;
+
+ ALLOC_HASHTABLE(ht);
+ zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_copy(ht, return_value->value.ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
+ return_value->value.ht = ht;
+ }
if (behavior == DIFF_NORMAL && data_compare_type == DIFF_COMP_DATA_USER) {
/* array_udiff() */
@@ -3410,7 +3469,8 @@ out:
pefree(lists[i], hash->persistent);
}
- BG(user_compare_func_name) = old_compare_func;
+ PHP_ARRAY_CMP_FUNC_RESTORE();
+
efree(ptrs);
efree(lists);
@@ -3845,8 +3905,11 @@ PHP_FUNCTION(array_reduce)
efree(callback_name);
if (ZEND_NUM_ARGS() > 2) {
- convert_to_long_ex(initial);
- result = *initial;
+ ALLOC_ZVAL(result);
+ *result = **initial;
+ zval_copy_ctor(result);
+ convert_to_long(result);
+ INIT_PZVAL(result);
} else {
MAKE_STD_ZVAL(result);
ZVAL_NULL(result);
@@ -3862,6 +3925,7 @@ PHP_FUNCTION(array_reduce)
if (result) {
*return_value = *result;
zval_copy_ctor(return_value);
+ zval_ptr_dtor(&result);
}
return;
}
@@ -3911,6 +3975,7 @@ PHP_FUNCTION(array_reduce)
PHP_FUNCTION(array_filter)
{
zval **input, **callback = NULL;
+ zval *array;
zval **operand;
zval **args[1];
zval *retval = NULL;
@@ -3930,6 +3995,7 @@ PHP_FUNCTION(array_filter)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be an array");
return;
}
+ array = *input;
if (ZEND_NUM_ARGS() > 1) {
if (!zend_is_callable(*callback, 0, &callback_name)) {
@@ -3941,13 +4007,13 @@ PHP_FUNCTION(array_filter)
}
array_init(return_value);
- if (zend_hash_num_elements(Z_ARRVAL_PP(input)) == 0) {
+ if (zend_hash_num_elements(Z_ARRVAL_P(array)) == 0) {
return;
}
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&operand, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos)) {
+ for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos);
+ zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **)&operand, &pos) == SUCCESS;
+ zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos)) {
if (callback) {
zend_fcall_info fci;
@@ -3980,7 +4046,7 @@ PHP_FUNCTION(array_filter)
}
zval_add_ref(operand);
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &pos)) {
+ switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(array), &string_key, &string_key_len, &num_key, 0, &pos)) {
case HASH_KEY_IS_STRING:
zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len, operand, sizeof(zval *), NULL);
break;
@@ -4046,6 +4112,7 @@ PHP_FUNCTION(array_map)
efree(array_pos);
return;
}
+ SEPARATE_ZVAL_IF_NOT_REF(pargs[i]);
args[i] = *pargs[i];
array_len[i] = zend_hash_num_elements(Z_ARRVAL_PP(pargs[i]));
if (array_len[i] > maxlen) {
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index f6b4bc3ae..b9b687e5b 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.673.2.13 2005/03/10 12:10:57 hyanantha Exp $ */
+/* $Id: basic_functions.c,v 1.673.2.18 2005/08/21 18:36:33 zeev Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -469,7 +469,6 @@ function_entry basic_functions[] = {
PHP_FALIAS(show_source, highlight_file, NULL)
PHP_FE(highlight_string, NULL)
PHP_FE(php_strip_whitespace, NULL)
- PHP_FE(php_check_syntax, second_arg_force_ref)
PHP_FE(ini_get, NULL)
PHP_FE(ini_get_all, NULL)
@@ -930,7 +929,6 @@ static void basic_globals_ctor(php_basic_globals *basic_globals_p TSRMLS_DC)
BG(user_tick_functions) = NULL;
BG(user_filter_map) = NULL;
BG(user_compare_fci_cache) = empty_fcall_info_cache;
- /*BG(array_walk_fci_cache) = empty_fcall_info_cache;*/
zend_hash_init(&BG(sm_protected_env_vars), 5, NULL, NULL, 1);
BG(sm_allowed_env_vars) = NULL;
@@ -1192,17 +1190,10 @@ PHP_RSHUTDOWN_FUNCTION(basic)
}
STR_FREE(BG(locale_string));
- if (FG(stream_wrappers)) {
- zend_hash_destroy(FG(stream_wrappers));
- efree(FG(stream_wrappers));
- FG(stream_wrappers) = NULL;
- }
-
- if (FG(stream_filters)) {
- zend_hash_destroy(FG(stream_filters));
- efree(FG(stream_filters));
- FG(stream_filters) = NULL;
- }
+ /*
+ FG(stream_wrappers) and FG(stream_filters) are destroyed
+ during php_request_shutdown()
+ */
PHP_RSHUTDOWN(filestat)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
#ifdef HAVE_SYSLOG_H
@@ -1909,7 +1900,7 @@ PHP_FUNCTION(call_user_func)
convert_to_string_ex(params[0]);
}
- if (!zend_is_callable(*params[0], 0, &name)) {
+ if (!zend_is_callable(*params[0], IS_CALLABLE_CHECK_NO_ACCESS, &name)) {
php_error_docref1(NULL TSRMLS_CC, name, E_WARNING, "First argument is expected to be a valid callback");
efree(name);
efree(params);
@@ -1964,7 +1955,7 @@ PHP_FUNCTION(call_user_func_array)
convert_to_string_ex(func);
}
- if (!zend_is_callable(*func, 0, &name)) {
+ if (!zend_is_callable(*func, IS_CALLABLE_CHECK_NO_ACCESS, &name)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argument is expected to be a valid callback, '%s' was given", name);
efree(name);
RETURN_NULL();
@@ -2103,17 +2094,21 @@ void user_tick_function_dtor(user_tick_function_entry *tick_function_entry)
static int user_shutdown_function_call(php_shutdown_function_entry *shutdown_function_entry TSRMLS_DC)
{
zval retval;
-
- if (call_user_function( EG(function_table), NULL,
- shutdown_function_entry->arguments[0],
- &retval,
- shutdown_function_entry->arg_count - 1,
- shutdown_function_entry->arguments + 1
- TSRMLS_CC ) == SUCCESS ) {
+ char *function_name = NULL;
+
+ if (!zend_is_callable(shutdown_function_entry->arguments[0], 0, &function_name)) {
+ php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", function_name);
+ } else if (call_user_function(EG(function_table), NULL,
+ shutdown_function_entry->arguments[0],
+ &retval,
+ shutdown_function_entry->arg_count - 1,
+ shutdown_function_entry->arguments + 1
+ TSRMLS_CC ) == SUCCESS)
+ {
zval_dtor(&retval);
-
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s() - function does not exist", Z_STRVAL_P(shutdown_function_entry->arguments[0]));
+ }
+ if (function_name) {
+ efree(function_name);
}
return 0;
}
@@ -2206,6 +2201,7 @@ void php_free_shutdown_functions(TSRMLS_D)
PHP_FUNCTION(register_shutdown_function)
{
php_shutdown_function_entry shutdown_function_entry;
+ char *function_name = NULL;
int i;
shutdown_function_entry.arg_count = ZEND_NUM_ARGS();
@@ -2214,26 +2210,31 @@ PHP_FUNCTION(register_shutdown_function)
WRONG_PARAM_COUNT;
}
- shutdown_function_entry.arguments = (pval **) safe_emalloc(sizeof(pval *), shutdown_function_entry.arg_count, 0);
+ shutdown_function_entry.arguments = (zval **) safe_emalloc(sizeof(zval *), shutdown_function_entry.arg_count, 0);
if (zend_get_parameters_array(ht, shutdown_function_entry.arg_count, shutdown_function_entry.arguments) == FAILURE) {
RETURN_FALSE;
}
- /* Prevent entering of anything but arrays/strings */
- if (Z_TYPE_P(shutdown_function_entry.arguments[0]) != IS_ARRAY) {
- convert_to_string(shutdown_function_entry.arguments[0]);
- }
-
- if (!BG(user_shutdown_function_names)) {
- ALLOC_HASHTABLE(BG(user_shutdown_function_names));
- zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0);
- }
+ /* Prevent entering of anything but valid callback (syntax check only!) */
+ if (!zend_is_callable(shutdown_function_entry.arguments[0], 1, &function_name)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid shutdown callback '%s' passed", function_name);
+ efree(shutdown_function_entry.arguments);
+ RETVAL_FALSE;
+ } else {
+ if (!BG(user_shutdown_function_names)) {
+ ALLOC_HASHTABLE(BG(user_shutdown_function_names));
+ zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0);
+ }
- for (i = 0; i < shutdown_function_entry.arg_count; i++) {
- shutdown_function_entry.arguments[i]->refcount++;
+ for (i = 0; i < shutdown_function_entry.arg_count; i++) {
+ shutdown_function_entry.arguments[i]->refcount++;
+ }
+ zend_hash_next_index_insert(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL);
+ }
+ if (function_name) {
+ efree(function_name);
}
- zend_hash_next_index_insert(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL);
}
/* }}} */
@@ -2323,49 +2324,6 @@ PHP_FUNCTION(php_strip_whitespace)
}
/* }}} */
-/* {{{ proto bool php_check_syntax(string file_name [, &$error_message])
- Check the syntax of the specified file. */
-PHP_FUNCTION(php_check_syntax)
-{
- char *filename;
- int filename_len;
- zval *errm=NULL;
- zend_file_handle file_handle = {0};
-
- int old_errors = PG(display_errors);
- int log_errors = PG(log_errors);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &filename, &filename_len, &errm) == FAILURE) {
- RETURN_FALSE;
- }
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = filename;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- PG(log_errors) = PG(display_errors) = 0;
-
- if (php_lint_script(&file_handle TSRMLS_CC) != SUCCESS) {
- if (errm) {
- char *error_str;
-
- zval_dtor(errm);
- spprintf(&error_str, 0, "%s in %s on line %d", PG(last_error_message), PG(last_error_file), PG(last_error_lineno));
- ZVAL_STRING(errm, error_str, 0);
- }
- RETVAL_FALSE;
- } else {
- RETVAL_TRUE;
- }
-
- PG(display_errors) = old_errors;
- PG(log_errors) = log_errors;
-
- return;
-}
-/* }}} */
-
/* {{{ proto bool highlight_string(string string [, bool return] )
Syntax highlight a string or optionally return it */
PHP_FUNCTION(highlight_string)
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index 59fb04f33..655bdcc3a 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.h,v 1.133 2004/03/27 00:50:39 helly Exp $ */
+/* $Id: basic_functions.h,v 1.133.2.2 2005/08/21 18:36:34 zeev Exp $ */
#ifndef BASIC_FUNCTIONS_H
#define BASIC_FUNCTIONS_H
@@ -82,7 +82,6 @@ PHP_FUNCTION(register_shutdown_function);
PHP_FUNCTION(highlight_file);
PHP_FUNCTION(highlight_string);
PHP_FUNCTION(php_strip_whitespace);
-PHP_FUNCTION(php_check_syntax);
ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);
PHP_FUNCTION(ini_get);
@@ -154,7 +153,6 @@ typedef struct _php_basic_globals {
ulong strtok_len;
char str_ebuf[40];
zval **array_walk_func_name;
- zend_fcall_info_cache array_walk_fci_cache;
zval **user_compare_func_name;
zend_fcall_info_cache user_compare_fci_cache;
zend_llist *user_tick_functions;
diff --git a/ext/standard/credits_ext.h b/ext/standard/credits_ext.h
index 203af04ae..aa2aa4f45 100644
--- a/ext/standard/credits_ext.h
+++ b/ext/standard/credits_ext.h
@@ -46,13 +46,12 @@ CREDIT_LINE("mhash", "Sascha Schumann");
CREDIT_LINE("mime_magic", "Hartmut Holzgraefe");
CREDIT_LINE("MING", "Dave Hayden, Frank M. Kromann");
CREDIT_LINE("mnoGoSearch", "Sergey Kartashoff, Alex Barkov, Ramil Kalimullin");
-CREDIT_LINE("mono", "Sterling Hughes");
+CREDIT_LINE("MS SQL", "Frank M. Kromann");
CREDIT_LINE("msession", "Mark L. Woodward");
CREDIT_LINE("mSQL", "Zeev Suraski");
-CREDIT_LINE("MS SQL", "Frank M. Kromann");
CREDIT_LINE("Multibyte String Functions", "Tsukada Takuya, Rui Hirokawa");
-CREDIT_LINE("MySQLi", "Zak Greant, Georg Richter");
CREDIT_LINE("MySQL", "Zeev Suraski, Zak Greant, Georg Richter");
+CREDIT_LINE("MySQLi", "Zak Greant, Georg Richter");
CREDIT_LINE("ncurses", "Ilia Alshanetsky, Wez Furlong, Hartmut Holzgraefe, Georg Richter");
CREDIT_LINE("OCI8", "Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal");
CREDIT_LINE("ODBC", "Stig Bakken, Andreas Karajannis, Frank M. Kromann, Daniel R. Kalowsky");
@@ -60,7 +59,6 @@ CREDIT_LINE("OpenSSL", "Stig Venaas, Wez Furlong, Sascha Kettler");
CREDIT_LINE("Oracle", "Stig Bakken, Mitch Golden, Rasmus Lerdorf, Andreas Karajannis, Thies C. Arntzen");
CREDIT_LINE("Ovrimos", "Nikos Mavroyanopoulos");
CREDIT_LINE("pcntl", "Jason Greene");
-CREDIT_LINE("PDF", "Uwe Steinmann, Rainer Schaaf");
CREDIT_LINE("Perl Compatible Regexps", "Andrei Zmievski");
CREDIT_LINE("Posix", "Kristian Köhntopp");
CREDIT_LINE("PostgreSQL", "Jouni Ahto, Zeev Suraski, Yasuo Ohgaki");
@@ -71,9 +69,10 @@ CREDIT_LINE("Sessions", "Sascha Schumann, Andrei Zmievski");
CREDIT_LINE("Shared Memory Operations", "Slava Poliakov, Ilia Alshanetsky");
CREDIT_LINE("SimpleXML", "Sterling Hughes, Marcus Boerger, Rob Richards");
CREDIT_LINE("SNMP", "Rasmus Lerdorf, Harrie Hazewinkel, Mike Jackson, Steven Lawrance, Johann Hanne");
+CREDIT_LINE("SOAP", "Brad Lafountain, Shane Caraveo, Dmitry Stogov");
CREDIT_LINE("Sockets", "Chris Vandomelen, Sterling Hughes, Daniel Beulshausen, Jason Greene");
CREDIT_LINE("SPL", "Marcus Boerger");
-CREDIT_LINE("SQLite", "Wez Furlong, Tal Peer, Marcus Börger, Ilia Alshanetsky");
+CREDIT_LINE("SQLite", "Wez Furlong, Tal Peer, Marcus Boerger, Ilia Alshanetsky");
CREDIT_LINE("Sybase-CT", "Zeev Suraski, Tom May, Timm Friebe");
CREDIT_LINE("Sybase-DB", "Zeev Suraski");
CREDIT_LINE("System V Message based IPC", "Wez Furlong");
@@ -84,9 +83,8 @@ CREDIT_LINE("tokenizer", "Andrei Zmievski");
CREDIT_LINE("Verisign Payflow Pro", "John Donagher, David Croft");
CREDIT_LINE("W32API", "James Moore");
CREDIT_LINE("WDDX", "Andrei Zmievski");
-CREDIT_LINE("xmlrpc", "Dan Libby");
CREDIT_LINE("XML", "Stig Bakken, Thies C. Arntzen, Sterling Hughes");
+CREDIT_LINE("xmlrpc", "Dan Libby");
CREDIT_LINE("XSL", "Christian Stocker, Rob Richards");
-CREDIT_LINE("YAZ", "Adam Dickmeiss");
CREDIT_LINE("Yellow Pages", "Stephanie Wehner, Fredrik Ohrn");
CREDIT_LINE("Zlib", "Rasmus Lerdorf, Stefan Roehrich, Zeev Suraski, Jade Nicoletti");
diff --git a/ext/standard/credits_sapi.h b/ext/standard/credits_sapi.h
index ab7c2755a..e91957141 100644
--- a/ext/standard/credits_sapi.h
+++ b/ext/standard/credits_sapi.h
@@ -10,7 +10,6 @@
*/
-CREDIT_LINE("ActiveScript", "Wez Furlong");
CREDIT_LINE("AOLserver", "Sascha Schumann");
CREDIT_LINE("Apache 1.3 (apache_hooks)", "Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar, George Schlossnagle, Lukas Schroeder");
CREDIT_LINE("Apache 1.3", "Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar");
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index 4d33eb91d..ee7bd4903 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: datetime.c,v 1.121.2.4 2005/03/11 09:07:34 hyanantha Exp $ */
+/* $Id: datetime.c,v 1.121.2.6 2005/08/30 09:15:58 derick Exp $ */
#include "php.h"
#include "zend_operators.h"
@@ -657,7 +657,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
wk = (yd + 6 - wd + fd) / 7 - (fd > 3);
}
- sprintf(tmp_buff, "%d", wk); /* SAFE */
+ sprintf(tmp_buff, "%02d", wk); /* SAFE */
strcat(Z_STRVAL_P(return_value), tmp_buff);
break;
@@ -953,7 +953,7 @@ char *php_std_date(time_t t TSRMLS_DC)
tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
} else {
snprintf(str, 80, "%s, %02d-%s-%02d %02d:%02d:%02d GMT",
- day_short_names[tm1->tm_wday],
+ day_full_names[tm1->tm_wday],
tm1->tm_mday,
mon_short_names[tm1->tm_mon],
((tm1->tm_year) % 100),
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index f56357046..5b66413f9 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dl.c,v 1.96.2.2 2005/03/21 08:34:37 hyanantha Exp $ */
+/* $Id: dl.c,v 1.96.2.3 2005/05/04 13:48:01 hyanantha Exp $ */
#include "php.h"
#include "dl.h"
@@ -142,7 +142,6 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
efree(libpath);
-#ifndef NETWARE
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
/*
@@ -153,23 +152,6 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
if (!get_module)
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "_get_module");
-#else
- /* NetWare doesn't support two NLMs exporting same symbol */
- {
- char symbol_name[64] = "\0";
- int module_name_length = Z_STRLEN_P(file) - 4; /* '.nlm' is 4 characters; knock it off */
-
- /* Take the module name (e.g.: 'php_ldap') and append '@get_module' to it */
- strncpy(symbol_name, Z_STRVAL_P(file), module_name_length);
- symbol_name[module_name_length] = '\0';
- strcat(symbol_name, "@");
- strcat(symbol_name, "get_module");
-
- get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, symbol_name);
- }
- /* NetWare doesn't prepend '_' to symbol names; so the corresponding portion of code is also
- not required for NetWare */
-#endif
if (!get_module) {
DL_UNLOAD(handle);
diff --git a/ext/standard/file.c b/ext/standard/file.c
index f72a4e4c0..99a51716a 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.382.2.8 2005/03/27 15:53:30 iliaa Exp $ */
+/* $Id: file.c,v 1.382.2.9 2005/04/06 13:59:48 iliaa Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -275,13 +275,13 @@ PHP_FUNCTION(flock)
/* flock_values contains all possible actions if (operation & 4) we won't block on the lock */
act = flock_values[act - 1] | (operation & 4 ? LOCK_NB : 0);
- if (!php_stream_lock(stream, act)) {
+ if (php_stream_lock(stream, act)) {
if (operation && errno == EWOULDBLOCK && arg3 && PZVAL_IS_REF(arg3)) {
Z_LVAL_P(arg3) = 1;
}
- RETURN_TRUE;
+ RETURN_FALSE;
}
- RETURN_FALSE;
+ RETURN_TRUE;
}
/* }}} */
diff --git a/ext/standard/file.h b/ext/standard/file.h
index c9f541db1..abb1ca71b 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.h,v 1.90 2004/06/21 21:08:05 pollita Exp $ */
+/* $Id: file.h,v 1.90.2.1 2005/07/15 09:29:18 hyanantha Exp $ */
/* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */
@@ -59,7 +59,7 @@ PHP_FUNCTION(get_meta_tags);
PHP_FUNCTION(flock);
PHP_FUNCTION(fd_set);
PHP_FUNCTION(fd_isset);
-#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
+#if (!defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
PHP_FUNCTION(realpath);
PHP_FUNCTION(fnmatch);
#endif
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 18b6fcf7b..d48896e34 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filestat.c,v 1.130.2.2 2005/03/11 11:20:24 hyanantha Exp $ */
+/* $Id: filestat.c,v 1.130.2.4 2005/07/15 09:29:18 hyanantha Exp $ */
#include "php.h"
#include "safe_mode.h"
@@ -464,11 +464,7 @@ PHP_FUNCTION(touch)
{
pval **filename, **filetime, **fileatime;
int ret;
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc sb;
-#else
struct stat sb;
-#endif
FILE *file;
struct utimbuf newtimebuf;
struct utimbuf *newtime = NULL;
@@ -550,11 +546,7 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
{
zval *stat_dev, *stat_ino, *stat_mode, *stat_nlink, *stat_uid, *stat_gid, *stat_rdev,
*stat_size, *stat_atime, *stat_mtime, *stat_ctime, *stat_blksize, *stat_blocks;
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc *stat_sb;
-#else
struct stat *stat_sb;
-#endif
php_stream_statbuf ssb;
int flags = 0, rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */
char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev",
@@ -637,30 +629,26 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
case FS_INODE:
RETURN_LONG((long)ssb.sb.st_ino);
case FS_SIZE:
-#if defined(NETWARE) && defined(NEW_LIBC)
- RETURN_LONG((long)(stat_sb->st_size));
-#else
RETURN_LONG((long)ssb.sb.st_size);
-#endif
case FS_OWNER:
RETURN_LONG((long)ssb.sb.st_uid);
case FS_GROUP:
RETURN_LONG((long)ssb.sb.st_gid);
case FS_ATIME:
#ifdef NETWARE
- RETURN_LONG((long)((stat_sb->st_atime).tv_sec));
+ RETURN_LONG((long)ssb.sb.st_atime.tv_sec);
#else
RETURN_LONG((long)ssb.sb.st_atime);
#endif
case FS_MTIME:
#ifdef NETWARE
- RETURN_LONG((long)((stat_sb->st_mtime).tv_sec));
+ RETURN_LONG((long)ssb.sb.st_mtime.tv_sec);
#else
RETURN_LONG((long)ssb.sb.st_mtime);
#endif
case FS_CTIME:
#ifdef NETWARE
- RETURN_LONG((long)((stat_sb->st_ctime).tv_sec));
+ RETURN_LONG((long)ssb.sb.st_ctime.tv_sec);
#else
RETURN_LONG((long)ssb.sb.st_ctime);
#endif
diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c
index 0be10abc3..63f2973b2 100644
--- a/ext/standard/flock_compat.c
+++ b/ext/standard/flock_compat.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: flock_compat.c,v 1.27 2004/01/08 08:17:31 andi Exp $ */
+/* $Id: flock_compat.c,v 1.27.2.1 2005/06/28 13:46:45 hyanantha Exp $ */
#include "php.h"
#include <errno.h>
@@ -33,11 +33,7 @@
#endif
#ifdef NETWARE
-#ifdef NEW_LIBC
#include <netinet/in.h>
-#else
-#include <sys/socket.h>
-#endif
#endif
#ifndef HAVE_FLOCK
diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h
index 8c9bbad26..6ca9d2719 100644
--- a/ext/standard/fsock.h
+++ b/ext/standard/fsock.h
@@ -18,21 +18,13 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fsock.h,v 1.47 2004/01/08 17:32:51 sniper Exp $ */
+/* $Id: fsock.h,v 1.47.2.2 2005/07/25 13:10:19 hyanantha Exp $ */
/* Synced with php 3.0 revision 1.24 1999-06-18 [ssb] */
#ifndef FSOCK_H
#define FSOCK_H
-#ifdef NETWARE
-#ifdef NEW_LIBC
-#include "sys/timeval.h"
-#else
-#include "netware/time_nw.h" /* For 'timeval' */
-#endif
-#endif
-
#include "file.h"
#include "php_network.h"
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 71c5c2ec4..a7be53ac9 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -18,7 +18,7 @@
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: ftp_fopen_wrapper.c,v 1.74.2.4 2005/03/21 08:42:34 hyanantha Exp $ */
+/* $Id: ftp_fopen_wrapper.c,v 1.74.2.7 2005/06/27 08:16:42 sesser Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -113,7 +113,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path
{
php_stream *stream = NULL, *reuseid = NULL;
php_url *resource = NULL;
- int result, use_ssl, use_ssl_on_data = 0;
+ int result, use_ssl, use_ssl_on_data = 0, tmp_len;
char *scratch;
char tmp_line[512];
@@ -206,10 +206,24 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path
#endif
}
+#define PHP_FTP_CNTRL_CHK(val, val_len, err_msg) { \
+ unsigned char *s = val, *e = s + val_len; \
+ while (s < e) { \
+ if (iscntrl(*s)) { \
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, err_msg, val); \
+ goto connect_errexit; \
+ } \
+ s++; \
+ } \
+}
+
/* send the user name */
php_stream_write_string(stream, "USER ");
if (resource->user != NULL) {
- php_raw_url_decode(resource->user, strlen(resource->user));
+ tmp_len = php_raw_url_decode(resource->user, strlen(resource->user));
+
+ PHP_FTP_CNTRL_CHK(resource->user, tmp_len, "Invalid login %s")
+
php_stream_write_string(stream, resource->user);
} else {
php_stream_write_string(stream, "anonymous");
@@ -225,7 +239,10 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path
php_stream_write_string(stream, "PASS ");
if (resource->pass != NULL) {
- php_raw_url_decode(resource->pass, strlen(resource->pass));
+ tmp_len = php_raw_url_decode(resource->pass, strlen(resource->pass));
+
+ PHP_FTP_CNTRL_CHK(resource->pass, tmp_len, "Invalid password %s")
+
php_stream_write_string(stream, resource->pass);
} else {
/* if the user has configured who they are,
@@ -266,7 +283,11 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path
return stream;
- connect_errexit:
+connect_errexit:
+ if (resource) {
+ php_url_free(resource);
+ }
+
if (stream) {
php_stream_close(stream);
}
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 70d235d5e..e59754f57 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -15,14 +15,9 @@
| Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: head.c,v 1.75.2.1 2005/01/07 21:16:00 tony2001 Exp $ */
+/* $Id: head.c,v 1.75.2.2 2005/06/28 14:49:14 hyanantha Exp $ */
#include <stdio.h>
-
-#if defined(NETWARE) && !defined(NEW_LIBC)
-#include <sys/socket.h>
-#endif
-
#include "php.h"
#include "ext/standard/php_standard.h"
#include "SAPI.h"
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 1582d4ea1..aa96423f7 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: html.c,v 1.97.2.8 2005/03/21 08:43:57 hyanantha Exp $ */
+/* $Id: html.c,v 1.97.2.10 2005/05/11 14:58:34 jorton Exp $ */
/*
* HTML entity resources:
@@ -58,7 +58,7 @@ enum entity_charset { cs_terminator, cs_8859_1, cs_cp1252,
cs_big5hkscs, cs_sjis, cs_eucjp, cs_koi8r,
cs_cp1251, cs_8859_5, cs_cp866, cs_macroman
};
-typedef const char *entity_table_t;
+typedef const char *const entity_table_t;
/* codepage 1252 is a Windows extension to iso-8859-1. */
static entity_table_t ent_cp_1252[] = {
@@ -113,11 +113,11 @@ static entity_table_t ent_uni_338_402[] = {
"Scaron", "scaron", NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- /* 376 (0x0178)
+ /* 376 (0x0178) */
"Yuml", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, */
- /* 400 (0x0190)*/
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ /* 400 (0x0190) */
NULL, NULL, "fnof"
};
@@ -988,7 +988,11 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
if ((code >= 0x80 && code < 0xa0) || code > 0xff) {
invalid_code = 1;
} else {
- *(q++) = code;
+ if (code == 39 || !quote_style) {
+ invalid_code = 1;
+ } else {
+ *(q++) = code;
+ }
}
break;
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index d2cf689e3..f46041558 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -18,7 +18,7 @@
| Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: http_fopen_wrapper.c,v 1.88.2.1 2005/03/21 08:46:50 hyanantha Exp $ */
+/* $Id: http_fopen_wrapper.c,v 1.88.2.4 2005/06/06 12:41:28 derick Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -101,6 +101,8 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
char *transport_string, *errstr = NULL;
int transport_len, have_header = 0, request_fulluri = 0;
+ tmp_line[0] = '\0';
+
if (redirect_max < 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Circular redirect, aborting.");
return NULL;
@@ -517,6 +519,34 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
} else {
strlcpy(new_path, location, sizeof(new_path));
}
+
+ php_url_free(resource);
+ /* check for invalid redirection URLs */
+ if ((resource = php_url_parse(new_path)) == NULL) {
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Invalid redirect url! %s", new_path);
+ goto out;
+ }
+
+#define CHECK_FOR_CNTRL_CHARS(val) { \
+ if (val) { \
+ unsigned char *s, *e; \
+ int l; \
+ l = php_url_decode(val, strlen(val)); \
+ s = val; e = s + l; \
+ while (s < e) { \
+ if (iscntrl(*s)) { \
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Invalid redirect url! %s", new_path); \
+ goto out; \
+ } \
+ s++; \
+ } \
+ } \
+} \
+ /* check for control characters in login, password & path */
+ CHECK_FOR_CNTRL_CHARS(resource->user)
+ CHECK_FOR_CNTRL_CHARS(resource->pass)
+ CHECK_FOR_CNTRL_CHARS(resource->path)
+
stream = php_stream_url_wrap_http_ex(NULL, new_path, mode, options, opened_path, context, --redirect_max, 0 STREAMS_CC TSRMLS_CC);
if (stream && stream->wrapperdata) {
entryp = &entry;
@@ -541,7 +571,9 @@ out:
efree(http_header_line);
if (scratch)
efree(scratch);
- php_url_free(resource);
+ if (resource) {
+ php_url_free(resource);
+ }
if (stream) {
if (header_init) {
diff --git a/ext/standard/image.c b/ext/standard/image.c
index cb256bc65..db22f779a 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -17,13 +17,10 @@
+----------------------------------------------------------------------+
*/
-/* $Id: image.c,v 1.98.2.8 2005/03/06 17:04:22 iliaa Exp $ */
+/* $Id: image.c,v 1.98.2.10 2005/06/28 15:22:39 hyanantha Exp $ */
#include "php.h"
#include <stdio.h>
-#if defined(NETWARE) && !defined(NEW_LIBC)
-#include <sys/socket.h>
-#endif
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
@@ -401,7 +398,7 @@ static unsigned int php_next_marker(php_stream * stream, int last_marker, int co
last_marker = M_PSEUDO; /* stop skipping non 0xff for M_COM */
}
}
- if (++a > 10)
+ if (++a > 25)
{
/* who knows the maxim amount of 0xff? though 7 */
/* but found other implementations */
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 031aa0a72..0e3ae4412 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: info.c,v 1.245 2004/05/02 13:23:30 helly Exp $ */
+/* $Id: info.c,v 1.245.2.5 2005/08/16 00:25:46 iliaa Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -135,10 +135,25 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
PUTS(" => ");
}
if (Z_TYPE_PP(tmp) == IS_ARRAY) {
+ zval *tmp3;
+
+ MAKE_STD_ZVAL(tmp3);
+
if (!sapi_module.phpinfo_as_text) {
PUTS("<pre>");
}
+ php_start_ob_buffer(NULL, 4096, 1 TSRMLS_CC);
+
zend_print_zval_r(*tmp, 0 TSRMLS_CC);
+
+ php_ob_get_buffer(tmp3 TSRMLS_CC);
+ php_end_ob_buffer(0, 0 TSRMLS_CC);
+
+ elem_esc = php_info_html_esc(Z_STRVAL_P(tmp3) TSRMLS_CC);
+ PUTS(elem_esc);
+ efree(elem_esc);
+ zval_ptr_dtor(&tmp3);
+
if (!sapi_module.phpinfo_as_text) {
PUTS("</pre>");
}
@@ -198,7 +213,7 @@ void php_info_print_style(TSRMLS_D)
PHPAPI char *php_info_html_esc(char *string TSRMLS_DC)
{
int new_len;
- return php_escape_html_entities(string, strlen(string), &new_len, 0, ENT_NOQUOTES, NULL TSRMLS_CC);
+ return php_escape_html_entities(string, strlen(string), &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
}
/* }}} */
@@ -406,7 +421,9 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
if (expose_php && !sapi_module.phpinfo_as_text) {
PUTS("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");
if (SG(request_info).request_uri) {
- PUTS(SG(request_info).request_uri);
+ char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);
+ PUTS(elem_esc);
+ efree(elem_esc);
}
PUTS("?=");
logo_guid = php_logo_guid();
@@ -467,6 +484,12 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
php_info_print_table_row(2, "Thread Safety", "disabled" );
#endif
+#if USE_ZEND_ALLOC
+ php_info_print_table_row(2, "Zend Memory Manager", "enabled" );
+#else
+ php_info_print_table_row(2, "Zend Memory Manager", "disabled" );
+#endif
+
#if HAVE_IPV6
php_info_print_table_row(2, "IPv6 Support", "enabled" );
#else
@@ -551,7 +574,9 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
if (expose_php && !sapi_module.phpinfo_as_text) {
PUTS("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\"");
if (SG(request_info).request_uri) {
- PUTS(SG(request_info).request_uri);
+ char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);
+ PUTS(elem_esc);
+ efree(elem_esc);
}
PUTS("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n");
}
@@ -570,7 +595,9 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
php_info_print_hr();
PUTS("<h1><a href=\"");
if (SG(request_info).request_uri) {
- PUTS(SG(request_info).request_uri);
+ char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);
+ PUTS(elem_esc);
+ efree(elem_esc);
}
PUTS("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
PUTS("PHP Credits");
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
index 072f19b41..441f9eb81 100644
--- a/ext/standard/lcg.c
+++ b/ext/standard/lcg.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: lcg.c,v 1.38 2004/01/08 08:17:33 andi Exp $ */
+/* $Id: lcg.c,v 1.38.2.2 2005/07/25 13:10:18 hyanantha Exp $ */
#include "php.h"
#include "php_lcg.h"
@@ -27,12 +27,6 @@
#ifdef PHP_WIN32
#include "win32/time.h"
-#elif defined(NETWARE)
-#ifdef NEW_LIBC
-#include <sys/timeval.h>
-#else
-#include "netware/time_nw.h"
-#endif
#else
#include <sys/time.h>
#endif
diff --git a/ext/standard/link.c b/ext/standard/link.c
index 6c3e3e5f5..486efe31f 100644
--- a/ext/standard/link.c
+++ b/ext/standard/link.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: link.c,v 1.48.2.2 2005/03/11 08:51:08 hyanantha Exp $ */
+/* $Id: link.c,v 1.48.2.3 2005/07/15 09:29:19 hyanantha Exp $ */
#include "php.h"
#include "php_filestat.h"
@@ -89,11 +89,7 @@ PHP_FUNCTION(readlink)
PHP_FUNCTION(linkinfo)
{
zval **filename;
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc sb;
-#else
struct stat sb;
-#endif
int ret;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index e122c2b76..4ad612bfd 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mail.c,v 1.82.2.1 2004/08/03 06:26:59 tony2001 Exp $ */
+/* $Id: mail.c,v 1.82.2.3 2005/07/28 08:48:31 hyanantha Exp $ */
#include <stdlib.h>
#include <ctype.h>
@@ -42,8 +42,8 @@
#endif
#ifdef NETWARE
-#include "netware/pipe.h" /* For popen(), pclose() */
-#include "netware/sysexits.h" /* For exit status codes like EX_OK */
+#define EX_OK 0 /* successful termination */
+#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
#endif
#define SKIP_LONG_HEADER_SEP(str, pos) \
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 503031572..faf1e7e06 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: math.c,v 1.115.2.2 2004/12/14 00:38:35 iliaa Exp $ */
+/* $Id: math.c,v 1.115.2.3 2005/07/29 13:00:11 sniper Exp $ */
#include "php.h"
#include "php_math.h"
@@ -1139,7 +1139,7 @@ PHP_FUNCTION(number_format)
if (Z_TYPE_PP(d_p) != IS_NULL) {
convert_to_string_ex(d_p);
- if (Z_STRLEN_PP(d_p)==1) {
+ if (Z_STRLEN_PP(d_p)>=1) {
dec_point=Z_STRVAL_PP(d_p)[0];
} else if (Z_STRLEN_PP(d_p)==0) {
dec_point=0;
@@ -1147,7 +1147,7 @@ PHP_FUNCTION(number_format)
}
if (Z_TYPE_PP(t_s) != IS_NULL) {
convert_to_string_ex(t_s);
- if (Z_STRLEN_PP(t_s)==1) {
+ if (Z_STRLEN_PP(t_s)>=1) {
thousand_sep=Z_STRVAL_PP(t_s)[0];
} else if(Z_STRLEN_PP(t_s)==0) {
thousand_sep=0;
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
index 8c4a695d4..6b6b03b05 100644
--- a/ext/standard/md5.c
+++ b/ext/standard/md5.c
@@ -16,16 +16,14 @@
+----------------------------------------------------------------------+
*/
-/* $Id: md5.c,v 1.35 2004/01/08 08:17:33 andi Exp $ */
+/* $Id: md5.c,v 1.35.2.2 2005/04/16 09:50:13 thetaphi Exp $ */
/*
* md5.c - Copyright 1997 Lachlan Roche
* md5_file() added by Alessandro Astarita <aleast@capri.it>
*/
-#include <stdio.h>
#include "php.h"
-
#include "md5.h"
PHPAPI void make_digest(char *md5str, unsigned char *digest)
@@ -81,40 +79,31 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
unsigned char digest[16];
PHP_MD5_CTX context;
int n;
- FILE *fp;
+ php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
return;
}
-
- if (PG(safe_mode) && (!php_checkuid(arg, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(arg TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if ((fp = VCWD_FOPEN(arg, "rb")) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open file");
+
+ stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL);
+ if (!stream) {
RETURN_FALSE;
}
PHP_MD5Init(&context);
- while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) {
+ while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
PHP_MD5Update(&context, buf, n);
}
PHP_MD5Final(digest, &context);
- if (ferror(fp)) {
- fclose(fp);
+ php_stream_close(stream);
+
+ if (n<0) {
RETURN_FALSE;
}
- fclose(fp);
-
if (raw_output) {
RETURN_STRINGL(digest, 16, 1);
} else {
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
index cff47ab6a..08a83b696 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: microtime.c,v 1.44.2.1 2005/03/01 21:33:03 iliaa Exp $ */
+/* $Id: microtime.c,v 1.44.2.2 2005/06/28 15:19:35 hyanantha Exp $ */
#include "php.h"
@@ -25,12 +25,6 @@
#endif
#ifdef PHP_WIN32
#include "win32/time.h"
-#elif defined(NETWARE)
-#ifdef NEW_LIBC
-#include <sys/timeval.h>
-#else
-#include "netware/time_nw.h"
-#endif
#else
#include <sys/time.h>
#endif
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index e8255b644..7a0c70384 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -15,7 +15,7 @@
| Author: Chris Schneider <cschneid@relog.ch> |
+----------------------------------------------------------------------+
*/
-/* $Id: pack.c,v 1.52.2.3 2005/03/21 08:55:43 hyanantha Exp $ */
+/* $Id: pack.c,v 1.52.2.4 2005/05/27 02:03:27 iliaa Exp $ */
#include "php.h"
@@ -824,7 +824,9 @@ PHP_FUNCTION(unpack)
inputpos += size;
if (inputpos < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type);
+ if (size != -1) { /* only print warning if not working with * */
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: outside of string", type);
+ }
inputpos = 0;
}
} else if (arg < 0) {
diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c
index 39d1d4023..78faba588 100644
--- a/ext/standard/pageinfo.c
+++ b/ext/standard/pageinfo.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pageinfo.c,v 1.37.2.1 2005/03/10 12:26:14 hyanantha Exp $ */
+/* $Id: pageinfo.c,v 1.37.2.2 2005/07/15 09:29:19 hyanantha Exp $ */
#include "php.h"
#include "pageinfo.h"
@@ -59,11 +59,7 @@
*/
PHPAPI void php_statpage(TSRMLS_D)
{
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc *pstat;
-#else
struct stat *pstat;
-#endif
pstat = sapi_get_stat(TSRMLS_C);
@@ -73,7 +69,7 @@ PHPAPI void php_statpage(TSRMLS_D)
BG(page_gid) = pstat->st_gid;
BG(page_inode) = pstat->st_ino;
#ifdef NETWARE
- BG(page_mtime) = (pstat->st_mtime).tv_nsec;
+ BG(page_mtime) = (pstat->st_mtime).tv_sec;
#else
BG(page_mtime) = pstat->st_mtime;
#endif
diff --git a/ext/standard/parsedate.c b/ext/standard/parsedate.c
index e6dbcd6b8..4cb276415 100644
--- a/ext/standard/parsedate.c
+++ b/ext/standard/parsedate.c
@@ -33,7 +33,7 @@
** This code is in the public domain and has no copyright.
*/
-/* $Id: parsedate.y,v 1.56.2.1 2004/11/15 16:30:46 derick Exp $ */
+/* $Id: parsedate.y,v 1.56.2.2 2005/05/20 11:14:01 derick Exp $ */
#include "php.h"
@@ -1878,7 +1878,7 @@ static TABLE const OtherTable[] = {
{ "now", tDAY_UNIT, 0 },
{ "last", tUNUMBER, -1 },
{ "this", tUNUMBER, 0 },
- { "next", tUNUMBER, 2 },
+ { "next", tUNUMBER, 1 },
{ "first", tUNUMBER, 1 },
/* { "second", tUNUMBER, 2 }, */
{ "third", tUNUMBER, 3 },
diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y
index a8a92bf4b..6502fb355 100644
--- a/ext/standard/parsedate.y
+++ b/ext/standard/parsedate.y
@@ -8,7 +8,7 @@
** This code is in the public domain and has no copyright.
*/
-/* $Id: parsedate.y,v 1.56.2.1 2004/11/15 16:30:46 derick Exp $ */
+/* $Id: parsedate.y,v 1.56.2.2 2005/05/20 11:14:01 derick Exp $ */
#include "php.h"
@@ -635,7 +635,7 @@ static TABLE const OtherTable[] = {
{ "now", tDAY_UNIT, 0 },
{ "last", tUNUMBER, -1 },
{ "this", tUNUMBER, 0 },
- { "next", tUNUMBER, 2 },
+ { "next", tUNUMBER, 1 },
{ "first", tUNUMBER, 1 },
/* { "second", tUNUMBER, 2 }, */
{ "third", tUNUMBER, 3 },
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
index dba0fee08..187584ff8 100644
--- a/ext/standard/php_incomplete_class.h
+++ b/ext/standard/php_incomplete_class.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_incomplete_class.h,v 1.13 2004/03/18 16:54:36 dmitry Exp $ */
+/* $Id: php_incomplete_class.h,v 1.13.2.2 2005/06/29 09:29:08 johannes Exp $ */
#ifndef PHP_INCOMPLETE_CLASS_H
#define PHP_INCOMPLETE_CLASS_H
@@ -26,18 +26,18 @@
#define PHP_IC_ENTRY \
BG(incomplete_class)
-#define PHP_SET_CLASS_ATTRIBUTES(struc) \
- /* OBJECTS_FIXME: Fix for new object model */ \
- if (Z_OBJCE_P(struc) == BG(incomplete_class)) { \
- class_name = php_lookup_class_name(struc, &name_len); \
- free_class_name = 1; \
+#define PHP_SET_CLASS_ATTRIBUTES(struc) \
+ /* OBJECTS_FIXME: Fix for new object model */ \
+ if (Z_OBJ_HT_P(struc)->get_class_entry && \
+ Z_OBJCE_P(struc) == BG(incomplete_class)) { \
+ class_name = php_lookup_class_name(struc, &name_len); \
+ free_class_name = 1; \
incomplete_class = 1; \
- } else { \
- class_name = Z_OBJCE_P(struc)->name; \
- name_len = Z_OBJCE_P(struc)->name_length; \
+ } else { \
+ free_class_name = !zend_get_object_classname(struc, &class_name, &name_len TSRMLS_CC);\
}
-#define PHP_CLEANUP_CLASS_ATTRIBUTES() \
+#define PHP_CLEANUP_CLASS_ATTRIBUTES() \
if (free_class_name) efree(class_name)
#define PHP_CLASS_ATTRIBUTES \
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
index 9827b81b6..8f683412e 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_string.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_string.h,v 1.84.2.1 2004/11/03 23:27:26 derick Exp $ */
+/* $Id: php_string.h,v 1.84.2.2 2005/05/31 12:55:33 sniper Exp $ */
/* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
@@ -119,6 +119,7 @@ PHPAPI char *php_strtoupper(char *s, size_t len);
PHPAPI char *php_strtolower(char *s, size_t len);
PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen);
PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit TSRMLS_DC);
+PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int freeit, int ignore_sybase TSRMLS_DC);
PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength TSRMLS_DC);
PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC);
PHPAPI void php_stripcslashes(char *str, int *len);
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 392a8c2f7..9df0afd21 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -15,7 +15,7 @@
| Author: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: proc_open.c,v 1.28.2.3 2005/03/11 09:01:52 hyanantha Exp $ */
+/* $Id: proc_open.c,v 1.28.2.5 2005/07/01 05:53:06 hyanantha Exp $ */
#if 0 && (defined(__linux__) || defined(sun) || defined(__IRIX__))
# define _BSD_SOURCE /* linux wants this when XOPEN mode is on */
@@ -35,6 +35,11 @@
#include "php_globals.h"
#include "SAPI.h"
+#ifdef NETWARE
+#include <proc.h>
+#include <library.h>
+#endif
+
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
@@ -397,6 +402,7 @@ PHP_FUNCTION(proc_get_status)
exitcode = WEXITSTATUS(wstatus);
}
if (WIFSIGNALED(wstatus)) {
+ running = 0;
signaled = 1;
#ifdef NETWARE
termsig = WIFTERMSIG(wstatus);
@@ -408,7 +414,7 @@ PHP_FUNCTION(proc_get_status)
stopped = 1;
stopsig = WSTOPSIG(wstatus);
}
- } else {
+ } else if (wait_pid == -1) {
running = 0;
}
#endif
@@ -485,6 +491,13 @@ PHP_FUNCTION(proc_open)
char *command_with_cmd;
UINT old_error_mode;
#endif
+#ifdef NETWARE
+ char** child_argv = NULL;
+ char* command_dup = NULL;
+ char* orig_cwd = NULL;
+ int command_num_args = 0;
+ wiring_t channel;
+#endif
php_process_id_t child;
struct php_process_handle *proc;
int is_persistent = 0; /* TODO: ensure that persistent procs will work */
@@ -748,6 +761,46 @@ PHP_FUNCTION(proc_open)
child = pi.hProcess;
CloseHandle(pi.hThread);
+#elif defined(NETWARE)
+ if (cwd) {
+ orig_cwd = getcwd(NULL, PATH_MAX);
+ chdir2(cwd);
+ }
+ channel.infd = descriptors[0].childend;
+ channel.outfd = descriptors[1].childend;
+ channel.errfd = -1;
+ /* Duplicate the command as processing downwards will modify it*/
+ command_dup = strdup(command);
+ /* get a number of args */
+ construct_argc_argv(command_dup, NULL, &command_num_args, NULL);
+ child_argv = (char**) malloc((command_num_args + 1) * sizeof(char*));
+ if(!child_argv) {
+ free(command_dup);
+ if (cwd && orig_cwd) {
+ chdir2(orig_cwd);
+ free(orig_cwd);
+ }
+ }
+ /* fill the child arg vector */
+ construct_argc_argv(command_dup, NULL, &command_num_args, child_argv);
+ child_argv[command_num_args] = NULL;
+ child = procve(child_argv[0], PROC_DETACHED|PROC_INHERIT_CWD, NULL, &channel, NULL, NULL, 0, NULL, (const char**)child_argv);
+ free(child_argv);
+ free(command_dup);
+ if (cwd && orig_cwd) {
+ chdir2(orig_cwd);
+ free(orig_cwd);
+ }
+ if (child < 0) {
+ /* failed to fork() */
+ /* clean up all the descriptors */
+ for (i = 0; i < ndesc; i++) {
+ close(descriptors[i].childend);
+ close(descriptors[i].parentend);
+ }
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "procve failed - %s", strerror(errno));
+ goto exit_fail;
+ }
#elif HAVE_FORK
/* the unix way */
child = fork();
diff --git a/ext/standard/reg.c b/ext/standard/reg.c
index 4b3d3bcbc..3e37f55e3 100644
--- a/ext/standard/reg.c
+++ b/ext/standard/reg.c
@@ -17,7 +17,7 @@
| Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
+----------------------------------------------------------------------+
*/
-/* $Id: reg.c,v 1.78 2004/01/08 08:17:34 andi Exp $ */
+/* $Id: reg.c,v 1.78.2.2 2005/07/18 23:10:08 sniper Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -33,6 +33,8 @@ typedef struct {
int cflags;
} reg_cache;
+static int reg_magic = 0;
+
/* {{{ _php_regcomp
*/
static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
@@ -42,8 +44,39 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
reg_cache *rc = NULL;
TSRMLS_FETCH();
- if(zend_hash_find(&REG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE ||
- rc->cflags != cflags) {
+ if(zend_hash_find(&REG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == SUCCESS
+ && rc->cflags == cflags) {
+#ifdef HAVE_REGEX_T_RE_MAGIC
+ /*
+ * We use a saved magic number to see whether cache is corrupted, and if it
+ * is, we flush it and compile the pattern from scratch.
+ */
+ if (rc->preg.re_magic != reg_magic) {
+ zend_hash_clean(&REG(ht_rc));
+ } else {
+ memcpy(preg, &rc->preg, sizeof(*preg));
+ return r;
+ }
+ }
+
+ r = regcomp(preg, pattern, cflags);
+ if(!r) {
+ reg_cache rcp;
+
+ rcp.cflags = cflags;
+ memcpy(&rcp.preg, preg, sizeof(*preg));
+ /*
+ * Since we don't have access to the actual MAGIC1 definition in the private
+ * header file, we save the magic value immediately after compilation. Hopefully,
+ * it's good.
+ */
+ if (!reg_magic) reg_magic = preg->re_magic;
+ zend_hash_update(&REG(ht_rc), (char *) pattern, patlen+1,
+ (void *) &rcp, sizeof(rcp), NULL);
+ }
+#else
+ memcpy(preg, &rc->preg, sizeof(*preg));
+ } else {
r = regcomp(preg, pattern, cflags);
if(!r) {
reg_cache rcp;
@@ -51,12 +84,10 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
rcp.cflags = cflags;
memcpy(&rcp.preg, preg, sizeof(*preg));
zend_hash_update(&REG(ht_rc), (char *) pattern, patlen+1,
- (void *) &rcp, sizeof(rcp), NULL);
+ (void *) &rcp, sizeof(rcp), NULL);
}
- } else {
- memcpy(preg, &rc->preg, sizeof(*preg));
}
-
+#endif
return r;
}
/* }}} */
diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c
index a408ac903..f72c73b37 100644
--- a/ext/standard/sha1.c
+++ b/ext/standard/sha1.c
@@ -16,9 +16,8 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sha1.c,v 1.9 2004/01/08 08:17:34 andi Exp $ */
+/* $Id: sha1.c,v 1.9.2.2 2005/04/16 09:50:13 thetaphi Exp $ */
-#include <stdio.h>
#include "php.h"
/* This code is heavily based on the PHP md5 implementation */
@@ -67,6 +66,7 @@ PHP_FUNCTION(sha1)
/* }}} */
+
/* {{{ proto string sha1_file(string filename [, bool raw_output])
Calculate the sha1 hash of given filename */
PHP_FUNCTION(sha1_file)
@@ -79,40 +79,31 @@ PHP_FUNCTION(sha1_file)
unsigned char digest[20];
PHP_SHA1_CTX context;
int n;
- FILE *fp;
+ php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
return;
}
-
- if (PG(safe_mode) && (!php_checkuid(arg, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(arg TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- if ((fp = VCWD_FOPEN(arg, "rb")) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open file");
+
+ stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS | ENFORCE_SAFE_MODE, NULL);
+ if (!stream) {
RETURN_FALSE;
}
PHP_SHA1Init(&context);
- while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) {
+ while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
PHP_SHA1Update(&context, buf, n);
}
PHP_SHA1Final(digest, &context);
- if (ferror(fp)) {
- fclose(fp);
+ php_stream_close(stream);
+
+ if (n<0) {
RETURN_FALSE;
}
- fclose(fp);
-
if (raw_output) {
RETURN_STRINGL(digest, 20, 1);
} else {
diff --git a/ext/standard/string.c b/ext/standard/string.c
index e8134f900..2c8c87265 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.420.2.6 2005/03/01 15:01:08 hyanantha Exp $ */
+/* $Id: string.c,v 1.420.2.12 2005/07/16 11:18:35 hyanantha Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -1175,6 +1175,22 @@ PHPAPI size_t php_dirname(char *path, size_t len)
return len;
}
}
+#elif defined(NETWARE)
+ /*
+ * Find the first occurence of : from the left
+ * move the path pointer to the position just after :
+ * increment the len_adjust to the length of path till colon character(inclusive)
+ * If there is no character beyond : simple return len
+ */
+ char *colonpos = NULL;
+ colonpos = strchr(path, ':');
+ if(colonpos != NULL) {
+ len_adjust = ((colonpos - path) + 1);
+ path += len_adjust;
+ if(len_adjust == len) {
+ return len;
+ }
+ }
#endif
if (len == 0) {
@@ -1199,9 +1215,21 @@ PHPAPI size_t php_dirname(char *path, size_t len)
}
if (end < path) {
/* No slash found, therefore return '.' */
+#ifdef NETWARE
+ if(len_adjust == 0) {
+ path[0] = '.';
+ path[1] = '\0';
+ return 1; //only one character
+ }
+ else {
+ path[0] = '\0';
+ return len_adjust;
+ }
+#else
path[0] = '.';
path[1] = '\0';
return 1 + len_adjust;
+#endif
}
/* Strip slashes which came before the file name */
@@ -1382,8 +1410,6 @@ PHP_FUNCTION(stristr)
if (!Z_STRLEN_PP(needle)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
efree(haystack_orig);
- zval_ptr_dtor(haystack);
- zval_ptr_dtor(needle);
RETURN_FALSE;
}
@@ -1409,8 +1435,6 @@ PHP_FUNCTION(stristr)
RETVAL_FALSE;
}
- zval_ptr_dtor(haystack);
- zval_ptr_dtor(needle);
efree(haystack_orig);
}
/* }}} */
@@ -1839,7 +1863,13 @@ PHP_FUNCTION(chunk_split)
}
if (chunklen > Z_STRLEN_PP(p_str)) {
- RETURN_STRINGL(Z_STRVAL_PP(p_str), Z_STRLEN_PP(p_str), 1);
+ /* to maintain BC, we must return original string + ending */
+ result_len = endlen + Z_STRLEN_PP(p_str);
+ result = emalloc(result_len + 1);
+ memcpy(result, Z_STRVAL_PP(p_str), Z_STRLEN_PP(p_str));
+ memcpy(result + Z_STRLEN_PP(p_str), end, endlen);
+ result[result_len] = '\0';
+ RETURN_STRINGL(result, result_len, 0);
}
if (!Z_STRLEN_PP(p_str)) {
@@ -2856,6 +2886,14 @@ PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_
*/
PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free TSRMLS_DC)
{
+ return php_addslashes_ex(str, length, new_length, should_free, 0 TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ php_addslashes_ex
+ */
+PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int should_free, int ignore_sybase TSRMLS_DC)
+{
/* maximum string length, worst case situation */
char *new_str;
char *source, *target;
@@ -2874,7 +2912,7 @@ PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_f
end = source + length;
target = new_str;
- if (PG(magic_quotes_sybase)) {
+ if (!ignore_sybase && PG(magic_quotes_sybase)) {
while (source < end) {
switch (*source) {
case '\0':
@@ -2937,7 +2975,7 @@ PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_l
char *source, *target, *tmp, *source_end=str+len, *tmp_end = NULL;
for (source = str; source < source_end; source++) {
- if (*source == from) {
+ if ((case_sensitivity && *source == from) || (!case_sensitivity && tolower(*source) == tolower(from))) {
char_count++;
}
}
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
index 326e0e87f..1800dad40 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: syslog.c,v 1.46.2.1 2004/07/30 14:39:18 wez Exp $ */
+/* $Id: syslog.c,v 1.46.2.2 2005/07/15 09:29:19 hyanantha Exp $ */
#include "php.h"
@@ -75,7 +75,7 @@ PHP_MINIT_FUNCTION(syslog)
/* AIX doesn't have LOG_AUTHPRIV */
REGISTER_LONG_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT);
#endif
-#if !defined(PHP_WIN32) && !defined(NETWARE)
+#ifndef PHP_WIN32
REGISTER_LONG_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT);
@@ -144,7 +144,9 @@ static void start_syslog(TSRMLS_D)
SET_VAR_LONG("LOG_MAIL", LOG_MAIL); /* log to email */
SET_VAR_LONG("LOG_DAEMON", LOG_DAEMON); /* other system daemons */
SET_VAR_LONG("LOG_AUTH", LOG_AUTH);
+#ifndef NETWARE
SET_VAR_LONG("LOG_SYSLOG", LOG_SYSLOG);
+#endif
SET_VAR_LONG("LOG_LPR", LOG_LPR);
#ifdef LOG_NEWS
/* No LOG_NEWS on HP-UX */
diff --git a/ext/standard/tests/array/bug29253.phpt b/ext/standard/tests/array/bug29253.phpt
new file mode 100755
index 000000000..7d6cdaeb4
--- /dev/null
+++ b/ext/standard/tests/array/bug29253.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #29253 array_diff with $GLOBALS argument fails
+--FILE--
+<?php
+$zz = $GLOBALS;
+$gg = 'afad';
+var_dump(array_diff_assoc($GLOBALS, $zz));
+var_dump($gg);
+?>
+--EXPECT--
+array(0) {
+}
+string(4) "afad"
diff --git a/ext/standard/tests/array/bug30833.phpt b/ext/standard/tests/array/bug30833.phpt
new file mode 100644
index 000000000..61701a532
--- /dev/null
+++ b/ext/standard/tests/array/bug30833.phpt
@@ -0,0 +1,35 @@
+--TEST--
+bug #30833 (array_count_values() modifying input array)
+--FILE--
+<?php
+
+$foo = array('abc', '0000');
+var_dump($foo);
+
+$count = array_count_values( $foo );
+var_dump($count);
+
+var_dump($foo);
+
+echo "Done\n";
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ string(3) "abc"
+ [1]=>
+ string(4) "0000"
+}
+array(2) {
+ ["abc"]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+array(2) {
+ [0]=>
+ string(3) "abc"
+ [1]=>
+ string(4) "0000"
+}
+Done
diff --git a/ext/standard/tests/array/bug31158.phpt b/ext/standard/tests/array/bug31158.phpt
new file mode 100755
index 000000000..e672a10b2
--- /dev/null
+++ b/ext/standard/tests/array/bug31158.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #31158 (array_splice on $GLOBALS crashes)
+--FILE--
+<?php
+function __(){
+ $GLOBALS['a'] = "bug\n";
+ array_splice($GLOBALS,0,count($GLOBALS));
+ /* All global variables including $GLOBALS are removed */
+ echo $GLOBALS['a'];
+}
+__();
+echo "ok\n";
+?>
+--EXPECTF--
+Notice: Undefined variable: GLOBALS in %sbug31158.php on line 6
+ok
+
diff --git a/ext/standard/tests/array/bug31213.phpt b/ext/standard/tests/array/bug31213.phpt
index 55ad88110..6aa31d5e0 100644
--- a/ext/standard/tests/array/bug31213.phpt
+++ b/ext/standard/tests/array/bug31213.phpt
@@ -28,6 +28,8 @@ function test($use_extract) {
test(false);
test(true);
+
+?>
--EXPECT--
int(1)
int(1)
diff --git a/ext/standard/tests/array/bug33940.phpt b/ext/standard/tests/array/bug33940.phpt
new file mode 100755
index 000000000..e5c499001
--- /dev/null
+++ b/ext/standard/tests/array/bug33940.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Bug #33940 array_map() fails to pass by reference when called recursively
+--INI--
+error_reporting=4095
+--FILE--
+<?php
+function ref_map(&$item) {
+ if(!is_array($item)) {
+ $item = 1;
+ return 2;
+ } else {
+ $ret = array_map('ref_map', &$item);
+ return $ret;
+ }
+}
+
+$a = array(array(0), 0);
+$ret = array_map('ref_map', $a);
+echo 'Array: '; print_r($a);
+echo 'Return: '; print_r($ret);
+$a = array(array(0), 0);
+$ret = array_map('ref_map', &$a);
+echo 'Array: '; print_r($a);
+echo 'Return: '; print_r($ret);
+?>
+--EXPECT--
+Array: Array
+(
+ [0] => Array
+ (
+ [0] => 0
+ )
+
+ [1] => 0
+)
+Return: Array
+(
+ [0] => Array
+ (
+ [0] => 2
+ )
+
+ [1] => 2
+)
+Array: Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ )
+
+ [1] => 1
+)
+Return: Array
+(
+ [0] => Array
+ (
+ [0] => 2
+ )
+
+ [1] => 2
+)
diff --git a/ext/standard/tests/array/bug33989.phpt b/ext/standard/tests/array/bug33989.phpt
new file mode 100755
index 000000000..4bb9a2562
--- /dev/null
+++ b/ext/standard/tests/array/bug33989.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #33989 (extract($GLOBALS,EXTR_REFS) crashes PHP)
+--FILE--
+<?php
+$a="a";
+extract($GLOBALS, EXTR_REFS);
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/standard/tests/array/bug34227.phpt b/ext/standard/tests/array/bug34227.phpt
new file mode 100755
index 000000000..29762b723
--- /dev/null
+++ b/ext/standard/tests/array/bug34227.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Bug #34277 (array_filter() crashes with references and objects)
+--FILE--
+<?php
+
+class C
+{
+ function m1()
+ {
+ $this->m2();
+ }
+
+ function m2()
+ {
+ $this->m3();
+ }
+
+ function m3()
+ {
+ $this->m4();
+ }
+
+ function m4()
+ {
+ $this->m5();
+ }
+
+ function m5()
+ {
+ $this->m6();
+ }
+
+ function m6()
+ {
+ $this->m7();
+ }
+
+ function m7()
+ {
+ $this->m8();
+ }
+
+ function m8()
+ {
+ $this->m9();
+ }
+
+ function m9()
+ {
+ $this->m10();
+ }
+
+ function m10()
+ {
+ $this->m11(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ }
+
+ function m11($a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $a10)
+ {
+ $arr = explode('a', 'b');
+ }
+}
+
+function f($str)
+{
+ $obj = new C;
+ $obj->m1();
+ return TRUE;
+}
+
+function p5($a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $a10, $a11, $a12)
+{
+ $ret = array_filter(array(0), 'f');
+}
+
+function p4()
+{
+ p5(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+}
+
+function p3()
+{
+ p4();
+}
+
+function p2()
+{
+ p3();
+}
+
+function p1()
+{
+ p2();
+}
+
+p1();
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/standard/tests/file/bug30362.phpt b/ext/standard/tests/file/bug30362.phpt
new file mode 100644
index 000000000..1c2b4be97
--- /dev/null
+++ b/ext/standard/tests/file/bug30362.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #30362 (stream_get_line() not working as documented)
+--FILE--
+<?php
+
+$resource = fopen(dirname(__FILE__).'/bug30362.txt', 'rb');
+
+for ($i = 0; ($i < 10) && !feof($resource); ++$i ) {
+ $a = "Y";
+ $line = stream_get_line($resource, 50, $a);
+ echo $line . "\n";
+}
+fclose($resource);
+
+?>
+--EXPECT--
+111
+111111111
+111111111
+111111111
+111111111
+111111111
+111111111
+111111111
+111111111
+111111111
diff --git a/ext/standard/tests/file/bug30362.txt b/ext/standard/tests/file/bug30362.txt
new file mode 100644
index 000000000..3a1b7f448
--- /dev/null
+++ b/ext/standard/tests/file/bug30362.txt
@@ -0,0 +1 @@
+111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111
diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt
new file mode 100644
index 000000000..ca98f429a
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug32647.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Bug #32647 (Using register_shutdown_function() with invalid callback can crash PHP)
+--INI--
+error_reporting=2047
+display_errors=1
+--FILE--
+<?php
+
+function foo()
+{
+ echo "joo!\n";
+}
+
+class bar
+{
+ function barfoo ()
+ { echo "bar!\n"; }
+}
+
+unset($obj);
+register_shutdown_function(array($obj,"")); // Invalid
+register_shutdown_function(array($obj,"some string")); // Invalid
+register_shutdown_function(array(0,"")); // Invalid
+register_shutdown_function(array('bar','foo')); // Invalid
+register_shutdown_function(array(0,"some string")); // Invalid
+register_shutdown_function('bar'); // Valid
+register_shutdown_function('foo'); // Valid
+register_shutdown_function(array('bar','barfoo')); // Valid
+
+$obj = new bar;
+register_shutdown_function(array($obj,'foobar')); // Invalid
+register_shutdown_function(array($obj,'barfoo')); // Valid
+
+?>
+--EXPECTF--
+Notice: Undefined variable: obj in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Notice: Undefined variable: obj in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Warning: (Registered shutdown functions) Unable to call bar::foo() - function does not exist in Unknown on line 0
+
+Warning: (Registered shutdown functions) Unable to call bar() - function does not exist in Unknown on line 0
+joo!
+bar!
+
+Warning: (Registered shutdown functions) Unable to call bar::foobar() - function does not exist in Unknown on line 0
+bar!
diff --git a/ext/standard/tests/serialize/bug31402.phpt b/ext/standard/tests/serialize/bug31402.phpt
index 4f8bf0ca5..0fbb445d0 100644
--- a/ext/standard/tests/serialize/bug31402.phpt
+++ b/ext/standard/tests/serialize/bug31402.phpt
@@ -4,7 +4,7 @@ Bug #31402 (unserialize() generates references when it should not)
<?php
class X {
- var $i;
+ public $i;
function X($i) {
$this->i = $i;
@@ -12,8 +12,8 @@ class X {
}
class Y {
- var $A = array();
- var $B;
+ public $A = array();
+ public $B;
function Y() {
$this->A[1] = new X(1);
@@ -29,43 +29,43 @@ $after = unserialize($ser);
var_dump($before, $after);
?>
---EXPECT--
-object(y)(2) {
+--EXPECTF--
+object(Y)#%d (2) {
["A"]=>
array(2) {
[1]=>
- object(x)(1) {
+ object(X)#%d (1) {
["i"]=>
int(1)
}
[2]=>
- object(x)(1) {
+ object(X)#%d (1) {
["i"]=>
int(2)
}
}
["B"]=>
- object(x)(1) {
+ object(X)#%d (1) {
["i"]=>
int(1)
}
}
-object(y)(2) {
+object(Y)#%d (2) {
["A"]=>
array(2) {
[1]=>
- &object(x)(1) {
+ object(X)#%d (1) {
["i"]=>
int(1)
}
[2]=>
- object(x)(1) {
+ object(X)#%d (1) {
["i"]=>
int(2)
}
}
["B"]=>
- &object(x)(1) {
+ object(X)#%d (1) {
["i"]=>
int(1)
}
diff --git a/ext/standard/tests/strings/bug33076.phpt b/ext/standard/tests/strings/bug33076.phpt
new file mode 100644
index 000000000..dafb8161b
--- /dev/null
+++ b/ext/standard/tests/strings/bug33076.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #33076 (str_ireplace() incorrectly counts result string length and may cause segfault)
+--FILE--
+<?php
+
+$value = str_ireplace("t", "bz", "Text");
+
+var_dump($value);
+
+echo "Done\n";
+?>
+--EXPECT--
+string(6) "bzexbz"
+Done
diff --git a/ext/standard/tests/strings/chunk_split.phpt b/ext/standard/tests/strings/chunk_split.phpt
index 6aec9fd24..b6bed3ab4 100644
--- a/ext/standard/tests/strings/chunk_split.phpt
+++ b/ext/standard/tests/strings/chunk_split.phpt
@@ -5,6 +5,7 @@ chunk_split() function
echo chunk_split('abc', 1, '-')."\n";
echo chunk_split('foooooooooooooooo', 5)."\n";
echo chunk_split(str_repeat('X', 2*76))."\n";
+echo chunk_split("test", 10, "|end") . "\n";
?>
--EXPECT--
a-b-c-
@@ -15,3 +16,5 @@ oo
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+
+test|end
diff --git a/ext/standard/tests/strings/strval.phpt b/ext/standard/tests/strings/strval.phpt
new file mode 100644
index 000000000..3f8b5cc98
--- /dev/null
+++ b/ext/standard/tests/strings/strval.phpt
@@ -0,0 +1,24 @@
+--TEST--
+strval() function
+--FILE--
+<?php
+$foo = 'bar';
+var_dump(strval($foo));
+define('FOO', 'BAR');
+var_dump(strval(FOO));
+var_dump(strval('foobar'));
+var_dump(strval(1));
+var_dump(strval(1.1));
+var_dump(strval(true));
+var_dump(strval(false));
+var_dump(strval(array('foo')));
+?>
+--EXPECT--
+string(3) "bar"
+string(3) "BAR"
+string(6) "foobar"
+string(1) "1"
+string(3) "1.1"
+string(1) "1"
+string(0) ""
+string(5) "Array"
diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt
index dd323ffc2..f6fec50de 100644
--- a/ext/standard/tests/strings/url_t.phpt
+++ b/ext/standard/tests/strings/url_t.phpt
@@ -67,7 +67,9 @@ $sample_urls = array (
'file://path/to/file',
'file:/path/to/file',
'http://1.2.3.4:/abc.asp?a=1&b=2',
-'http://foo.com#bar'
+'http://foo.com#bar',
+'scheme:',
+'foo+bar://baz@bang/bla',
);
foreach ($sample_urls as $url) {
@@ -657,3 +659,17 @@ array(3) {
["fragment"]=>
string(3) "bar"
}
+array(1) {
+ ["scheme"]=>
+ string(6) "scheme"
+}
+array(4) {
+ ["scheme"]=>
+ string(7) "foo+bar"
+ ["host"]=>
+ string(4) "bang"
+ ["user"]=>
+ string(3) "baz"
+ ["path"]=>
+ string(4) "/bla"
+}
diff --git a/ext/standard/type.c b/ext/standard/type.c
index 6f1111b06..a90ae5396 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: type.c,v 1.25 2004/04/01 08:54:44 derick Exp $ */
+/* $Id: type.c,v 1.25.2.1 2005/05/25 10:58:26 stas Exp $ */
#include "php.h"
#include "php_incomplete_class.h"
@@ -213,6 +213,10 @@ static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
if (Z_TYPE_PP(arg) == type) {
if (type == IS_OBJECT) {
zend_class_entry *ce;
+ if(Z_OBJ_HT_PP(arg)->get_class_entry == NULL) {
+ /* if there's no get_class_entry it's not a PHP object, so it can't be INCOMPLETE_CLASS */
+ RETURN_TRUE;
+ }
ce = Z_OBJCE_PP(arg);
if (!strcmp(ce->name, INCOMPLETE_CLASS)) {
RETURN_FALSE;
diff --git a/ext/standard/url.c b/ext/standard/url.c
index fb6bc9f6d..48848d7ce 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -15,7 +15,7 @@
| Author: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: url.c,v 1.81.2.2 2005/01/27 16:38:05 iliaa Exp $ */
+/* $Id: url.c,v 1.81.2.5 2005/08/16 14:15:43 iliaa Exp $ */
#include <stdlib.h>
#include <string.h>
@@ -104,6 +104,26 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
/* parse scheme */
if ((e = memchr(s, ':', length)) && (e - s)) {
+ /* validate scheme */
+ p = s;
+ while (p < e) {
+ /* scheme = 1*[ lowalpha | digit | "+" | "-" | "." ] */
+ if (!isalpha(*p) && !isdigit(*p) && *p != '+' && *p != '.' && *p != '-') {
+ if (e + 1 < ue) {
+ goto parse_port;
+ } else {
+ goto just_path;
+ }
+ }
+ p++;
+ }
+
+ if (*(e + 1) == '\0') { /* only scheme is available */
+ ret->scheme = estrndup(s, (e - s));
+ php_replace_controlchars_ex(ret->scheme, (e - s));
+ goto end;
+ }
+
/*
* certain schemas like mailto: and zlib: may not have any / after them
* this check ensures we support those.
@@ -303,7 +323,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
ret->path = estrndup(s, (ue-s));
php_replace_controlchars_ex(ret->path, (ue - s));
}
-
+end:
return ret;
}
/* }}} */
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index eff1c30c1..92c35479e 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.2 on Sat Mar 13 15:56:45 2004 */
+/* Generated by re2c 0.9.6 on Fri Apr 15 01:39:15 2005 */
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
@@ -144,23 +144,25 @@ scan:
128, 128, 128, 128, 128, 128, 128, 128,
};
goto yy0;
-yy1: ++YYCURSOR;
+ ++YYCURSOR;
yy0:
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yybm[0+yych] & 128) goto yy8;
+ if(yybm[0+yych] & 128) {
+ goto yy8;
+ }
if(yych <= '9') goto yy6;
if(yych >= ';') goto yy4;
goto yy2;
-yy2: yych = *++YYCURSOR;
+yy2: ++YYCURSOR;
goto yy3;
yy3:
{ smart_str_append(dest, url); return; }
-yy4: yych = *++YYCURSOR;
+yy4: ++YYCURSOR;
goto yy5;
yy5:
{ sep = separator; goto scan; }
-yy6: yych = *++YYCURSOR;
+yy6: ++YYCURSOR;
goto yy7;
yy7:
{ bash = p - 1; goto done; }
@@ -168,7 +170,9 @@ yy8: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy9;
-yy9: if(yybm[0+yych] & 128) goto yy8;
+yy9: if(yybm[0+yych] & 128) {
+ goto yy8;
+ }
goto yy10;
yy10:
{ goto scan; }
@@ -379,13 +383,15 @@ state_plain:
128, 128, 128, 128, 128, 128, 128, 128,
};
goto yy11;
-yy12: ++YYCURSOR;
+ ++YYCURSOR;
yy11:
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yybm[0+yych] & 128) goto yy15;
+ if(yybm[0+yych] & 128) {
+ goto yy15;
+ }
goto yy13;
-yy13: yych = *++YYCURSOR;
+yy13: ++YYCURSOR;
goto yy14;
yy14:
{ passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
@@ -393,7 +399,9 @@ yy15: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy16;
-yy16: if(yybm[0+yych] & 128) goto yy15;
+yy16: if(yybm[0+yych] & 128) {
+ goto yy15;
+ }
goto yy17;
yy17:
{ passthru(STD_ARGS); goto state_plain; }
@@ -441,7 +449,7 @@ state_tag:
0, 0, 0, 0, 0, 0, 0, 0,
};
goto yy18;
-yy19: ++YYCURSOR;
+ ++YYCURSOR;
yy18:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
@@ -450,11 +458,12 @@ yy18:
if(yych <= '`') goto yy22;
if(yych >= '{') goto yy22;
goto yy20;
-yy20: yych = *++YYCURSOR;
+yy20: ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy25;
yy21:
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
-yy22: yych = *++YYCURSOR;
+yy22: ++YYCURSOR;
goto yy23;
yy23:
{ passthru(STD_ARGS); goto state_plain_begin; }
@@ -462,7 +471,9 @@ yy24: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy25;
-yy25: if(yybm[0+yych] & 128) goto yy24;
+yy25: if(yybm[0+yych] & 128) {
+ goto yy24;
+ }
goto yy21;
}
@@ -511,13 +522,13 @@ state_next_arg:
0, 0, 0, 0, 0, 0, 0, 0,
};
goto yy26;
-yy27: ++YYCURSOR;
+ ++YYCURSOR;
yy26:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if(yych <= '='){
- if(yych <= '\v'){
- if(yych <= '\b') goto yy34;
+ if(yych <= 0x0B){
+ if(yych <= 0x08) goto yy34;
goto yy30;
} else {
if(yych == ' ') goto yy30;
@@ -534,19 +545,20 @@ yy26:
goto yy34;
}
}
-yy28: yych = *++YYCURSOR;
+yy28: ++YYCURSOR;
goto yy29;
yy29:
{ passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
-yy30: yych = *++YYCURSOR;
+yy30: ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy37;
yy31:
{ passthru(STD_ARGS); goto state_next_arg; }
-yy32: yych = *++YYCURSOR;
+yy32: ++YYCURSOR;
goto yy33;
yy33:
{ --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
-yy34: yych = *++YYCURSOR;
+yy34: ++YYCURSOR;
goto yy35;
yy35:
{ passthru(STD_ARGS); goto state_plain_begin; }
@@ -554,7 +566,9 @@ yy36: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy37;
-yy37: if(yybm[0+yych] & 128) goto yy36;
+yy37: if(yybm[0+yych] & 128) {
+ goto yy36;
+ }
goto yy31;
}
@@ -600,7 +614,7 @@ state_arg:
0, 0, 0, 0, 0, 0, 0, 0,
};
goto yy38;
-yy39: ++YYCURSOR;
+ ++YYCURSOR;
yy38:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
@@ -609,11 +623,12 @@ yy38:
if(yych <= '`') goto yy42;
if(yych >= '{') goto yy42;
goto yy40;
-yy40: yych = *++YYCURSOR;
+yy40: ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy45;
yy41:
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
-yy42: yych = *++YYCURSOR;
+yy42: ++YYCURSOR;
goto yy43;
yy43:
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
@@ -621,7 +636,9 @@ yy44: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy45;
-yy45: if(yybm[0+yych] & 128) goto yy44;
+yy45: if(yybm[0+yych] & 128) {
+ goto yy44;
+ }
goto yy41;
}
@@ -667,7 +684,7 @@ state_before_val:
0, 0, 0, 0, 0, 0, 0, 0,
};
goto yy46;
-yy47: ++YYCURSOR;
+ ++YYCURSOR;
yy46:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
@@ -681,7 +698,8 @@ yy48: yyaccept = 0;
goto yy49;
yy49:
{ --YYCURSOR; goto state_next_arg_begin; }
-yy50: yych = *++YYCURSOR;
+yy50: ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy54;
yy51:
{ passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
@@ -691,7 +709,9 @@ yy53: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy54;
-yy54: if(yybm[0+yych] & 128) goto yy53;
+yy54: if(yybm[0+yych] & 128) {
+ goto yy53;
+ }
goto yy51;
yy55: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -749,13 +769,13 @@ state_val:
248, 248, 248, 248, 248, 248, 248, 248,
};
goto yy58;
-yy59: ++YYCURSOR;
+ ++YYCURSOR;
yy58:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
if(yych <= '!'){
- if(yych <= '\n'){
- if(yych <= '\b') goto yy63;
+ if(yych <= 0x0A){
+ if(yych <= 0x08) goto yy63;
goto yy64;
} else {
if(yych == ' ') goto yy64;
@@ -781,7 +801,7 @@ yy62: yyaccept = 0;
goto yy69;
yy63: yych = *++YYCURSOR;
goto yy67;
-yy64: yych = *++YYCURSOR;
+yy64: ++YYCURSOR;
goto yy65;
yy65:
{ passthru(STD_ARGS); goto state_next_arg_begin; }
@@ -789,19 +809,26 @@ yy66: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy67;
-yy67: if(yybm[0+yych] & 8) goto yy66;
+yy67: if(yybm[0+yych] & 8) {
+ goto yy66;
+ }
goto yy61;
yy68: yyaccept = 0;
YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy69;
-yy69: if(yybm[0+yych] & 16) goto yy68;
+yy69: if(yybm[0+yych] & 16) {
+ goto yy68;
+ }
if(yych <= '&') goto yy72;
if(yych >= '(') goto yy61;
goto yy70;
-yy70: yych = *++YYCURSOR;
- if(yybm[0+yych] & 8) goto yy66;
+yy70: ++YYCURSOR;
+ if(yybm[0+(yych = *YYCURSOR)] & 8) {
+ yych = *YYCURSOR;
+ goto yy66;
+ }
goto yy71;
yy71:
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
@@ -809,7 +836,9 @@ yy72: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy73;
-yy73: if(yybm[0+yych] & 32) goto yy72;
+yy73: if(yybm[0+yych] & 32) {
+ goto yy72;
+ }
if(yych <= '=') goto yy75;
goto yy74;
yy74: YYCURSOR = YYMARKER;
@@ -820,15 +849,20 @@ yy75: yych = *++YYCURSOR;
goto yy71;
yy76: yyaccept = 0;
YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy77;
-yy77: if(yybm[0+yych] & 64) goto yy76;
+yy77: if(yybm[0+yych] & 64) {
+ goto yy76;
+ }
if(yych <= '!') goto yy80;
if(yych >= '#') goto yy61;
goto yy78;
-yy78: yych = *++YYCURSOR;
- if(yybm[0+yych] & 8) goto yy66;
+yy78: ++YYCURSOR;
+ if(yybm[0+(yych = *YYCURSOR)] & 8) {
+ yych = *YYCURSOR;
+ goto yy66;
+ }
goto yy79;
yy79:
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
@@ -836,10 +870,13 @@ yy80: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy81;
-yy81: if(yybm[0+yych] & 128) goto yy80;
+yy81: if(yybm[0+yych] & 128) {
+ goto yy80;
+ }
if(yych >= '>') goto yy74;
goto yy82;
-yy82: yych = *++YYCURSOR;
+yy82: ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy79;
}
@@ -1003,7 +1040,7 @@ int php_url_scanner_reset_vars(TSRMLS_D)
BG(url_adapt_state_ex).form_app.len = 0;
BG(url_adapt_state_ex).url_app.len = 0;
- return FAILURE;
+ return SUCCESS;
}
PHP_MINIT_FUNCTION(url_scanner)
diff --git a/ext/standard/url_scanner_ex.c.orig b/ext/standard/url_scanner_ex.c.orig
index 8ef4c2e35..80d30531e 100644
--- a/ext/standard/url_scanner_ex.c.orig
+++ b/ext/standard/url_scanner_ex.c.orig
@@ -1,5 +1,5 @@
-/* Generated by re2c 0.9.2 on Sat Mar 13 15:56:45 2004 */
-#line 1 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+/* Generated by re2c 0.9.6 on Fri Apr 15 01:39:15 2005 */
+#line 1 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
@@ -89,7 +89,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals)
PHP_INI_END()
-#line 95 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 95 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
#define YYFILL(n) goto done
@@ -108,7 +108,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
scan:
-#line 7 "re2c-output.c"
+#line 7 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -147,44 +147,48 @@ scan:
128, 128, 128, 128, 128, 128, 128, 128,
};
goto yy0;
-yy1: ++YYCURSOR;
+ ++YYCURSOR;
yy0:
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yybm[0+yych] & 128) goto yy8;
+ if(yybm[0+yych] & 128) {
+ goto yy8;
+ }
if(yych <= '9') goto yy6;
if(yych >= ';') goto yy4;
goto yy2;
-yy2: yych = *++YYCURSOR;
+yy2: ++YYCURSOR;
goto yy3;
yy3:
-#line 113 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 113 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ smart_str_append(dest, url); return; }
-#line 59 "re2c-output.c"
-yy4: yych = *++YYCURSOR;
+#line 61 "<stdout>"
+yy4: ++YYCURSOR;
goto yy5;
yy5:
-#line 114 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 114 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ sep = separator; goto scan; }
-#line 65 "re2c-output.c"
-yy6: yych = *++YYCURSOR;
+#line 67 "<stdout>"
+yy6: ++YYCURSOR;
goto yy7;
yy7:
-#line 115 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 115 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ bash = p - 1; goto done; }
-#line 71 "re2c-output.c"
+#line 73 "<stdout>"
yy8: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy9;
-yy9: if(yybm[0+yych] & 128) goto yy8;
+yy9: if(yybm[0+yych] & 128) {
+ goto yy8;
+ }
goto yy10;
yy10:
-#line 116 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 116 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ goto scan; }
-#line 81 "re2c-output.c"
+#line 86 "<stdout>"
}
-#line 117 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 117 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
done:
@@ -353,7 +357,7 @@ state_plain_begin:
state_plain:
start = YYCURSOR;
-#line 85 "re2c-output.c"
+#line 90 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -392,36 +396,40 @@ state_plain:
128, 128, 128, 128, 128, 128, 128, 128,
};
goto yy11;
-yy12: ++YYCURSOR;
+ ++YYCURSOR;
yy11:
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yybm[0+yych] & 128) goto yy15;
+ if(yybm[0+yych] & 128) {
+ goto yy15;
+ }
goto yy13;
-yy13: yych = *++YYCURSOR;
+yy13: ++YYCURSOR;
goto yy14;
yy14:
-#line 285 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 285 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
-#line 135 "re2c-output.c"
+#line 142 "<stdout>"
yy15: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy16;
-yy16: if(yybm[0+yych] & 128) goto yy15;
+yy16: if(yybm[0+yych] & 128) {
+ goto yy15;
+ }
goto yy17;
yy17:
-#line 286 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 286 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain; }
-#line 145 "re2c-output.c"
+#line 155 "<stdout>"
}
-#line 287 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 287 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
state_tag:
start = YYCURSOR;
-#line 149 "re2c-output.c"
+#line 159 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -460,7 +468,7 @@ state_tag:
0, 0, 0, 0, 0, 0, 0, 0,
};
goto yy18;
-yy19: ++YYCURSOR;
+ ++YYCURSOR;
yy18:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
@@ -469,26 +477,29 @@ yy18:
if(yych <= '`') goto yy22;
if(yych >= '{') goto yy22;
goto yy20;
-yy20: yych = *++YYCURSOR;
+yy20: ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy25;
yy21:
-#line 292 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 292 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
-#line 202 "re2c-output.c"
-yy22: yych = *++YYCURSOR;
+#line 212 "<stdout>"
+yy22: ++YYCURSOR;
goto yy23;
yy23:
-#line 293 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 293 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain_begin; }
-#line 208 "re2c-output.c"
+#line 218 "<stdout>"
yy24: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy25;
-yy25: if(yybm[0+yych] & 128) goto yy24;
+yy25: if(yybm[0+yych] & 128) {
+ goto yy24;
+ }
goto yy21;
}
-#line 294 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 294 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
state_next_arg_begin:
@@ -497,7 +508,7 @@ state_next_arg_begin:
state_next_arg:
start = YYCURSOR;
-#line 218 "re2c-output.c"
+#line 231 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -536,13 +547,13 @@ state_next_arg:
0, 0, 0, 0, 0, 0, 0, 0,
};
goto yy26;
-yy27: ++YYCURSOR;
+ ++YYCURSOR;
yy26:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if(yych <= '='){
- if(yych <= '\v'){
- if(yych <= '\b') goto yy34;
+ if(yych <= 0x0B){
+ if(yych <= 0x08) goto yy34;
goto yy30;
} else {
if(yych == ' ') goto yy30;
@@ -559,44 +570,47 @@ yy26:
goto yy34;
}
}
-yy28: yych = *++YYCURSOR;
+yy28: ++YYCURSOR;
goto yy29;
yy29:
-#line 302 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 302 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
-#line 285 "re2c-output.c"
-yy30: yych = *++YYCURSOR;
+#line 298 "<stdout>"
+yy30: ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy37;
yy31:
-#line 303 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 303 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_next_arg; }
-#line 291 "re2c-output.c"
-yy32: yych = *++YYCURSOR;
+#line 304 "<stdout>"
+yy32: ++YYCURSOR;
goto yy33;
yy33:
-#line 304 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 304 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
-#line 297 "re2c-output.c"
-yy34: yych = *++YYCURSOR;
+#line 310 "<stdout>"
+yy34: ++YYCURSOR;
goto yy35;
yy35:
-#line 305 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 305 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain_begin; }
-#line 303 "re2c-output.c"
+#line 316 "<stdout>"
yy36: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy37;
-yy37: if(yybm[0+yych] & 128) goto yy36;
+yy37: if(yybm[0+yych] & 128) {
+ goto yy36;
+ }
goto yy31;
}
-#line 306 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 306 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
state_arg:
start = YYCURSOR;
-#line 313 "re2c-output.c"
+#line 329 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -635,7 +649,7 @@ state_arg:
0, 0, 0, 0, 0, 0, 0, 0,
};
goto yy38;
-yy39: ++YYCURSOR;
+ ++YYCURSOR;
yy38:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
@@ -644,32 +658,35 @@ yy38:
if(yych <= '`') goto yy42;
if(yych >= '{') goto yy42;
goto yy40;
-yy40: yych = *++YYCURSOR;
+yy40: ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy45;
yy41:
-#line 311 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 311 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
-#line 366 "re2c-output.c"
-yy42: yych = *++YYCURSOR;
+#line 382 "<stdout>"
+yy42: ++YYCURSOR;
goto yy43;
yy43:
-#line 312 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 312 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
-#line 372 "re2c-output.c"
+#line 388 "<stdout>"
yy44: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy45;
-yy45: if(yybm[0+yych] & 128) goto yy44;
+yy45: if(yybm[0+yych] & 128) {
+ goto yy44;
+ }
goto yy41;
}
-#line 313 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 313 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
state_before_val:
start = YYCURSOR;
-#line 382 "re2c-output.c"
+#line 401 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -708,7 +725,7 @@ state_before_val:
0, 0, 0, 0, 0, 0, 0, 0,
};
goto yy46;
-yy47: ++YYCURSOR;
+ ++YYCURSOR;
yy46:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
@@ -721,22 +738,25 @@ yy48: yyaccept = 0;
if(yych == '=') goto yy53;
goto yy49;
yy49:
-#line 319 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 319 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ --YYCURSOR; goto state_next_arg_begin; }
-#line 436 "re2c-output.c"
-yy50: yych = *++YYCURSOR;
+#line 455 "<stdout>"
+yy50: ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy54;
yy51:
-#line 318 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 318 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
-#line 442 "re2c-output.c"
+#line 461 "<stdout>"
yy52: yych = *++YYCURSOR;
goto yy49;
yy53: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy54;
-yy54: if(yybm[0+yych] & 128) goto yy53;
+yy54: if(yybm[0+yych] & 128) {
+ goto yy53;
+ }
goto yy51;
yy55: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -750,14 +770,14 @@ yy57: YYCURSOR = YYMARKER;
case 0: goto yy49;
}
}
-#line 320 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 320 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
state_val:
start = YYCURSOR;
-#line 465 "re2c-output.c"
+#line 488 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
@@ -796,13 +816,13 @@ state_val:
248, 248, 248, 248, 248, 248, 248, 248,
};
goto yy58;
-yy59: ++YYCURSOR;
+ ++YYCURSOR;
yy58:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
if(yych <= '!'){
- if(yych <= '\n'){
- if(yych <= '\b') goto yy63;
+ if(yych <= 0x0A){
+ if(yych <= 0x08) goto yy63;
goto yy64;
} else {
if(yych == ' ') goto yy64;
@@ -822,47 +842,56 @@ yy60: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy77;
yy61:
-#line 328 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 328 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 0, '\0'); goto state_next_arg_begin; }
-#line 532 "re2c-output.c"
+#line 555 "<stdout>"
yy62: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy69;
yy63: yych = *++YYCURSOR;
goto yy67;
-yy64: yych = *++YYCURSOR;
+yy64: ++YYCURSOR;
goto yy65;
yy65:
-#line 329 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 329 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_next_arg_begin; }
-#line 543 "re2c-output.c"
+#line 566 "<stdout>"
yy66: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy67;
-yy67: if(yybm[0+yych] & 8) goto yy66;
+yy67: if(yybm[0+yych] & 8) {
+ goto yy66;
+ }
goto yy61;
yy68: yyaccept = 0;
YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy69;
-yy69: if(yybm[0+yych] & 16) goto yy68;
+yy69: if(yybm[0+yych] & 16) {
+ goto yy68;
+ }
if(yych <= '&') goto yy72;
if(yych >= '(') goto yy61;
goto yy70;
-yy70: yych = *++YYCURSOR;
- if(yybm[0+yych] & 8) goto yy66;
+yy70: ++YYCURSOR;
+ if(yybm[0+(yych = *YYCURSOR)] & 8) {
+ yych = *YYCURSOR;
+ goto yy66;
+ }
goto yy71;
yy71:
-#line 327 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 327 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
-#line 565 "re2c-output.c"
+#line 595 "<stdout>"
yy72: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy73;
-yy73: if(yybm[0+yych] & 32) goto yy72;
+yy73: if(yybm[0+yych] & 32) {
+ goto yy72;
+ }
if(yych <= '=') goto yy75;
goto yy74;
yy74: YYCURSOR = YYMARKER;
@@ -873,31 +902,39 @@ yy75: yych = *++YYCURSOR;
goto yy71;
yy76: yyaccept = 0;
YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy77;
-yy77: if(yybm[0+yych] & 64) goto yy76;
+yy77: if(yybm[0+yych] & 64) {
+ goto yy76;
+ }
if(yych <= '!') goto yy80;
if(yych >= '#') goto yy61;
goto yy78;
-yy78: yych = *++YYCURSOR;
- if(yybm[0+yych] & 8) goto yy66;
+yy78: ++YYCURSOR;
+ if(yybm[0+(yych = *YYCURSOR)] & 8) {
+ yych = *YYCURSOR;
+ goto yy66;
+ }
goto yy79;
yy79:
-#line 326 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 326 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
-#line 594 "re2c-output.c"
+#line 631 "<stdout>"
yy80: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy81;
-yy81: if(yybm[0+yych] & 128) goto yy80;
+yy81: if(yybm[0+yych] & 128) {
+ goto yy80;
+ }
if(yych >= '>') goto yy74;
goto yy82;
-yy82: yych = *++YYCURSOR;
+yy82: ++YYCURSOR;
+ yych = *YYCURSOR;
goto yy79;
}
-#line 330 "/usr/src/php5/ext/standard/url_scanner_ex.re"
+#line 330 "/usr/src/php/php_5_0/ext/standard/url_scanner_ex.re"
stop:
@@ -1059,7 +1096,7 @@ int php_url_scanner_reset_vars(TSRMLS_D)
BG(url_adapt_state_ex).form_app.len = 0;
BG(url_adapt_state_ex).url_app.len = 0;
- return FAILURE;
+ return SUCCESS;
}
PHP_MINIT_FUNCTION(url_scanner)
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index ec02d5ebb..5debff724 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -488,7 +488,7 @@ int php_url_scanner_reset_vars(TSRMLS_D)
BG(url_adapt_state_ex).form_app.len = 0;
BG(url_adapt_state_ex).url_app.len = 0;
- return FAILURE;
+ return SUCCESS;
}
PHP_MINIT_FUNCTION(url_scanner)
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
index f729d7c7b..ba7472724 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: user_filters.c,v 1.28 2004/06/21 21:08:05 pollita Exp $ */
+/* $Id: user_filters.c,v 1.28.2.1 2005/06/09 08:19:18 dmitry Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -135,11 +135,6 @@ static void userfilter_dtor(php_stream_filter *thisfilter TSRMLS_DC)
if (retval)
zval_ptr_dtor(&retval);
- if (SUCCESS == zend_hash_find(Z_OBJPROP_P(obj), "filter", sizeof("filter"), (void**)&tmp)) {
- zend_list_delete(Z_LVAL_PP(tmp));
- FREE_ZVAL(*tmp);
- }
-
/* kill the object */
zval_ptr_dtor(&obj);
}
@@ -345,6 +340,8 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
ZEND_REGISTER_RESOURCE(zfilter, filter, le_userfilters);
filter->abstract = obj;
add_property_zval(obj, "filter", zfilter);
+ /* add_property_zval increments the refcount which is unwanted here */
+ zval_ptr_dtor(&zfilter);
return filter;
}
@@ -470,6 +467,8 @@ PHP_FUNCTION(stream_bucket_new)
ZEND_REGISTER_RESOURCE(zbucket, bucket, le_bucket);
object_init(return_value);
add_property_zval(return_value, "bucket", zbucket);
+ /* add_property_zval increments the refcount which is unwanted here */
+ zval_ptr_dtor(&zbucket);
add_property_stringl(return_value, "data", bucket->buf, bucket->buflen, 1);
add_property_long(return_value, "datalen", bucket->buflen);
}
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 555846d25..b6459b15b 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -18,7 +18,8 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var.c,v 1.191.2.5 2004/12/17 14:39:35 derick Exp $ */
+/* $Id: var.c,v 1.191.2.8 2005/06/28 09:17:19 stas Exp $ */
+
/* {{{ includes
@@ -463,7 +464,7 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old
/* relies on "(long)" being a perfect hash function for data pointers,
however the actual identity of an object has had to be determined
by its object handle and the class entry since 5.0. */
- if (Z_TYPE_P(var) == IS_OBJECT) {
+ if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry != NULL) {
p = smart_str_print_long(id + sizeof(id) - 1,
(((unsigned long)Z_OBJCE_P(var) << 5)
| ((unsigned long)Z_OBJCE_P(var) >> (sizeof(long) * 8 - 5)))
@@ -584,18 +585,18 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
do {
zend_mangle_property_name(&priv_name, &prop_name_length, ce->name, ce->name_length,
- Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, ce->type & ZEND_INTERNAL_CLASS);
- if (zend_hash_find(Z_OBJPROP_PP(struc), priv_name, prop_name_length, (void *) &d) == SUCCESS) {
- php_var_serialize_string(buf, priv_name, prop_name_length-1);
+ Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS);
+ if (zend_hash_find(Z_OBJPROP_PP(struc), priv_name, prop_name_length+1, (void *) &d) == SUCCESS) {
+ php_var_serialize_string(buf, priv_name, prop_name_length);
efree(priv_name);
php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
break;
}
efree(priv_name);
zend_mangle_property_name(&prot_name, &prop_name_length, "*", 1,
- Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, ce->type & ZEND_INTERNAL_CLASS);
- if (zend_hash_find(Z_OBJPROP_PP(struc), prot_name, prop_name_length, (void *) &d) == SUCCESS) {
- php_var_serialize_string(buf, prot_name, prop_name_length - 1);
+ Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS);
+ if (zend_hash_find(Z_OBJPROP_PP(struc), prot_name, prop_name_length+1, (void *) &d) == SUCCESS) {
+ php_var_serialize_string(buf, prot_name, prop_name_length);
efree(prot_name);
php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
break;
@@ -671,7 +672,8 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
zval fname;
int res;
- if(Z_OBJCE_PP(struc) != PHP_IC_ENTRY) {
+ if (Z_OBJ_HT_PP(struc)->get_class_entry && Z_OBJCE_PP(struc) != PHP_IC_ENTRY &&
+ zend_hash_exists(&Z_OBJCE_PP(struc)->function_table, "__sleep", sizeof("__sleep"))) {
INIT_PZVAL(&fname);
ZVAL_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1, 0);
res = call_user_function_ex(CG(function_table), struc, &fname,
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index 211fc5f32..e45f24aef 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.4 on Thu Mar 10 02:54:37 2005 */
+/* Generated by re2c 0.9.6 on Fri Apr 15 01:39:24 2005 */
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var_unserializer.c,v 1.38.2.13 2005/03/10 01:58:13 helly Exp $ */
+/* $Id: var_unserializer.c,v 1.38.2.15 2005/06/01 10:53:25 dmitry Exp $ */
#include "php.h"
#include "ext/standard/php_var.h"
@@ -296,7 +296,8 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, long elements)
return 0;
}
- if(Z_OBJCE_PP(rval) != PHP_IC_ENTRY) {
+ if (Z_OBJCE_PP(rval) != PHP_IC_ENTRY &&
+ zend_hash_exists(&Z_OBJCE_PP(rval)->function_table, "__wakeup", sizeof("__wakeup"))) {
INIT_PZVAL(&fname);
ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1, 0);
call_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
@@ -363,7 +364,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
0, 0, 0, 0, 0, 0, 0, 0,
};
goto yy0;
-yy1: ++YYCURSOR;
+ ++YYCURSOR;
yy0:
if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
yych = *YYCURSOR;
@@ -464,17 +465,23 @@ yy15:
yy16: yych = *++YYCURSOR;
goto yy4;
yy17: yych = *++YYCURSOR;
- if(yybm[0+yych] & 128) goto yy19;
+ if(yybm[0+yych] & 128) {
+ goto yy19;
+ }
if(yych != '+') goto yy2;
goto yy18;
yy18: yych = *++YYCURSOR;
- if(yybm[0+yych] & 128) goto yy19;
+ if(yybm[0+yych] & 128) {
+ goto yy19;
+ }
goto yy2;
yy19: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy20;
-yy20: if(yybm[0+yych] & 128) goto yy19;
+yy20: if(yybm[0+yych] & 128) {
+ goto yy19;
+ }
if(yych != ':') goto yy2;
goto yy21;
yy21: yych = *++YYCURSOR;
@@ -597,7 +604,7 @@ yy25: yych = *++YYCURSOR;
if(yych >= ':') goto yy2;
goto yy26;
yy26: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy27;
yy27: if(yych <= '/') goto yy2;
@@ -627,7 +634,7 @@ yy32: yych = *++YYCURSOR;
if(yych >= ':') goto yy2;
goto yy33;
yy33: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy34;
yy34: if(yych <= '/') goto yy2;
@@ -675,7 +682,7 @@ yy39: yych = *++YYCURSOR;
if(yych >= ':') goto yy2;
goto yy40;
yy40: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy41;
yy41: if(yych <= '/') goto yy2;
@@ -756,7 +763,7 @@ yy49: yych = *++YYCURSOR;
if(yych >= ':') goto yy2;
goto yy50;
yy50: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
goto yy51;
yy51: if(yych <= ':'){
@@ -783,7 +790,7 @@ yy52: yych = *++YYCURSOR;
if(yych >= ':') goto yy2;
goto yy53;
yy53: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
goto yy54;
yy54: if(yych <= ';'){
diff --git a/ext/standard/var_unserializer.c.orig b/ext/standard/var_unserializer.c.orig
index f8989865c..678877067 100644
--- a/ext/standard/var_unserializer.c.orig
+++ b/ext/standard/var_unserializer.c.orig
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.4 on Thu Mar 10 02:54:37 2005 */
+/* Generated by re2c 0.9.6 on Fri Apr 15 01:39:24 2005 */
#line 1 "/usr/src/php/php_5_0/ext/standard/var_unserializer.re"
/*
+----------------------------------------------------------------------+
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var_unserializer.c,v 1.38.2.13 2005/03/10 01:58:13 helly Exp $ */
+/* $Id: var_unserializer.c,v 1.38.2.15 2005/06/01 10:53:25 dmitry Exp $ */
#include "php.h"
#include "ext/standard/php_var.h"
@@ -298,7 +298,8 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, long elements)
return 0;
}
- if(Z_OBJCE_PP(rval) != PHP_IC_ENTRY) {
+ if (Z_OBJCE_PP(rval) != PHP_IC_ENTRY &&
+ zend_hash_exists(&Z_OBJCE_PP(rval)->function_table, "__wakeup", sizeof("__wakeup"))) {
INIT_PZVAL(&fname);
ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1, 0);
call_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
@@ -366,7 +367,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
0, 0, 0, 0, 0, 0, 0, 0,
};
goto yy0;
-yy1: ++YYCURSOR;
+ ++YYCURSOR;
yy0:
if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
yych = *YYCURSOR;
@@ -471,17 +472,23 @@ yy15:
yy16: yych = *++YYCURSOR;
goto yy4;
yy17: yych = *++YYCURSOR;
- if(yybm[0+yych] & 128) goto yy19;
+ if(yybm[0+yych] & 128) {
+ goto yy19;
+ }
if(yych != '+') goto yy2;
goto yy18;
yy18: yych = *++YYCURSOR;
- if(yybm[0+yych] & 128) goto yy19;
+ if(yybm[0+yych] & 128) {
+ goto yy19;
+ }
goto yy2;
yy19: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy20;
-yy20: if(yybm[0+yych] & 128) goto yy19;
+yy20: if(yybm[0+yych] & 128) {
+ goto yy19;
+ }
if(yych != ':') goto yy2;
goto yy21;
yy21: yych = *++YYCURSOR;
@@ -590,7 +597,7 @@ yy23:
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
-#line 271 "<stdout>"
+#line 277 "<stdout>"
yy24: yych = *++YYCURSOR;
if(yych <= ','){
if(yych != '+') goto yy2;
@@ -606,7 +613,7 @@ yy25: yych = *++YYCURSOR;
if(yych >= ':') goto yy2;
goto yy26;
yy26: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy27;
yy27: if(yych <= '/') goto yy2;
@@ -627,7 +634,7 @@ yy30:
return object_common2(UNSERIALIZE_PASSTHRU,
object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR));
}
-#line 309 "<stdout>"
+#line 315 "<stdout>"
yy31: yych = *++YYCURSOR;
if(yych == '+') goto yy32;
if(yych <= '/') goto yy2;
@@ -638,7 +645,7 @@ yy32: yych = *++YYCURSOR;
if(yych >= ':') goto yy2;
goto yy33;
yy33: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy34;
yy34: if(yych <= '/') goto yy2;
@@ -677,7 +684,7 @@ yy37:
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
-#line 360 "<stdout>"
+#line 366 "<stdout>"
yy38: yych = *++YYCURSOR;
if(yych == '+') goto yy39;
if(yych <= '/') goto yy2;
@@ -688,7 +695,7 @@ yy39: yych = *++YYCURSOR;
if(yych >= ':') goto yy2;
goto yy40;
yy40: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy41;
yy41: if(yych <= '/') goto yy2;
@@ -729,7 +736,7 @@ yy44:
ZVAL_STRINGL(*rval, str, len, 1);
return 1;
}
-#line 413 "<stdout>"
+#line 419 "<stdout>"
yy45: yych = *++YYCURSOR;
if(yych <= '/'){
if(yych <= ','){
@@ -771,7 +778,7 @@ yy49: yych = *++YYCURSOR;
if(yych >= ':') goto yy2;
goto yy50;
yy50: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
goto yy51;
yy51: if(yych <= ':'){
@@ -798,7 +805,7 @@ yy52: yych = *++YYCURSOR;
if(yych >= ':') goto yy2;
goto yy53;
yy53: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
+ if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
goto yy54;
yy54: if(yych <= ';'){
@@ -825,7 +832,7 @@ yy56:
ZVAL_DOUBLE(*rval, zend_strtod((const char *)start + 2, NULL));
return 1;
}
-#line 511 "<stdout>"
+#line 517 "<stdout>"
yy57: yych = *++YYCURSOR;
if(yych <= ','){
if(yych != '+') goto yy2;
@@ -900,7 +907,7 @@ yy67:
return 1;
}
-#line 588 "<stdout>"
+#line 594 "<stdout>"
yy68: yych = *++YYCURSOR;
if(yych == 'N') goto yy65;
goto yy2;
@@ -936,7 +943,7 @@ yy74:
ZVAL_LONG(*rval, parse_iv(start + 2));
return 1;
}
-#line 625 "<stdout>"
+#line 631 "<stdout>"
yy75: yych = *++YYCURSOR;
if(yych <= '/') goto yy2;
if(yych >= '2') goto yy2;
@@ -954,7 +961,7 @@ yy78:
ZVAL_BOOL(*rval, parse_iv(start + 2));
return 1;
}
-#line 643 "<stdout>"
+#line 649 "<stdout>"
yy79: ++YYCURSOR;
goto yy80;
yy80:
@@ -965,7 +972,7 @@ yy80:
ZVAL_NULL(*rval);
return 1;
}
-#line 654 "<stdout>"
+#line 660 "<stdout>"
yy81: yych = *++YYCURSOR;
if(yych <= ','){
if(yych != '+') goto yy2;
@@ -1014,7 +1021,7 @@ yy86:
return 1;
}
-#line 704 "<stdout>"
+#line 710 "<stdout>"
yy87: yych = *++YYCURSOR;
if(yych <= ','){
if(yych != '+') goto yy2;
@@ -1061,7 +1068,7 @@ yy92:
return 1;
}
-#line 752 "<stdout>"
+#line 758 "<stdout>"
}
#line 591 "/usr/src/php/php_5_0/ext/standard/var_unserializer.re"
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index 5ada54547..a96972eeb 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var_unserializer.re,v 1.27.2.12 2005/03/10 01:54:24 helly Exp $ */
+/* $Id: var_unserializer.re,v 1.27.2.13 2005/06/01 10:53:25 dmitry Exp $ */
#include "php.h"
#include "ext/standard/php_var.h"
@@ -301,7 +301,8 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, long elements)
return 0;
}
- if(Z_OBJCE_PP(rval) != PHP_IC_ENTRY) {
+ if (Z_OBJCE_PP(rval) != PHP_IC_ENTRY &&
+ zend_hash_exists(&Z_OBJCE_PP(rval)->function_table, "__wakeup", sizeof("__wakeup"))) {
INIT_PZVAL(&fname);
ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1, 0);
call_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);