diff options
Diffstat (limited to 'ext')
1170 files changed, 3546 insertions, 24878 deletions
diff --git a/ext/bz2/tests/001.phpt b/ext/bz2/tests/001.phpt index 5a6b2878b8..ee1872f0ef 100644 --- a/ext/bz2/tests/001.phpt +++ b/ext/bz2/tests/001.phpt @@ -5,7 +5,6 @@ bzopen() and invalid parameters --FILE-- <?php -var_dump(bzopen()); var_dump(bzopen("", "")); var_dump(bzopen("", "r")); var_dump(bzopen("", "w")); @@ -19,9 +18,6 @@ var_dump(bzopen($fp, "r")); echo "Done\n"; ?> --EXPECTF-- -Warning: bzopen() expects exactly 2 parameters, 0 given in %s on line %d -NULL - Warning: bzopen(): '' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d bool(false) diff --git a/ext/bz2/tests/003-mb.phpt b/ext/bz2/tests/003-mb.phpt index 6454d0d182..13bc85d5e7 100644 --- a/ext/bz2/tests/003-mb.phpt +++ b/ext/bz2/tests/003-mb.phpt @@ -6,8 +6,6 @@ bzread() tests <?php $fd = bzopen(dirname(__FILE__)."/003私はガラスを食べられます.txt.bz2","r"); -var_dump(bzread()); -var_dump(bzread($fd, 1 ,0)); var_dump(bzread($fd, 0)); var_dump(bzread($fd, -10)); var_dump(bzread($fd, 1)); @@ -17,11 +15,6 @@ var_dump(bzread($fd, 100000)); echo "Done\n"; ?> --EXPECTF-- -Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d -bool(false) string(0) "" Warning: bzread(): length may not be negative in %s on line %d diff --git a/ext/bz2/tests/003.phpt b/ext/bz2/tests/003.phpt index 23b005ac11..af1a65e5b2 100644 --- a/ext/bz2/tests/003.phpt +++ b/ext/bz2/tests/003.phpt @@ -6,8 +6,6 @@ bzread() tests <?php $fd = bzopen(dirname(__FILE__)."/003.txt.bz2","r"); -var_dump(bzread()); -var_dump(bzread($fd, 1 ,0)); var_dump(bzread($fd, 0)); var_dump(bzread($fd, -10)); var_dump(bzread($fd, 1)); @@ -17,11 +15,6 @@ var_dump(bzread($fd, 100000)); echo "Done\n"; ?> --EXPECTF-- -Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d -bool(false) string(0) "" Warning: bzread(): length may not be negative in %s on line %d diff --git a/ext/bz2/tests/005.phpt b/ext/bz2/tests/005.phpt index da29a6d0b4..4241513526 100644 --- a/ext/bz2/tests/005.phpt +++ b/ext/bz2/tests/005.phpt @@ -10,7 +10,6 @@ Drifting further everyday Getting lost within myself Nothing matters no one else"; -var_dump(bzcompress()); var_dump(bzcompress(1,1,1)); var_dump(bzcompress($string, 100)); var_dump(bzcompress($string, 100, -1)); @@ -23,8 +22,6 @@ $data2 = bzcompress($string, 1, 10); $data3 = $data2; $data3{3} = 0; -var_dump(bzdecompress()); -var_dump(bzdecompress(1,1,1)); var_dump(bzdecompress(1,1)); var_dump(bzdecompress($data3)); var_dump(bzdecompress($data3,1)); @@ -38,19 +35,11 @@ var_dump(bzdecompress($data2)); echo "Done\n"; ?> --EXPECTF-- -Warning: bzcompress() expects at least 1 parameter, 0 given in %s on line %d -NULL string(%d) "BZ%a" int(-2) int(-2) int(-2) int(-2) - -Warning: bzdecompress() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: bzdecompress() expects at most 2 parameters, 3 given in %s on line %d -bool(false) int(-5) int(-5) int(-5) diff --git a/ext/calendar/tests/jdtomonthname.phpt b/ext/calendar/tests/jdtomonthname.phpt index 2ad50a450e..c7fa6cc774 100644 --- a/ext/calendar/tests/jdtomonthname.phpt +++ b/ext/calendar/tests/jdtomonthname.phpt @@ -9,7 +9,6 @@ $jd_days = Array( 2453396, 2440588, -1, - array(), 10000000 ); @@ -52,28 +51,6 @@ string(0) "" string(0) "" string(0) "" -=== -Notice: Array to string conversion in %sjdtomonthname.php on line %d -Array - -Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d -bool(false) - === 10000000 string(3) "Dec" string(8) "December" diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 6619cb4b44..5bfc425b64 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -832,7 +832,8 @@ PHP_FUNCTION(com_load_typelib) } if (!cs) { - php_error_docref(NULL, E_DEPRECATED, "Declaration of case-insensitive constants is deprecated"); + php_error_docref(NULL, E_WARNING, "Declaration of case-insensitive constants is no longer supported"); + RETURN_FALSE; } RETVAL_FALSE; diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index 94b6b65ee6..3aa59f3720 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -237,8 +237,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate) modifier = php_strtok_r(NULL, "#", &strtok_buf); if (modifier != NULL) { if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) { - php_error_docref("com.configuration", E_DEPRECATED, "Declaration of case-insensitive constants is deprecated"); - mode &= ~CONST_CS; + php_error_docref("com.configuration", E_WARNING, "Declaration of case-insensitive constants is no longer supported; #cis modifier ignored"); } } @@ -269,7 +268,8 @@ static PHP_INI_MH(OnTypeLibFileUpdate) static ZEND_INI_MH(OnAutoregisterCasesensitive) { if (!zend_ini_parse_bool(new_value)) { - php_error_docref("com.configuration", E_DEPRECATED, "Declaration of case-insensitive constants is deprecated"); + php_error_docref("com.configuration", E_WARNING, "Declaration of case-insensitive constants is no longer supported"); + return FAILURE; } return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); } diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index 0a4693fec5..d00cb14f14 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -27,7 +27,7 @@ #include "php_com_dotnet_internal.h" #include "Zend/zend_exceptions.h" -static zval *com_property_read(zval *object, zval *member, int type, void **cahce_slot, zval *rv) +static zval *com_property_read(zend_object *object, zend_string *member, int type, void **cahce_slot, zval *rv) { php_com_dotnet_object *obj; VARIANT v; @@ -35,21 +35,22 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc ZVAL_NULL(rv); - obj = CDNO_FETCH(object); + obj = (php_com_dotnet_object*) object; if (V_VT(&obj->v) == VT_DISPATCH) { VariantInit(&v); - convert_to_string_ex(member); - - res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), + res = php_com_do_invoke(obj, ZSTR_VAL(member), ZSTR_LEN(member), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1); if (res == SUCCESS) { php_com_zval_from_variant(rv, &v, obj->code_page); VariantClear(&v); } else if (res == DISP_E_BADPARAMCOUNT) { - php_com_saproxy_create(object, rv, member); + zval zv; + + ZVAL_STR(&zv, member); + php_com_saproxy_create(object, rv, &zv); } } else { php_com_throw_exception(E_INVALIDARG, "this variant has no properties"); @@ -58,18 +59,17 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc return rv; } -static zval *com_property_write(zval *object, zval *member, zval *value, void **cache_slot) +static zval *com_property_write(zend_object *object, zend_string *member, zval *value, void **cache_slot) { php_com_dotnet_object *obj; VARIANT v; - obj = CDNO_FETCH(object); + obj = (php_com_dotnet_object*) object; if (V_VT(&obj->v) == VT_DISPATCH) { VariantInit(&v); - convert_to_string_ex(member); - if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), + if (SUCCESS == php_com_do_invoke(obj, ZSTR_VAL(member), ZSTR_LEN(member), DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0)) { VariantClear(&v); } @@ -79,14 +79,14 @@ static zval *com_property_write(zval *object, zval *member, zval *value, void ** return value; } -static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv) +static zval *com_read_dimension(zend_object *object, zval *offset, int type, zval *rv) { php_com_dotnet_object *obj; VARIANT v; ZVAL_NULL(rv); - obj = CDNO_FETCH(object); + obj = (php_com_dotnet_object*) object; if (V_VT(&obj->v) == VT_DISPATCH) { VariantInit(&v); @@ -115,14 +115,14 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv) return rv; } -static void com_write_dimension(zval *object, zval *offset, zval *value) +static void com_write_dimension(zend_object *object, zval *offset, zval *value) { php_com_dotnet_object *obj; zval args[2]; VARIANT v; HRESULT res; - obj = CDNO_FETCH(object); + obj = (php_com_dotnet_object*) object; if (V_VT(&obj->v) == VT_DISPATCH) { ZVAL_COPY_VALUE(&args[0], offset); @@ -187,16 +187,15 @@ static zval *com_object_get(zval *property) } #endif -static int com_property_exists(zval *object, zval *member, int check_empty, void **cache_slot) +static int com_property_exists(zend_object *object, zend_string *member, int check_empty, void **cache_slot) { DISPID dispid; php_com_dotnet_object *obj; - obj = CDNO_FETCH(object); + obj = (php_com_dotnet_object*) object; if (V_VT(&obj->v) == VT_DISPATCH) { - convert_to_string_ex(member); - if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), &dispid))) { + if (SUCCEEDED(php_com_get_id_of_name(obj, ZSTR_VAL(member), ZSTR_LEN(member), &dispid))) { /* TODO: distinguish between property and method! */ return 1; } @@ -207,23 +206,23 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void return 0; } -static int com_dimension_exists(zval *object, zval *member, int check_empty) +static int com_dimension_exists(zend_object *object, zval *member, int check_empty) { php_error_docref(NULL, E_WARNING, "Operation not yet supported on a COM object"); return 0; } -static void com_property_delete(zval *object, zval *member, void **cache_slot) +static void com_property_delete(zend_object *object, zend_string *member, void **cache_slot) { php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object"); } -static void com_dimension_delete(zval *object, zval *offset) +static void com_dimension_delete(zend_object *object, zval *offset) { php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object"); } -static HashTable *com_properties_get(zval *object) +static HashTable *com_properties_get(zend_object *object) { /* TODO: use type-info to get all the names and values ? * DANGER: if we do that, there is a strong possibility for @@ -247,11 +246,42 @@ static void function_dtor(zval *zv) static PHP_FUNCTION(com_method_handler) { zval *object = getThis(); + zend_string *method = EX(func)->common.function_name; + zval *args = NULL; + php_com_dotnet_object *obj = CDNO_FETCH(object); + int nargs; + VARIANT v; + int ret = FAILURE; + + if (V_VT(&obj->v) != VT_DISPATCH) { + goto exit; + } + + nargs = ZEND_NUM_ARGS(); + + if (nargs) { + args = (zval *)safe_emalloc(sizeof(zval), nargs, 0); + zend_get_parameters_array_ex(nargs, args); + } - Z_OBJ_HANDLER_P(object, call_method)( - ((zend_internal_function*)EX(func))->function_name, - Z_OBJ_P(object), - INTERNAL_FUNCTION_PARAM_PASSTHRU); + VariantInit(&v); + + if (SUCCESS == php_com_do_invoke_byref(obj, (zend_internal_function*)EX(func), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args)) { + php_com_zval_from_variant(return_value, &v, obj->code_page); + ret = SUCCESS; + VariantClear(&v); + } + + if (args) { + efree(args); + } + +exit: + /* Cleanup trampoline */ + ZEND_ASSERT(EX(func)->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE); + zend_string_release(EX(func)->common.function_name); + zend_free_trampoline(EX(func)); + EX(func) = NULL; } static zend_function *com_method_get(zend_object **object_ptr, zend_string *name, const zval *key) @@ -271,7 +301,8 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name /* check cache */ if (obj->method_cache == NULL || NULL == (fptr = zend_hash_find_ptr(obj->method_cache, name))) { - f.type = ZEND_OVERLOADED_FUNCTION; + memset(&f, 0, sizeof(zend_internal_function)); + f.type = ZEND_INTERNAL_FUNCTION; f.num_args = 0; f.arg_info = NULL; f.scope = obj->ce; @@ -346,6 +377,7 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name if (fptr) { /* duplicate this into a new chunk of emalloc'd memory, * since the engine will efree it */ + zend_string_addref(fptr->function_name); func = emalloc(sizeof(*fptr)); memcpy(func, fptr, sizeof(*fptr)); @@ -355,40 +387,6 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name return NULL; } -static int com_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS) -{ - zval *args = NULL; - php_com_dotnet_object *obj = (php_com_dotnet_object*)object; - int nargs; - VARIANT v; - int ret = FAILURE; - - if (V_VT(&obj->v) != VT_DISPATCH) { - return FAILURE; - } - - nargs = ZEND_NUM_ARGS(); - - if (nargs) { - args = (zval *)safe_emalloc(sizeof(zval), nargs, 0); - zend_get_parameters_array_ex(nargs, args); - } - - VariantInit(&v); - - if (SUCCESS == php_com_do_invoke_byref(obj, (zend_internal_function*)EX(func), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args)) { - php_com_zval_from_variant(return_value, &v, obj->code_page); - ret = SUCCESS; - VariantClear(&v); - } - - if (args) { - efree(args); - } - - return ret; -} - static zend_function *com_constructor_get(zend_object *object) { php_com_dotnet_object *obj = (php_com_dotnet_object *) object; @@ -461,14 +459,14 @@ static int com_objects_compare(zval *object1, zval *object2) return ret; } -static int com_object_cast(zval *readobj, zval *writeobj, int type) +static int com_object_cast(zend_object *readobj, zval *writeobj, int type) { php_com_dotnet_object *obj; VARIANT v; VARTYPE vt = VT_EMPTY; HRESULT res = S_OK; - obj = CDNO_FETCH(readobj); + obj = (php_com_dotnet_object*) readobj; ZVAL_NULL(writeobj); VariantInit(&v); @@ -518,12 +516,12 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type) return zend_std_cast_object_tostring(readobj, writeobj, type); } -static int com_object_count(zval *object, zend_long *count) +static int com_object_count(zend_object *object, zend_long *count) { php_com_dotnet_object *obj; LONG ubound = 0, lbound = 0; - obj = CDNO_FETCH(object); + obj = (php_com_dotnet_object*) object; if (!V_ISARRAY(&obj->v)) { return FAILURE; @@ -555,7 +553,6 @@ zend_object_handlers php_com_object_handlers = { com_dimension_delete, com_properties_get, com_method_get, - com_call_method, com_constructor_get, com_class_name_get, com_objects_compare, @@ -619,11 +616,11 @@ void php_com_object_free_storage(zend_object *object) zend_object_std_dtor(object); } -zend_object* php_com_object_clone(zval *object) +zend_object* php_com_object_clone(zend_object *object) { php_com_dotnet_object *cloneobj, *origobject; - origobject = (php_com_dotnet_object*)Z_OBJ_P(object); + origobject = (php_com_dotnet_object*) object; cloneobj = (php_com_dotnet_object*)emalloc(sizeof(php_com_dotnet_object)); memcpy(cloneobj, origobject, sizeof(*cloneobj)); diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index 89c100b0fa..e78503be3c 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -287,7 +287,6 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream) } #define CPH_ME(fname, arginfo) PHP_ME(com_persist, fname, arginfo, ZEND_ACC_PUBLIC) -#define CPH_SME(fname, arginfo) PHP_ME(com_persist, fname, arginfo, ZEND_ACC_ALLOW_STATIC|ZEND_ACC_PUBLIC) #define CPH_METHOD(fname) static PHP_METHOD(com_persist, fname) #define CPH_FETCH() php_com_persist_helper *helper = (php_com_persist_helper*)Z_OBJ_P(getThis()); @@ -710,9 +709,9 @@ static void helper_free_storage(zend_object *obj) } -static zend_object* helper_clone(zval *obj) +static zend_object* helper_clone(zend_object *obj) { - php_com_persist_helper *clone, *object = (php_com_persist_helper*)Z_OBJ_P(obj); + php_com_persist_helper *clone, *object = (php_com_persist_helper*) obj; clone = emalloc(sizeof(*object)); memcpy(clone, object, sizeof(*object)); diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c index 7eec446a3f..ebef6430a3 100644 --- a/ext/com_dotnet/com_saproxy.c +++ b/ext/com_dotnet/com_saproxy.c @@ -37,7 +37,6 @@ typedef struct { zend_object std; /* the object we a proxying for; we hold a refcount to it */ - zval *zobj; php_com_dotnet_object *obj; /* how many dimensions we are indirecting to get into this element */ @@ -69,7 +68,7 @@ static inline void clone_indices(php_com_saproxy *dest, php_com_saproxy *src, in } } -static zval *saproxy_property_read(zval *object, zval *member, int type, void **cache_slot, zval *rv) +static zval *saproxy_property_read(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) { ZVAL_NULL(rv); @@ -78,14 +77,14 @@ static zval *saproxy_property_read(zval *object, zval *member, int type, void ** return rv; } -static void saproxy_property_write(zval *object, zval *member, zval *value, void **cache_slot) +static void saproxy_property_write(zend_object *object, zend_string *member, zval *value, void **cache_slot) { php_com_throw_exception(E_INVALIDARG, "safearray has no properties"); } -static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *rv) +static zval *saproxy_read_dimension(zend_object *object, zval *offset, int type, zval *rv) { - php_com_saproxy *proxy = SA_FETCH(object); + php_com_saproxy *proxy = (php_com_saproxy*) object; UINT dims, i; SAFEARRAY *sa; LONG ubound, lbound; @@ -201,9 +200,9 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * return rv; } -static void saproxy_write_dimension(zval *object, zval *offset, zval *value) +static void saproxy_write_dimension(zend_object *object, zval *offset, zval *value) { - php_com_saproxy *proxy = SA_FETCH(object); + php_com_saproxy *proxy = (php_com_saproxy*) object; UINT dims, i; HRESULT res; VARIANT v; @@ -286,29 +285,29 @@ static zval *saproxy_object_get(zval *property) } #endif -static int saproxy_property_exists(zval *object, zval *member, int check_empty, void **cache_slot) +static int saproxy_property_exists(zend_object *object, zend_string *member, int check_empty, void **cache_slot) { /* no properties */ return 0; } -static int saproxy_dimension_exists(zval *object, zval *member, int check_empty) +static int saproxy_dimension_exists(zend_object *object, zval *member, int check_empty) { php_error_docref(NULL, E_WARNING, "Operation not yet supported on a COM object"); return 0; } -static void saproxy_property_delete(zval *object, zval *member, void **cache_slot) +static void saproxy_property_delete(zend_object *object, zend_string *member, void **cache_slot) { php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object"); } -static void saproxy_dimension_delete(zval *object, zval *offset) +static void saproxy_dimension_delete(zend_object *object, zval *offset) { php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object"); } -static HashTable *saproxy_properties_get(zval *object) +static HashTable *saproxy_properties_get(zend_object *object) { /* no properties */ return NULL; @@ -320,11 +319,6 @@ static zend_function *saproxy_method_get(zend_object **object, zend_string *name return NULL; } -static int saproxy_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS) -{ - return FAILURE; -} - static zend_function *saproxy_constructor_get(zend_object *object) { /* user cannot instantiate */ @@ -341,14 +335,14 @@ static int saproxy_objects_compare(zval *object1, zval *object2) return -1; } -static int saproxy_object_cast(zval *readobj, zval *writeobj, int type) +static int saproxy_object_cast(zend_object *readobj, zval *writeobj, int type) { return FAILURE; } -static int saproxy_count_elements(zval *object, zend_long *count) +static int saproxy_count_elements(zend_object *object, zend_long *count) { - php_com_saproxy *proxy = SA_FETCH(object); + php_com_saproxy *proxy = (php_com_saproxy*) object; LONG ubound, lbound; if (!V_ISARRAY(&proxy->obj->v)) { @@ -374,21 +368,22 @@ static void saproxy_free_storage(zend_object *object) //??? } //??? } + OBJ_RELEASE(&proxy->obj->zo); + zend_object_std_dtor(object); - zval_ptr_dtor(proxy->zobj); efree(proxy->indices); } -static zend_object* saproxy_clone(zval *object) +static zend_object* saproxy_clone(zend_object *object) { - php_com_saproxy *proxy = (php_com_saproxy *)Z_OBJ_P(object); + php_com_saproxy *proxy = (php_com_saproxy *) object; php_com_saproxy *cloneproxy; cloneproxy = emalloc(sizeof(*cloneproxy)); memcpy(cloneproxy, proxy, sizeof(*cloneproxy)); - Z_ADDREF_P(cloneproxy->zobj); + GC_ADDREF(&cloneproxy->obj->zo); cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0); clone_indices(cloneproxy, proxy, proxy->dimensions); @@ -413,7 +408,6 @@ zend_object_handlers php_com_saproxy_handlers = { saproxy_dimension_delete, saproxy_properties_get, saproxy_method_get, - saproxy_call_method, saproxy_constructor_get, saproxy_class_name_get, saproxy_objects_compare, @@ -421,24 +415,22 @@ zend_object_handlers php_com_saproxy_handlers = { saproxy_count_elements }; -int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index) +int php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index) { php_com_saproxy *proxy, *rel = NULL; proxy = ecalloc(1, sizeof(*proxy)); proxy->dimensions = 1; - if (Z_OBJCE_P(com_object) == php_com_saproxy_class_entry) { - rel = SA_FETCH(com_object); + if (com_object->ce == php_com_saproxy_class_entry) { + rel = (php_com_saproxy*) com_object; proxy->obj = rel->obj; - proxy->zobj = rel->zobj; proxy->dimensions += rel->dimensions; } else { - proxy->obj = CDNO_FETCH(com_object); - proxy->zobj = com_object; + proxy->obj = (php_com_dotnet_object*) com_object; } - Z_ADDREF_P(proxy->zobj); + GC_ADDREF(&proxy->obj->zo); proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0); if (rel) { diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h index e41b7ffdd1..611220b729 100644 --- a/ext/com_dotnet/php_com_dotnet_internal.h +++ b/ext/com_dotnet/php_com_dotnet_internal.h @@ -75,14 +75,14 @@ zend_class_entry *php_com_variant_class_entry, *php_com_exception_class_entry, * /* com_handlers.c */ zend_object* php_com_object_new(zend_class_entry *ce); -zend_object* php_com_object_clone(zval *object); +zend_object* php_com_object_clone(zend_object *object); void php_com_object_free_storage(zend_object *object); zend_object_handlers php_com_object_handlers; void php_com_object_enable_event_sink(php_com_dotnet_object *obj, int enable); /* com_saproxy.c */ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *object, int by_ref); -int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index); +int php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index); /* com_olechar.c */ PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring, diff --git a/ext/curl/tests/curl_setopt_error.phpt b/ext/curl/tests/curl_setopt_error.phpt index ab864d4b2d..0a7db7265f 100644 --- a/ext/curl/tests/curl_setopt_error.phpt +++ b/ext/curl/tests/curl_setopt_error.phpt @@ -9,37 +9,17 @@ Paul Sohier <?php echo "*** curl_setopt() call with incorrect parameters\n"; $ch = curl_init(); -curl_setopt(); -curl_setopt(false); -curl_setopt($ch); -curl_setopt($ch, false); -curl_setopt($ch, -10); -curl_setopt($ch, ''); -curl_setopt($ch, 1, false); +try { + curl_setopt($ch, '', false); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -curl_setopt(false, false, false); -curl_setopt($ch, '', false); -curl_setopt($ch, 1, ''); curl_setopt($ch, -10, 0); ?> --EXPECTF-- *** curl_setopt() call with incorrect parameters - -Warning: curl_setopt() expects exactly 3 parameters, 0 given in %s on line %d - -Warning: curl_setopt() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: curl_setopt() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d - -Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d - -Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d - -Warning: curl_setopt() expects parameter 1 to be resource, bool given in %s on line %d - -Warning: curl_setopt() expects parameter 2 to be int, string given in %s on line %d +curl_setopt() expects parameter 2 to be int, string given Warning: curl_setopt(): Invalid curl configuration option in %scurl_setopt_error.php on line %d diff --git a/ext/date/php_date.c b/ext/date/php_date.c index d218d011d8..2deea9964d 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -81,7 +81,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_strtotime, 0, 0, 1) ZEND_ARG_INFO(0, now) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_mktime, 0, 0, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_mktime, 0, 0, 1) ZEND_ARG_INFO(0, hour) ZEND_ARG_INFO(0, min) ZEND_ARG_INFO(0, sec) @@ -90,7 +90,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_mktime, 0, 0, 0) ZEND_ARG_INFO(0, year) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_gmmktime, 0, 0, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_gmmktime, 0, 0, 1) ZEND_ARG_INFO(0, hour) ZEND_ARG_INFO(0, min) ZEND_ARG_INFO(0, sec) @@ -638,28 +638,28 @@ static zend_object *date_object_new_timezone(zend_class_entry *class_type); static zend_object *date_object_new_interval(zend_class_entry *class_type); static zend_object *date_object_new_period(zend_class_entry *class_type); -static zend_object *date_object_clone_date(zval *this_ptr); -static zend_object *date_object_clone_timezone(zval *this_ptr); -static zend_object *date_object_clone_interval(zval *this_ptr); -static zend_object *date_object_clone_period(zval *this_ptr); +static zend_object *date_object_clone_date(zend_object *this_ptr); +static zend_object *date_object_clone_timezone(zend_object *this_ptr); +static zend_object *date_object_clone_interval(zend_object *this_ptr); +static zend_object *date_object_clone_period(zend_object *this_ptr); static int date_object_compare_date(zval *d1, zval *d2); -static HashTable *date_object_get_gc(zval *object, zval **table, int *n); -static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose); -static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n); -static HashTable *date_object_get_properties_interval(zval *object); -static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n); -static HashTable *date_object_get_properties_period(zval *object); -static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose); -static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n); -static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp); +static HashTable *date_object_get_gc(zend_object *object, zval **table, int *n); +static HashTable *date_object_get_properties_for(zend_object *object, zend_prop_purpose purpose); +static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, int *n); +static HashTable *date_object_get_properties_interval(zend_object *object); +static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n); +static HashTable *date_object_get_properties_period(zend_object *object); +static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose); +static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n); +static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp); static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv); -zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); -zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot); -static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot); -static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); -static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot); +zval *date_interval_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv); +zval *date_interval_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot); +static zval *date_interval_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot); +static zval *date_period_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv); +static zval *date_period_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot); /* {{{ Module struct */ zend_module_entry date_module_entry = { @@ -1527,9 +1527,9 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) zend_long ts, adjust_seconds = 0; int error; - ZEND_PARSE_PARAMETERS_START(0, 6) - Z_PARAM_OPTIONAL + ZEND_PARSE_PARAMETERS_START(1, 6) Z_PARAM_LONG(hou) + Z_PARAM_OPTIONAL Z_PARAM_LONG(min) Z_PARAM_LONG(sec) Z_PARAM_LONG(mon) @@ -1549,8 +1549,6 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) } /* Fill in the new data */ switch (ZEND_NUM_ARGS()) { - case 7: - /* break intentionally missing */ case 6: if (yea >= 0 && yea < 70) { yea += 2000; @@ -1574,8 +1572,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) case 1: now->h = hou; break; - default: - php_error_docref(NULL, E_DEPRECATED, "You should be using the time() function instead"); + EMPTY_SWITCH_DEFAULT_CASE() } /* Update the timestamp */ if (gmt) { @@ -1597,7 +1594,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) } /* }}} */ -/* {{{ proto int mktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) +/* {{{ proto int mktime(int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]) Get UNIX timestamp for a date */ PHP_FUNCTION(mktime) { @@ -1605,7 +1602,7 @@ PHP_FUNCTION(mktime) } /* }}} */ -/* {{{ proto int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) +/* {{{ proto int gmmktime(int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]) Get UNIX timestamp for a GMT date */ PHP_FUNCTION(gmmktime) { @@ -2019,31 +2016,21 @@ static int implement_date_interface_handler(zend_class_entry *interface, zend_cl return SUCCESS; } /* }}} */ -static int date_interval_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static int date_interval_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */ { php_interval_obj *obj; - zval tmp_member; zval rv; zval *prop; int retval = 0; - if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_PHPINTERVAL_P(object); + obj = php_interval_obj_from_obj(object); if (!obj->initialized) { - retval = zend_std_has_property(object, member, type, cache_slot); - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } + retval = zend_std_has_property(object, name, type, cache_slot); return retval; } - prop = date_interval_read_property(object, member, BP_VAR_IS, cache_slot, &rv); + prop = date_interval_read_property(object, name, BP_VAR_IS, cache_slot, &rv); if (prop != &EG(uninitialized_zval)) { if (type == 2) { @@ -2054,11 +2041,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void retval = (Z_TYPE_P(prop) != IS_NULL); } } else { - retval = zend_std_has_property(object, member, type, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + retval = zend_std_has_property(object, name, type, cache_slot); } return retval; @@ -2188,9 +2171,9 @@ static zend_object *date_object_new_date(zend_class_entry *class_type) /* {{{ */ return &intern->std; } /* }}} */ -static zend_object *date_object_clone_date(zval *this_ptr) /* {{{ */ +static zend_object *date_object_clone_date(zend_object *this_ptr) /* {{{ */ { - php_date_obj *old_obj = Z_PHPDATE_P(this_ptr); + php_date_obj *old_obj = php_date_obj_from_obj(this_ptr); php_date_obj *new_obj = php_date_obj_from_obj(date_object_new_date(old_obj->std.ce)); zend_objects_clone_members(&new_obj->std, &old_obj->std); @@ -2213,7 +2196,7 @@ static zend_object *date_object_clone_date(zval *this_ptr) /* {{{ */ static void date_clone_immutable(zval *object, zval *new_object) /* {{{ */ { - ZVAL_OBJ(new_object, date_object_clone_date(object)); + ZVAL_OBJ(new_object, date_object_clone_date(Z_OBJ_P(object))); } /* }}} */ static int date_object_compare_date(zval *d1, zval *d2) /* {{{ */ @@ -2235,21 +2218,21 @@ static int date_object_compare_date(zval *d1, zval *d2) /* {{{ */ return timelib_time_compare(o1->time, o2->time); } /* }}} */ -static HashTable *date_object_get_gc(zval *object, zval **table, int *n) /* {{{ */ +static HashTable *date_object_get_gc(zend_object *object, zval **table, int *n) /* {{{ */ { *table = NULL; *n = 0; return zend_std_get_properties(object); } /* }}} */ -static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n) /* {{{ */ +static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n) /* {{{ */ { *table = NULL; *n = 0; return zend_std_get_properties(object); } /* }}} */ -static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose) /* {{{ */ +static HashTable *date_object_get_properties_for(zend_object *object, zend_prop_purpose purpose) /* {{{ */ { HashTable *props; zval zv; @@ -2265,7 +2248,7 @@ static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose return zend_std_get_properties_for(object, purpose); } - dateobj = Z_PHPDATE_P(object); + dateobj = php_date_obj_from_obj(object); props = zend_array_dup(zend_std_get_properties(object)); if (!dateobj->time) { return props; @@ -2317,9 +2300,9 @@ static zend_object *date_object_new_timezone(zend_class_entry *class_type) /* {{ return &intern->std; } /* }}} */ -static zend_object *date_object_clone_timezone(zval *this_ptr) /* {{{ */ +static zend_object *date_object_clone_timezone(zend_object *this_ptr) /* {{{ */ { - php_timezone_obj *old_obj = Z_PHPTIMEZONE_P(this_ptr); + php_timezone_obj *old_obj = php_timezone_obj_from_obj(this_ptr); php_timezone_obj *new_obj = php_timezone_obj_from_obj(date_object_new_timezone(old_obj->std.ce)); zend_objects_clone_members(&new_obj->std, &old_obj->std); @@ -2370,7 +2353,7 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv) } } -static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose) /* {{{ */ +static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose) /* {{{ */ { HashTable *props; zval zv; @@ -2386,7 +2369,7 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro return zend_std_get_properties_for(object, purpose); } - tzobj = Z_PHPTIMEZONE_P(object); + tzobj = php_timezone_obj_from_obj(object); props = zend_array_dup(zend_std_get_properties(object)); if (!tzobj->initialized) { return props; @@ -2401,13 +2384,13 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro return props; } /* }}} */ -static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp) /* {{{ */ +static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp) /* {{{ */ { HashTable *ht, *props; zval zv; php_timezone_obj *tzobj; - tzobj = Z_PHPTIMEZONE_P(object); + tzobj = php_timezone_obj_from_obj(object); props = zend_std_get_properties(object); *is_temp = 1; @@ -2433,9 +2416,9 @@ static zend_object *date_object_new_interval(zend_class_entry *class_type) /* {{ return &intern->std; } /* }}} */ -static zend_object *date_object_clone_interval(zval *this_ptr) /* {{{ */ +static zend_object *date_object_clone_interval(zend_object *this_ptr) /* {{{ */ { - php_interval_obj *old_obj = Z_PHPINTERVAL_P(this_ptr); + php_interval_obj *old_obj = php_interval_obj_from_obj(this_ptr); php_interval_obj *new_obj = php_interval_obj_from_obj(date_object_new_interval(old_obj->std.ce)); zend_objects_clone_members(&new_obj->std, &old_obj->std); @@ -2447,7 +2430,7 @@ static zend_object *date_object_clone_interval(zval *this_ptr) /* {{{ */ return &new_obj->std; } /* }}} */ -static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n) /* {{{ */ +static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, int *n) /* {{{ */ { *table = NULL; @@ -2455,13 +2438,13 @@ static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n return zend_std_get_properties(object); } /* }}} */ -static HashTable *date_object_get_properties_interval(zval *object) /* {{{ */ +static HashTable *date_object_get_properties_interval(zend_object *object) /* {{{ */ { HashTable *props; zval zv; php_interval_obj *intervalobj; - intervalobj = Z_PHPINTERVAL_P(object); + intervalobj = php_interval_obj_from_obj(object); props = zend_std_get_properties(object); if (!intervalobj->initialized) { return props; @@ -2509,9 +2492,9 @@ static zend_object *date_object_new_period(zend_class_entry *class_type) /* {{{ return &intern->std; } /* }}} */ -static zend_object *date_object_clone_period(zval *this_ptr) /* {{{ */ +static zend_object *date_object_clone_period(zend_object *this_ptr) /* {{{ */ { - php_period_obj *old_obj = Z_PHPPERIOD_P(this_ptr); + php_period_obj *old_obj = php_period_obj_from_obj(this_ptr); php_period_obj *new_obj = php_period_obj_from_obj(date_object_new_period(old_obj->std.ce)); zend_objects_clone_members(&new_obj->std, &old_obj->std); @@ -2813,7 +2796,7 @@ PHP_METHOD(DateTime, __construct) size_t time_str_len = 0; zend_error_handling error_handling; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 0, 2) + ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL Z_PARAM_STRING(time_str, time_str_len) Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0) @@ -2835,7 +2818,7 @@ PHP_METHOD(DateTimeImmutable, __construct) size_t time_str_len = 0; zend_error_handling error_handling; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 0, 2) + ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL Z_PARAM_STRING(time_str, time_str_len) Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0) @@ -3840,7 +3823,7 @@ PHP_METHOD(DateTimeZone, __construct) php_timezone_obj *tzobj; zend_error_handling error_handling; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(tz) ZEND_PARSE_PARAMETERS_END(); @@ -4134,34 +4117,24 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma } /* }}} */ /* {{{ date_interval_read_property */ -zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) +zval *date_interval_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) { php_interval_obj *obj; zval *retval; - zval tmp_member; timelib_sll value = -1; double fvalue = -1; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_PHPINTERVAL_P(object); + obj = php_interval_obj_from_obj(object); if (!obj->initialized) { - retval = zend_std_read_property(object, member, type, cache_slot, rv); - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } + retval = zend_std_read_property(object, name, type, cache_slot, rv); return retval; } #define GET_VALUE_FROM_STRUCT(n,m) \ - if (strcmp(Z_STRVAL_P(member), m) == 0) { \ - value = obj->diff->n; \ - break; \ + if (strcmp(ZSTR_VAL(name), m) == 0) { \ + value = obj->diff->n; \ + break; \ } do { GET_VALUE_FROM_STRUCT(y, "y"); @@ -4170,18 +4143,14 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c GET_VALUE_FROM_STRUCT(h, "h"); GET_VALUE_FROM_STRUCT(i, "i"); GET_VALUE_FROM_STRUCT(s, "s"); - if (strcmp(Z_STRVAL_P(member), "f") == 0) { + if (strcmp(ZSTR_VAL(name), "f") == 0) { fvalue = obj->diff->us / 1000000.0; break; } GET_VALUE_FROM_STRUCT(invert, "invert"); GET_VALUE_FROM_STRUCT(days, "days"); /* didn't find any */ - retval = zend_std_read_property(object, member, type, cache_slot, rv); - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } + retval = zend_std_read_property(object, name, type, cache_slot, rv); return retval; } while(0); @@ -4196,38 +4165,23 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c ZVAL_FALSE(retval); } - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } - return retval; } /* }}} */ /* {{{ date_interval_write_property */ -zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot) +zval *date_interval_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) { php_interval_obj *obj; - zval tmp_member; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_PHPINTERVAL_P(object); + obj = php_interval_obj_from_obj(object); if (!obj->initialized) { - value = zend_std_write_property(object, member, value, cache_slot); - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } - return value; + return zend_std_write_property(object, name, value, cache_slot); } -#define SET_VALUE_FROM_STRUCT(n,m) \ - if (strcmp(Z_STRVAL_P(member), m) == 0) { \ +#define SET_VALUE_FROM_STRUCT(n,m) \ + if (strcmp(ZSTR_VAL(name), m) == 0) { \ obj->diff->n = zval_get_long(value); \ break; \ } @@ -4239,51 +4193,37 @@ zval *date_interval_write_property(zval *object, zval *member, zval *value, void SET_VALUE_FROM_STRUCT(h, "h"); SET_VALUE_FROM_STRUCT(i, "i"); SET_VALUE_FROM_STRUCT(s, "s"); - if (strcmp(Z_STRVAL_P(member), "f") == 0) { + if (strcmp(ZSTR_VAL(name), "f") == 0) { obj->diff->us = zval_get_double(value) * 1000000; break; } SET_VALUE_FROM_STRUCT(invert, "invert"); /* didn't find any */ - value = zend_std_write_property(object, member, value, cache_slot); + value = zend_std_write_property(object, name, value, cache_slot); } while(0); - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } - return value; } /* }}} */ /* {{{ date_interval_get_property_ptr_ptr */ -static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) -{ - zval tmp_member, *ret; - - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - cache_slot = NULL; - } - - if(zend_binary_strcmp("y", sizeof("y") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("m", sizeof("m") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("d", sizeof("d") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("f", sizeof("f") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) { +static zval *date_interval_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) +{ + zval *ret; + + if(zend_binary_strcmp("y", sizeof("y") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("m", sizeof("m") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("d", sizeof("d") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("h", sizeof("h") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("i", sizeof("i") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("s", sizeof("s") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("f", sizeof("f") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("days", sizeof("days") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("invert", sizeof("invert") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0) { /* Fallback to read_property. */ ret = NULL; } else { - ret = zend_std_get_property_ptr_ptr(object, member, type, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + ret = zend_std_get_property_ptr_ptr(object, name, type, cache_slot); } return ret; @@ -4299,7 +4239,7 @@ PHP_METHOD(DateInterval, __construct) timelib_rel_time *reltime; zend_error_handling error_handling; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(interval_string) ZEND_PARSE_PARAMETERS_END(); @@ -5088,20 +5028,20 @@ PHP_FUNCTION(date_sun_info) } /* }}} */ -static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n) /* {{{ */ +static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n) /* {{{ */ { *table = NULL; *n = 0; return zend_std_get_properties(object); } /* }}} */ -static HashTable *date_object_get_properties_period(zval *object) /* {{{ */ +static HashTable *date_object_get_properties_period(zend_object *object) /* {{{ */ { HashTable *props; zval zv; php_period_obj *period_obj; - period_obj = Z_PHPPERIOD_P(object); + period_obj = php_period_obj_from_obj(object); props = zend_std_get_properties(object); if (!period_obj->start) { return props; @@ -5279,21 +5219,21 @@ PHP_METHOD(DatePeriod, __wakeup) /* }}} */ /* {{{ date_period_read_property */ -static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) +static zval *date_period_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) { if (type != BP_VAR_IS && type != BP_VAR_R) { zend_throw_error(NULL, "Retrieval of DatePeriod properties for modification is unsupported"); return &EG(uninitialized_zval); } - Z_OBJPROP_P(object); /* build properties hash table */ + object->handlers->get_properties(object); /* build properties hash table */ - return zend_std_read_property(object, member, type, cache_slot, rv); + return zend_std_read_property(object, name, type, cache_slot, rv); } /* }}} */ /* {{{ date_period_write_property */ -static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot) +static zval *date_period_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) { zend_throw_error(NULL, "Writing to DatePeriod properties is unsupported"); return value; diff --git a/ext/date/tests/005.phpt b/ext/date/tests/005.phpt index e1075ef248..23fff3b731 100644 --- a/ext/date/tests/005.phpt +++ b/ext/date/tests/005.phpt @@ -6,9 +6,6 @@ date_default_timezone_set('UTC'); $t = mktime(0,0,0, 6, 27, 2006); -var_dump(idate()); -var_dump(idate(1,1,1)); - var_dump(idate(1,1)); var_dump(idate("")); var_dump(idate(0)); @@ -20,12 +17,6 @@ var_dump(idate("'")); echo "Done\n"; ?> --EXPECTF-- -Warning: idate() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: idate() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - Warning: idate(): Unrecognized date format token. in %s on line %d bool(false) diff --git a/ext/date/tests/006.phpt b/ext/date/tests/006.phpt index 425430a470..5171c430e2 100644 --- a/ext/date/tests/006.phpt +++ b/ext/date/tests/006.phpt @@ -4,7 +4,6 @@ checkdate() tests <?php date_default_timezone_set('UTC'); -var_dump(checkdate()); var_dump(checkdate(1,1,1)); var_dump(checkdate(2,29,2006)); @@ -18,9 +17,7 @@ var_dump(checkdate(1,1,-1)); echo "Done\n"; ?> ---EXPECTF-- -Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d -bool(false) +--EXPECT-- bool(true) bool(false) bool(false) diff --git a/ext/date/tests/007.phpt b/ext/date/tests/007.phpt index 141e251753..4e0b24ce75 100644 --- a/ext/date/tests/007.phpt +++ b/ext/date/tests/007.phpt @@ -5,7 +5,6 @@ localtime() tests date_default_timezone_set('UTC'); $t = mktime(0,0,0, 6, 27, 2006); -var_dump(localtime(1,1,1)); var_dump(localtime()); var_dump(localtime($t)); @@ -15,8 +14,6 @@ var_dump(localtime($t, false)); echo "Done\n"; ?> --EXPECTF-- -Warning: localtime() expects at most 2 parameters, 3 given in %s on line %d -bool(false) array(9) { [0]=> int(%d) diff --git a/ext/date/tests/008.phpt b/ext/date/tests/008.phpt index e67b4bd0a4..701403d1f8 100644 --- a/ext/date/tests/008.phpt +++ b/ext/date/tests/008.phpt @@ -5,7 +5,6 @@ getdate() tests date_default_timezone_set('UTC'); $t = mktime(0,0,0, 6, 27, 2006); -var_dump(getdate(1,1)); var_dump(getdate($t)); var_dump(getdate()); @@ -13,8 +12,6 @@ var_dump(getdate()); echo "Done\n"; ?> --EXPECTF-- -Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d -bool(false) array(11) { ["seconds"]=> int(0) diff --git a/ext/date/tests/009.phpt b/ext/date/tests/009.phpt index 4812d63de6..9d77a552cc 100644 --- a/ext/date/tests/009.phpt +++ b/ext/date/tests/009.phpt @@ -10,16 +10,12 @@ date_default_timezone_set('Asia/Jerusalem'); $t = mktime(0,0,0, 6, 27, 2006); -var_dump(strftime()); - var_dump(strftime("")); var_dump(strftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t)); var_dump(strftime("%%q %%a", $t)); var_dump(strftime("%q", $t)); var_dump(strftime("blah", $t)); -var_dump(gmstrftime()); - var_dump(gmstrftime("")); var_dump(gmstrftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t)); var_dump(gmstrftime("%%q %%a", $t)); @@ -29,17 +25,12 @@ var_dump(gmstrftime("blah", $t)); echo "Done\n"; ?> --EXPECTF-- -Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d -bool(false) bool(false) string(%d) "Tue Tuesday Jun June Tue Jun 27 00:00:00 2006 %s %s %" string(5) "%q %a" string(%d) "%s" string(4) "blah" - -Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d -bool(false) bool(false) string(%d) "Mon Monday Jun June Mon Jun 26 21:00:00 2006 %s %s %" diff --git a/ext/date/tests/009_win32.phpt b/ext/date/tests/009_win32.phpt index 91c1b261ce..dcd118c97d 100644 --- a/ext/date/tests/009_win32.phpt +++ b/ext/date/tests/009_win32.phpt @@ -14,8 +14,6 @@ setlocale(LC_TIME, "en-us"); $t = mktime(0,0,0, 6, 27, 2006); -var_dump(strftime()); - var_dump(strftime("")); var_dump(strftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t)); @@ -24,8 +22,6 @@ var_dump(strftime("%%q %%a", $t)); var_dump(strftime("blah", $t)); -var_dump(gmstrftime()); - var_dump(gmstrftime("")); var_dump(gmstrftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t)); @@ -39,15 +35,10 @@ echo "Done\n"; setlocale(LC_TIME, $loc); ?> --EXPECTF-- -Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d -bool(false) bool(false) string(%d) "Tue Tuesday Jun June 6/27/2006 12:00:00 AM 27 00 12 178 06 00 AM 00 26 26 2 6/27/2006 12:00:00 AM 06 2006 %s" string(5) "%q %a" string(4) "blah" - -Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d -bool(false) bool(false) string(%d) "Mon Monday Jun June 6/26/2006 9:00:00 PM 26 21 09 177 06 00 PM 00 26 26 1 6/26/2006 9:00:00 PM 06 2006 %s" string(5) "%q %a" diff --git a/ext/date/tests/011.phpt b/ext/date/tests/011.phpt index 092a4b7758..ca9820c4ef 100644 --- a/ext/date/tests/011.phpt +++ b/ext/date/tests/011.phpt @@ -4,7 +4,6 @@ timezone_name_from_abbr() tests <?php date_default_timezone_set('UTC'); -var_dump(timezone_name_from_abbr()); var_dump(timezone_name_from_abbr("CET")); var_dump(timezone_name_from_abbr("AXST")); var_dump(timezone_name_from_abbr("", 3600)); @@ -12,9 +11,7 @@ var_dump(timezone_name_from_abbr("", 3600, 0)); echo "Done\n"; ?> ---EXPECTF-- -Warning: timezone_name_from_abbr() expects at least 1 parameter, 0 given in %s on line %d -bool(false) +--EXPECT-- string(13) "Europe/Berlin" bool(false) bool(false) diff --git a/ext/date/tests/012.phpt b/ext/date/tests/012.phpt index be7e4e32af..ee8faf1c00 100644 --- a/ext/date/tests/012.phpt +++ b/ext/date/tests/012.phpt @@ -7,15 +7,10 @@ date_default_timezone_set('UTC'); $dto = date_create("2006-12-12"); var_dump(date_isodate_set($dto, 2006, 2, 15)); var_dump($dto->format("Y/m/d H:i:s")); -var_dump(date_isodate_set($dto, 2006)); -var_dump($dto->format("Y/m/d H:i:s")); var_dump(date_isodate_set($dto, 2006, 5)); var_dump($dto->format("Y/m/d H:i:s")); var_dump(date_isodate_set($dto, 2006, 100, 15)); var_dump($dto->format("Y/m/d H:i:s")); -var_dump(date_isodate_set($dto, 2006, 100, 15, 10)); -var_dump($dto->format("Y/m/d H:i:s")); - echo "Done\n"; ?> --EXPECTF-- @@ -28,10 +23,6 @@ object(DateTime)#1 (3) { string(3) "UTC" } string(19) "2006/01/23 00:00:00" - -Warning: date_isodate_set() expects at least 3 parameters, 2 given in %s on line %d -bool(false) -string(19) "2006/01/23 00:00:00" object(DateTime)#1 (3) { ["date"]=> string(26) "2006-01-30 00:00:00.000000" @@ -50,8 +41,4 @@ object(DateTime)#1 (3) { string(3) "UTC" } string(19) "2007/12/10 00:00:00" - -Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d -bool(false) -string(19) "2007/12/10 00:00:00" Done diff --git a/ext/date/tests/013.phpt b/ext/date/tests/013.phpt index 266dafe06a..6010071be6 100644 --- a/ext/date/tests/013.phpt +++ b/ext/date/tests/013.phpt @@ -7,10 +7,6 @@ date_default_timezone_set('UTC'); $dto = date_create("2006-12-12"); var_dump($dto); var_dump($dto->format("Y.m.d H:i:s")); -var_dump(date_date_set()); -var_dump($dto->format("Y.m.d H:i:s")); -var_dump(date_date_set($dto, 2006, 5)); -var_dump($dto->format("Y.m.d H:i:s")); var_dump(date_date_set($dto, 2006, 2, 15)); var_dump($dto->format("Y.m.d H:i:s")); var_dump(date_date_set($dto, 2006, 24, 60)); @@ -28,14 +24,6 @@ object(DateTime)#%d (3) { string(3) "UTC" } string(19) "2006.12.12 00:00:00" - -Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d -bool(false) -string(19) "2006.12.12 00:00:00" - -Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d -bool(false) -string(19) "2006.12.12 00:00:00" object(DateTime)#1 (3) { ["date"]=> string(26) "2006-02-15 00:00:00.000000" diff --git a/ext/date/tests/014.phpt b/ext/date/tests/014.phpt index 2e72bdabe0..5c1c061e75 100644 --- a/ext/date/tests/014.phpt +++ b/ext/date/tests/014.phpt @@ -10,7 +10,6 @@ var_dump($dto); $dtz = date_timezone_get($dto); var_dump($dtz); -var_dump(timezone_offset_get()); var_dump(timezone_offset_get($dtz, $dto)); var_dump(timezone_offset_get($dto, $dtz)); @@ -32,9 +31,6 @@ object(DateTimeZone)#%d (2) { ["timezone"]=> string(3) "UTC" } - -Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) int(0) Fatal error: Uncaught TypeError: Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of DateTime given in %s:%d diff --git a/ext/date/tests/68062.phpt b/ext/date/tests/68062.phpt index 6b1e16ae67..1270382158 100644 --- a/ext/date/tests/68062.phpt +++ b/ext/date/tests/68062.phpt @@ -6,8 +6,12 @@ DateTimeZone::getOffset() accepts a DateTimeInterface object $tz = new DateTimeZone('Europe/London'); $dt = new DateTimeImmutable('2014-09-20', $tz); -echo $tz->getOffset($dt); -echo $tz->getOffset(1); ---EXPECTF-- +echo $tz->getOffset($dt), "\n"; +try { + echo $tz->getOffset(1); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +--EXPECT-- 3600 -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given in %s +DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given diff --git a/ext/date/tests/DateTimeImmutable_createFromMutable.phpt b/ext/date/tests/DateTimeImmutable_createFromMutable.phpt index ac92fb4bb4..671afc1229 100644 --- a/ext/date/tests/DateTimeImmutable_createFromMutable.phpt +++ b/ext/date/tests/DateTimeImmutable_createFromMutable.phpt @@ -1,5 +1,5 @@ --TEST-- -Tests for DateTimeImmutable::createFromMutable. +Tests for DateTimeImmutable::createFromMutable --INI-- date.timezone=Europe/London --FILE-- @@ -9,8 +9,11 @@ $current = "2014-03-02 16:24:08"; $i = DateTimeImmutable::createFromMutable( date_create( $current ) ); var_dump( $i ); -$i = DateTimeImmutable::createFromMutable( date_create_immutable( $current ) ); -var_dump( $i ); +try { + DateTimeImmutable::createFromMutable( date_create_immutable( $current ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- object(DateTimeImmutable)#%d (3) { @@ -21,6 +24,4 @@ object(DateTimeImmutable)#%d (3) { ["timezone"]=> string(13) "Europe/London" } - -Warning: DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given in %stests%eDateTimeImmutable_createFromMutable.php on line %d -NULL +DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given diff --git a/ext/date/tests/DateTime_createFromImmutable.phpt b/ext/date/tests/DateTime_createFromImmutable.phpt index ee7731855a..841a3d4d33 100644 --- a/ext/date/tests/DateTime_createFromImmutable.phpt +++ b/ext/date/tests/DateTime_createFromImmutable.phpt @@ -14,8 +14,11 @@ $m->modify('+ 1 hour'); var_dump( $i->format('Y-m-d H:i:s') === $current ); -$m = DateTime::createFromImmutable( date_create( $current ) ); -var_dump( $m ); +try { + DateTime::createFromImmutable( date_create( $current ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- object(DateTime)#%d (3) { @@ -27,6 +30,4 @@ object(DateTime)#%d (3) { string(13) "Europe/London" } bool(true) - -Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d -NULL +DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given diff --git a/ext/date/tests/bug36988.phpt b/ext/date/tests/bug36988.phpt index ab0f3a3c8a..691bb4a7e2 100644 --- a/ext/date/tests/bug36988.phpt +++ b/ext/date/tests/bug36988.phpt @@ -6,7 +6,11 @@ Bug #36988 (mktime freezes on long numbers) <?php date_default_timezone_set('GMT'); $start = microtime(true); -$a = mktime(1, 1, 1, 1, 1, 11111111111); +try { + $a = mktime(1, 1, 1, 1, 1, 11111111111); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: mktime() expects parameter 6 to be int, float given in %s on line %d +--EXPECT-- +mktime() expects parameter 6 to be int, float given diff --git a/ext/date/tests/bug52062.phpt b/ext/date/tests/bug52062.phpt index cbcccf84b9..b1f7f25d7b 100644 --- a/ext/date/tests/bug52062.phpt +++ b/ext/date/tests/bug52062.phpt @@ -13,7 +13,11 @@ var_dump($d->format('Y-m-d H:i:s U')); var_dump($d->getTimestamp()); var_dump($d->format('U')); -$d->setTimestamp(100000000000); +try { + $d->setTimestamp(100000000000); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($d->format('Y-m-d H:i:s U')); var_dump($d->getTimestamp()); @@ -24,8 +28,7 @@ var_dump($i->format('%s')); string(32) "5138-11-16 09:46:40 100000000000" bool(false) string(12) "100000000000" - -Warning: DateTime::setTimestamp() expects parameter 1 to be int, float given in %s on line %d +DateTime::setTimestamp() expects parameter 1 to be int, float given string(32) "5138-11-16 09:46:40 100000000000" bool(false) string(10) "1215752192" diff --git a/ext/date/tests/bug70245.phpt b/ext/date/tests/bug70245.phpt index f754bf65a1..b480192326 100644 --- a/ext/date/tests/bug70245.phpt +++ b/ext/date/tests/bug70245.phpt @@ -3,8 +3,11 @@ Bug #70245 (strtotime does not emit warning when 2nd parameter is object or stri --FILE-- <?php $d = new DateTime('2011-01-15 00:00:00'); -var_dump(strtotime('-1 month', $d)); +try { + var_dump(strtotime('-1 month', $d)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- -Warning: strtotime() expects parameter 2 to be int, object given in %sbug70245.php on line %d -bool(false) +strtotime() expects parameter 2 to be int, object given diff --git a/ext/date/tests/date_default_timezone_set_error.phpt b/ext/date/tests/date_default_timezone_set_error.phpt index 15c6aa6fed..24a851ff01 100644 --- a/ext/date/tests/date_default_timezone_set_error.phpt +++ b/ext/date/tests/date_default_timezone_set_error.phpt @@ -9,13 +9,6 @@ Test date_default_timezone_set() function : error variations echo "*** Testing date_default_timezone_set() : error variations ***\n"; -echo "\n-- Testing date_default_timezone_set() function with less than expected no. of arguments --\n"; -var_dump( date_default_timezone_set() ); - -echo "\n-- Testing date_default_timezone_set() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( date_default_timezone_set("GMT", $extra_arg) ); - echo "\n-- Testing date_default_timezone_set() function with invalid timezone identifier --\n"; var_dump( date_default_timezone_set("foo") ); @@ -24,16 +17,6 @@ var_dump( date_default_timezone_set("foo") ); --EXPECTF-- *** Testing date_default_timezone_set() : error variations *** --- Testing date_default_timezone_set() function with less than expected no. of arguments -- - -Warning: date_default_timezone_set() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date_default_timezone_set() function with more than expected no. of arguments -- - -Warning: date_default_timezone_set() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing date_default_timezone_set() function with invalid timezone identifier -- Notice: date_default_timezone_set(): Timezone ID 'foo' is invalid in %s on line %d diff --git a/ext/date/tests/date_parse_001.phpt b/ext/date/tests/date_parse_001.phpt index b5c5ac0f48..0d58c1f8e9 100644 --- a/ext/date/tests/date_parse_001.phpt +++ b/ext/date/tests/date_parse_001.phpt @@ -12,7 +12,6 @@ Test basic date_parse() var_dump(date_parse("03-03")); var_dump(date_parse("0-0")); var_dump(date_parse("")); - var_dump(date_parse(array())); echo "Done\n"; ?> --EXPECTF-- @@ -298,7 +297,4 @@ array(12) { ["is_localtime"]=> bool(false) } - -Warning: date_parse() expects parameter 1 to be string, array given in %sdate_parse_001.php on line %d -bool(false) Done diff --git a/ext/date/tests/date_parse_error.phpt b/ext/date/tests/date_parse_error.phpt index 9f444bb435..dc03944004 100644 --- a/ext/date/tests/date_parse_error.phpt +++ b/ext/date/tests/date_parse_error.phpt @@ -12,14 +12,6 @@ date_default_timezone_set("Europe/London"); echo "*** Testing date_parse() : error conditions ***\n"; -echo "\n-- Testing date_parse() function with zero arguments --\n"; -var_dump( date_parse() ); - -echo "\n-- Testing date_parse() function with more than expected no. of arguments --\n"; -$date = "2009-02-27 10:00:00.5"; -$extra_arg = 10; -var_dump( date_parse($date, $extra_arg) ); - echo "\n-- Testing date_parse() function with unexpected characters in \$date argument --\n"; $invalid_date = "2OO9-02--27 10:00?00.5"; var_dump( date_parse($invalid_date) ); @@ -29,16 +21,6 @@ var_dump( date_parse($invalid_date) ); --EXPECTF-- *** Testing date_parse() : error conditions *** --- Testing date_parse() function with zero arguments -- - -Warning: date_parse() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date_parse() function with more than expected no. of arguments -- - -Warning: date_parse() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing date_parse() function with unexpected characters in $date argument -- array(13) { ["year"]=> diff --git a/ext/date/tests/date_sunrise_variation9.phpt b/ext/date/tests/date_sunrise_variation9.phpt deleted file mode 100644 index 75794cc632..0000000000 --- a/ext/date/tests/date_sunrise_variation9.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -Test date_sunrise() function : usage variation - Passing high positive and negative float values to time argument. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunrise for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunrise() : usage variation ***\n"; - -// GMT is zero for the timezone -date_default_timezone_set("Asia/Calcutta"); -//Initialise the variables -$latitude = 38.4; -$longitude = -9; -$zenith = 90; -$gmt_offset = 1; - -echo "\n-- Testing date_sunrise() function by passing float 12.3456789000e10 value to time --\n"; -$time = 12.3456789000e10; -var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) ); - -echo "\n-- Testing date_sunrise() function by passing float -12.3456789000e10 value to time --\n"; -$time = -12.3456789000e10; -var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunrise() : usage variation *** - --- Testing date_sunrise() function by passing float 12.3456789000e10 value to time -- - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) - --- Testing date_sunrise() function by passing float -12.3456789000e10 value to time -- - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_sunset_variation9.phpt b/ext/date/tests/date_sunset_variation9.phpt deleted file mode 100644 index 4f897e1df0..0000000000 --- a/ext/date/tests/date_sunset_variation9.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -Test date_sunset() function : usage variation - Passing high positive and negative float values to time argument. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunset for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunset() : usage variation ***\n"; - -// GMT is zero for the timezone -date_default_timezone_set("Asia/Calcutta"); -//Initialise the variables -$latitude = 38.4; -$longitude = -9; -$zenith = 90; -$gmt_offset = 1; - -echo "\n-- Testing date_sunset() function by passing float 12.3456789000e10 value to time --\n"; -$time = 12.3456789000e10; -var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) ); - -echo "\n-- Testing date_sunset() function by passing float -12.3456789000e10 value to time --\n"; -$time = -12.3456789000e10; -var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunset() : usage variation *** - --- Testing date_sunset() function by passing float 12.3456789000e10 value to time -- - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) - --- Testing date_sunset() function by passing float -12.3456789000e10 value to time -- - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/getdate_variation7.phpt b/ext/date/tests/getdate_variation7.phpt deleted file mode 100644 index e24f3e6d84..0000000000 --- a/ext/date/tests/getdate_variation7.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test getdate() function : usage variation - Passing high positive and negative float values to timestamp. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : array getdate([int timestamp]) - * Description: Get date/time information - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing getdate() : usage variation ***\n"; -date_default_timezone_set("Asia/Calcutta"); - -echo "\n-- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --\n"; -$timestamp = 12.3456789000e10; -var_dump( getdate($timestamp) ); - -echo "\n-- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --\n"; -$timestamp = -12.3456789000e10; -var_dump( getdate($timestamp) ); -?> -===DONE=== ---EXPECTF-- -*** Testing getdate() : usage variation *** - --- Testing getdate() function by passing float 12.3456789000e10 value to timestamp -- - -Warning: getdate() expects parameter 1 to be int, float given in %s on line %d -bool(false) - --- Testing getdate() function by passing float -12.3456789000e10 value to timestamp -- - -Warning: getdate() expects parameter 1 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/gmdate_variation14.phpt b/ext/date/tests/gmdate_variation14.phpt deleted file mode 100644 index 5b6c48fca5..0000000000 --- a/ext/date/tests/gmdate_variation14.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test gmdate() function : usage variation - Passing high positive and negetive float values to timestamp. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : string gmdate(string format [, long timestamp]) - * Description: Format a GMT date/time - * Source code: ext/date/php_date.c - */ - -echo "*** Testing gmdate() : usage variation ***\n"; - -// Initialise all required variables -date_default_timezone_set('UTC'); -$format = DATE_ISO8601; - -echo "\n-- Testing gmdate() function with float 12.3456789000e10 to timestamp --\n"; -$timestamp = 12.3456789000e10; -var_dump( gmdate($format, $timestamp) ); - -echo "\n-- Testing gmdate() function with float -12.3456789000e10 to timestamp --\n"; -$timestamp = -12.3456789000e10; -var_dump( gmdate($format, $timestamp) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing gmdate() : usage variation *** - --- Testing gmdate() function with float 12.3456789000e10 to timestamp -- - -Warning: gmdate() expects parameter 2 to be int, float given in %s on line %d -bool(false) - --- Testing gmdate() function with float -12.3456789000e10 to timestamp -- - -Warning: gmdate() expects parameter 2 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/gmmktime_basic.phpt b/ext/date/tests/gmmktime_basic.phpt index cdb44f0c62..dca6675e6c 100644 --- a/ext/date/tests/gmmktime_basic.phpt +++ b/ext/date/tests/gmmktime_basic.phpt @@ -21,15 +21,9 @@ $year = 2008; // Calling gmmktime() with all possible arguments var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) ); -// Calling gmmktime() with mandatory arguments -var_dump( gmmktime() ); - ?> ===DONE=== --EXPECTF-- *** Testing gmmktime() : basic functionality *** int(1218182888) - -Deprecated: gmmktime(): You should be using the time() function instead in %s on line %d -int(%d) ===DONE=== diff --git a/ext/date/tests/idate_variation3.phpt b/ext/date/tests/idate_variation3.phpt deleted file mode 100644 index 9b6bc567e0..0000000000 --- a/ext/date/tests/idate_variation3.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test idate() function : usage variation - Passing higher positive and negetive float values to timestamp. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : int idate(string format [, int timestamp]) - * Description: Format a local time/date as integer - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing idate() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$format = 'Y'; -date_default_timezone_set("Asia/Calcutta"); - -echo "\n-- Testing idate() function with float 12.3456789000e10 to timestamp --\n"; -$timestamp = 12.3456789000e10; -var_dump( idate($format, $timestamp) ); - -echo "\n-- Testing idate() function with float -12.3456789000e10 to timestamp --\n"; -$timestamp = -12.3456789000e10; -var_dump( idate($format, $timestamp) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing idate() : usage variation *** - --- Testing idate() function with float 12.3456789000e10 to timestamp -- - -Warning: idate() expects parameter 2 to be int, float given in %s on line %d -bool(false) - --- Testing idate() function with float -12.3456789000e10 to timestamp -- - -Warning: idate() expects parameter 2 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/localtime_variation3.phpt b/ext/date/tests/localtime_variation3.phpt deleted file mode 100644 index 42731dc6ce..0000000000 --- a/ext/date/tests/localtime_variation3.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -Test localtime() function : usage variation - Passing higher positive and negetive float values to timestamp. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : array localtime([int timestamp [, bool associative_array]]) - * Description: Returns the results of the C system call localtime as an associative array - * if the associative_array argument is set to 1 other wise it is a regular array - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing localtime() : usage variation ***\n"; - -date_default_timezone_set("UTC"); -// Initialise function arguments not being substituted (if any) -$is_associative = true; - -echo "\n-- Testing localtime() function with 'float 12.3456789000e10' to timestamp --\n"; -$timestamp = 12.3456789000e10; -var_dump( localtime($timestamp) ); -var_dump( localtime($timestamp, $is_associative) ); - -echo "\n-- Testing localtime() function with 'float -12.3456789000e10' to timestamp --\n"; -$timestamp = -12.3456789000e10; -var_dump( localtime($timestamp) ); -var_dump( localtime($timestamp, $is_associative) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing localtime() : usage variation *** - --- Testing localtime() function with 'float 12.3456789000e10' to timestamp -- - -Warning: localtime() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, float given in %s on line %d -bool(false) - --- Testing localtime() function with 'float -12.3456789000e10' to timestamp -- - -Warning: localtime() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/microtime_error.phpt b/ext/date/tests/microtime_error.phpt index 699416d382..0e4b5d5a35 100644 --- a/ext/date/tests/microtime_error.phpt +++ b/ext/date/tests/microtime_error.phpt @@ -7,13 +7,6 @@ Test wrong number of arguments for microtime() * Function is implemented in ext/standard/microtime.c */ -$opt_arg_0 = true; -$extra_arg = 1; - -echo "\n-- Too many arguments --\n"; -var_dump(microtime($opt_arg_0, $extra_arg)); - - echo "\n-- Bad Arg types --\n"; $bad_args = array(null, @@ -25,17 +18,16 @@ $bad_args = array(null, foreach ($bad_args as $bad_arg) { echo "\n--> bad arg: "; var_dump($bad_arg); - var_dump(microtime($bad_arg)); + try { + var_dump(microtime($bad_arg)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> ===DONE=== --EXPECTF-- --- Too many arguments -- - -Warning: microtime() expects at most 1 parameter, 2 given in %s on line 11 -NULL - -- Bad Arg types -- --> bad arg: NULL @@ -56,15 +48,11 @@ float(%s) int(0) } } - -Warning: microtime() expects parameter 1 to be bool, array given in %s on line 25 -NULL +microtime() expects parameter 1 to be bool, array given --> bad arg: object(stdClass)#%d (0) { } - -Warning: microtime() expects parameter 1 to be bool, object given in %s on line 25 -NULL +microtime() expects parameter 1 to be bool, object given --> bad arg: int(1) float(%s) diff --git a/ext/date/tests/mktime_error.phpt b/ext/date/tests/mktime_error.phpt index a24d189fb1..c507ecf78b 100644 --- a/ext/date/tests/mktime_error.phpt +++ b/ext/date/tests/mktime_error.phpt @@ -14,7 +14,11 @@ date_default_timezone_set("Europe/London"); echo "*** Testing mktime() : error conditions ***\n"; echo "\n-- Testing mktime() function with Zero arguments --\n"; -var_dump( mktime() ); +try { + var_dump( mktime() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing mktime() function with more than expected no. of arguments --\n"; $hour = 10; @@ -24,7 +28,11 @@ $month = 7; $day = 2; $year = 1963; $extra_arg = 10; -var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) ); +try { + var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== @@ -32,12 +40,8 @@ var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) ); *** Testing mktime() : error conditions *** -- Testing mktime() function with Zero arguments -- - -Deprecated: mktime(): You should be using the time() function instead in %s on line %d -int(%d) +mktime() expects at least 1 parameter, 0 given -- Testing mktime() function with more than expected no. of arguments -- - -Warning: mktime() expects at most 6 parameters, 7 given in %s on line %d -bool(false) +mktime() expects at most 6 parameters, 7 given ===DONE=== diff --git a/ext/date/tests/strftime_variation23.phpt b/ext/date/tests/strftime_variation23.phpt deleted file mode 100644 index 22f079702a..0000000000 --- a/ext/date/tests/strftime_variation23.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -Test strftime() function : usage variation - Checking large positive and negative float values to timestamp. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : string strftime(string format [, int timestamp]) - * Description: Format a local time/date according to locale settings - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing strftime() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -setlocale(LC_ALL, "en_US"); -date_default_timezone_set("UTC"); -$format = '%b %d %Y %H:%M:%S'; - -echo "\n-- Testing strftime() function with float 12.3456789000e10 to timestamp --\n"; -$timestamp = 12.3456789000e10; -var_dump( strftime($format, $timestamp) ); - -echo "\n-- Testing strftime() function with float -12.3456789000e10 to timestamp --\n"; -$timestamp = -12.3456789000e10; -var_dump( strftime($format, $timestamp) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing strftime() : usage variation *** - --- Testing strftime() function with float 12.3456789000e10 to timestamp -- - -Warning: strftime() expects parameter 2 to be int, float given in %s on line %d -bool(false) - --- Testing strftime() function with float -12.3456789000e10 to timestamp -- - -Warning: strftime() expects parameter 2 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_offset_get_error.phpt b/ext/date/tests/timezone_offset_get_error.phpt index 413755ac72..f77836c8ef 100644 --- a/ext/date/tests/timezone_offset_get_error.phpt +++ b/ext/date/tests/timezone_offset_get_error.phpt @@ -15,31 +15,6 @@ $date = date_create("GMT"); echo "*** Testing timezone_offset_get() : error conditions ***\n"; -echo "\n-- Testing timezone_offset_get() function with zero arguments --\n"; -try { - var_dump( timezone_offset_get() ); -} catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; -} - -echo "\n-- Testing timezone_offset_get() function with less than expected no. of arguments --\n"; -try { - var_dump( timezone_offset_get($tz) ); -} catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; -} - -echo "\n-- Testing timezone_offset_get() function with more than expected no. of arguments --\n"; -$extra_arg = 99; -try { - var_dump( timezone_offset_get($tz, $date, $extra_arg) ); -} catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; -} - echo "\n-- Testing timezone_offset_get() function with an invalid values for \$object argument --\n"; $invalid_obj = new stdClass(); try { @@ -90,21 +65,6 @@ try { --EXPECTF-- *** Testing timezone_offset_get() : error conditions *** --- Testing timezone_offset_get() function with zero arguments -- - -Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - --- Testing timezone_offset_get() function with less than expected no. of arguments -- - -Warning: timezone_offset_get() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - --- Testing timezone_offset_get() function with more than expected no. of arguments -- - -Warning: timezone_offset_get() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - -- Testing timezone_offset_get() function with an invalid values for $object argument -- string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of stdClass given" diff --git a/ext/dba/tests/dba011.phpt b/ext/dba/tests/dba011.phpt index 0891a30f48..1642587a43 100644 --- a/ext/dba/tests/dba011.phpt +++ b/ext/dba/tests/dba011.phpt @@ -9,7 +9,6 @@ die("info $HND handler used"); <?php require_once(dirname(__FILE__) .'/test.inc'); echo "database handler: $handler\n"; -var_dump(dba_open($db_file)); var_dump(dba_open($db_file, 'n')); var_dump(dba_open($db_file, 'n', 'bogus')); var_dump(dba_open($db_file, 'q', $handler)); @@ -22,9 +21,6 @@ require(dirname(__FILE__) .'/clean.inc'); ?> --EXPECTF-- database handler: flatfile - -Warning: Wrong parameter count for dba_open() in %sdba011.php on line %d -NULL resource(%d) of type (dba) Warning: dba_open(%stest0.dbm,n): No such handler: bogus in %sdba011.php on line %d diff --git a/ext/dba/tests/dba_handlers.phpt b/ext/dba/tests/dba_handlers.phpt index 41c23b5cf6..3c9d174514 100644 --- a/ext/dba/tests/dba_handlers.phpt +++ b/ext/dba/tests/dba_handlers.phpt @@ -35,13 +35,9 @@ check(dba_handlers(null)); echo "Test 3\n"; -check(dba_handlers(1, 2)); - -echo "Test 4\n"; - check(dba_handlers(0)); -echo "Test 5 - full info\n"; +echo "Test 4 - full info\n"; $h = dba_handlers(1); foreach ($h as $key => $val) { if ($key === "flatfile") { @@ -61,9 +57,6 @@ Success: flatfile enabled Test 2 Success: flatfile enabled Test 3 - -Warning: dba_handlers() expects at most 1 parameter, 2 given in %sdba_handlers.php on line %d -Test 4 Success: flatfile enabled -Test 5 - full info +Test 4 - full info Success: flatfile enabled diff --git a/ext/dba/tests/dba_optimize.phpt b/ext/dba/tests/dba_optimize.phpt index 6347d4983c..21e135de81 100644 --- a/ext/dba/tests/dba_optimize.phpt +++ b/ext/dba/tests/dba_optimize.phpt @@ -23,8 +23,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) { echo dba_exists("key$i", $db_file) ? "Y" : "N"; } echo "\n"; - var_dump(dba_optimize()); - var_dump(dba_optimize("")); var_dump(dba_optimize($db_file)); dba_close($db_file); } else { @@ -41,11 +39,5 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) { --EXPECTF-- database handler: flatfile 2YY - -Warning: dba_optimize() expects exactly 1 parameter, 0 given in %sdba_optimize.php on line %d -NULL - -Warning: dba_optimize() expects parameter 1 to be resource, string given in %sdba_optimize.php on line %d -NULL bool(true) ===DONE=== diff --git a/ext/dba/tests/dba_split.phpt b/ext/dba/tests/dba_split.phpt index 0989f09feb..1f660daf09 100644 --- a/ext/dba/tests/dba_split.phpt +++ b/ext/dba/tests/dba_split.phpt @@ -7,7 +7,6 @@ DBA Split Test ?> --FILE-- <?php -var_dump(dba_key_split("key1", "name")); var_dump(dba_key_split(1)); var_dump(dba_key_split(null)); var_dump(dba_key_split("")); @@ -23,8 +22,6 @@ var_dump(dba_key_split("[key1]name1")); ===DONE=== <?php exit(0); ?> --EXPECTF-- -Warning: Wrong parameter count for dba_key_split() in %sdba_split.php on line %d -NULL array(2) { [0]=> string(0) "" diff --git a/ext/dba/tests/dba_sync.phpt b/ext/dba/tests/dba_sync.phpt index 0e64ea2905..5b2ae5bb76 100644 --- a/ext/dba/tests/dba_sync.phpt +++ b/ext/dba/tests/dba_sync.phpt @@ -23,8 +23,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) { echo dba_exists("key$i", $db_file) ? "Y" : "N"; } echo "\n"; - var_dump(dba_sync()); - var_dump(dba_sync("")); var_dump(dba_sync($db_file)); dba_close($db_file); } else { @@ -41,11 +39,5 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) { --EXPECTF-- database handler: flatfile 2YY - -Warning: dba_sync() expects exactly 1 parameter, 0 given in %sdba_sync.php on line %d -NULL - -Warning: dba_sync() expects parameter 1 to be resource, string given in %sdba_sync.php on line %d -NULL bool(true) ===DONE=== diff --git a/ext/dom/document.c b/ext/dom/document.c index 95b077b648..051c5db10e 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -210,16 +210,16 @@ const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */ PHP_FALIAS(adoptNode, dom_document_adopt_node, arginfo_dom_document_adopt_node) PHP_FALIAS(normalizeDocument, dom_document_normalize_document, arginfo_dom_document_normalize_document) PHP_FALIAS(renameNode, dom_document_rename_node, arginfo_dom_document_rename_node) - PHP_ME(domdocument, load, arginfo_dom_document_load, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(domdocument, load, arginfo_dom_document_load, ZEND_ACC_PUBLIC) PHP_FALIAS(save, dom_document_save, arginfo_dom_document_save) - PHP_ME(domdocument, loadXML, arginfo_dom_document_loadxml, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(domdocument, loadXML, arginfo_dom_document_loadxml, ZEND_ACC_PUBLIC) PHP_FALIAS(saveXML, dom_document_savexml, arginfo_dom_document_savexml) PHP_ME(domdocument, __construct, arginfo_dom_document_construct, ZEND_ACC_PUBLIC) PHP_FALIAS(validate, dom_document_validate, arginfo_dom_document_validate) PHP_FALIAS(xinclude, dom_document_xinclude, arginfo_dom_document_xinclude) #if defined(LIBXML_HTML_ENABLED) - PHP_ME(domdocument, loadHTML, arginfo_dom_document_loadhtml, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) - PHP_ME(domdocument, loadHTMLFile, arginfo_dom_document_loadhtmlfile, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(domdocument, loadHTML, arginfo_dom_document_loadhtml, ZEND_ACC_PUBLIC) + PHP_ME(domdocument, loadHTMLFile, arginfo_dom_document_loadhtmlfile, ZEND_ACC_PUBLIC) PHP_FALIAS(saveHTML, dom_document_save_html, arginfo_dom_document_savehtml) PHP_FALIAS(saveHTMLFile, dom_document_save_html_file, arginfo_dom_document_savehtmlfile) #endif /* defined(LIBXML_HTML_ENABLED) */ diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c index e80561a86e..bbebacc243 100644 --- a/ext/dom/domimplementation.c +++ b/ext/dom/domimplementation.c @@ -55,10 +55,10 @@ ZEND_END_ARG_INFO(); */ const zend_function_entry php_dom_domimplementation_class_functions[] = { - PHP_ME(domimplementation, getFeature, arginfo_dom_implementation_get_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) - PHP_ME(domimplementation, hasFeature, arginfo_dom_implementation_has_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) - PHP_ME(domimplementation, createDocumentType, arginfo_dom_implementation_create_documenttype, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) - PHP_ME(domimplementation, createDocument, arginfo_dom_implementation_create_document, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(domimplementation, getFeature, arginfo_dom_implementation_get_feature, ZEND_ACC_PUBLIC) + PHP_ME(domimplementation, hasFeature, arginfo_dom_implementation_has_feature, ZEND_ACC_PUBLIC) + PHP_ME(domimplementation, createDocumentType, arginfo_dom_implementation_create_documenttype, ZEND_ACC_PUBLIC) + PHP_ME(domimplementation, createDocument, arginfo_dom_implementation_create_document, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 726b74b934..1a3689926b 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -310,31 +310,27 @@ static void dom_register_prop_handler(HashTable *prop_handler, char *name, size_ } /* }}} */ -static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static zval *dom_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */ { - dom_object *obj = Z_DOMOBJ_P(object); - zend_string *member_str = zval_get_string(member); + dom_object *obj = php_dom_obj_from_obj(object); zval *retval = NULL; - if (!obj->prop_handler || !zend_hash_exists(obj->prop_handler, member_str)) { - retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot); + if (!obj->prop_handler || !zend_hash_exists(obj->prop_handler, name)) { + retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot); } - - zend_string_release_ex(member_str, 0); return retval; } /* }}} */ /* {{{ dom_read_property */ -zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) +zval *dom_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) { - dom_object *obj = Z_DOMOBJ_P(object); - zend_string *member_str = zval_get_string(member); + dom_object *obj = php_dom_obj_from_obj(object); zval *retval; dom_prop_handler *hnd = NULL; if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, member_str); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } else if (instanceof_function(obj->std.ce, dom_node_class_entry)) { php_error(E_WARNING, "Couldn't fetch %s. Node no longer exists", ZSTR_VAL(obj->std.ce->name)); } @@ -347,46 +343,41 @@ zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot, retval = &EG(uninitialized_zval); } } else { - retval = zend_std_read_property(object, member, type, cache_slot, rv); + retval = zend_std_read_property(object, name, type, cache_slot, rv); } - zend_string_release_ex(member_str, 0); return retval; } /* }}} */ /* {{{ dom_write_property */ -zval *dom_write_property(zval *object, zval *member, zval *value, void **cache_slot) +zval *dom_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) { - dom_object *obj = Z_DOMOBJ_P(object); - zend_string *member_str = zval_get_string(member); + dom_object *obj = php_dom_obj_from_obj(object); dom_prop_handler *hnd = NULL; if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, member_str); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd) { hnd->write_func(obj, value); } else { - value = zend_std_write_property(object, member, value, cache_slot); + value = zend_std_write_property(object, name, value, cache_slot); } - zend_string_release_ex(member_str, 0); - return value; } /* }}} */ /* {{{ dom_property_exists */ -static int dom_property_exists(zval *object, zval *member, int check_empty, void **cache_slot) +static int dom_property_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot) { - dom_object *obj = Z_DOMOBJ_P(object); - zend_string *member_str = zval_get_string(member); + dom_object *obj = php_dom_obj_from_obj(object); dom_prop_handler *hnd = NULL; int retval = 0; if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, member_str); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd) { zval tmp; @@ -402,17 +393,16 @@ static int dom_property_exists(zval *object, zval *member, int check_empty, void zval_ptr_dtor(&tmp); } } else { - retval = zend_std_has_property(object, member, check_empty, cache_slot); + retval = zend_std_has_property(object, name, check_empty, cache_slot); } - zend_string_release_ex(member_str, 0); return retval; } /* }}} */ -static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ */ +static HashTable* dom_get_debug_info_helper(zend_object *object, int *is_temp) /* {{{ */ { - dom_object *obj = Z_DOMOBJ_P(object); + dom_object *obj = php_dom_obj_from_obj(object); HashTable *debug_info, *prop_handlers = obj->prop_handler, *std_props; @@ -453,7 +443,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ * } /* }}} */ -static HashTable* dom_get_debug_info(zval *object, int *is_temp) /* {{{ */ +static HashTable* dom_get_debug_info(zend_object *object, int *is_temp) /* {{{ */ { return dom_get_debug_info_helper(object, is_temp); } @@ -500,9 +490,9 @@ PHP_FUNCTION(dom_import_simplexml) static dom_object* dom_objects_set_class(zend_class_entry *class_type); -static zend_object *dom_objects_store_clone_obj(zval *zobject) /* {{{ */ +static zend_object *dom_objects_store_clone_obj(zend_object *zobject) /* {{{ */ { - dom_object *intern = Z_DOMOBJ_P(zobject); + dom_object *intern = php_dom_obj_from_obj(zobject); dom_object *clone = dom_objects_set_class(intern->std.ce); clone->std.handlers = dom_get_obj_handlers(); @@ -583,7 +573,9 @@ ZEND_GET_MODULE(dom) void dom_objects_free_storage(zend_object *object); void dom_nnodemap_objects_free_storage(zend_object *object); -static zend_object *dom_objects_store_clone_obj(zval *zobject); +static zval *dom_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv); +static int dom_nodelist_has_dimension(zend_object *object, zval *member, int check_empty); +static zend_object *dom_objects_store_clone_obj(zend_object *zobject); static void dom_nnodemap_object_dtor(zend_object *object); #if defined(LIBXML_XPATH_ENABLED) void dom_xpath_objects_free_storage(zend_object *object); @@ -1530,7 +1522,7 @@ xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) { } /* }}} end dom_get_nsdecl */ -zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */ +static zval *dom_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */ { zval offset_copy; @@ -1540,12 +1532,12 @@ zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv ZVAL_LONG(&offset_copy, zval_get_long(offset)); - zend_call_method_with_1_params(object, Z_OBJCE_P(object), NULL, "item", rv, &offset_copy); + zend_call_method_with_1_params(object, object->ce, NULL, "item", rv, &offset_copy); return rv; } /* }}} end dom_nodelist_read_dimension */ -int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty) +static int dom_nodelist_has_dimension(zend_object *object, zval *member, int check_empty) { zend_long offset = zval_get_long(member); zval rv; @@ -1553,8 +1545,11 @@ int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty) if (offset < 0) { return 0; } else { - zval *length = zend_read_property(Z_OBJCE_P(object), object, "length", sizeof("length") - 1, 0, &rv); + zval obj; + zval *length; + ZVAL_OBJ(&obj, object); + length = zend_read_property(object->ce, &obj, "length", sizeof("length") - 1, 0, &rv); return length && offset < Z_LVAL_P(length); } } /* }}} end dom_nodelist_has_dimension */ diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index ce377b5ce7..c3b24c8691 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -125,8 +125,6 @@ xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index); xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index); zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref); void dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce); -zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv); -int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty); #define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \ INIT_CLASS_ENTRY(ce, name, funcs); \ diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 74821944d6..ae2b9a2012 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -97,7 +97,6 @@ ZEND_END_ARG_INFO() */ static const zend_function_entry exif_functions[] = { PHP_FE(exif_read_data, arginfo_exif_read_data) - PHP_DEP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data) PHP_FE(exif_tagname, arginfo_exif_tagname) PHP_FE(exif_thumbnail, arginfo_exif_thumbnail) PHP_FE(exif_imagetype, arginfo_exif_imagetype) diff --git a/ext/exif/tests/exif_imagetype_error.phpt b/ext/exif/tests/exif_imagetype_error.phpt index 3627ad969d..2098b2d273 100644 --- a/ext/exif/tests/exif_imagetype_error.phpt +++ b/ext/exif/tests/exif_imagetype_error.phpt @@ -12,13 +12,6 @@ Test exif_imagetype() function : error conditions echo "*** Testing exif_imagetype() : error conditions ***\n"; -echo "\n-- Testing exif_imagetype() function with no arguments --\n"; -var_dump( exif_imagetype() ); - -echo "\n-- Testing exif_imagetype() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( exif_imagetype(dirname(__FILE__).'/test2.jpg', $extra_arg) ); - echo "\n-- Testing exif_imagetype() function with an unknown file --\n"; var_dump( exif_imagetype(dirname(__FILE__).'/foo.jpg') ); @@ -28,16 +21,6 @@ var_dump( exif_imagetype(dirname(__FILE__).'/foo.jpg') ); --EXPECTF-- *** Testing exif_imagetype() : error conditions *** --- Testing exif_imagetype() function with no arguments -- - -Warning: exif_imagetype() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing exif_imagetype() function with more than expected no. of arguments -- - -Warning: exif_imagetype() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -- Testing exif_imagetype() function with an unknown file -- Warning: exif_imagetype(%s/foo.jpg): failed to open stream: No such file or directory in %s on line %d diff --git a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt b/ext/exif/tests/exif_read_exif_data_basic-mb.phpt deleted file mode 100644 index b70be24278..0000000000 --- a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -Check for read_exif_data default behaviour ---SKIPIF-- -<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> ---INI-- -output_handler= -zlib.output_compression=0 ---FILE-- -<?php - -/* Prototype : array read_exif_data ( string $filename [, string $sections [, bool $arrays [, bool $thumbnail ]]] ) - * Description: Alias of exif_read_data() - * Source code: ext/exif/exif.c -*/ -echo "*** Testing read_exif_data() : basic functionality ***\n"; - -print_r(read_exif_data(dirname(__FILE__).'/test2私はガラスを食べられます.jpg')); -?> -===Done=== ---EXPECTF-- -*** Testing read_exif_data() : basic functionality *** - -Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic-mb.php on line 9 -Array -( - [FileName] => test2私はガラスを食べられます.jpg - [FileDateTime] => %d - [FileSize] => 1240 - [FileType] => 2 - [MimeType] => image/jpeg - [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT - [COMPUTED] => Array - ( - [html] => width="1" height="1" - [Height] => 1 - [Width] => 1 - [IsColor] => 1 - [ByteOrderMotorola] => 1 - [UserComment] => Exif test image. - [UserCommentEncoding] => ASCII - [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger. - [Copyright.Photographer] => Photo (c) M.Boerger - [Copyright.Editor] => Edited by M.Boerger. - [Thumbnail.FileType] => 2 - [Thumbnail.MimeType] => image/jpeg - ) - - [Copyright] => Photo (c) M.Boerger - [UserComment] => ASCII - [THUMBNAIL] => Array - ( - [JPEGInterchangeFormat] => 134 - [JPEGInterchangeFormatLength] => 523 - ) - - [COMMENT] => Array - ( - [0] => Comment #1. - [1] => Comment #2. - [2] => Comment #3end - ) - -) -===Done=== diff --git a/ext/exif/tests/exif_read_exif_data_basic.phpt b/ext/exif/tests/exif_read_exif_data_basic.phpt deleted file mode 100644 index b2799909d3..0000000000 --- a/ext/exif/tests/exif_read_exif_data_basic.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -Check for read_exif_data default behaviour ---SKIPIF-- -<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> ---INI-- -output_handler= -zlib.output_compression=0 ---FILE-- -<?php - -/* Prototype : array read_exif_data ( string $filename [, string $sections [, bool $arrays [, bool $thumbnail ]]] ) - * Description: Alias of exif_read_data() - * Source code: ext/exif/exif.c -*/ -echo "*** Testing read_exif_data() : basic functionality ***\n"; - -print_r(read_exif_data(dirname(__FILE__).'/test2.jpg')); -?> -===Done=== ---EXPECTF-- -*** Testing read_exif_data() : basic functionality *** - -Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic.php on line 9 -Array -( - [FileName] => test2.jpg - [FileDateTime] => %d - [FileSize] => 1240 - [FileType] => 2 - [MimeType] => image/jpeg - [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT - [COMPUTED] => Array - ( - [html] => width="1" height="1" - [Height] => 1 - [Width] => 1 - [IsColor] => 1 - [ByteOrderMotorola] => 1 - [UserComment] => Exif test image. - [UserCommentEncoding] => ASCII - [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger. - [Copyright.Photographer] => Photo (c) M.Boerger - [Copyright.Editor] => Edited by M.Boerger. - [Thumbnail.FileType] => 2 - [Thumbnail.MimeType] => image/jpeg - ) - - [Copyright] => Photo (c) M.Boerger - [UserComment] => ASCII - [THUMBNAIL] => Array - ( - [JPEGInterchangeFormat] => 134 - [JPEGInterchangeFormatLength] => 523 - ) - - [COMMENT] => Array - ( - [0] => Comment #1. - [1] => Comment #2. - [2] => Comment #3end - ) - -) -===Done=== diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 1885c63ddc..e443701293 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -883,9 +883,9 @@ static void *zend_ffi_create_callback(zend_ffi_type *type, zval *value) /* {{{ * /* }}} */ #endif -static zval* zend_ffi_cdata_get(zval *object, zval *rv) /* {{{ */ +static zval* zend_ffi_cdata_get(zend_object *obj, zval *rv) /* {{{ */ { - zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object); + zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj; zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); #if 0 @@ -900,9 +900,9 @@ static zval* zend_ffi_cdata_get(zval *object, zval *rv) /* {{{ */ } /* }}} */ -static void zend_ffi_cdata_set(zval *object, zval *value) /* {{{ */ +static void zend_ffi_cdata_set(zend_object *obj, zval *value) /* {{{ */ { - zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object); + zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj; zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); #if 0 @@ -916,15 +916,15 @@ static void zend_ffi_cdata_set(zval *object, zval *value) /* {{{ */ } /* }}} */ -static int zend_ffi_cdata_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */ +static int zend_ffi_cdata_cast_object(zend_object *readobj, zval *writeobj, int type) /* {{{ */ { return FAILURE; } /* }}} */ -static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type, void **cache_slot, zval *rv) /* {{{ */ +static zval *zend_ffi_cdata_read_field(zend_object *obj, zend_string *field_name, int read_type, void **cache_slot, zval *rv) /* {{{ */ { - zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object); + zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj; zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); void *ptr = cdata->ptr; zend_ffi_field *field; @@ -932,28 +932,22 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type if (cache_slot && *cache_slot == type) { field = *(cache_slot + 1); } else { - zend_string *tmp_field_name; - zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name); - if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) { if (type->kind == ZEND_FFI_TYPE_POINTER) { /* transparently dereference the pointer */ if (UNEXPECTED(!ptr)) { zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference"); - zend_tmp_string_release(tmp_field_name); return &EG(uninitialized_zval); } ptr = (void*)(*(char**)ptr); if (UNEXPECTED(!ptr)) { zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference"); - zend_tmp_string_release(tmp_field_name); return &EG(uninitialized_zval); } type = ZEND_FFI_TYPE(type->pointer.type); } if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) { zend_throw_error(zend_ffi_exception_ce, "Attempt to read field '%s' of non C struct/union", ZSTR_VAL(field_name)); - zend_tmp_string_release(tmp_field_name); return &EG(uninitialized_zval); } } @@ -961,12 +955,9 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type field = zend_hash_find_ptr(&type->record.fields, field_name); if (UNEXPECTED(!field)) { zend_throw_error(zend_ffi_exception_ce, "Attempt to read undefined field '%s' of C struct/union", ZSTR_VAL(field_name)); - zend_tmp_string_release(tmp_field_name); return &EG(uninitialized_zval); } - zend_tmp_string_release(tmp_field_name); - if (cache_slot) { *cache_slot = type; *(cache_slot + 1) = field; @@ -1000,9 +991,9 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type } /* }}} */ -static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */ +static zval *zend_ffi_cdata_write_field(zend_object *obj, zend_string *field_name, zval *value, void **cache_slot) /* {{{ */ { - zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object); + zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj; zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); void *ptr = cdata->ptr; zend_ffi_field *field; @@ -1010,28 +1001,22 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value, if (cache_slot && *cache_slot == type) { field = *(cache_slot + 1); } else { - zend_string *tmp_field_name; - zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name); - if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) { if (type->kind == ZEND_FFI_TYPE_POINTER) { /* transparently dereference the pointer */ if (UNEXPECTED(!ptr)) { zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference"); - zend_tmp_string_release(tmp_field_name); return value; } ptr = (void*)(*(char**)ptr); if (UNEXPECTED(!ptr)) { zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference"); - zend_tmp_string_release(tmp_field_name); return value; } type = ZEND_FFI_TYPE(type->pointer.type); } if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) { zend_throw_error(zend_ffi_exception_ce, "Attempt to assign field '%s' of non C struct/union", ZSTR_VAL(field_name)); - zend_tmp_string_release(tmp_field_name); return value; } } @@ -1039,12 +1024,9 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value, field = zend_hash_find_ptr(&type->record.fields, field_name); if (UNEXPECTED(!field)) { zend_throw_error(zend_ffi_exception_ce, "Attempt to assign undefined field '%s' of C struct/union", ZSTR_VAL(field_name)); - zend_tmp_string_release(tmp_field_name); return value; } - zend_tmp_string_release(tmp_field_name); - if (cache_slot) { *cache_slot = type; *(cache_slot + 1) = field; @@ -1062,10 +1044,7 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value, zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only location"); return value; } else if (UNEXPECTED(field->is_const)) { - zend_string *tmp_field_name; - zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name); zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only field '%s'", ZSTR_VAL(field_name)); - zend_tmp_string_release(tmp_field_name); return value; } @@ -1079,9 +1058,9 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value, } /* }}} */ -static zval *zend_ffi_cdata_read_dim(zval *object, zval *offset, int read_type, zval *rv) /* {{{ */ +static zval *zend_ffi_cdata_read_dim(zend_object *obj, zval *offset, int read_type, zval *rv) /* {{{ */ { - zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object); + zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj; zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); zend_long dim = zval_get_long(offset); zend_ffi_type *dim_type; @@ -1137,9 +1116,9 @@ static zval *zend_ffi_cdata_read_dim(zval *object, zval *offset, int read_type, } /* }}} */ -static void zend_ffi_cdata_write_dim(zval *object, zval *offset, zval *value) /* {{{ */ +static void zend_ffi_cdata_write_dim(zend_object *obj, zval *offset, zval *value) /* {{{ */ { - zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object); + zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj; zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); zend_long dim; void *ptr; @@ -1492,9 +1471,9 @@ static int zend_ffi_cdata_compare_objects(zval *o1, zval *o2) /* {{{ */ } /* }}} */ -static int zend_ffi_cdata_count_elements(zval *object, zend_long *count) /* {{{ */ +static int zend_ffi_cdata_count_elements(zend_object *obj, zend_long *count) /* {{{ */ { - zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object); + zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj; zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); if (type->kind != ZEND_FFI_TYPE_ARRAY) { @@ -1744,9 +1723,9 @@ static zend_object_iterator *zend_ffi_cdata_get_iterator(zend_class_entry *ce, z } /* }}} */ -static HashTable *zend_ffi_cdata_get_debug_info(zval *object, int *is_temp) /* {{{ */ +static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */ { - zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object); + zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj; zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); void *ptr = cdata->ptr; HashTable *ht = NULL; @@ -1843,9 +1822,9 @@ static HashTable *zend_ffi_cdata_get_debug_info(zval *object, int *is_temp) /* { } /* }}} */ -static int zend_ffi_cdata_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */ +static int zend_ffi_cdata_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */ { - zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(obj); + zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj; zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); zend_function *func; @@ -1975,7 +1954,7 @@ static int zend_ffi_ctype_compare_objects(zval *o1, zval *o2) /* {{{ */ } /* }}} */ -static HashTable *zend_ffi_ctype_get_debug_info(zval *object, int *is_temp) /* {{{ */ +static HashTable *zend_ffi_ctype_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */ { return NULL; } @@ -2151,9 +2130,9 @@ static void zend_ffi_cdata_free_obj(zend_object *object) /* {{{ */ } /* }}} */ -static zend_object *zend_ffi_cdata_clone_obj(zval *zobject) /* {{{ */ +static zend_object *zend_ffi_cdata_clone_obj(zend_object *obj) /* {{{ */ { - zend_ffi_cdata *old_cdata = (zend_ffi_cdata*)Z_OBJ_P(zobject); + zend_ffi_cdata *old_cdata = (zend_ffi_cdata*)obj; zend_ffi_type *type = ZEND_FFI_TYPE(old_cdata->type); zend_ffi_cdata *new_cdata; @@ -2170,11 +2149,9 @@ static zend_object *zend_ffi_cdata_clone_obj(zval *zobject) /* {{{ */ } /* }}} */ -static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void **cache_slot, zval *rv) /* {{{ */ +static zval *zend_ffi_read_var(zend_object *obj, zend_string *var_name, int read_type, void **cache_slot, zval *rv) /* {{{ */ { - zend_ffi *ffi = (zend_ffi*)Z_OBJ_P(object); - zend_string *tmp_var_name; - zend_string *var_name = zval_get_tmp_string(member, &tmp_var_name); + zend_ffi *ffi = (zend_ffi*)obj; zend_ffi_symbol *sym = NULL; if (ffi->symbols) { @@ -2185,12 +2162,9 @@ static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void * } if (!sym) { zend_throw_error(zend_ffi_exception_ce, "Attempt to read undefined C variable '%s'", ZSTR_VAL(var_name)); - zend_tmp_string_release(tmp_var_name); return &EG(uninitialized_zval); } - zend_tmp_string_release(tmp_var_name); - if (sym->kind == ZEND_FFI_SYM_VAR) { zend_ffi_cdata_to_zval(NULL, sym->addr, ZEND_FFI_TYPE(sym->type), read_type, rv, (zend_ffi_flags)sym->is_const, 0); } else { @@ -2201,11 +2175,9 @@ static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void * } /* }}} */ -static zval *zend_ffi_write_var(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */ +static zval *zend_ffi_write_var(zend_object *obj, zend_string *var_name, zval *value, void **cache_slot) /* {{{ */ { - zend_ffi *ffi = (zend_ffi*)Z_OBJ_P(object); - zend_string *tmp_var_name; - zend_string *var_name = zval_get_tmp_string(member, &tmp_var_name); + zend_ffi *ffi = (zend_ffi*)obj; zend_ffi_symbol *sym = NULL; if (ffi->symbols) { @@ -2216,12 +2188,9 @@ static zval *zend_ffi_write_var(zval *object, zval *member, zval *value, void ** } if (!sym) { zend_throw_error(zend_ffi_exception_ce, "Attempt to assign undefined C variable '%s'", ZSTR_VAL(var_name)); - zend_tmp_string_release(tmp_var_name); return value; } - zend_tmp_string_release(tmp_var_name); - if (sym->is_const) { zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only C variable '%s'", ZSTR_VAL(var_name)); return value; @@ -4377,33 +4346,29 @@ static ZEND_COLD zend_never_inline void zend_bad_array_access(zend_class_entry * } /* }}} */ -static ZEND_COLD zval *zend_fake_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */ +static ZEND_COLD zval *zend_fake_read_dimension(zend_object *obj, zval *offset, int type, zval *rv) /* {{{ */ { - zend_class_entry *ce = Z_OBJCE_P(object); - zend_bad_array_access(ce); + zend_bad_array_access(obj->ce); return NULL; } /* }}} */ -static ZEND_COLD void zend_fake_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */ +static ZEND_COLD void zend_fake_write_dimension(zend_object *obj, zval *offset, zval *value) /* {{{ */ { - zend_class_entry *ce = Z_OBJCE_P(object); - zend_bad_array_access(ce); + zend_bad_array_access(obj->ce); } /* }}} */ -static ZEND_COLD int zend_fake_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */ +static ZEND_COLD int zend_fake_has_dimension(zend_object *obj, zval *offset, int check_empty) /* {{{ */ { - zend_class_entry *ce = Z_OBJCE_P(object); - zend_bad_array_access(ce); + zend_bad_array_access(obj->ce); return 0; } /* }}} */ -static ZEND_COLD void zend_fake_unset_dimension(zval *object, zval *offset) /* {{{ */ +static ZEND_COLD void zend_fake_unset_dimension(zend_object *obj, zval *offset) /* {{{ */ { - zend_class_entry *ce = Z_OBJCE_P(object); - zend_bad_array_access(ce); + zend_bad_array_access(obj->ce); } /* }}} */ @@ -4413,38 +4378,34 @@ static ZEND_COLD zend_never_inline void zend_bad_property_access(zend_class_entr } /* }}} */ -static ZEND_COLD zval *zend_fake_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */ +static ZEND_COLD zval *zend_fake_read_property(zend_object *obj, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */ { - zend_class_entry *ce = Z_OBJCE_P(object); - zend_bad_property_access(ce); + zend_bad_property_access(obj->ce); return &EG(uninitialized_zval); } /* }}} */ -static ZEND_COLD zval *zend_fake_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */ +static ZEND_COLD zval *zend_fake_write_property(zend_object *obj, zend_string *member, zval *value, void **cache_slot) /* {{{ */ { - zend_class_entry *ce = Z_OBJCE_P(object); - zend_bad_array_access(ce); + zend_bad_array_access(obj->ce); return value; } /* }}} */ -static ZEND_COLD int zend_fake_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */ +static ZEND_COLD int zend_fake_has_property(zend_object *obj, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */ { - zend_class_entry *ce = Z_OBJCE_P(object); - zend_bad_array_access(ce); + zend_bad_array_access(obj->ce); return 0; } /* }}} */ -static ZEND_COLD void zend_fake_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */ +static ZEND_COLD void zend_fake_unset_property(zend_object *obj, zend_string *member, void **cache_slot) /* {{{ */ { - zend_class_entry *ce = Z_OBJCE_P(object); - zend_bad_array_access(ce); + zend_bad_array_access(obj->ce); } /* }}} */ -static zval *zend_fake_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static zval *zend_fake_get_property_ptr_ptr(zend_object *obj, zend_string *member, int type, void **cache_slot) /* {{{ */ { return NULL; } @@ -4458,13 +4419,13 @@ static ZEND_COLD zend_function *zend_fake_get_method(zend_object **obj_ptr, zend } /* }}} */ -static HashTable *zend_fake_get_properties(zval *object) /* {{{ */ +static HashTable *zend_fake_get_properties(zend_object *obj) /* {{{ */ { return (HashTable*)&zend_empty_array; } /* }}} */ -static HashTable *zend_fake_get_gc(zval *object, zval **table, int *n) /* {{{ */ +static HashTable *zend_fake_get_gc(zend_object *ob, zval **table, int *n) /* {{{ */ { *table = NULL; *n = 0; @@ -4478,74 +4439,74 @@ static ZEND_COLD zend_never_inline void zend_ffi_use_after_free(void) /* {{{ */ } /* }}} */ -static zend_object *zend_ffi_free_clone_obj(zval *zobject) /* {{{ */ +static zend_object *zend_ffi_free_clone_obj(zend_object *obj) /* {{{ */ { zend_ffi_use_after_free(); return NULL; } /* }}} */ -static ZEND_COLD zval *zend_ffi_free_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */ +static ZEND_COLD zval *zend_ffi_free_read_dimension(zend_object *obj, zval *offset, int type, zval *rv) /* {{{ */ { zend_ffi_use_after_free(); return NULL; } /* }}} */ -static ZEND_COLD void zend_ffi_free_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */ +static ZEND_COLD void zend_ffi_free_write_dimension(zend_object *obj, zval *offset, zval *value) /* {{{ */ { zend_ffi_use_after_free(); } /* }}} */ -static ZEND_COLD int zend_ffi_free_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */ +static ZEND_COLD int zend_ffi_free_has_dimension(zend_object *obj, zval *offset, int check_empty) /* {{{ */ { zend_ffi_use_after_free(); return 0; } /* }}} */ -static ZEND_COLD void zend_ffi_free_unset_dimension(zval *object, zval *offset) /* {{{ */ +static ZEND_COLD void zend_ffi_free_unset_dimension(zend_object *obj, zval *offset) /* {{{ */ { zend_ffi_use_after_free(); } /* }}} */ -static ZEND_COLD zval *zend_ffi_free_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */ +static ZEND_COLD zval *zend_ffi_free_read_property(zend_object *obj, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */ { zend_ffi_use_after_free(); return &EG(uninitialized_zval); } /* }}} */ -static ZEND_COLD zval *zend_ffi_free_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */ +static ZEND_COLD zval *zend_ffi_free_write_property(zend_object *obj, zend_string *member, zval *value, void **cache_slot) /* {{{ */ { zend_ffi_use_after_free(); return value; } /* }}} */ -static ZEND_COLD int zend_ffi_free_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */ +static ZEND_COLD int zend_ffi_free_has_property(zend_object *obj, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */ { zend_ffi_use_after_free(); return 0; } /* }}} */ -static ZEND_COLD void zend_ffi_free_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */ +static ZEND_COLD void zend_ffi_free_unset_property(zend_object *obj, zend_string *member, void **cache_slot) /* {{{ */ { zend_ffi_use_after_free(); } /* }}} */ -static zval* zend_ffi_free_get(zval *object, zval *rv) /* {{{ */ +static zval* zend_ffi_free_get(zend_object *obj, zval *rv) /* {{{ */ { zend_ffi_use_after_free(); return NULL; } /* }}} */ -static HashTable *zend_ffi_free_get_debug_info(zval *object, int *is_temp) /* {{{ */ +static HashTable *zend_ffi_free_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */ { zend_ffi_use_after_free(); return NULL; diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 8bb76b5657..6343b48aa9 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -161,7 +161,7 @@ ZEND_END_ARG_INFO() /* {{{ finfo_class_functions */ static const zend_function_entry finfo_class_functions[] = { - ZEND_ME_MAPPING(finfo, finfo_open, arginfo_finfo_open, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(__construct, finfo_open, arginfo_finfo_open, ZEND_ACC_PUBLIC) ZEND_ME_MAPPING(set_flags, finfo_set_flags,arginfo_finfo_method_set_flags, ZEND_ACC_PUBLIC) ZEND_ME_MAPPING(file, finfo_file, arginfo_finfo_method_file, ZEND_ACC_PUBLIC) ZEND_ME_MAPPING(buffer, finfo_buffer, arginfo_finfo_method_buffer, ZEND_ACC_PUBLIC) @@ -292,9 +292,8 @@ PHP_FUNCTION(finfo_open) FILEINFO_DECLARE_INIT_OBJECT(object) char resolved_path[MAXPATHLEN]; zend_error_handling zeh; - int flags = object ? ZEND_PARSE_PARAMS_THROW : 0; - if (zend_parse_parameters_ex(flags, ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) { RETURN_FALSE; } diff --git a/ext/fileinfo/tests/bug61173.phpt b/ext/fileinfo/tests/bug61173.phpt index 9fbf48b2ec..6487e15bbb 100644 --- a/ext/fileinfo/tests/bug61173.phpt +++ b/ext/fileinfo/tests/bug61173.phpt @@ -14,4 +14,4 @@ try { echo $e->getMessage(), "\n"; } --EXPECT-- -finfo::finfo() expects at most 2 parameters, 3 given +finfo::__construct() expects at most 2 parameters, 3 given diff --git a/ext/fileinfo/tests/bug71527-mb.phpt b/ext/fileinfo/tests/bug71527-mb.phpt index 60af049f4f..1f56b679f8 100644 --- a/ext/fileinfo/tests/bug71527-mb.phpt +++ b/ext/fileinfo/tests/bug71527-mb.phpt @@ -9,11 +9,8 @@ USE_ZEND_ALLOC=0 --FILE-- <?php $finfo = finfo_open(FILEINFO_NONE, dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug71527私はガラスを食べられます.magic"); - $info = finfo_file($finfo, __FILE__); - var_dump($info); + var_dump($finfo); ?> --EXPECTF-- Warning: finfo_open(): Failed to load magic database at '%sbug71527私はガラスを食べられます.magic'. in %sbug71527-mb.php on line %d - -Warning: finfo_file() expects parameter 1 to be resource, bool given in %sbug71527-mb.php on line %d bool(false) diff --git a/ext/fileinfo/tests/bug71527.phpt b/ext/fileinfo/tests/bug71527.phpt index 1feb29dd73..a670a79b51 100644 --- a/ext/fileinfo/tests/bug71527.phpt +++ b/ext/fileinfo/tests/bug71527.phpt @@ -9,11 +9,8 @@ USE_ZEND_ALLOC=0 --FILE-- <?php $finfo = finfo_open(FILEINFO_NONE, dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug71527.magic"); - $info = finfo_file($finfo, __FILE__); - var_dump($info); + var_dump($finfo); ?> --EXPECTF-- Warning: finfo_open(): Failed to load magic database at '%sbug71527.magic'. in %sbug71527.php on line %d - -Warning: finfo_file() expects parameter 1 to be resource, bool given in %sbug71527.php on line %d bool(false) diff --git a/ext/fileinfo/tests/finfo_close_error.phpt b/ext/fileinfo/tests/finfo_close_error.phpt index 374787aa55..acd26896f0 100644 --- a/ext/fileinfo/tests/finfo_close_error.phpt +++ b/ext/fileinfo/tests/finfo_close_error.phpt @@ -12,17 +12,8 @@ Test finfo_close() function : error conditions echo "*** Testing finfo_close() : error conditions ***\n"; -$magicFile = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'magic'; -$finfo = finfo_open( FILEINFO_MIME, $magicFile ); -$fp = fopen( __FILE__, 'r' ); - -echo "\n-- Testing finfo_close() function with Zero arguments --\n"; -var_dump( finfo_close() ); - -echo "\n-- Testing finfo_close() function with more than expected no. of arguments --\n"; -var_dump( finfo_close( $finfo, '10') ); - echo "\n-- Testing finfo_close() function with wrong resource type --\n"; +$fp = fopen( __FILE__, 'r' ); var_dump( finfo_close( $fp ) ); ?> @@ -30,16 +21,6 @@ var_dump( finfo_close( $fp ) ); --EXPECTF-- *** Testing finfo_close() : error conditions *** --- Testing finfo_close() function with Zero arguments -- - -Warning: finfo_close() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing finfo_close() function with more than expected no. of arguments -- - -Warning: finfo_close() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing finfo_close() function with wrong resource type -- Warning: finfo_close(): supplied resource is not a valid file_info resource in %s on line %d diff --git a/ext/fileinfo/tests/finfo_open_001.phpt b/ext/fileinfo/tests/finfo_open_001.phpt index 17935c3676..98901f3a8e 100644 --- a/ext/fileinfo/tests/finfo_open_001.phpt +++ b/ext/fileinfo/tests/finfo_open_001.phpt @@ -5,7 +5,12 @@ finfo_open(): Testing magic_file names --FILE-- <?php -var_dump(finfo_open(FILEINFO_MIME, "\0")); +try { + var_dump(finfo_open(FILEINFO_MIME, "\0")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(finfo_open(FILEINFO_MIME, NULL)); var_dump(finfo_open(FILEINFO_MIME, '')); var_dump(finfo_open(FILEINFO_MIME, 123)); @@ -14,8 +19,7 @@ var_dump(finfo_open(FILEINFO_MIME, '/foo/bar/inexistent')); ?> --EXPECTF-- -Warning: finfo_open() expects parameter 2 to be a valid path, string given in %s on line %d -bool(false) +finfo_open() expects parameter 2 to be a valid path, string given resource(%d) of type (file_info) resource(%d) of type (file_info) diff --git a/ext/fileinfo/tests/finfo_open_002.phpt b/ext/fileinfo/tests/finfo_open_002.phpt index 744773b550..ca997a5f64 100644 --- a/ext/fileinfo/tests/finfo_open_002.phpt +++ b/ext/fileinfo/tests/finfo_open_002.phpt @@ -6,7 +6,7 @@ FileInfo - Calling the constructor twice <?php $x = new finfo; -$x->finfo(); +$x->__construct(); echo "done!\n"; diff --git a/ext/fileinfo/tests/finfo_open_error.phpt b/ext/fileinfo/tests/finfo_open_error.phpt index 15202e5799..60fcbce9c2 100644 --- a/ext/fileinfo/tests/finfo_open_error.phpt +++ b/ext/fileinfo/tests/finfo_open_error.phpt @@ -15,10 +15,13 @@ $magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic'; echo "*** Testing finfo_open() : error functionality ***\n"; var_dump( finfo_open( FILEINFO_MIME, 'foobarfile' ) ); -var_dump( finfo_open( array(), $magicFile ) ); -var_dump( finfo_open( FILEINFO_MIME, $magicFile, 'extraArg' ) ); var_dump( finfo_open( PHP_INT_MAX - 1, $magicFile ) ); -var_dump( finfo_open( 'foobar' ) ); + +try { + var_dump( finfo_open( 'foobar' ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} try { var_dump( new finfo('foobar') ); @@ -31,23 +34,15 @@ try { --EXPECTF-- *** Testing finfo_open() : error functionality *** -Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12 +Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line %d -Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12 +Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line %d -Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line 12 +Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line %d bool(false) -Warning: finfo_open() expects parameter 1 to be int, array given in %sfinfo_open_error.php on line 13 -bool(false) - -Warning: finfo_open() expects at most 2 parameters, 3 given in %sfinfo_open_error.php on line 14 -bool(false) - -Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line 15 +Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line %d resource(6) of type (file_info) - -Warning: finfo_open() expects parameter 1 to be int, string given in %sfinfo_open_error.php on line 16 -bool(false) -finfo::finfo() expects parameter 1 to be int, string given +finfo_open() expects parameter 1 to be int, string given +finfo::__construct() expects parameter 1 to be int, string given ===DONE=== diff --git a/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt b/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt index 615afd40f8..2641e7eb11 100644 --- a/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt +++ b/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt @@ -17,14 +17,12 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n"; var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) ); var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) ); -var_dump( finfo_set_flags() ); finfo_close( $finfo ); // OO way $finfo = new finfo( FILEINFO_NONE, $magicFile ); var_dump( $finfo->set_flags( FILEINFO_MIME ) ); -var_dump( $finfo->set_flags() ); ?> ===DONE=== @@ -32,11 +30,5 @@ var_dump( $finfo->set_flags() ); *** Testing finfo_set_flags() : basic functionality *** bool(true) bool(true) - -Warning: finfo_set_flags() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) bool(true) - -Warning: finfo::set_flags() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) ===DONE=== diff --git a/ext/fileinfo/tests/finfo_set_flags_basic.phpt b/ext/fileinfo/tests/finfo_set_flags_basic.phpt index 3b7168a684..12748c385f 100644 --- a/ext/fileinfo/tests/finfo_set_flags_basic.phpt +++ b/ext/fileinfo/tests/finfo_set_flags_basic.phpt @@ -17,14 +17,12 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n"; var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) ); var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) ); -var_dump( finfo_set_flags() ); finfo_close( $finfo ); // OO way $finfo = new finfo( FILEINFO_NONE, $magicFile ); var_dump( $finfo->set_flags( FILEINFO_MIME ) ); -var_dump( $finfo->set_flags() ); ?> ===DONE=== @@ -32,11 +30,5 @@ var_dump( $finfo->set_flags() ); *** Testing finfo_set_flags() : basic functionality *** bool(true) bool(true) - -Warning: finfo_set_flags() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) bool(true) - -Warning: finfo::set_flags() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) ===DONE=== diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 06467417db..465992b419 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -276,8 +276,6 @@ PHP_MINIT_FUNCTION(filter) REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT); diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index f2ac4d8570..50f4f33def 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -537,11 +537,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ php_url *url; size_t old_len = Z_STRLEN_P(value); - if (flags & (FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)) { - php_error_docref(NULL, E_DEPRECATED, - "explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated"); - } - php_filter_url(value, flags, option_array, charset); if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRLEN_P(value)) { diff --git a/ext/filter/tests/007.phpt b/ext/filter/tests/007.phpt index 87f9a77a12..dc966b8cc9 100644 --- a/ext/filter/tests/007.phpt +++ b/ext/filter/tests/007.phpt @@ -14,20 +14,12 @@ var_dump(filter_has_var(INPUT_GET, "abc")); var_dump(filter_has_var(INPUT_GET, "nonex")); var_dump(filter_has_var(INPUT_GET, " ")); var_dump(filter_has_var(INPUT_GET, "")); -var_dump(filter_has_var(INPUT_GET, array())); var_dump(filter_has_var(INPUT_POST, "b")); var_dump(filter_has_var(INPUT_POST, "bbc")); var_dump(filter_has_var(INPUT_POST, "nonex")); var_dump(filter_has_var(INPUT_POST, " ")); var_dump(filter_has_var(INPUT_POST, "")); -var_dump(filter_has_var(INPUT_POST, array())); - -var_dump(filter_has_var(-1, "")); -var_dump(filter_has_var("", "")); -var_dump(filter_has_var(array(), array())); -var_dump(filter_has_var(array(), "")); -var_dump(filter_has_var("", array())); echo "Done\n"; ?> @@ -37,28 +29,9 @@ bool(true) bool(false) bool(false) bool(false) - -Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d -bool(false) bool(true) bool(true) bool(false) bool(false) bool(false) - -Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d -bool(false) -bool(false) - -Warning: filter_has_var() expects parameter 1 to be int, string given in %s007.php on line %d -bool(false) - -Warning: filter_has_var() expects parameter 1 to be int, array given in %s007.php on line %d -bool(false) - -Warning: filter_has_var() expects parameter 1 to be int, array given in %s007.php on line %d -bool(false) - -Warning: filter_has_var() expects parameter 1 to be int, string given in %s007.php on line %d -bool(false) Done diff --git a/ext/filter/tests/008.phpt b/ext/filter/tests/008.phpt index a3cb7172ff..b34c977425 100644 --- a/ext/filter/tests/008.phpt +++ b/ext/filter/tests/008.phpt @@ -6,7 +6,6 @@ filter_list() <?php var_dump(filter_list()); -var_dump(filter_list(array())); echo "Done\n"; ?> @@ -57,7 +56,4 @@ array(22) { [21]=> string(8) "callback" } - -Warning: filter_list() expects exactly 0 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/filter/tests/009.phpt b/ext/filter/tests/009.phpt index 5c38e5603a..f456dc6dc1 100644 --- a/ext/filter/tests/009.phpt +++ b/ext/filter/tests/009.phpt @@ -10,23 +10,15 @@ var_dump(filter_id("string")); var_dump(filter_id("url")); var_dump(filter_id("int")); var_dump(filter_id("none")); -var_dump(filter_id(array())); var_dump(filter_id(-1)); -var_dump(filter_id(0,0,0)); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- int(513) int(513) int(518) int(257) bool(false) - -Warning: filter_id() expects parameter 1 to be string, array given in %s on line %d -NULL bool(false) - -Warning: filter_id() expects exactly 1 parameter, 3 given in %s on line %d -NULL Done diff --git a/ext/filter/tests/010.phpt b/ext/filter/tests/010.phpt index 3e71d331bd..14f8db01af 100644 --- a/ext/filter/tests/010.phpt +++ b/ext/filter/tests/010.phpt @@ -9,7 +9,6 @@ precision=14 var_dump(filter_var(array(1,"1","", "-23234", "text", "asdf234asdfgs", array()), FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY)); var_dump(filter_var(array(1.2,"1.7","", "-23234.123", "text", "asdf234.2asdfgs", array()), FILTER_VALIDATE_FLOAT, FILTER_REQUIRE_ARRAY)); -var_dump(filter_var(1, array())); var_dump(filter_var(1, FILTER_SANITIZE_STRING, 1)); var_dump(filter_var(1, FILTER_SANITIZE_STRING, 0)); var_dump(filter_var(1, FILTER_SANITIZE_STRING, array())); @@ -53,9 +52,6 @@ array(7) { array(0) { } } - -Warning: filter_var() expects parameter 2 to be int, array given in %s on line %d -NULL string(1) "1" string(1) "1" string(1) "1" diff --git a/ext/filter/tests/011.phpt b/ext/filter/tests/011.phpt index b5075d1821..1b2a2ec357 100644 --- a/ext/filter/tests/011.phpt +++ b/ext/filter/tests/011.phpt @@ -20,12 +20,6 @@ var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_FLOAT)); var_dump(filter_input(INPUT_POST, "c", FILTER_SANITIZE_SPECIAL_CHARS)); var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_INT)); -var_dump(filter_var(new stdClass, "d")); - -var_dump(filter_input(INPUT_POST, "c", "", "")); -var_dump(filter_var("", "", "", "", "")); -var_dump(filter_var(0, 0, 0, 0, 0)); - echo "Done\n"; ?> --EXPECTF-- @@ -39,16 +33,4 @@ string(6) "string" float(12345.7) string(29) "<p>string</p>" bool(false) - -Warning: filter_var() expects parameter 2 to be int, string given in %s011.php on line %d -NULL - -Warning: filter_input() expects parameter 3 to be int, string given in %s011.php on line %d -NULL - -Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d -NULL - -Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d -NULL Done diff --git a/ext/filter/tests/039.phpt b/ext/filter/tests/039.phpt index 501414deee..bdd090ae86 100644 --- a/ext/filter/tests/039.phpt +++ b/ext/filter/tests/039.phpt @@ -6,7 +6,6 @@ filter_var_array() and different arguments <?php echo "-- (1)\n"; -var_dump(filter_var_array(NULL)); var_dump(filter_var_array(array())); var_dump(filter_var_array(array(1,"blah"=>"hoho"))); var_dump(filter_var_array(array(), -1)); @@ -51,9 +50,6 @@ echo "Done\n"; ?> --EXPECTF-- -- (1) - -Warning: filter_var_array() expects parameter 1 to be array, null given in %s on line %d -NULL array(0) { } array(2) { diff --git a/ext/filter/tests/040.phpt b/ext/filter/tests/040.phpt index d77b33135e..2ef6839405 100644 --- a/ext/filter/tests/040.phpt +++ b/ext/filter/tests/040.phpt @@ -9,9 +9,7 @@ ap[]=1&bp=test&cp= --FILE-- <?php -var_dump(filter_has_var()); var_dump(filter_has_var(INPUT_GET,"")); -var_dump(filter_has_var(INPUT_GET,array())); var_dump(filter_has_var(INPUT_POST, "ap")); var_dump(filter_has_var(INPUT_POST, "cp")); var_dump(filter_has_var(INPUT_GET, "a")); @@ -20,16 +18,10 @@ var_dump(filter_has_var(INPUT_GET, "abc")); var_dump(filter_has_var(INPUT_GET, "cc")); var_dump(filter_has_var(-1, "cc")); var_dump(filter_has_var(0, "cc")); -var_dump(filter_has_var("", "cc")); echo "Done\n"; ?> ---EXPECTF-- -Warning: filter_has_var() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) -bool(false) - -Warning: filter_has_var() expects parameter 2 to be string, array given in %s on line %d +--EXPECT-- bool(false) bool(true) bool(true) @@ -39,7 +31,4 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: filter_has_var() expects parameter 1 to be int, string given in %s on line %d -bool(false) Done diff --git a/ext/filter/tests/deprecated.phpt b/ext/filter/tests/deprecated.phpt deleted file mode 100644 index a7771056ef..0000000000 --- a/ext/filter/tests/deprecated.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED are deprecated ---SKIPIF-- -<?php -if (!extension_loaded('filter')) die('skip filter extension not available'); -?> ---FILE-- -<?php -var_dump(filter_var('//example.com/', FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)); -var_dump(filter_var('http://', FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)); -?> -===DONE=== ---EXPECTF-- -Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in %s -bool(false) - -Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in %s -bool(false) -===DONE=== diff --git a/ext/ftp/tests/004.phpt b/ext/ftp/tests/004.phpt index 3fcf272e3b..b95c12c518 100644 --- a/ext/ftp/tests/004.phpt +++ b/ext/ftp/tests/004.phpt @@ -8,68 +8,22 @@ require 'skipif.inc'; <?php require 'server.inc'; +// Negative timeout +var_dump(ftp_connect('127.0.0.1', 0, -3)); + $ftp = ftp_connect('127.0.0.1', $port); if (!$ftp) die("Couldn't connect to the server"); var_dump(ftp_login($ftp, 'user', 'pass')); - -var_dump(ftp_systype($ftp)); - -/* some bogus usage */ -var_dump(ftp_alloc($ftp, array())); -var_dump(ftp_cdup($ftp, 0)); -var_dump(ftp_chdir($ftp, array())); -var_dump(ftp_chmod($ftp, 0666)); -var_dump(ftp_close()); -var_dump(ftp_connect('sfjkfjaksfjkasjf')); -var_dump(ftp_delete($ftp, array())); -var_dump(ftp_exec($ftp, array())); - -var_dump(ftp_systype($ftp, 0)); -var_dump(ftp_pwd($ftp, array())); - -var_dump(ftp_login($ftp)); var_dump(ftp_login($ftp, 'user', 'bogus')); var_dump(ftp_quit($ftp)); ?> --EXPECTF-- -bool(true) -string(4) "UNIX" - -Warning: ftp_alloc() expects parameter 2 to be int, array given in %s004.php on line 12 -bool(false) - -Warning: ftp_cdup() expects exactly 1 parameter, 2 given in %s004.php on line 13 -NULL - -Warning: ftp_chdir() expects parameter 2 to be string, array given in %s004.php on line 14 -NULL - -Warning: ftp_chmod() expects exactly 3 parameters, 2 given in %s on line %d +Warning: ftp_connect(): Timeout has to be greater than 0 in %s on line %d bool(false) +bool(true) -Warning: ftp_close() expects exactly 1 parameter, 0 given in %s004.php on line 16 -NULL - -Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s004.php on line 17 -bool(false) - -Warning: ftp_delete() expects parameter 2 to be string, array given in %s004.php on line 18 -NULL - -Warning: ftp_exec() expects parameter 2 to be string, array given in %s004.php on line 19 -NULL - -Warning: ftp_systype() expects exactly 1 parameter, 2 given in %s004.php on line 21 -NULL - -Warning: ftp_pwd() expects exactly 1 parameter, 2 given in %s004.php on line 22 -NULL - -Warning: ftp_login() expects exactly 3 parameters, 1 given in %s004.php on line 24 -NULL - -Warning: ftp_login(): Not logged in. in %s004.php on line 25 +Warning: ftp_login(): Not logged in. in %s on line %d bool(false) bool(true) diff --git a/ext/ftp/tests/006.phpt b/ext/ftp/tests/006.phpt deleted file mode 100644 index ff0d258917..0000000000 --- a/ext/ftp/tests/006.phpt +++ /dev/null @@ -1,108 +0,0 @@ ---TEST-- -FTP with bogus parameters ---SKIPIF-- -<?php -require 'skipif.inc'; -?> ---FILE-- -<?php -$ftp=null; - -var_dump(ftp_connect(array())); -var_dump(ftp_connect('127.0.0.1', 0, -3)); -var_dump(ftp_raw($ftp)); -var_dump(ftp_mkdir($ftp)); -var_dump(ftp_rmdir($ftp)); -var_dump(ftp_nlist($ftp)); -var_dump(ftp_rawlist($ftp)); -var_dump(ftp_fget($ftp)); -var_dump(ftp_nb_fget($ftp)); -var_dump(ftp_nb_get($ftp)); -var_dump(ftp_pasv($ftp)); -var_dump(ftp_nb_continue()); -var_dump(ftp_fput()); -var_dump(ftp_nb_fput($ftp)); -var_dump(ftp_put($ftp)); -var_dump(ftp_nb_put($ftp)); -var_dump(ftp_size($ftp)); -var_dump(ftp_mdtm($ftp)); -var_dump(ftp_rename($ftp)); -var_dump(ftp_site($ftp)); -var_dump(ftp_set_option($ftp)); -var_dump(ftp_get_option($ftp)); -var_dump(ftp_mlsd($ftp)); -var_dump(ftp_append($ftp)); - -?> ---EXPECTF-- -Warning: ftp_connect() expects parameter 1 to be string, array given in %s006.php on line 4 -NULL - -Warning: ftp_connect(): Timeout has to be greater than 0 in %s006.php on line 5 -bool(false) - -Warning: ftp_raw() expects exactly 2 parameters, 1 given in %s006.php on line 6 -NULL - -Warning: ftp_mkdir() expects exactly 2 parameters, 1 given in %s006.php on line 7 -NULL - -Warning: ftp_rmdir() expects exactly 2 parameters, 1 given in %s006.php on line 8 -NULL - -Warning: ftp_nlist() expects exactly 2 parameters, 1 given in %s006.php on line 9 -NULL - -Warning: ftp_rawlist() expects at least 2 parameters, 1 given in %s006.php on line 10 -NULL - -Warning: ftp_fget() expects at least 3 parameters, 1 given in %s006.php on line 11 -NULL - -Warning: ftp_nb_fget() expects at least 3 parameters, 1 given in %s006.php on line 12 -NULL - -Warning: ftp_nb_get() expects at least 3 parameters, 1 given in %s006.php on line 13 -NULL - -Warning: ftp_pasv() expects exactly 2 parameters, 1 given in %s006.php on line 14 -NULL - -Warning: ftp_nb_continue() expects exactly 1 parameter, 0 given in %s006.php on line 15 -NULL - -Warning: ftp_fput() expects at least 3 parameters, 0 given in %s006.php on line 16 -NULL - -Warning: ftp_nb_fput() expects at least 3 parameters, 1 given in %s006.php on line 17 -NULL - -Warning: ftp_put() expects at least 3 parameters, 1 given in %s006.php on line 18 -NULL - -Warning: ftp_nb_put() expects at least 3 parameters, 1 given in %s006.php on line 19 -NULL - -Warning: ftp_size() expects exactly 2 parameters, 1 given in %s006.php on line 20 -NULL - -Warning: ftp_mdtm() expects exactly 2 parameters, 1 given in %s006.php on line 21 -NULL - -Warning: ftp_rename() expects exactly 3 parameters, 1 given in %s006.php on line 22 -NULL - -Warning: ftp_site() expects exactly 2 parameters, 1 given in %s006.php on line 23 -NULL - -Warning: ftp_set_option() expects exactly 3 parameters, 1 given in %s006.php on line 24 -NULL - -Warning: ftp_get_option() expects exactly 2 parameters, 1 given in %s006.php on line 25 -NULL - -Warning: ftp_mlsd() expects exactly 2 parameters, 1 given in %s006.php on line 26 -NULL - -Warning: ftp_append() expects at least 3 parameters, 1 given in %s006.php on line 27 -NULL diff --git a/ext/ftp/tests/ftp_get_basic.phpt b/ext/ftp/tests/ftp_get_basic.phpt index 60f1b1de79..43022cde45 100644 --- a/ext/ftp/tests/ftp_get_basic.phpt +++ b/ext/ftp/tests/ftp_get_basic.phpt @@ -29,9 +29,6 @@ unlink($tmpfname); //test non-existent file request ftp_get($ftp, $tmpfname ,'a warning.txt', FTP_ASCII); - -//test invalid ftp_get params -var_dump(ftp_get('foo', 'bar', 'baz')); ?> --EXPECTF-- bool(true) @@ -41,6 +38,3 @@ bool(true) string(21) "BINARYFoo%00Bar%0D%0A" Warning: ftp_get(): a warning: No such file or directory in %sftp_get_basic.php on line %d - -Warning: ftp_get() expects parameter 1 to be resource, string given in %s on line %d -NULL diff --git a/ext/ftp/tests/ftp_ssl_connect_error.phpt b/ext/ftp/tests/ftp_ssl_connect_error.phpt index b0ece5d63b..13c8f9e9c0 100644 --- a/ext/ftp/tests/ftp_ssl_connect_error.phpt +++ b/ext/ftp/tests/ftp_ssl_connect_error.phpt @@ -12,14 +12,6 @@ echo "*** Testing ftp_ssl_connect() function : error conditions ***\n"; echo "\n-- Testing ftp_ssl_connect() function on failure --\n"; var_dump(ftp_ssl_connect('totes.invalid')); -echo "\n-- Testing ftp_ssl_connect() function invalid argument type --\n"; -ftp_ssl_connect([]); -ftp_ssl_connect('totes.invalid', []); -ftp_ssl_connect('totes.invalid', 21, []); - -echo "\n-- Testing ftp_ssl_connect() function with more than expected no. of arguments --\n"; -ftp_ssl_connect('totes.invalid', 21, 1, []); - echo "\n-- Testing ftp_ssl_connect() function timeout warning for value 0 --\n"; ftp_ssl_connect('totes.invalid', 21, 0); @@ -32,18 +24,6 @@ echo "===DONE===\n"; Warning: ftp_ssl_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s on line %d bool(false) --- Testing ftp_ssl_connect() function invalid argument type -- - -Warning: ftp_ssl_connect() expects parameter 1 to be string, array given in %s on line %d - -Warning: ftp_ssl_connect() expects parameter 2 to be int, array given in %s on line %d - -Warning: ftp_ssl_connect() expects parameter 3 to be int, array given in %s on line %d - --- Testing ftp_ssl_connect() function with more than expected no. of arguments -- - -Warning: ftp_ssl_connect() expects at most 3 parameters, 4 given in %s on line %d - -- Testing ftp_ssl_connect() function timeout warning for value 0 -- Warning: ftp_ssl_connect(): Timeout has to be greater than 0 in %s on line %d diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 6849be1825..7be602c994 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -128,11 +128,10 @@ static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS); static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS); /* End Section filters declarations */ -static gdImagePtr _php_image_create_from_string (zval *Data, char *tn, gdImagePtr (*ioctx_func_p)()); +static gdImagePtr _php_image_create_from_string(zend_string *Data, char *tn, gdImagePtr (*ioctx_func_p)()); static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)()); static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)()); static int _php_image_type(char data[12]); -static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type); /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO(arginfo_gd_info, 0) @@ -758,32 +757,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagettftext, 0) ZEND_END_ARG_INFO() #endif -ZEND_BEGIN_ARG_INFO_EX(arginfo_image2wbmp, 0, 0, 1) - ZEND_ARG_INFO(0, im) - ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(0, foreground) -ZEND_END_ARG_INFO() - -#if defined(HAVE_GD_JPG) -ZEND_BEGIN_ARG_INFO(arginfo_jpeg2wbmp, 0) - ZEND_ARG_INFO(0, f_org) - ZEND_ARG_INFO(0, f_dest) - ZEND_ARG_INFO(0, d_height) - ZEND_ARG_INFO(0, d_width) - ZEND_ARG_INFO(0, d_threshold) -ZEND_END_ARG_INFO() -#endif - -#if defined(HAVE_GD_PNG) -ZEND_BEGIN_ARG_INFO(arginfo_png2wbmp, 0) - ZEND_ARG_INFO(0, f_org) - ZEND_ARG_INFO(0, f_dest) - ZEND_ARG_INFO(0, d_height) - ZEND_ARG_INFO(0, d_width) - ZEND_ARG_INFO(0, d_threshold) -ZEND_END_ARG_INFO() -#endif - ZEND_BEGIN_ARG_INFO_EX(arginfo_imagefilter, 0, 0, 2) ZEND_ARG_INFO(0, im) ZEND_ARG_INFO(0, filtertype) @@ -991,13 +964,6 @@ static const zend_function_entry gd_functions[] = { PHP_FE(imagetypes, arginfo_imagetypes) -#if defined(HAVE_GD_JPG) - PHP_DEP_FE(jpeg2wbmp, arginfo_jpeg2wbmp) -#endif -#if defined(HAVE_GD_PNG) - PHP_DEP_FE(png2wbmp, arginfo_png2wbmp) -#endif - PHP_DEP_FE(image2wbmp, arginfo_image2wbmp) PHP_FE(imagelayereffect, arginfo_imagelayereffect) PHP_FE(imagexbm, arginfo_imagexbm) @@ -2258,12 +2224,12 @@ static int _php_image_type (char data[12]) /* {{{ _php_image_create_from_string */ -gdImagePtr _php_image_create_from_string(zval *data, char *tn, gdImagePtr (*ioctx_func_p)()) +gdImagePtr _php_image_create_from_string(zend_string *data, char *tn, gdImagePtr (*ioctx_func_p)()) { gdImagePtr im; gdIOCtx *io_ctx; - io_ctx = gdNewDynamicCtxEx(Z_STRLEN_P(data), Z_STRVAL_P(data), 0); + io_ctx = gdNewDynamicCtxEx(ZSTR_LEN(data), ZSTR_VAL(data), 0); if (!io_ctx) { return NULL; @@ -2286,22 +2252,21 @@ gdImagePtr _php_image_create_from_string(zval *data, char *tn, gdImagePtr (*ioct Create a new image from the image stream in the string */ PHP_FUNCTION(imagecreatefromstring) { - zval *data; + zend_string *data; gdImagePtr im; int imtype; char sig[12]; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &data) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &data) == FAILURE) { return; } - convert_to_string_ex(data); - if (Z_STRLEN_P(data) < sizeof(sig)) { + if (ZSTR_LEN(data) < sizeof(sig)) { php_error_docref(NULL, E_WARNING, "Empty string or invalid image"); RETURN_FALSE; } - memcpy(sig, Z_STRVAL_P(data), sizeof(sig)); + memcpy(sig, ZSTR_VAL(data), sizeof(sig)); imtype = _php_image_type(sig); @@ -2594,7 +2559,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char int argc = ZEND_NUM_ARGS(); int q = -1, i, t = 1; - /* The quality parameter for Wbmp stands for the foreground when called from image2wbmp() */ /* The quality parameter for gd2 stands for chunk size */ if (zend_parse_parameters(argc, "r|pll", &imgind, &file, &file_len, &quality, &type) == FAILURE) { @@ -4041,224 +4005,6 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int /* }}} */ #endif /* ENABLE_GD_TTF */ -/* {{{ proto bool image2wbmp(resource im [, string filename [, int foreground]]) - Output WBMP image to browser or file */ -PHP_FUNCTION(image2wbmp) -{ - _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_CONVERT_WBM, "WBMP", NULL); -} -/* }}} */ - -#if defined(HAVE_GD_JPG) -/* {{{ proto bool jpeg2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold) - Convert JPEG image to WBMP image */ -PHP_FUNCTION(jpeg2wbmp) -{ - _php_image_convert(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG); -} -/* }}} */ -#endif - -#if defined(HAVE_GD_PNG) -/* {{{ proto bool png2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold) - Convert PNG image to WBMP image */ -PHP_FUNCTION(png2wbmp) -{ - _php_image_convert(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG); -} -/* }}} */ -#endif - -/* {{{ _php_image_convert - * _php_image_convert converts jpeg/png images to wbmp and resizes them as needed */ -static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) -{ - char *f_org, *f_dest; - size_t f_org_len, f_dest_len; - zend_long height, width, threshold; - gdImagePtr im_org, im_dest, im_tmp; - char *fn_org = NULL; - char *fn_dest = NULL; - FILE *org, *dest; - int dest_height = -1; - int dest_width = -1; - int org_height, org_width; - int white, black; - int color, color_org, median; - int int_threshold; - int x, y; - float x_ratio, y_ratio; -#ifdef HAVE_GD_JPG - zend_long ignore_warning; -#endif - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "pplll", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) { - return; - } - - fn_org = f_org; - fn_dest = f_dest; - dest_height = height; - dest_width = width; - int_threshold = threshold; - - /* Check threshold value */ - if (int_threshold < 0 || int_threshold > 8) { - php_error_docref(NULL, E_WARNING, "Invalid threshold value '%d'", int_threshold); - RETURN_FALSE; - } - - /* Check origin file */ - PHP_GD_CHECK_OPEN_BASEDIR(fn_org, "Invalid origin filename"); - - /* Check destination file */ - PHP_GD_CHECK_OPEN_BASEDIR(fn_dest, "Invalid destination filename"); - - /* Open origin file */ - org = VCWD_FOPEN(fn_org, "rb"); - if (!org) { - php_error_docref(NULL, E_WARNING, "Unable to open '%s' for reading", fn_org); - RETURN_FALSE; - } - - /* Open destination file */ - dest = VCWD_FOPEN(fn_dest, "wb"); - if (!dest) { - php_error_docref(NULL, E_WARNING, "Unable to open '%s' for writing", fn_dest); - fclose(org); - RETURN_FALSE; - } - - switch (image_type) { - -#ifdef HAVE_GD_JPG - case PHP_GDIMG_TYPE_JPG: - ignore_warning = INI_INT("gd.jpeg_ignore_warning"); - im_org = gdImageCreateFromJpegEx(org, ignore_warning); - if (im_org == NULL) { - php_error_docref(NULL, E_WARNING, "Unable to open '%s' Not a valid JPEG file", fn_dest); - fclose(org); - fclose(dest); - RETURN_FALSE; - } - break; -#endif /* HAVE_GD_JPG */ - -#ifdef HAVE_GD_PNG - case PHP_GDIMG_TYPE_PNG: - im_org = gdImageCreateFromPng(org); - if (im_org == NULL) { - php_error_docref(NULL, E_WARNING, "Unable to open '%s' Not a valid PNG file", fn_dest); - fclose(org); - fclose(dest); - RETURN_FALSE; - } - break; -#endif /* HAVE_GD_PNG */ - - default: - php_error_docref(NULL, E_WARNING, "Format not supported"); - fclose(org); - fclose(dest); - RETURN_FALSE; - break; - } - - fclose(org); - - org_width = gdImageSX (im_org); - org_height = gdImageSY (im_org); - - x_ratio = (float) org_width / (float) dest_width; - y_ratio = (float) org_height / (float) dest_height; - - if (x_ratio > 1 && y_ratio > 1) { - if (y_ratio > x_ratio) { - x_ratio = y_ratio; - } else { - y_ratio = x_ratio; - } - dest_width = (int) (org_width / x_ratio); - dest_height = (int) (org_height / y_ratio); - } else { - x_ratio = (float) dest_width / (float) org_width; - y_ratio = (float) dest_height / (float) org_height; - - if (y_ratio < x_ratio) { - x_ratio = y_ratio; - } else { - y_ratio = x_ratio; - } - dest_width = (int) (org_width * x_ratio); - dest_height = (int) (org_height * y_ratio); - } - - im_tmp = gdImageCreate (dest_width, dest_height); - if (im_tmp == NULL ) { - php_error_docref(NULL, E_WARNING, "Unable to allocate temporary buffer"); - fclose(dest); - gdImageDestroy(im_org); - RETURN_FALSE; - } - - gdImageCopyResized (im_tmp, im_org, 0, 0, 0, 0, dest_width, dest_height, org_width, org_height); - - gdImageDestroy(im_org); - - im_dest = gdImageCreate(dest_width, dest_height); - if (im_dest == NULL) { - php_error_docref(NULL, E_WARNING, "Unable to allocate destination buffer"); - fclose(dest); - gdImageDestroy(im_tmp); - RETURN_FALSE; - } - - white = gdImageColorAllocate(im_dest, 255, 255, 255); - if (white == -1) { - php_error_docref(NULL, E_WARNING, "Unable to allocate the colors for the destination buffer"); - fclose(dest); - gdImageDestroy(im_tmp); - gdImageDestroy(im_dest); - RETURN_FALSE; - } - - black = gdImageColorAllocate(im_dest, 0, 0, 0); - if (black == -1) { - php_error_docref(NULL, E_WARNING, "Unable to allocate the colors for the destination buffer"); - fclose(dest); - gdImageDestroy(im_tmp); - gdImageDestroy(im_dest); - RETURN_FALSE; - } - - int_threshold = int_threshold * 32; - - for (y = 0; y < dest_height; y++) { - for (x = 0; x < dest_width; x++) { - color_org = gdImageGetPixel (im_tmp, x, y); - median = (im_tmp->red[color_org] + im_tmp->green[color_org] + im_tmp->blue[color_org]) / 3; - if (median < int_threshold) { - color = black; - } else { - color = white; - } - gdImageSetPixel (im_dest, x, y, color); - } - } - - gdImageDestroy (im_tmp ); - - gdImageWBMP(im_dest, black , dest); - - fflush(dest); - fclose(dest); - - gdImageDestroy(im_dest); - - RETURN_TRUE; -} -/* }}} */ - /* Section Filters */ #define PHP_GD_SINGLE_RES \ zval *SIM; \ @@ -4679,10 +4425,6 @@ PHP_FUNCTION(imagecropauto) } switch (mode) { - case -1: - php_error_docref(NULL, E_DEPRECATED, "Crop mode -1 is deprecated. Use IMG_CROP_DEFAULT instead."); - mode = GD_CROP_DEFAULT; - /* FALLTHRU */ case GD_CROP_DEFAULT: case GD_CROP_TRANSPARENT: case GD_CROP_BLACK: diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index 03700ebca8..d563eb1384 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -94,7 +94,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, int close_stream = 1; /* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called - * from image<type>(). + * from imagey<type>(). */ switch (image_type) { case PHP_GDIMG_TYPE_XBM: diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h index 982decd064..be2b3ce855 100644 --- a/ext/gd/php_gd.h +++ b/ext/gd/php_gd.h @@ -204,10 +204,6 @@ PHP_FUNCTION(imagedashedline); PHP_FUNCTION(imagettfbbox); PHP_FUNCTION(imagettftext); -PHP_FUNCTION(jpeg2wbmp); -PHP_FUNCTION(png2wbmp); -PHP_FUNCTION(image2wbmp); - PHP_FUNCTION(imagecolormatch); PHP_FUNCTION(imagelayereffect); diff --git a/ext/gd/tests/image2wbmp_error.phpt b/ext/gd/tests/image2wbmp_error.phpt deleted file mode 100644 index 8d8d836ef7..0000000000 --- a/ext/gd/tests/image2wbmp_error.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -image2wbmp() is deprecated ---SKIPIF-- -<?php -if (!extension_loaded('gd')) die('skip gd extension not available'); -?> ---FILE-- -<?php -$im = imagecreate(10, 10); -imagecolorallocate($im, 0, 0, 0); -image2wbmp($im, __DIR__ . '/image2wbmp_error.wbmp'); -?> -===DONE=== ---CLEAN-- -<?php -unlink(__DIR__ . '/image2wbmp_error.wbmp'); -?> ---EXPECTF-- -Deprecated: Function image2wbmp() is deprecated in %s on line %d -===DONE=== diff --git a/ext/gd/tests/imagecolorallocatealpha_error1.phpt b/ext/gd/tests/imagecolorallocatealpha_error1.phpt index 793c02d106..cdc83d8479 100644 --- a/ext/gd/tests/imagecolorallocatealpha_error1.phpt +++ b/ext/gd/tests/imagecolorallocatealpha_error1.phpt @@ -9,17 +9,7 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php $resource = tmpfile(); - imagecolorallocatealpha($resource, 255, 255, 255, 50); -imagecolorallocatealpha('string', 255, 255, 255, 50); -imagecolorallocatealpha(array(), 255, 255, 255, 50); -imagecolorallocatealpha(null, 255, 255, 255, 50); ?> --EXPECTF-- Warning: imagecolorallocatealpha(): supplied resource is not a valid Image resource in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 1 to be resource, %s given in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 1 to be resource, array given in %s on line %d - -Warning: imagecolorallocatealpha() expects parameter 1 to be resource, null given in %s on line %d diff --git a/ext/gd/tests/imagecolorstotal_error.phpt b/ext/gd/tests/imagecolorstotal_error.phpt index 59999423ca..328cf12e7c 100644 --- a/ext/gd/tests/imagecolorstotal_error.phpt +++ b/ext/gd/tests/imagecolorstotal_error.phpt @@ -1,5 +1,5 @@ --TEST-- -Test imagecolorstotal() function : error conditions - Pass incorrect number of arguments +Test imagecolorstotal() function : error conditions - Pass invalid resource type --SKIPIF-- <?php if(!extension_loaded('gd')) { @@ -21,13 +21,6 @@ echo "*** Testing imagecolorstotal() : error conditions ***\n"; // Get a resource $im = fopen(__FILE__, 'r'); -echo "\n-- Testing imagecolorstotal() function with Zero arguments --\n"; -var_dump( imagecolorstotal() ); - -echo "\n-- Testing imagecolorstotal() function with more than expected no. of arguments --\n"; -$extra_arg = false; -var_dump( imagecolorstotal($im, $extra_arg) ); - echo "\n-- Testing imagecolorstotal() function with a invalid resource\n"; var_dump( imagecolorstotal($im) ); @@ -37,16 +30,6 @@ fclose($im); --EXPECTF-- *** Testing imagecolorstotal() : error conditions *** --- Testing imagecolorstotal() function with Zero arguments -- - -Warning: imagecolorstotal() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing imagecolorstotal() function with more than expected no. of arguments -- - -Warning: imagecolorstotal() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -- Testing imagecolorstotal() function with a invalid resource Warning: imagecolorstotal(): supplied resource is not a valid Image resource in %s on line %d diff --git a/ext/gd/tests/imagecreatetruecolor_error2.phpt b/ext/gd/tests/imagecreatetruecolor_error2.phpt index 3ab4cf1e1f..8847333722 100644 --- a/ext/gd/tests/imagecreatetruecolor_error2.phpt +++ b/ext/gd/tests/imagecreatetruecolor_error2.phpt @@ -11,14 +11,8 @@ Rafael Dohms <rdohms [at] gmail [dot] com> <?php $image = imagecreatetruecolor(-1, 30); $image = imagecreatetruecolor(30, -1); -$image = imagecreatetruecolor(999999999999999999999999999, 30); -$image = imagecreatetruecolor(30, 999999999999999999999999999); ?> --EXPECTF-- Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d - -Warning: imagecreatetruecolor() expects parameter 1 to be int, float given in %s on line %d - -Warning: imagecreatetruecolor() expects parameter 2 to be int, float given in %s on line %d diff --git a/ext/gd/tests/imagefilter_error1.phpt b/ext/gd/tests/imagefilter_error1.phpt index 41637994b4..407944d899 100644 --- a/ext/gd/tests/imagefilter_error1.phpt +++ b/ext/gd/tests/imagefilter_error1.phpt @@ -11,8 +11,11 @@ if (!extension_loaded("gd")) die("skip GD not present"); <?php $image = imagecreatetruecolor(180, 30); -var_dump(imagefilter($image)); +try { + var_dump(imagefilter($image)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: Wrong parameter count for imagefilter() in %s on line %d -NULL +--EXPECT-- +Wrong parameter count for imagefilter() diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt index 2370d5036e..5eae5c719c 100644 --- a/ext/gd/tests/imagegd2_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd2_nullbyte_injection.phpt @@ -22,13 +22,16 @@ $userinput = "1\0"; // from post or get data $temp = $tempdir. "/test" . $userinput .".tmp"; echo "\nimagegd2 TEST\n"; -imagegd2($image, $temp); +try { + imagegd2($image, $temp); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } ---EXPECTF-- +--EXPECT-- imagegd2 TEST - -Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d +imagegd2() expects parameter 2 to be a valid path, string given bool(false) bool(false) diff --git a/ext/gd/tests/imagegd_nullbyte_injection.phpt b/ext/gd/tests/imagegd_nullbyte_injection.phpt index 25e54fe36c..235bd4680c 100644 --- a/ext/gd/tests/imagegd_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt @@ -22,13 +22,16 @@ $userinput = "1\0"; // from post or get data $temp = $tempdir. "/test" . $userinput .".tmp"; echo "\nimagegd TEST\n"; -imagegd($image, $temp); +try { + imagegd($image, $temp); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(file_exists($tempdir. "/test1")); var_dump(file_exists($tempdir. "/test1.tmp")); foreach (glob($tempdir . "/test*") as $file ) { unlink($file); } ---EXPECTF-- +--EXPECT-- imagegd TEST - -Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d +imagegd() expects parameter 2 to be a valid path, string given bool(false) bool(false) diff --git a/ext/gd/tests/imageistruecolor_error1.phpt b/ext/gd/tests/imageistruecolor_error1.phpt index ab0a9fe653..e2364bcec6 100644 --- a/ext/gd/tests/imageistruecolor_error1.phpt +++ b/ext/gd/tests/imageistruecolor_error1.phpt @@ -9,16 +9,8 @@ Rafael Dohms <rdohms [at] gmail [dot] com> ?> --FILE-- <?php -$image = imagecreatetruecolor(180, 30); $resource = tmpfile(); - -imageistruecolor('string'); imageistruecolor($resource); -imageistruecolor(array()); ?> --EXPECTF-- -Warning: imageistruecolor() expects parameter 1 to be resource, string given in %s on line %d - Warning: imageistruecolor(): supplied resource is not a valid Image resource in %s on line %d - -Warning: imageistruecolor() expects parameter 1 to be resource, array given in %s on line %d diff --git a/ext/gd/tests/imagesetthickness_error1.phpt b/ext/gd/tests/imagesetthickness_error1.phpt index f54270afbc..2542444c87 100644 --- a/ext/gd/tests/imagesetthickness_error1.phpt +++ b/ext/gd/tests/imagesetthickness_error1.phpt @@ -9,14 +9,7 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php $resource = tmpfile(); - -imagesetthickness('string', 5); -imagesetthickness(array(), 5); imagesetthickness($resource, 5); ?> --EXPECTF-- -Warning: imagesetthickness() expects parameter 1 to be resource, %s given in %s on line %d - -Warning: imagesetthickness() expects parameter 1 to be resource, array given in %s on line %d - Warning: imagesetthickness(): supplied resource is not a valid Image resource in %s on line %d diff --git a/ext/gd/tests/imagetruecolortopalette_error1.phpt b/ext/gd/tests/imagetruecolortopalette_error1.phpt index 3418449c01..a4d3bdfc16 100644 --- a/ext/gd/tests/imagetruecolortopalette_error1.phpt +++ b/ext/gd/tests/imagetruecolortopalette_error1.phpt @@ -10,17 +10,7 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php $resource = tmpfile(); - imagetruecolortopalette($resource, true, 2); -imagetruecolortopalette('string', true, 2); -imagetruecolortopalette(array(), true, 2); -imagetruecolortopalette(null, true, 2); ?> --EXPECTF-- Warning: imagetruecolortopalette(): supplied resource is not a valid Image resource in %s on line %d - -Warning: imagetruecolortopalette() expects parameter 1 to be resource, %s given in %s on line %d - -Warning: imagetruecolortopalette() expects parameter 1 to be resource, array given in %s on line %d - -Warning: imagetruecolortopalette() expects parameter 1 to be resource, null given in %s on line %d diff --git a/ext/gd/tests/imagetruecolortopalette_error3.phpt b/ext/gd/tests/imagetruecolortopalette_error3.phpt index d89bbcb31b..2a256ba957 100644 --- a/ext/gd/tests/imagetruecolortopalette_error3.phpt +++ b/ext/gd/tests/imagetruecolortopalette_error3.phpt @@ -10,19 +10,7 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php $image = imagecreatetruecolor(50, 50); -$resource = tmpfile(); - -imagetruecolortopalette($image, true, 'string'); -imagetruecolortopalette($image, true, $resource); -imagetruecolortopalette($image, true, array()); imagetruecolortopalette($image, true, null); - ?> --EXPECTF-- -Warning: imagetruecolortopalette() expects parameter 3 to be int, string given in %s on line %d - -Warning: imagetruecolortopalette() expects parameter 3 to be int, resource given in %s on line %d - -Warning: imagetruecolortopalette() expects parameter 3 to be int, array given in %s on line %d - Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s on line %d diff --git a/ext/gd/tests/jpeg2wbmp_error1.phpt b/ext/gd/tests/jpeg2wbmp_error1.phpt deleted file mode 100644 index fcdef0bcb1..0000000000 --- a/ext/gd/tests/jpeg2wbmp_error1.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test jpeg2wbmp() function : wrong threshold value param ---CREDITS-- -Levi Fukumori <levi [at] fukumori [dot] com [dot] br> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('jpeg2wbmp')) { - die('skip jpeg2wbmp function is not available'); -} -?> ---FILE-- -<?php -// Create a blank image and add some text -$im = imagecreatetruecolor(120, 20); -$text_color = imagecolorallocate($im, 255, 255, 255); -imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); - -$file = dirname(__FILE__) .'/simpletext.jpg'; -$file2 = dirname(__FILE__) .'/simpletext.wbmp'; - -// Save the image as 'simpletext.jpg' -imagejpeg($im, $file); - -// Free up memory -imagedestroy($im); - -jpeg2wbmp($file, $file2, 20, 120, 9); -jpeg2wbmp($file, $file2, 20, 120, -1); -?> ---EXPECTF-- -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Invalid threshold value '9' in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Invalid threshold value '-1' in %s on line %d ---CLEAN-- -<?php -unlink(dirname(__FILE__) .'/simpletext.jpg'); -unlink(dirname(__FILE__) .'/simpletext.wbmp'); -?> diff --git a/ext/gd/tests/jpeg2wbmp_error2-mb.phpt b/ext/gd/tests/jpeg2wbmp_error2-mb.phpt deleted file mode 100644 index 4eeac126a4..0000000000 --- a/ext/gd/tests/jpeg2wbmp_error2-mb.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test jpeg2wbmp() function : wrong origin filename param ---CREDITS-- -Levi Fukumori <levi [at] fukumori [dot] com [dot] br> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('jpeg2wbmp')) { - die('skip jpeg2wbmp function is not available'); -} -?> ---FILE-- -<?php -$file = dirname(__FILE__) .'/simpletext私はガラスを食べられます.wbmp'; -jpeg2wbmp('', $file, 20, 120, 8); -jpeg2wbmp(null, $file, 20, 120, 8); -jpeg2wbmp(false, $file, 20, 120, 8); -?> ---EXPECTF-- -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d ---CLEAN-- -<?php -unlink(dirname(__FILE__) .'/simpletext私はガラスを食べられます.wbmp'); -?> diff --git a/ext/gd/tests/jpeg2wbmp_error2.phpt b/ext/gd/tests/jpeg2wbmp_error2.phpt deleted file mode 100644 index 405eb83129..0000000000 --- a/ext/gd/tests/jpeg2wbmp_error2.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test jpeg2wbmp() function : wrong origin filename param ---CREDITS-- -Levi Fukumori <levi [at] fukumori [dot] com [dot] br> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('jpeg2wbmp')) { - die('skip jpeg2wbmp function is not available'); -} -?> ---FILE-- -<?php -$file = dirname(__FILE__) .'/simpletext.wbmp'; -jpeg2wbmp('', $file, 20, 120, 8); -jpeg2wbmp(null, $file, 20, 120, 8); -jpeg2wbmp(false, $file, 20, 120, 8); -?> ---EXPECTF-- -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d ---CLEAN-- -<?php -unlink(dirname(__FILE__) .'/simpletext.wbmp'); -?> diff --git a/ext/gd/tests/jpeg2wbmp_error3.phpt b/ext/gd/tests/jpeg2wbmp_error3.phpt deleted file mode 100644 index 2662b7a86b..0000000000 --- a/ext/gd/tests/jpeg2wbmp_error3.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -Test jpeg2wbmp() function : wrong destination filename param ---CREDITS-- -Levi Fukumori <levi [at] fukumori [dot] com [dot] br> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('jpeg2wbmp')) { - die('skip jpeg2wbmp function is not available'); -} -?> ---FILE-- -<?php -// Create a blank image and add some text -$im = imagecreatetruecolor(120, 20); -$text_color = imagecolorallocate($im, 255, 255, 255); -imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); - -$file = dirname(__FILE__) .'/simpletext.jpg'; - -// Save the image as 'simpletext.jpg' -imagejpeg($im, $file); - -// Free up memory -imagedestroy($im); - -jpeg2wbmp($file, '', 20, 120, 8); -jpeg2wbmp($file, null, 20, 120, 8); -jpeg2wbmp($file, false, 20, 120, 8); -?> ---EXPECTF-- -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d - -Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d - -Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d ---CLEAN-- -<?php -unlink(dirname(__FILE__) .'/simpletext.jpg'); -?> diff --git a/ext/gd/tests/lines.phpt b/ext/gd/tests/lines.phpt index dda8497222..9401b6c82d 100644 --- a/ext/gd/tests/lines.phpt +++ b/ext/gd/tests/lines.phpt @@ -9,10 +9,6 @@ imageline no AA $im = imagecreatetruecolor(6,6); imagefill($im, 0,0, 0xffffff); -// Wrong argument count -imageline($im, 0,0, 5,5); - - // Horizontal line imageline($im, 0,5, 5,5, 0x00ff00); @@ -105,7 +101,6 @@ if ($p3) { ?> --EXPECTF-- -Warning: imageline() expects exactly 6 parameters, 5 given in %s on line %d Horizontal: ok Vertical: ok Diagonal: ok diff --git a/ext/gd/tests/png2wbmp_error1-mb.phpt b/ext/gd/tests/png2wbmp_error1-mb.phpt deleted file mode 100644 index 8c779d36d9..0000000000 --- a/ext/gd/tests/png2wbmp_error1-mb.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test png2wbmp() function : wrong threshold value param ---CREDITS-- -Levi Fukumori <levi [at] fukumori [dot] com [dot] br> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('png2wbmp')) { - die('skip png2wbmp function is not available'); -} -?> ---FILE-- -<?php -// Create a blank image and add some text -$im = imagecreatetruecolor(120, 20); -$text_color = imagecolorallocate($im, 255, 255, 255); -imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); - -$file = dirname(__FILE__) .'/simpletext私はガラスを食べられます.png'; -$file2 = dirname(__FILE__) .'/simpletext私はガラスを食べられます.wbmp'; - -// Save the image as 'simpletext.png' -imagepng($im, $file); - -// Free up memory -imagedestroy($im); - -png2wbmp($file, $file2, 20, 120, 9); -png2wbmp($file, $file2, 20, 120, -1); -?> ---EXPECTF-- -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Invalid threshold value '9' in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d ---CLEAN-- -<?php -unlink(dirname(__FILE__) .'/simpletext私はガラスを食べられます.png'); -unlink(dirname(__FILE__) .'/simpletext私はガラスを食べられます.wbmp'); -?> diff --git a/ext/gd/tests/png2wbmp_error1.phpt b/ext/gd/tests/png2wbmp_error1.phpt deleted file mode 100644 index 543013b4bc..0000000000 --- a/ext/gd/tests/png2wbmp_error1.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test png2wbmp() function : wrong threshold value param ---CREDITS-- -Levi Fukumori <levi [at] fukumori [dot] com [dot] br> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('png2wbmp')) { - die('skip png2wbmp function is not available'); -} -?> ---FILE-- -<?php -// Create a blank image and add some text -$im = imagecreatetruecolor(120, 20); -$text_color = imagecolorallocate($im, 255, 255, 255); -imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); - -$file = dirname(__FILE__) .'/simpletext.png'; -$file2 = dirname(__FILE__) .'/simpletext.wbmp'; - -// Save the image as 'simpletext.png' -imagepng($im, $file); - -// Free up memory -imagedestroy($im); - -png2wbmp($file, $file2, 20, 120, 9); -png2wbmp($file, $file2, 20, 120, -1); -?> ---EXPECTF-- -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Invalid threshold value '9' in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d ---CLEAN-- -<?php -unlink(dirname(__FILE__) .'/simpletext.png'); -unlink(dirname(__FILE__) .'/simpletext.wbmp'); -?> diff --git a/ext/gd/tests/png2wbmp_error2.phpt b/ext/gd/tests/png2wbmp_error2.phpt deleted file mode 100644 index a674e0d6cc..0000000000 --- a/ext/gd/tests/png2wbmp_error2.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test png2wbmp() function : wrong origin filename param ---CREDITS-- -Levi Fukumori <levi [at] fukumori [dot] com [dot] br> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('png2wbmp')) { - die('skip png2wbmp function is not available'); -} -?> ---FILE-- -<?php -$file = dirname(__FILE__) .'/simpletext.wbmp'; -png2wbmp('', $file, 20, 120, 8); -png2wbmp(null, $file, 20, 120, 8); -png2wbmp(false, $file, 20, 120, 8); -?> ---EXPECTF-- -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for reading in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for reading in %s on line %d ---CLEAN-- -<?php -unlink(dirname(__FILE__) .'/simpletext.wbmp'); -?> diff --git a/ext/gd/tests/png2wbmp_error3.phpt b/ext/gd/tests/png2wbmp_error3.phpt deleted file mode 100644 index 3cab3ccb98..0000000000 --- a/ext/gd/tests/png2wbmp_error3.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -Test png2wbmp() function : wrong destination filename param ---CREDITS-- -Levi Fukumori <levi [at] fukumori [dot] com [dot] br> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if(!extension_loaded('gd')) { - die('skip gd extension is not loaded'); -} -if(!function_exists('png2wbmp')) { - die('skip png2wbmp function is not available'); -} -?> ---FILE-- -<?php -// Create a blank image and add some text -$im = imagecreatetruecolor(120, 20); -$text_color = imagecolorallocate($im, 255, 255, 255); -imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); - -$file = dirname(__FILE__) .'/simpletext.png'; - -// Save the image as 'simpletext.png' -imagepng($im, $file); - -// Free up memory -imagedestroy($im); - -png2wbmp($file, '', 20, 120, 8); -png2wbmp($file, null, 20, 120, 8); -png2wbmp($file, false, 20, 120, 8); -?> ---EXPECTF-- -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for writing in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for writing in %s on line %d - -Deprecated: Function png2wbmp() is deprecated in %s on line %d - -Warning: png2wbmp(): Unable to open '' for writing in %s on line %d ---CLEAN-- -<?php -unlink(dirname(__FILE__) .'/simpletext.png'); -?> diff --git a/ext/gettext/tests/dcngettext.phpt b/ext/gettext/tests/dcngettext.phpt index 4bf493507b..f004febcb6 100644 --- a/ext/gettext/tests/dcngettext.phpt +++ b/ext/gettext/tests/dcngettext.phpt @@ -8,7 +8,6 @@ if (!function_exists("dcngettext")) die("skip dcngettext() doesn't exist"); --FILE-- <?php -var_dump(dcngettext(1,1,1,1)); var_dump(dcngettext(1,1,1,1,1)); var_dump(dcngettext("test","test","test",1,1)); var_dump(dcngettext("test","test","test",0,0)); @@ -18,9 +17,7 @@ var_dump(dcngettext("","","",0,0)); echo "Done\n"; ?> ---EXPECTF-- -Warning: dcngettext() expects exactly 5 parameters, 4 given in %s on line %d -bool(false) +--EXPECT-- string(1) "1" string(4) "test" string(4) "test" diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 0b55945f41..73462b8313 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -99,10 +99,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_prob_prime, 0, 0, 1) ZEND_ARG_INFO(0, reps) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random, 0, 0, 0) - ZEND_ARG_INFO(0, limiter) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_seed, 0, 0, 1) ZEND_ARG_INFO(0, seed) ZEND_END_ARG_INFO() @@ -175,7 +171,6 @@ static const zend_function_entry gmp_functions[] = { ZEND_FE(gmp_kronecker, arginfo_gmp_binary) ZEND_FE(gmp_cmp, arginfo_gmp_binary) ZEND_FE(gmp_sign, arginfo_gmp_unary) - ZEND_DEP_FE(gmp_random, arginfo_gmp_random) ZEND_FE(gmp_random_seed, arginfo_gmp_random_seed) ZEND_FE(gmp_random_bits, arginfo_gmp_random_bits) ZEND_FE(gmp_random_range, arginfo_gmp_random_range) @@ -409,24 +404,24 @@ static inline void gmp_create(zval *target, mpz_ptr *gmpnum_target) /* {{{ */ } /* }}} */ -static int gmp_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */ +static int gmp_cast_object(zend_object *readobj, zval *writeobj, int type) /* {{{ */ { mpz_ptr gmpnum; switch (type) { case IS_STRING: - gmpnum = GET_GMP_FROM_ZVAL(readobj); + gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num; gmp_strval(writeobj, gmpnum, 10); return SUCCESS; case IS_LONG: - gmpnum = GET_GMP_FROM_ZVAL(readobj); + gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num; ZVAL_LONG(writeobj, mpz_get_si(gmpnum)); return SUCCESS; case IS_DOUBLE: - gmpnum = GET_GMP_FROM_ZVAL(readobj); + gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num; ZVAL_DOUBLE(writeobj, mpz_get_d(gmpnum)); return SUCCESS; case _IS_NUMBER: - gmpnum = GET_GMP_FROM_ZVAL(readobj); + gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num; if (mpz_fits_slong_p(gmpnum)) { ZVAL_LONG(writeobj, mpz_get_si(gmpnum)); } else { @@ -439,10 +434,10 @@ static int gmp_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */ } /* }}} */ -static HashTable *gmp_get_debug_info(zval *obj, int *is_temp) /* {{{ */ +static HashTable *gmp_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */ { HashTable *ht, *props = zend_std_get_properties(obj); - mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(obj); + mpz_ptr gmpnum = GET_GMP_OBJECT_FROM_OBJ(obj)->num; zval zv; *is_temp = 1; @@ -455,10 +450,10 @@ static HashTable *gmp_get_debug_info(zval *obj, int *is_temp) /* {{{ */ } /* }}} */ -static zend_object *gmp_clone_obj(zval *obj) /* {{{ */ +static zend_object *gmp_clone_obj(zend_object *obj) /* {{{ */ { - gmp_object *old_object = GET_GMP_OBJECT_FROM_ZVAL(obj); - gmp_object *new_object = GET_GMP_OBJECT_FROM_OBJ(gmp_create_object(Z_OBJCE_P(obj))); + gmp_object *old_object = GET_GMP_OBJECT_FROM_OBJ(obj); + gmp_object *new_object = GET_GMP_OBJECT_FROM_OBJ(gmp_create_object(obj->ce)); zend_objects_clone_members( &new_object->std, &old_object->std); @@ -579,7 +574,7 @@ static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len, php_var_serialize(&buf, &zv, &serialize_data); zval_ptr_dtor_str(&zv); - ZVAL_ARR(&zv, zend_std_get_properties(object)); + ZVAL_ARR(&zv, zend_std_get_properties(Z_OBJ_P(object))); php_var_serialize(&buf, &zv, &serialize_data); PHP_VAR_SERIALIZE_DESTROY(serialize_data); @@ -598,14 +593,12 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch zval *zv; int retval = FAILURE; php_unserialize_data_t unserialize_data; - zval object_copy; + zend_object *zobj; PHP_VAR_UNSERIALIZE_INIT(unserialize_data); gmp_create(object, &gmpnum); - /* The "object" variable may be modified during the execution of this unserialize handler - * (it may turn into a reference). Keep the original object around for further operations. */ - ZVAL_COPY_VALUE(&object_copy, object); + zobj = Z_OBJ_P(object); p = buf; max = buf + buf_len; @@ -629,7 +622,7 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch if (zend_hash_num_elements(Z_ARRVAL_P(zv)) != 0) { zend_hash_copy( - zend_std_get_properties(&object_copy), Z_ARRVAL_P(zv), + zend_std_get_properties(zobj), Z_ARRVAL_P(zv), (copy_ctor_func_t) zval_add_ref ); } @@ -1882,28 +1875,6 @@ static void gmp_init_random(void) } } -/* {{{ proto GMP gmp_random([int limiter]) - Gets random number */ -ZEND_FUNCTION(gmp_random) -{ - zend_long limiter = 20; - mpz_ptr gmpnum_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &limiter) == FAILURE) { - return; - } - - INIT_GMP_RETVAL(gmpnum_result); - gmp_init_random(); - -#ifdef GMP_LIMB_BITS - mpz_urandomb(gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * GMP_LIMB_BITS); -#else - mpz_urandomb(gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * __GMP_BITS_PER_MP_LIMB); -#endif -} -/* }}} */ - /* {{{ proto GMP gmp_random_seed(mixed seed) Seed the RNG */ ZEND_FUNCTION(gmp_random_seed) diff --git a/ext/gmp/tests/gmp_abs.phpt b/ext/gmp/tests/gmp_abs.phpt index 811ab3d5ee..236acc4684 100644 --- a/ext/gmp/tests/gmp_abs.phpt +++ b/ext/gmp/tests/gmp_abs.phpt @@ -15,8 +15,6 @@ var_dump(gmp_strval(gmp_abs("0000"))); var_dump(gmp_strval(gmp_abs("09876543"))); var_dump(gmp_strval(gmp_abs("-099987654"))); -var_dump(gmp_abs()); -var_dump(gmp_abs(1,2)); var_dump(gmp_abs(array())); echo "Done\n"; @@ -39,12 +37,6 @@ string(1) "0" Warning: gmp_abs(): Unable to convert variable to GMP - string is not an integer in %s on line %d string(1) "0" -Warning: gmp_abs() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: gmp_abs() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: gmp_abs(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) Done diff --git a/ext/gmp/tests/gmp_and.phpt b/ext/gmp/tests/gmp_and.phpt index 2fb27c3e70..b582a6b480 100644 --- a/ext/gmp/tests/gmp_and.phpt +++ b/ext/gmp/tests/gmp_and.phpt @@ -17,8 +17,6 @@ var_dump(gmp_strval(gmp_and($n, "34332"))); $n1 = gmp_init("987657878765436543456"); var_dump(gmp_strval(gmp_and($n, $n1))); -var_dump(gmp_and($n, $n1, 1)); -var_dump(gmp_and(1)); var_dump(gmp_and(array(), 1)); var_dump(gmp_and(1, array())); var_dump(gmp_and(array(), array())); @@ -37,12 +35,6 @@ string(1) "0" string(4) "1536" string(15) "424703623692768" -Warning: gmp_and() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_and() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: gmp_and(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_clrbit.phpt b/ext/gmp/tests/gmp_clrbit.phpt index 0aab89dd37..255b9947b9 100644 --- a/ext/gmp/tests/gmp_clrbit.phpt +++ b/ext/gmp/tests/gmp_clrbit.phpt @@ -28,10 +28,11 @@ gmp_clrbit($n, 20); var_dump(gmp_strval($n)); $n = array(); -gmp_clrbit($n, 3); -gmp_clrbit($n, 3, 1); -gmp_clrbit($n); -gmp_clrbit(); +try { + gmp_clrbit($n, 3); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -46,12 +47,5 @@ Warning: gmp_clrbit(): Index must be greater than or equal to zero in %s on line string(7) "1000000" string(7) "1000000" string(30) "238462734628347239571822592658" - -Warning: gmp_clrbit() expects parameter 1 to be GMP, array given in %s on line %d - -Warning: gmp_clrbit() expects exactly 2 parameters, 3 given in %s on line %d - -Warning: gmp_clrbit() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: gmp_clrbit() expects exactly 2 parameters, 0 given in %s on line %d +gmp_clrbit() expects parameter 1 to be GMP, array given Done diff --git a/ext/gmp/tests/gmp_cmp.phpt b/ext/gmp/tests/gmp_cmp.phpt index 2e48d3b83b..4748e7db87 100644 --- a/ext/gmp/tests/gmp_cmp.phpt +++ b/ext/gmp/tests/gmp_cmp.phpt @@ -17,10 +17,7 @@ var_dump(gmp_cmp(0,$n) < 0); $n1 = gmp_init("827278512385463739"); var_dump(gmp_cmp($n1,$n)); -var_dump(gmp_cmp($n1,$n,1)); var_dump(gmp_cmp(array(),array())); -var_dump(gmp_cmp(array())); -var_dump(gmp_cmp()); echo "Done\n"; ?> @@ -34,15 +31,6 @@ int(-1) bool(true) int(0) -Warning: gmp_cmp() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: gmp_cmp(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) - -Warning: gmp_cmp() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: gmp_cmp() expects exactly 2 parameters, 0 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_com.phpt b/ext/gmp/tests/gmp_com.phpt index ae6ec59200..97299dd064 100644 --- a/ext/gmp/tests/gmp_com.phpt +++ b/ext/gmp/tests/gmp_com.phpt @@ -19,7 +19,6 @@ $n = gmp_init("98765463337"); var_dump(gmp_strval(gmp_com($n))); var_dump(gmp_strval(gmp_com(array()))); -var_dump(gmp_strval(gmp_com())); echo "Done\n"; ?> @@ -38,9 +37,4 @@ string(12) "-98765463338" Warning: gmp_com(): Unable to convert variable to GMP - wrong type in %s on line %d string(1) "0" - -Warning: gmp_com() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d -bool(false) Done diff --git a/ext/gmp/tests/gmp_div_q.phpt b/ext/gmp/tests/gmp_div_q.phpt index afc64c3547..9fd94efdac 100644 --- a/ext/gmp/tests/gmp_div_q.phpt +++ b/ext/gmp/tests/gmp_div_q.phpt @@ -5,9 +5,6 @@ gmp_div_q() tests --FILE-- <?php -var_dump(gmp_div_q()); -var_dump(gmp_div_q("")); - var_dump(gmp_div_q(0,1)); var_dump(gmp_div_q(1,0)); var_dump(gmp_div_q(12653,23482734)); @@ -27,11 +24,6 @@ var_dump(gmp_div_q(array(), array())); echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_div_q() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: gmp_div_q() expects at least 2 parameters, 1 given in %s on line %d -NULL object(GMP)#%d (1) { ["num"]=> string(1) "0" diff --git a/ext/gmp/tests/gmp_div_qr.phpt b/ext/gmp/tests/gmp_div_qr.phpt index 936fbc6ef1..373beb5701 100644 --- a/ext/gmp/tests/gmp_div_qr.phpt +++ b/ext/gmp/tests/gmp_div_qr.phpt @@ -5,9 +5,6 @@ gmp_div_qr() tests --FILE-- <?php -var_dump(gmp_div_qr()); -var_dump(gmp_div_qr("")); - var_dump(gmp_div_qr(0,1)); var_dump(gmp_div_qr(1,0)); var_dump(gmp_div_qr(gmp_init(1), gmp_init(0))); @@ -29,11 +26,6 @@ var_dump(gmp_div_qr(array(), array())); echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_div_qr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: gmp_div_qr() expects at least 2 parameters, 1 given in %s on line %d -NULL array(2) { [0]=> object(GMP)#%d (1) { diff --git a/ext/gmp/tests/gmp_div_r.phpt b/ext/gmp/tests/gmp_div_r.phpt index bab243e465..2b19ed1f48 100644 --- a/ext/gmp/tests/gmp_div_r.phpt +++ b/ext/gmp/tests/gmp_div_r.phpt @@ -5,9 +5,6 @@ gmp_div_r() tests --FILE-- <?php -var_dump(gmp_div_r()); -var_dump(gmp_div_r("")); - var_dump($r = gmp_div_r(0,1)); var_dump($r = gmp_div_r(1,0)); var_dump($r = gmp_div_r(12653,23482734)); @@ -27,11 +24,6 @@ var_dump(gmp_div_r(array(), array())); echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_div_r() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: gmp_div_r() expects at least 2 parameters, 1 given in %s on line %d -NULL object(GMP)#%d (1) { ["num"]=> string(1) "0" diff --git a/ext/gmp/tests/gmp_divexact.phpt b/ext/gmp/tests/gmp_divexact.phpt index 53f0c677ab..c6183cb734 100644 --- a/ext/gmp/tests/gmp_divexact.phpt +++ b/ext/gmp/tests/gmp_divexact.phpt @@ -10,9 +10,6 @@ if (!defined('GMP_VERSION') || version_compare("4.2.1", GMP_VERSION, ">=")) { --FILE-- <?php -var_dump(gmp_divexact(1, 1, 1)); -var_dump(gmp_divexact()); - $r = gmp_divexact("233", "23345555555555555555555555"); var_dump(gmp_strval($r)); @@ -39,11 +36,6 @@ var_dump(gmp_strval($r)); echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_divexact() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_divexact() expects exactly 2 parameters, 0 given in %s on line %d -NULL string(1) "0" Warning: gmp_divexact(): Zero operand not allowed in %s on line %d diff --git a/ext/gmp/tests/gmp_export.phpt b/ext/gmp/tests/gmp_export.phpt index 52449ecf0a..bbc26d086c 100644 --- a/ext/gmp/tests/gmp_export.phpt +++ b/ext/gmp/tests/gmp_export.phpt @@ -50,9 +50,6 @@ foreach ($export as $k => $test) { var_dump($passed); -// Invalid arguments (zpp failure) -var_dump(gmp_export()); - // Invalid word sizes var_dump(gmp_export(123, -1)); var_dump(gmp_export(123, 0)); @@ -63,9 +60,6 @@ var_dump(gmp_export(123, 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN)); --EXPECTF-- bool(true) -Warning: gmp_export() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: gmp_export(): Word size must be positive, -1 given in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_fact.phpt b/ext/gmp/tests/gmp_fact.phpt index 032f735435..d861fae40e 100644 --- a/ext/gmp/tests/gmp_fact.phpt +++ b/ext/gmp/tests/gmp_fact.phpt @@ -21,8 +21,6 @@ var_dump(gmp_strval(gmp_fact($n))); $n = gmp_init(-10); var_dump(gmp_strval(gmp_fact($n))); -var_dump(gmp_fact()); -var_dump(gmp_fact(1,1)); var_dump(gmp_fact(array())); var_dump(gmp_strval(gmp_fact(array()))); @@ -50,12 +48,6 @@ string(9) "479001600" Warning: gmp_fact(): Number has to be greater than or equal to 0 in %s on line %d string(1) "0" -Warning: gmp_fact() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: gmp_fact() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: gmp_fact(): Number has to be an integer in %s on line %d object(GMP)#%d (1) { ["num"]=> diff --git a/ext/gmp/tests/gmp_gcd.phpt b/ext/gmp/tests/gmp_gcd.phpt index cf4eac9e92..4e130a1fd9 100644 --- a/ext/gmp/tests/gmp_gcd.phpt +++ b/ext/gmp/tests/gmp_gcd.phpt @@ -21,13 +21,10 @@ $n = gmp_init("8127346234"); var_dump(gmp_strval(gmp_gcd($n,$n))); $n = gmp_init("8127346234"); var_dump(gmp_strval(gmp_gcd($n,0))); -var_dump(gmp_gcd($n,$n,1)); -var_dump(gmp_gcd($n,array(),1)); -var_dump(gmp_gcd(array(),$n,1)); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- string(1) "3" string(5) "12387" string(3) "224" @@ -39,13 +36,4 @@ string(1) "2" string(1) "1" string(10) "8127346234" string(10) "8127346234" - -Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_gcdext.phpt b/ext/gmp/tests/gmp_gcdext.phpt index 4adecf25d2..d02f341129 100644 --- a/ext/gmp/tests/gmp_gcdext.phpt +++ b/ext/gmp/tests/gmp_gcdext.phpt @@ -31,9 +31,6 @@ foreach ($a as $val) { var_dump(gmp_gcdext($val[0],array())); var_dump(gmp_gcdext(array(),array())); -var_dump(gmp_gcdext(array(),array(),1)); -var_dump(gmp_gcdext(array())); -var_dump(gmp_gcdext()); echo "Done\n"; ?> @@ -64,13 +61,4 @@ bool(false) Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) - -Warning: gmp_gcdext() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_gcdext() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: gmp_gcdext() expects exactly 2 parameters, 0 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_hamdist.phpt b/ext/gmp/tests/gmp_hamdist.phpt index 60ef89f84d..7057c5f32a 100644 --- a/ext/gmp/tests/gmp_hamdist.phpt +++ b/ext/gmp/tests/gmp_hamdist.phpt @@ -16,11 +16,9 @@ var_dump(gmp_hamdist($n, "8333765434567897654333334567")); var_dump(gmp_hamdist($n, $n)); var_dump(gmp_hamdist($n, $n1)); -var_dump(gmp_hamdist($n, $n1, 1)); var_dump(gmp_hamdist($n, array())); var_dump(gmp_hamdist(array(), $n)); var_dump(gmp_hamdist(array(), array())); -var_dump(gmp_hamdist()); echo "Done\n"; ?> @@ -33,9 +31,6 @@ int(43) int(0) int(26) -Warning: gmp_hamdist() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) @@ -44,7 +39,4 @@ bool(false) Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) - -Warning: gmp_hamdist() expects exactly 2 parameters, 0 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_import.phpt b/ext/gmp/tests/gmp_import.phpt index a9e9314483..b3c4e0154a 100644 --- a/ext/gmp/tests/gmp_import.phpt +++ b/ext/gmp/tests/gmp_import.phpt @@ -47,9 +47,6 @@ foreach ($import as $k => $test) { var_dump($passed); -// Invalid arguments (zpp failure) -var_dump(gmp_import()); - // Invalid word sizes var_dump(gmp_import('a', -1)); var_dump(gmp_import('a', 0)); @@ -65,9 +62,6 @@ var_dump(gmp_import('a', 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN)); --EXPECTF-- bool(true) -Warning: gmp_import() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: gmp_import(): Word size must be positive, -1 given in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_init.phpt b/ext/gmp/tests/gmp_init.phpt index a35f12345c..7da7c8e55e 100644 --- a/ext/gmp/tests/gmp_init.phpt +++ b/ext/gmp/tests/gmp_init.phpt @@ -7,9 +7,6 @@ gmp_init() basic tests var_dump(gmp_init("98765678")); var_dump(gmp_strval(gmp_init("98765678"))); -var_dump(gmp_strval(gmp_init())); -var_dump(gmp_init()); -var_dump(gmp_init(1,2,3,4)); var_dump(gmp_init(1,-1)); var_dump(gmp_init("",36)); var_dump(gmp_init("foo",3)); @@ -24,17 +21,6 @@ object(GMP)#%d (1) { } string(8) "98765678" -Warning: gmp_init() expects at least 1 parameter, 0 given in %s on line %d - -Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d -bool(false) - -Warning: gmp_init() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: gmp_init() expects at most 2 parameters, 4 given in %s on line %d -NULL - Warning: gmp_init(): Bad base for conversion: -1 (should be between 2 and %d) in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_intval.phpt b/ext/gmp/tests/gmp_intval.phpt index f30b391573..019ab3d070 100644 --- a/ext/gmp/tests/gmp_intval.phpt +++ b/ext/gmp/tests/gmp_intval.phpt @@ -5,7 +5,6 @@ gmp_intval() tests --FILE-- <?php -var_dump(gmp_intval(1,1)); var_dump(gmp_intval("")); var_dump(gmp_intval(1.0001)); var_dump(gmp_intval("1.0001")); @@ -25,8 +24,6 @@ var_dump(gmp_intval($g)); echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_intval() expects exactly 1 parameter, 2 given in %s on line %d -NULL int(0) int(1) int(1) diff --git a/ext/gmp/tests/gmp_invert.phpt b/ext/gmp/tests/gmp_invert.phpt index 8c1d7c577c..40793afd53 100644 --- a/ext/gmp/tests/gmp_invert.phpt +++ b/ext/gmp/tests/gmp_invert.phpt @@ -19,8 +19,6 @@ $n1 = gmp_init("3498273496234234523451"); var_dump(gmp_strval(gmp_invert($n, $n1))); var_dump(gmp_strval(gmp_invert($n1, $n))); -var_dump(gmp_invert($n1, $n, 10)); -var_dump(gmp_invert($n1)); var_dump(gmp_invert(array(), 1)); var_dump(gmp_invert(1, array())); var_dump(gmp_invert(array(), array())); @@ -38,12 +36,6 @@ string(1) "0" string(22) "3498273496234234523441" string(1) "1" -Warning: gmp_invert() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_invert() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: gmp_invert(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_jacobi.phpt b/ext/gmp/tests/gmp_jacobi.phpt index da92b87401..2040b666f6 100644 --- a/ext/gmp/tests/gmp_jacobi.phpt +++ b/ext/gmp/tests/gmp_jacobi.phpt @@ -24,10 +24,6 @@ var_dump(gmp_jacobi(3, array())); var_dump(gmp_jacobi(array(), 3)); var_dump(gmp_jacobi(array(), array())); -var_dump(gmp_jacobi(array(), array(), 1)); -var_dump(gmp_jacobi(array())); -var_dump(gmp_jacobi()); - echo "Done\n"; ?> --EXPECTF-- @@ -57,13 +53,4 @@ bool(false) Warning: gmp_jacobi(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) - -Warning: gmp_jacobi() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_jacobi() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: gmp_jacobi() expects exactly 2 parameters, 0 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_legendre.phpt b/ext/gmp/tests/gmp_legendre.phpt index 71191e133d..6b6197f25a 100644 --- a/ext/gmp/tests/gmp_legendre.phpt +++ b/ext/gmp/tests/gmp_legendre.phpt @@ -24,10 +24,6 @@ var_dump(gmp_legendre(3, array())); var_dump(gmp_legendre(array(), 3)); var_dump(gmp_legendre(array(), array())); -var_dump(gmp_legendre(array(), array(), 1)); -var_dump(gmp_legendre(array())); -var_dump(gmp_legendre()); - echo "Done\n"; ?> --EXPECTF-- @@ -57,13 +53,4 @@ bool(false) Warning: gmp_legendre(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) - -Warning: gmp_legendre() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_legendre() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: gmp_legendre() expects exactly 2 parameters, 0 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_mod.phpt b/ext/gmp/tests/gmp_mod.phpt index 4f216965c9..135c2ca11c 100644 --- a/ext/gmp/tests/gmp_mod.phpt +++ b/ext/gmp/tests/gmp_mod.phpt @@ -5,8 +5,6 @@ gmp_mod tests() --FILE-- <?php -var_dump(gmp_mod()); -var_dump(gmp_mod("")); var_dump(gmp_mod("","")); var_dump(gmp_mod(0,1)); var_dump(gmp_mod(0,-1)); @@ -22,12 +20,6 @@ var_dump(gmp_mod($a, $b)); echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_mod() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: gmp_mod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: gmp_mod(): Unable to convert variable to GMP - string is not an integer in %s on line %d bool(false) object(GMP)#%d (1) { diff --git a/ext/gmp/tests/gmp_neg.phpt b/ext/gmp/tests/gmp_neg.phpt index c457fa6574..777de69105 100644 --- a/ext/gmp/tests/gmp_neg.phpt +++ b/ext/gmp/tests/gmp_neg.phpt @@ -17,8 +17,6 @@ var_dump(gmp_intval(gmp_neg($n))); $n = gmp_init("12345678901234567890"); var_dump(gmp_strval(gmp_neg($n))); -var_dump(gmp_neg(1,1)); -var_dump(gmp_neg()); var_dump(gmp_neg(array())); echo "Done\n"; @@ -35,12 +33,6 @@ int(0) int(0) string(21) "-12345678901234567890" -Warning: gmp_neg() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: gmp_neg() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: gmp_neg(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) Done diff --git a/ext/gmp/tests/gmp_or.phpt b/ext/gmp/tests/gmp_or.phpt index ef486df8e9..affd6ae5b8 100644 --- a/ext/gmp/tests/gmp_or.phpt +++ b/ext/gmp/tests/gmp_or.phpt @@ -17,8 +17,6 @@ var_dump(gmp_strval(gmp_or($n, "34332"))); $n1 = gmp_init("987657878765436543456"); var_dump(gmp_strval(gmp_or($n, $n1))); -var_dump(gmp_or($n, $n1, 1)); -var_dump(gmp_or(1)); var_dump(gmp_or(array(), 1)); var_dump(gmp_or(1, array())); var_dump(gmp_or(array(), array())); @@ -37,12 +35,6 @@ string(1) "0" string(15) "987657876576252" string(21) "987658441719689394144" -Warning: gmp_or() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_or() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: gmp_or(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_perfect_square.phpt b/ext/gmp/tests/gmp_perfect_square.phpt index 0f519c7b79..b477910378 100644 --- a/ext/gmp/tests/gmp_perfect_square.phpt +++ b/ext/gmp/tests/gmp_perfect_square.phpt @@ -21,7 +21,6 @@ var_dump(gmp_perfect_square($n)); $n = gmp_init(-5); var_dump(gmp_perfect_square($n)); -var_dump(gmp_perfect_square()); var_dump(gmp_perfect_square(array())); echo "Done\n"; @@ -39,9 +38,6 @@ bool(false) bool(true) bool(false) -Warning: gmp_perfect_square() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: gmp_perfect_square(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) Done diff --git a/ext/gmp/tests/gmp_popcount.phpt b/ext/gmp/tests/gmp_popcount.phpt index 26a7b5af8d..76dc2a89c0 100644 --- a/ext/gmp/tests/gmp_popcount.phpt +++ b/ext/gmp/tests/gmp_popcount.phpt @@ -13,7 +13,6 @@ var_dump(gmp_popcount("-23476123423433")); $n = gmp_init("9876546789222"); var_dump(gmp_popcount($n)); var_dump(gmp_popcount(array())); -var_dump(gmp_popcount()); echo "Done\n"; ?> @@ -27,7 +26,4 @@ int(20) Warning: gmp_popcount(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) - -Warning: gmp_popcount() expects exactly 1 parameter, 0 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_pow.phpt b/ext/gmp/tests/gmp_pow.phpt index 5424d410a0..e9525867e1 100644 --- a/ext/gmp/tests/gmp_pow.phpt +++ b/ext/gmp/tests/gmp_pow.phpt @@ -21,11 +21,11 @@ var_dump(gmp_strval(gmp_pow($n,10))); $n = gmp_init("-20"); var_dump(gmp_strval(gmp_pow($n,10))); -var_dump(gmp_pow(2,10,1)); -var_dump(gmp_pow(2)); -var_dump(gmp_pow()); -var_dump(gmp_pow(array(), array())); -var_dump(gmp_pow(2,array())); +try { + var_dump(gmp_pow(2,array())); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(gmp_pow(array(),10)); echo "Done\n"; @@ -47,21 +47,7 @@ Warning: gmp_pow(): Negative exponent not supported in %s on line %d string(1) "0" string(14) "10240000000000" string(14) "10240000000000" - -Warning: gmp_pow() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_pow() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: gmp_pow() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: gmp_pow() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: gmp_pow() expects parameter 2 to be int, array given in %s on line %d -NULL +gmp_pow() expects parameter 2 to be int, array given Warning: gmp_pow(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_pown.phpt b/ext/gmp/tests/gmp_pown.phpt index b732aa331f..9a5b5deb11 100644 --- a/ext/gmp/tests/gmp_pown.phpt +++ b/ext/gmp/tests/gmp_pown.phpt @@ -26,9 +26,6 @@ var_dump(gmp_powm(array(),$e,$m)); var_dump(gmp_powm($n,array(),$m)); var_dump(gmp_powm($n,$e,array())); var_dump(gmp_powm(array(),array(),array())); -var_dump(gmp_powm(array(),array())); -var_dump(gmp_powm(array())); -var_dump(gmp_powm()); $n = gmp_init("-5"); var_dump(gmp_powm(10, $n, 10)); @@ -67,15 +64,6 @@ bool(false) Warning: gmp_powm(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) -Warning: gmp_powm() expects exactly 3 parameters, 2 given in %s on line %d -NULL - -Warning: gmp_powm() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: gmp_powm() expects exactly 3 parameters, 0 given in %s on line %d -NULL - Warning: gmp_powm(): Second parameter cannot be less than 0 in %s on line %d bool(false) object(GMP)#%d (1) { diff --git a/ext/gmp/tests/gmp_prob_prime.phpt b/ext/gmp/tests/gmp_prob_prime.phpt index 99735bd7c0..2872e01d84 100644 --- a/ext/gmp/tests/gmp_prob_prime.phpt +++ b/ext/gmp/tests/gmp_prob_prime.phpt @@ -28,7 +28,6 @@ var_dump(gmp_prob_prime($n)); $n = gmp_init(0); var_dump(gmp_prob_prime($n)); -var_dump(gmp_prob_prime()); var_dump(gmp_prob_prime(array())); echo "Done\n"; @@ -73,9 +72,6 @@ int(0) int(0) int(0) -Warning: gmp_prob_prime() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: gmp_prob_prime(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) Done diff --git a/ext/gmp/tests/gmp_random.phpt b/ext/gmp/tests/gmp_random.phpt deleted file mode 100644 index ab2b11b3f7..0000000000 --- a/ext/gmp/tests/gmp_random.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -gmp_random() basic tests ---SKIPIF-- -<?php if (!extension_loaded("gmp")) print "skip"; ?> ---FILE-- -<?php - -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(-1))); -var_dump(gmp_strval(gmp_random(0))); -var_dump(gmp_strval(gmp_random(10))); -var_dump(gmp_strval(gmp_random("-10"))); -var_dump(gmp_strval(gmp_random(-10))); - -var_dump(gmp_random(array())); -var_dump(gmp_random(array(),1)); -var_dump(gmp_random("")); -var_dump(gmp_random("test")); - -echo "Done\n"; -?> ---EXPECTF-- -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(%d) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(%d) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(1) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(%d) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(%d) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d -string(%d) "%d" - -Deprecated: Function gmp_random() is deprecated in %s on line %d - -Warning: gmp_random() expects parameter 1 to be int, array given in %s on line %d -NULL - -Deprecated: Function gmp_random() is deprecated in %s on line %d - -Warning: gmp_random() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Deprecated: Function gmp_random() is deprecated in %s on line %d - -Warning: gmp_random() expects parameter 1 to be int, string given in %s on line %d -NULL - -Deprecated: Function gmp_random() is deprecated in %s on line %d - -Warning: gmp_random() expects parameter 1 to be int, string given in %s on line %d -NULL -Done diff --git a/ext/gmp/tests/gmp_random_bits.phpt b/ext/gmp/tests/gmp_random_bits.phpt index b4aa5d7b73..42b90d6fe3 100644 --- a/ext/gmp/tests/gmp_random_bits.phpt +++ b/ext/gmp/tests/gmp_random_bits.phpt @@ -5,7 +5,6 @@ gmp_random_bits() basic tests --FILE-- <?php -var_dump(gmp_random_bits()); var_dump(gmp_random_bits(0)); var_dump(gmp_random_bits(-1)); @@ -34,9 +33,6 @@ while (1) { echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_random_bits() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: gmp_random_bits(): The number of bits must be positive in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_random_range.phpt b/ext/gmp/tests/gmp_random_range.phpt index 654ffbefb3..fec8274167 100644 --- a/ext/gmp/tests/gmp_random_range.phpt +++ b/ext/gmp/tests/gmp_random_range.phpt @@ -9,8 +9,6 @@ $minusTen = gmp_init(-10); $plusTen = gmp_init(10); $zero = gmp_init(0); -var_dump(gmp_random_range()); -var_dump(gmp_random_range(10)); var_dump(gmp_random_range(10, -10)); var_dump(gmp_random_range($plusTen, $minusTen)); @@ -64,12 +62,6 @@ while (1) { echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_random_range() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: gmp_random_range() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: gmp_random_range(): The minimum value must be less than the maximum value in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_random_seed-32bit.phpt b/ext/gmp/tests/gmp_random_seed-32bit.phpt deleted file mode 100644 index 95d8dd50f9..0000000000 --- a/ext/gmp/tests/gmp_random_seed-32bit.phpt +++ /dev/null @@ -1,232 +0,0 @@ ---TEST-- -gmp_random_seed() basic tests ---SKIPIF-- -<?php if (!extension_loaded("gmp")) print "skip"; ?> -<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> ---INI-- -error_reporting=E_ALL&~E_DEPRECATED ---FILE-- -<?php - -// zero int -var_dump(gmp_random_seed(0)); - -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - -var_dump(gmp_strval(gmp_random_bits(10))); -var_dump(gmp_strval(gmp_random_bits(100))); -var_dump(gmp_strval(gmp_random_bits(1000))); - -var_dump(gmp_strval(gmp_random_range(0, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 0))); - - -// zero gmp -var_dump(gmp_random_seed(gmp_init(0))); - -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - -var_dump(gmp_strval(gmp_random_bits(10))); -var_dump(gmp_strval(gmp_random_bits(100))); -var_dump(gmp_strval(gmp_random_bits(1000))); - -var_dump(gmp_strval(gmp_random_range(0, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 0))); - - -// negative int -var_dump(gmp_random_seed(-100)); - -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - -var_dump(gmp_strval(gmp_random_bits(10))); -var_dump(gmp_strval(gmp_random_bits(100))); -var_dump(gmp_strval(gmp_random_bits(1000))); - -var_dump(gmp_strval(gmp_random_range(0, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 0))); - - -// negative gmp -var_dump(gmp_random_seed(gmp_init(-100))); - -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - -var_dump(gmp_strval(gmp_random_bits(10))); -var_dump(gmp_strval(gmp_random_bits(100))); -var_dump(gmp_strval(gmp_random_bits(1000))); - -var_dump(gmp_strval(gmp_random_range(0, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 0))); - - -// positive int -var_dump(gmp_random_seed(100)); - -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - -var_dump(gmp_strval(gmp_random_bits(10))); -var_dump(gmp_strval(gmp_random_bits(100))); -var_dump(gmp_strval(gmp_random_bits(1000))); - -var_dump(gmp_strval(gmp_random_range(0, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 0))); - - -// positive gmp -var_dump(gmp_random_seed(100)); - -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - -var_dump(gmp_strval(gmp_random_bits(10))); -var_dump(gmp_strval(gmp_random_bits(100))); -var_dump(gmp_strval(gmp_random_bits(1000))); - -var_dump(gmp_strval(gmp_random_range(0, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 0))); - - -$seed = gmp_init(1); -$seed <<= 512; - -// large negative gmp -var_dump(gmp_random_seed($seed * -1)); - -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - -var_dump(gmp_strval(gmp_random_bits(10))); -var_dump(gmp_strval(gmp_random_bits(100))); -var_dump(gmp_strval(gmp_random_bits(1000))); - -var_dump(gmp_strval(gmp_random_range(0, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 0))); - - -// large positive gmp -var_dump(gmp_random_seed($seed)); - -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - -var_dump(gmp_strval(gmp_random_bits(10))); -var_dump(gmp_strval(gmp_random_bits(100))); -var_dump(gmp_strval(gmp_random_bits(1000))); - -var_dump(gmp_strval(gmp_random_range(0, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 10000))); -var_dump(gmp_strval(gmp_random_range(-10000, 0))); - - -// standard non conversion error -var_dump(gmp_random_seed('not a number')); - - -echo "Done\n"; -?> ---EXPECTF-- -NULL -string(193) "2000022451473107283132031190545479155678097978829612864726689673263990484954900429188146529905019042225609517482723730948135765344007937183893986134210303199345433818579954244943136664096571499" -string(10) "3792281639" -string(97) "1281406676617847191505318987040099388645126071814252743902229506206669580396236451813261179688680" -string(2) "86" -string(30) "539590049119295715487546581833" -string(301) "1421393257467327495225454368915273750356127352353055226245692071178379257048985726109650766437957017507708821700349355658110489309871463201057688894986035545794429493563972043777521547094922637182497036750765553664196591958728194711096442220858890056073974348364544481270013556644174056049511198143353" -string(4) "8971" -string(4) "7838" -string(5) "-7823" -NULL -string(193) "2000022451473107283132031190545479155678097978829612864726689673263990484954900429188146529905019042225609517482723730948135765344007937183893986134210303199345433818579954244943136664096571499" -string(10) "3792281639" -string(97) "1281406676617847191505318987040099388645126071814252743902229506206669580396236451813261179688680" -string(2) "86" -string(30) "539590049119295715487546581833" -string(301) "1421393257467327495225454368915273750356127352353055226245692071178379257048985726109650766437957017507708821700349355658110489309871463201057688894986035545794429493563972043777521547094922637182497036750765553664196591958728194711096442220858890056073974348364544481270013556644174056049511198143353" -string(4) "8971" -string(4) "7838" -string(5) "-7823" -NULL -string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424" -string(9) "513032517" -string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822" -string(3) "111" -string(31) "1007352579363975542750518386428" -string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527" -string(4) "2362" -string(5) "-9377" -string(5) "-8435" -NULL -string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424" -string(9) "513032517" -string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822" -string(3) "111" -string(31) "1007352579363975542750518386428" -string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527" -string(4) "2362" -string(5) "-9377" -string(5) "-8435" -NULL -string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424" -string(9) "513032517" -string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822" -string(3) "111" -string(31) "1007352579363975542750518386428" -string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527" -string(4) "2362" -string(5) "-9377" -string(5) "-8435" -NULL -string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424" -string(9) "513032517" -string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822" -string(3) "111" -string(31) "1007352579363975542750518386428" -string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527" -string(4) "2362" -string(5) "-9377" -string(5) "-8435" -NULL -string(193) "4314861641594785951065006537821497084129700255567731661104366342587560122488351847486220156468888511744226746306538524023190734733433083354034308520246964938498767672539252131810891590624763642" -string(10) "3301287097" -string(97) "1532710025135934106005683287301200805525218110207399702226596673360222079570223526337866801028045" -string(3) "317" -string(30) "949682013136255600092941702271" -string(302) "10419061168407861659407303769436775291881708415032871985692089124472434944956010985892897595466043265819000974537553172663152640727594826474137173310039809413311432062725623183603946900548710858191078057179743726366436832870919212340219523613153893742764101120396858424887711932475871305848021245801132" -string(4) "2417" -string(5) "-7975" -string(4) "-378" -NULL -string(193) "4314861641594785951065006537821497084129700255567731661104366342587560122488351847486220156468888511744226746306538524023190734733433083354034308520246964938498767672539252131810891590624763642" -string(10) "3301287097" -string(97) "1532710025135934106005683287301200805525218110207399702226596673360222079570223526337866801028045" -string(3) "317" -string(30) "949682013136255600092941702271" -string(302) "10419061168407861659407303769436775291881708415032871985692089124472434944956010985892897595466043265819000974537553172663152640727594826474137173310039809413311432062725623183603946900548710858191078057179743726366436832870919212340219523613153893742764101120396858424887711932475871305848021245801132" -string(4) "2417" -string(5) "-7975" -string(4) "-378" - -Warning: gmp_random_seed(): Unable to convert variable to GMP - string is not an integer in %s on line %d -bool(false) -Done diff --git a/ext/gmp/tests/gmp_random_seed.phpt b/ext/gmp/tests/gmp_random_seed.phpt index e143a5153e..80f49ee32c 100644 --- a/ext/gmp/tests/gmp_random_seed.phpt +++ b/ext/gmp/tests/gmp_random_seed.phpt @@ -3,18 +3,12 @@ gmp_random_seed() basic tests --SKIPIF-- <?php if (!extension_loaded("gmp")) print "skip"; ?> <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> ---INI-- -error_reporting=E_ALL&~E_DEPRECATED --FILE-- <?php // zero int var_dump(gmp_random_seed(0)); -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - var_dump(gmp_strval(gmp_random_bits(10))); var_dump(gmp_strval(gmp_random_bits(100))); var_dump(gmp_strval(gmp_random_bits(1000))); @@ -27,10 +21,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0))); // zero gmp var_dump(gmp_random_seed(gmp_init(0))); -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - var_dump(gmp_strval(gmp_random_bits(10))); var_dump(gmp_strval(gmp_random_bits(100))); var_dump(gmp_strval(gmp_random_bits(1000))); @@ -43,10 +33,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0))); // negative int var_dump(gmp_random_seed(-100)); -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - var_dump(gmp_strval(gmp_random_bits(10))); var_dump(gmp_strval(gmp_random_bits(100))); var_dump(gmp_strval(gmp_random_bits(1000))); @@ -59,10 +45,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0))); // negative gmp var_dump(gmp_random_seed(gmp_init(-100))); -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - var_dump(gmp_strval(gmp_random_bits(10))); var_dump(gmp_strval(gmp_random_bits(100))); var_dump(gmp_strval(gmp_random_bits(1000))); @@ -75,10 +57,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0))); // positive int var_dump(gmp_random_seed(100)); -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - var_dump(gmp_strval(gmp_random_bits(10))); var_dump(gmp_strval(gmp_random_bits(100))); var_dump(gmp_strval(gmp_random_bits(1000))); @@ -91,10 +69,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0))); // positive gmp var_dump(gmp_random_seed(100)); -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - var_dump(gmp_strval(gmp_random_bits(10))); var_dump(gmp_strval(gmp_random_bits(100))); var_dump(gmp_strval(gmp_random_bits(1000))); @@ -110,10 +84,6 @@ $seed <<= 512; // large negative gmp var_dump(gmp_random_seed($seed * -1)); -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - var_dump(gmp_strval(gmp_random_bits(10))); var_dump(gmp_strval(gmp_random_bits(100))); var_dump(gmp_strval(gmp_random_bits(1000))); @@ -126,10 +96,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0))); // large positive gmp var_dump(gmp_random_seed($seed)); -var_dump(gmp_strval(gmp_random())); -var_dump(gmp_strval(gmp_random(1))); -var_dump(gmp_strval(gmp_random(10))); - var_dump(gmp_strval(gmp_random_bits(10))); var_dump(gmp_strval(gmp_random_bits(100))); var_dump(gmp_strval(gmp_random_bits(1000))); @@ -147,85 +113,61 @@ echo "Done\n"; ?> --EXPECTF-- NULL -string(386) "16100871751340485642888774479422205950971474538471317276388238970713821926852258806210387669237144400278914671533438653274777493140545293541785377162348524402063489947660558889561219968642920852870483050552936324125257259316643328803697665037881088889859735075814746314563786538493931260996669892959501637800179548654075887300734264333417283208357503038004080669367070111848040502362219" -string(18) "255344473360201232" -string(192) "566276705882089203328999735915155615747289398229935944715725865523491463654289449864817867794422824157675456435165973986660058784111212531276312901205233176071526587181942240113004108328736022" -string(3) "766" -string(31) "1251852006013618829761115383588" -string(301) "2904442664575028522451529381233481137998826790384445089758175726247096826023839957531211794198483328480161675791738894500687706952157332727908305084432443942315866545175274665372161864357698401817740956147940095302549920711069038378541222669595494627580205085300332122174778540693048337420608925104417" -string(4) "5969" -string(5) "-4126" -string(4) "-926" +string(3) "107" +string(30) "576055025228722307492589900056" +string(301) "5075491613651149525976453192895895253653438900772590630831858908690082668789318258254821002217677675804439098856210618572534955562143303188483908287009522532300439665975877709754914215718998849272363858786685187951932478210775857465448084868199807983919191214972626993925394176279001074206804955195464" +string(4) "4098" +string(3) "866" +string(5) "-4602" NULL -string(386) "16100871751340485642888774479422205950971474538471317276388238970713821926852258806210387669237144400278914671533438653274777493140545293541785377162348524402063489947660558889561219968642920852870483050552936324125257259316643328803697665037881088889859735075814746314563786538493931260996669892959501637800179548654075887300734264333417283208357503038004080669367070111848040502362219" -string(18) "255344473360201232" -string(192) "566276705882089203328999735915155615747289398229935944715725865523491463654289449864817867794422824157675456435165973986660058784111212531276312901205233176071526587181942240113004108328736022" -string(3) "766" -string(31) "1251852006013618829761115383588" -string(301) "2904442664575028522451529381233481137998826790384445089758175726247096826023839957531211794198483328480161675791738894500687706952157332727908305084432443942315866545175274665372161864357698401817740956147940095302549920711069038378541222669595494627580205085300332122174778540693048337420608925104417" -string(4) "5969" -string(5) "-4126" -string(4) "-926" +string(3) "107" +string(30) "576055025228722307492589900056" +string(301) "5075491613651149525976453192895895253653438900772590630831858908690082668789318258254821002217677675804439098856210618572534955562143303188483908287009522532300439665975877709754914215718998849272363858786685187951932478210775857465448084868199807983919191214972626993925394176279001074206804955195464" +string(4) "4098" +string(3) "866" +string(5) "-4602" NULL -string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400" -string(20) "15370156633245019617" -string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133" -string(3) "683" -string(31) "1105092118036828878542238774672" -string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374" -string(4) "7268" -string(5) "-3518" -string(5) "-8432" +string(3) "800" +string(30) "136797365759249926716355081555" +string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168" +string(4) "1029" +string(4) "7093" +string(5) "-9074" NULL -string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400" -string(20) "15370156633245019617" -string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133" -string(3) "683" -string(31) "1105092118036828878542238774672" -string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374" -string(4) "7268" -string(5) "-3518" -string(5) "-8432" +string(3) "800" +string(30) "136797365759249926716355081555" +string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168" +string(4) "1029" +string(4) "7093" +string(5) "-9074" NULL -string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400" -string(20) "15370156633245019617" -string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133" -string(3) "683" -string(31) "1105092118036828878542238774672" -string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374" -string(4) "7268" -string(5) "-3518" -string(5) "-8432" +string(3) "800" +string(30) "136797365759249926716355081555" +string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168" +string(4) "1029" +string(4) "7093" +string(5) "-9074" NULL -string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400" -string(20) "15370156633245019617" -string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133" -string(3) "683" -string(31) "1105092118036828878542238774672" -string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374" -string(4) "7268" -string(5) "-3518" -string(5) "-8432" +string(3) "800" +string(30) "136797365759249926716355081555" +string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168" +string(4) "1029" +string(4) "7093" +string(5) "-9074" NULL -string(386) "17517289823903393220742578279919954815229524740463730368402128237511862318453381595675765692750750649609755422480004471234960388086555321894591036872550129477305413674775698107868844953599169316550102271816620108199930104365341610775602960735862041722613145476720452800951958891882288668416542937408952006310656170195090436314902430700708511047189929836145291647101130135292078875631354" -string(19) "1662391866670215057" -string(193) "1951928859951518261564127834731454911658112769477733872890285741065126442731035642243573666695893929882207432512593006044657806021743917753379619843420559355572830613932424235592411658293328273" -string(3) "888" -string(30) "136524289584478309125073026188" -string(301) "4487372666528061674404740793683112894444118579769413902123304803304884162086348577960502430419080687314731489440882833272125181594897832730214825704339272207090970657364333461383490282984012738008555512699878911293400686609929745464733074891420787002129849587668122219953473716759349853748437799165176" -string(4) "8559" -string(4) "9426" -string(5) "-2932" +string(3) "762" +string(30) "822340340897453415684831711085" +string(301) "7240560133683902061389868703829443708354917824328579773726122219756981024103097560162756171513655189995985599958252688592185764428631571614485572869738344560301294144844739876478557439580966605216861285841689262517286639329902832431755450003123084728943981078635297917573398492558065003906539489023830" +string(4) "9636" +string(5) "-9848" +string(5) "-9648" NULL -string(386) "17517289823903393220742578279919954815229524740463730368402128237511862318453381595675765692750750649609755422480004471234960388086555321894591036872550129477305413674775698107868844953599169316550102271816620108199930104365341610775602960735862041722613145476720452800951958891882288668416542937408952006310656170195090436314902430700708511047189929836145291647101130135292078875631354" -string(19) "1662391866670215057" -string(193) "1951928859951518261564127834731454911658112769477733872890285741065126442731035642243573666695893929882207432512593006044657806021743917753379619843420559355572830613932424235592411658293328273" -string(3) "888" -string(30) "136524289584478309125073026188" -string(301) "4487372666528061674404740793683112894444118579769413902123304803304884162086348577960502430419080687314731489440882833272125181594897832730214825704339272207090970657364333461383490282984012738008555512699878911293400686609929745464733074891420787002129849587668122219953473716759349853748437799165176" -string(4) "8559" -string(4) "9426" -string(5) "-2932" +string(3) "762" +string(30) "822340340897453415684831711085" +string(301) "7240560133683902061389868703829443708354917824328579773726122219756981024103097560162756171513655189995985599958252688592185764428631571614485572869738344560301294144844739876478557439580966605216861285841689262517286639329902832431755450003123084728943981078635297917573398492558065003906539489023830" +string(4) "9636" +string(5) "-9848" +string(5) "-9648" Warning: gmp_random_seed(): Unable to convert variable to GMP - string is not an integer in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_remroot.phpt b/ext/gmp/tests/gmp_remroot.phpt index acd8f84925..1316d7651c 100644 --- a/ext/gmp/tests/gmp_remroot.phpt +++ b/ext/gmp/tests/gmp_remroot.phpt @@ -5,8 +5,6 @@ gmp_rootrem() basic tests --FILE-- <?php -var_dump(gmp_rootrem()); - var_dump(gmp_rootrem(1000, 3)); var_dump(gmp_rootrem(100, 3)); var_dump(gmp_rootrem(-100, 3)); @@ -21,8 +19,6 @@ var_dump(gmp_rootrem(100, -3)); ?> --EXPECTF-- -Warning: gmp_rootrem() expects exactly 2 parameters, 0 given in %s on line %d -NULL array(2) { [0]=> object(GMP)#%d (1) { diff --git a/ext/gmp/tests/gmp_root.phpt b/ext/gmp/tests/gmp_root.phpt index 654e2ffeb6..47c1fcc608 100644 --- a/ext/gmp/tests/gmp_root.phpt +++ b/ext/gmp/tests/gmp_root.phpt @@ -5,8 +5,6 @@ gmp_root() basic tests --FILE-- <?php -var_dump(gmp_root()); - var_dump(gmp_root(1000, 3)); var_dump(gmp_root(100, 3)); var_dump(gmp_root(-100, 3)); @@ -21,8 +19,6 @@ var_dump(gmp_root(100, -3)); ?> --EXPECTF-- -Warning: gmp_root() expects exactly 2 parameters, 0 given in %s on line %d -NULL object(GMP)#%d (1) { ["num"]=> string(2) "10" diff --git a/ext/gmp/tests/gmp_scan0.phpt b/ext/gmp/tests/gmp_scan0.phpt index fb70cf8b25..c06f91f7dd 100644 --- a/ext/gmp/tests/gmp_scan0.phpt +++ b/ext/gmp/tests/gmp_scan0.phpt @@ -15,8 +15,6 @@ $n = gmp_init("24234527465274"); var_dump(gmp_scan0($n, 10)); var_dump(gmp_scan0(array(), 200)); -var_dump(gmp_scan0(array())); -var_dump(gmp_scan0()); echo "Done\n"; ?> @@ -31,10 +29,4 @@ int(13) Warning: gmp_scan0(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) - -Warning: gmp_scan0() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: gmp_scan0() expects exactly 2 parameters, 0 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_scan1.phpt b/ext/gmp/tests/gmp_scan1.phpt index a89a9195b0..43a2fdfa1b 100644 --- a/ext/gmp/tests/gmp_scan1.phpt +++ b/ext/gmp/tests/gmp_scan1.phpt @@ -15,8 +15,6 @@ $n = gmp_init("24234527465274"); var_dump(gmp_scan1($n, 10)); var_dump(gmp_scan1(array(), 200)); -var_dump(gmp_scan1(array())); -var_dump(gmp_scan1()); echo "Done\n"; ?> @@ -31,10 +29,4 @@ int(10) Warning: gmp_scan1(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) - -Warning: gmp_scan1() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: gmp_scan1() expects exactly 2 parameters, 0 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_setbit.phpt b/ext/gmp/tests/gmp_setbit.phpt index 2eac23db0e..15270eaf7b 100644 --- a/ext/gmp/tests/gmp_setbit.phpt +++ b/ext/gmp/tests/gmp_setbit.phpt @@ -32,12 +32,17 @@ gmp_setbit($n, 3); var_dump(gmp_strval($n)); $b = ""; -gmp_setbit($b, 23); -gmp_setbit($b); -gmp_setbit($b, 23,1,1); -gmp_setbit($b,array()); +try { + gmp_setbit($b, 23); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} $a = array(); -gmp_setbit($a,array()); +try { + gmp_setbit($a, array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -52,14 +57,6 @@ string(1) "7" string(12) "100008388608" string(12) "100000000000" string(12) "100000000008" - -Warning: gmp_setbit() expects parameter 1 to be GMP, string given in %s on line %d - -Warning: gmp_setbit() expects at least 2 parameters, 1 given in %s on line %d - -Warning: gmp_setbit() expects at most 3 parameters, 4 given in %s on line %d - -Warning: gmp_setbit() expects parameter 1 to be GMP, string given in %s on line %d - -Warning: gmp_setbit() expects parameter 1 to be GMP, array given in %s on line %d +gmp_setbit() expects parameter 1 to be GMP, string given +gmp_setbit() expects parameter 1 to be GMP, array given Done diff --git a/ext/gmp/tests/gmp_sign.phpt b/ext/gmp/tests/gmp_sign.phpt index 7ac03013d4..ac01845395 100644 --- a/ext/gmp/tests/gmp_sign.phpt +++ b/ext/gmp/tests/gmp_sign.phpt @@ -13,9 +13,7 @@ var_dump(gmp_sign("-34535345345")); var_dump(gmp_sign("+34534573457345")); $n = gmp_init("098909878976786545"); var_dump(gmp_sign($n)); -var_dump(gmp_sign($n, $n)); var_dump(gmp_sign(array())); -var_dump(gmp_sign()); echo "Done\n"; ?> @@ -32,12 +30,6 @@ bool(false) Warning: gmp_init(): Unable to convert variable to GMP - string is not an integer in %s on line %d int(0) -Warning: gmp_sign() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: gmp_sign(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) - -Warning: gmp_sign() expects exactly 1 parameter, 0 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_sqrt.phpt b/ext/gmp/tests/gmp_sqrt.phpt index e824de3706..03c460b79a 100644 --- a/ext/gmp/tests/gmp_sqrt.phpt +++ b/ext/gmp/tests/gmp_sqrt.phpt @@ -18,8 +18,6 @@ var_dump(gmp_strval(gmp_sqrt($n))); $n = gmp_init(777); var_dump(gmp_strval(gmp_sqrt($n))); -var_dump(gmp_sqrt($n, 1)); -var_dump(gmp_sqrt()); var_dump(gmp_sqrt(array())); echo "Done\n"; @@ -39,12 +37,6 @@ Warning: gmp_sqrt(): Number has to be greater than or equal to 0 in %s on line % string(1) "0" string(2) "27" -Warning: gmp_sqrt() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: gmp_sqrt() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: gmp_sqrt(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) Done diff --git a/ext/gmp/tests/gmp_sqrtrem.phpt b/ext/gmp/tests/gmp_sqrtrem.phpt index 595a1dc45a..c19969158e 100644 --- a/ext/gmp/tests/gmp_sqrtrem.phpt +++ b/ext/gmp/tests/gmp_sqrtrem.phpt @@ -51,7 +51,6 @@ var_dump(gmp_strval($r[0])); var_dump(gmp_strval($r[1])); var_dump(gmp_sqrtrem(array())); -var_dump(gmp_sqrtrem()); echo "Done\n"; ?> @@ -82,7 +81,4 @@ string(1) "1" Warning: gmp_sqrtrem(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) - -Warning: gmp_sqrtrem() expects exactly 1 parameter, 0 given in %s on line %d -NULL Done diff --git a/ext/gmp/tests/gmp_strval.phpt b/ext/gmp/tests/gmp_strval.phpt index cfa7335667..b349d31699 100644 --- a/ext/gmp/tests/gmp_strval.phpt +++ b/ext/gmp/tests/gmp_strval.phpt @@ -5,11 +5,8 @@ gmp_strval() tests --FILE-- <?php -var_dump(gmp_strval()); var_dump(gmp_strval("")); -var_dump(gmp_strval("", "")); var_dump(gmp_strval("", -1)); -var_dump(gmp_strval(-1, "")); $fp = fopen(__FILE__, "r"); var_dump(gmp_strval($fp)); @@ -26,29 +23,18 @@ var_dump(gmp_strval($g, -1)); var_dump(gmp_strval($g, 100000)); var_dump(gmp_strval($g, 10)); -var_dump(gmp_strval(array(1,2), array(1,2))); -var_dump(gmp_strval(new stdclass, new stdclass)); var_dump(gmp_strval(array(1,2))); var_dump(gmp_strval(new stdclass)); echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_strval() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in %s on line %d bool(false) -Warning: gmp_strval() expects parameter 2 to be int, string given in %s on line %d -NULL - Warning: gmp_strval(): Bad base for conversion: -1 (should be between 2 and %d or -2 and -%d) in %s on line %d bool(false) -Warning: gmp_strval() expects parameter 2 to be int, string given in %s on line %d -NULL - Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) string(7) "9765456" @@ -68,12 +54,6 @@ Warning: gmp_strval(): Bad base for conversion: 100000 (should be between 2 and bool(false) string(8) "-3373333" -Warning: gmp_strval() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: gmp_strval() expects parameter 2 to be int, object given in %s on line %d -NULL - Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) diff --git a/ext/gmp/tests/gmp_sub.phpt b/ext/gmp/tests/gmp_sub.phpt index fabc0c0ebb..b8dce49774 100644 --- a/ext/gmp/tests/gmp_sub.phpt +++ b/ext/gmp/tests/gmp_sub.phpt @@ -5,10 +5,7 @@ gmp_sub() tests --FILE-- <?php -var_dump(gmp_sub()); -var_dump(gmp_sub("")); var_dump(gmp_sub("", "")); -var_dump(gmp_sub("", "", "")); var_dump(gmp_sub(array(), array())); var_dump($g = gmp_sub(10000, 10001)); @@ -23,18 +20,9 @@ var_dump(gmp_strval($g)); echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_sub() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: gmp_sub() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: gmp_sub(): Unable to convert variable to GMP - string is not an integer in %s on line %d bool(false) -Warning: gmp_sub() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) object(GMP)#%d (1) { diff --git a/ext/gmp/tests/gmp_testbit.phpt b/ext/gmp/tests/gmp_testbit.phpt index bdabe3d841..f18af5d44d 100644 --- a/ext/gmp/tests/gmp_testbit.phpt +++ b/ext/gmp/tests/gmp_testbit.phpt @@ -5,8 +5,6 @@ gmp_testbit() basic tests --FILE-- <?php -var_dump(gmp_testbit()); - $n = gmp_init(0); var_dump(gmp_testbit($n, -10)); var_dump(gmp_testbit($n, 0)); @@ -40,9 +38,6 @@ var_dump(gmp_strval($n)); echo "Done\n"; ?> --EXPECTF-- -Warning: gmp_testbit() expects exactly 2 parameters, 0 given in %s on line %d -NULL - Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d bool(false) bool(false) diff --git a/ext/gmp/tests/gmp_xor.phpt b/ext/gmp/tests/gmp_xor.phpt index 9bf31f02f4..cc508907aa 100644 --- a/ext/gmp/tests/gmp_xor.phpt +++ b/ext/gmp/tests/gmp_xor.phpt @@ -17,8 +17,6 @@ var_dump(gmp_strval(gmp_xor($n, "34332"))); $n1 = gmp_init("987657878765436543456"); var_dump(gmp_strval(gmp_xor($n, $n1))); -var_dump(gmp_xor($n, $n1, 1)); -var_dump(gmp_xor(1)); var_dump(gmp_xor(array(), 1)); var_dump(gmp_xor(1, array())); var_dump(gmp_xor(array(), array())); @@ -37,12 +35,6 @@ string(1) "0" string(15) "987657876574716" string(21) "987658017016065701376" -Warning: gmp_xor() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: gmp_xor() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: gmp_xor(): Unable to convert variable to GMP - wrong type in %s on line %d bool(false) diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 449665a268..2b6d435f2f 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -570,7 +570,7 @@ PHP_FUNCTION(hash_copy) return; } - RETVAL_OBJ(Z_OBJ_HANDLER_P(zhash, clone_obj)(zhash)); + RETVAL_OBJ(Z_OBJ_HANDLER_P(zhash, clone_obj)(Z_OBJ_P(zhash))); if (php_hashcontext_from_object(Z_OBJ_P(return_value))->context == NULL) { zval_ptr_dtor(return_value); @@ -1138,12 +1138,12 @@ static void php_hashcontext_dtor(zend_object *obj) { /* }}} */ /* {{{ php_hashcontext_clone */ -static zend_object *php_hashcontext_clone(zval *pzv) { - php_hashcontext_object *oldobj = php_hashcontext_from_object(Z_OBJ_P(pzv)); - zend_object *znew = php_hashcontext_create(Z_OBJCE_P(pzv)); +static zend_object *php_hashcontext_clone(zend_object *zobj) { + php_hashcontext_object *oldobj = php_hashcontext_from_object(zobj); + zend_object *znew = php_hashcontext_create(zobj->ce); php_hashcontext_object *newobj = php_hashcontext_from_object(znew); - zend_objects_clone_members(znew, Z_OBJ_P(pzv)); + zend_objects_clone_members(znew, zobj); newobj->ops = oldobj->ops; newobj->options = oldobj->options; diff --git a/ext/hash/tests/hash_error.phpt b/ext/hash/tests/hash_error.phpt index e760819e69..f879d491d7 100644 --- a/ext/hash/tests/hash_error.phpt +++ b/ext/hash/tests/hash_error.phpt @@ -10,14 +10,6 @@ Hash: hash() function : error conditions */ echo "*** Testing hash() : error conditions ***\n"; -echo "\n-- Testing hash() function with less than expected no. of arguments --\n"; -var_dump(hash()); -var_dump(hash('adler32')); - -echo "\n-- Testing hash() function with more than expected no. of arguments --\n"; -$extra_arg= 10; -var_dump(hash('adler32', '', false, $extra_arg)); - echo "\n-- Testing hash() function with invalid hash algorithm --\n"; var_dump(hash('foo', '')); @@ -26,19 +18,6 @@ var_dump(hash('foo', '')); --EXPECTF-- *** Testing hash() : error conditions *** --- Testing hash() function with less than expected no. of arguments -- - -Warning: hash() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: hash() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing hash() function with more than expected no. of arguments -- - -Warning: hash() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing hash() function with invalid hash algorithm -- Warning: hash(): Unknown hashing algorithm: foo in %s on line %d diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt index a634070de5..b001001861 100644 --- a/ext/hash/tests/hash_file_error.phpt +++ b/ext/hash/tests/hash_file_error.phpt @@ -24,13 +24,6 @@ var_dump( hash_file( 'foobar', $filename ) ); echo "\n-- Testing hash_file() function with a non-existent file --\n"; var_dump( hash_file( 'md5', 'nonexistent.txt' ) ); -echo "\n-- Testing hash_file() function with less than expected no. of arguments --\n"; -var_dump( hash_file( 'md5' ) ); - -echo "\n-- Testing hash_file() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( hash_file( 'md5', $filename, false, $extra_arg ) ); - ?> ===DONE=== --CLEAN-- @@ -52,14 +45,4 @@ bool(false) Warning: hash_file(%s): failed to open stream: No such file or directory in %s on line %d bool(false) - --- Testing hash_file() function with less than expected no. of arguments -- - -Warning: hash_file() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing hash_file() function with more than expected no. of arguments -- - -Warning: hash_file() expects at most 3 parameters, 4 given in %s on line %d -NULL ===DONE=== diff --git a/ext/hash/tests/hash_hkdf_error.phpt b/ext/hash/tests/hash_hkdf_error.phpt index b833054e80..e5903f126a 100644 --- a/ext/hash/tests/hash_hkdf_error.phpt +++ b/ext/hash/tests/hash_hkdf_error.phpt @@ -12,13 +12,6 @@ $ikm = 'input key material'; echo "*** Testing hash_hkdf(): error conditions ***\n"; -echo "\n-- Testing hash_hkdf() function with less than expected no. of arguments --\n"; -var_dump(hash_hkdf()); -var_dump(hash_hkdf('sha1')); - -echo "\n-- Testing hash_hkdf() function with more than expected no. of arguments --\n"; -var_dump(hash_hkdf('sha1', $ikm, 20, '', '', 'extra parameter')); - echo "\n-- Testing hash_hkdf() function with invalid hash algorithm --\n"; var_dump(hash_hkdf('foo', $ikm)); @@ -41,19 +34,6 @@ var_dump(hash_hkdf('sha1', $ikm, 20 * 255 + 1)); // Length can't be more than 25 --EXPECTF-- *** Testing hash_hkdf(): error conditions *** --- Testing hash_hkdf() function with less than expected no. of arguments -- - -Warning: hash_hkdf() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: hash_hkdf() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing hash_hkdf() function with more than expected no. of arguments -- - -Warning: hash_hkdf() expects at most 5 parameters, 6 given in %s on line %d -NULL - -- Testing hash_hkdf() function with invalid hash algorithm -- Warning: hash_hkdf(): Unknown hashing algorithm: foo in %s on line %d diff --git a/ext/hash/tests/hash_hmac_error.phpt b/ext/hash/tests/hash_hmac_error.phpt index 89d29b8df8..1ed3e54127 100644 --- a/ext/hash/tests/hash_hmac_error.phpt +++ b/ext/hash/tests/hash_hmac_error.phpt @@ -12,15 +12,6 @@ echo "*** Testing hash_hmac() : error conditions ***\n"; $data = "This is a sample string used to test the hash_hmac function with various hashing algorithms"; $key = 'secret'; -echo "\n-- Testing hash_hmac() function with less than expected no. of arguments --\n"; -var_dump(hash_hmac()); -var_dump(hash_hmac('md5')); -var_dump(hash_hmac('md5', $data)); - -echo "\n-- Testing hash_hmac() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump(hash_hmac('md5', $data, $key, TRUE, $extra_arg)); - echo "\n-- Testing hash_hmac() function with invalid hash algorithm --\n"; var_dump(hash_hmac('foo', $data, $key)); @@ -32,22 +23,6 @@ var_dump(hash_hmac('crc32', $data, $key)); --EXPECTF-- *** Testing hash_hmac() : error conditions *** --- Testing hash_hmac() function with less than expected no. of arguments -- - -Warning: hash_hmac() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: hash_hmac() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: hash_hmac() expects at least 3 parameters, 2 given in %s on line %d -NULL - --- Testing hash_hmac() function with more than expected no. of arguments -- - -Warning: hash_hmac() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing hash_hmac() function with invalid hash algorithm -- Warning: hash_hmac(): Unknown hashing algorithm: foo in %s on line %d diff --git a/ext/hash/tests/hash_hmac_file_basic.phpt b/ext/hash/tests/hash_hmac_file_basic.phpt index 9135825008..7ad271b00b 100644 --- a/ext/hash/tests/hash_hmac_file_basic.phpt +++ b/ext/hash/tests/hash_hmac_file_basic.phpt @@ -54,11 +54,6 @@ echo "whirlpool: " . hash_hmac_file('whirlpool', $file, $key) . "\n"; echo "md5(raw): " . bin2hex(hash_hmac_file('md5', $file, $key, TRUE)). "\n"; echo "sha256(raw): " . bin2hex(hash_hmac_file('sha256', $file, $key, TRUE)). "\n"; -echo "Error cases:\n"; -hash_hmac_file(); -hash_hmac_file('foo', $file); -hash_hmac_file('foo', $file, $key, TRUE, 10); - unlink($file); ?> @@ -83,11 +78,4 @@ tiger192,3: ca89badf843ba68e3fae5832635aa848a72a4bc11676edd4 whirlpool: 37a0fbb90547690d5e5e11c046f6654ffdb7bab15e16d9d79c7d85765cc4bdcbfd9df8db7a3ce9558f3f244fead00ca29cf05297f75596555195a0683f15d69f md5(raw): 8bddf39dd1c566c27acc7fa85ec36acf sha256(raw): 9135286ca4c84dec711e4b831f6cd39e672e5ff93d011321274eb76733cc1e40 -Error cases: - -Warning: hash_hmac_file() expects at least 3 parameters, 0 given in %s on line %d - -Warning: hash_hmac_file() expects at least 3 parameters, 2 given in %s on line %d - -Warning: hash_hmac_file() expects at most 4 parameters, 5 given in %s on line %d ===Done=== diff --git a/ext/hash/tests/hash_hmac_file_error.phpt b/ext/hash/tests/hash_hmac_file_error.phpt index 5b82c288ec..505d52fef9 100644 --- a/ext/hash/tests/hash_hmac_file_error.phpt +++ b/ext/hash/tests/hash_hmac_file_error.phpt @@ -14,15 +14,6 @@ echo "*** Testing hash() : error conditions ***\n"; $file = dirname(__FILE__) . "hash_file.txt"; $key = 'secret'; -echo "\n-- Testing hash_hmac_file() function with less than expected no. of arguments --\n"; -var_dump(hash_hmac_file()); -var_dump(hash_hmac_file('crc32')); -var_dump(hash_hmac_file('crc32', $file)); - -echo "\n-- Testing hash_hmac_file() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -hash_hmac_file('crc32', $file, $key, TRUE, $extra_arg); - echo "\n-- Testing hash_hmac_file() function with invalid hash algorithm --\n"; hash_hmac_file('foo', $file, $key, TRUE); @@ -37,21 +28,6 @@ hash_hmac_file('md5', $file.chr(0).$file, $key, TRUE); --EXPECTF-- *** Testing hash() : error conditions *** --- Testing hash_hmac_file() function with less than expected no. of arguments -- - -Warning: hash_hmac_file() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: hash_hmac_file() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: hash_hmac_file() expects at least 3 parameters, 2 given in %s on line %d -NULL - --- Testing hash_hmac_file() function with more than expected no. of arguments -- - -Warning: hash_hmac_file() expects at most 4 parameters, 5 given in %s on line %d - -- Testing hash_hmac_file() function with invalid hash algorithm -- Warning: hash_hmac_file(): Unknown hashing algorithm: foo in %s on line %d diff --git a/ext/hash/tests/hash_init_error.phpt b/ext/hash/tests/hash_init_error.phpt index e941aabca5..9105b96801 100644 --- a/ext/hash/tests/hash_init_error.phpt +++ b/ext/hash/tests/hash_init_error.phpt @@ -4,9 +4,6 @@ Hash: hash_init() function - errors test <?php echo "*** Testing hash_init(): error conditions ***\n"; -echo "-- Testing hash_init() function with no parameters --\n"; -var_dump(hash_init()); - echo "-- Testing hash_init() function with unknown algorithms --\n"; var_dump(hash_init('dummy')); @@ -19,10 +16,6 @@ var_dump(hash_init('md5', HASH_HMAC, null)); ?> --EXPECTF-- *** Testing hash_init(): error conditions *** --- Testing hash_init() function with no parameters -- - -Warning: hash_init() expects at least 1 parameter, 0 given in %s on line %d -NULL -- Testing hash_init() function with unknown algorithms -- Warning: hash_init(): Unknown hashing algorithm: dummy in %s on line %d diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt index c0a76e17b4..a7fd08649b 100644 --- a/ext/hash/tests/hash_pbkdf2_error.phpt +++ b/ext/hash/tests/hash_pbkdf2_error.phpt @@ -12,15 +12,6 @@ echo "*** Testing hash_pbkdf2() : error conditions ***\n"; $password = 'password'; $salt = 'salt'; -echo "\n-- Testing hash_pbkdf2() function with less than expected no. of arguments --\n"; -var_dump(hash_pbkdf2()); -var_dump(hash_pbkdf2('md5')); -var_dump(hash_pbkdf2('md5', $password)); -var_dump(hash_pbkdf2('md5', $password, $salt)); - -echo "\n-- Testing hash_pbkdf2() function with more than expected no. of arguments --\n"; -var_dump(hash_pbkdf2('md5', $password, $salt, 10, 10, true, 'extra arg')); - echo "\n-- Testing hash_pbkdf2() function with invalid hash algorithm --\n"; var_dump(hash_pbkdf2('foo', $password, $salt, 1)); @@ -39,25 +30,6 @@ var_dump(hash_pbkdf2('md5', $password, $salt, 1, -1)); --EXPECTF-- *** Testing hash_pbkdf2() : error conditions *** --- Testing hash_pbkdf2() function with less than expected no. of arguments -- - -Warning: hash_pbkdf2() expects at least 4 parameters, 0 given in %s on line %d -NULL - -Warning: hash_pbkdf2() expects at least 4 parameters, 1 given in %s on line %d -NULL - -Warning: hash_pbkdf2() expects at least 4 parameters, 2 given in %s on line %d -NULL - -Warning: hash_pbkdf2() expects at least 4 parameters, 3 given in %s on line %d -NULL - --- Testing hash_pbkdf2() function with more than expected no. of arguments -- - -Warning: hash_pbkdf2() expects at most 6 parameters, 7 given in %s on line %d -NULL - -- Testing hash_pbkdf2() function with invalid hash algorithm -- Warning: hash_pbkdf2(): Unknown hashing algorithm: foo in %s on line %d diff --git a/ext/iconv/tests/iconv_mime_decode.phpt b/ext/iconv/tests/iconv_mime_decode.phpt index c5b76f3ce9..b5dee827df 100644 --- a/ext/iconv/tests/iconv_mime_decode.phpt +++ b/ext/iconv/tests/iconv_mime_decode.phpt @@ -6,7 +6,7 @@ iconv_mime_decode() iconv.internal_charset=iso-8859-1 --FILE-- <?php -function my_error_handler($errno, $errmsg, $filename, $linenum, $vars) +function my_error_handler($errno, $errmsg, $filename, $linenum) { echo "$errno: $errmsg\n"; } diff --git a/ext/iconv/tests/iconv_mime_encode.phpt b/ext/iconv/tests/iconv_mime_encode.phpt index bd090e4d50..e4be799915 100644 --- a/ext/iconv/tests/iconv_mime_encode.phpt +++ b/ext/iconv/tests/iconv_mime_encode.phpt @@ -6,7 +6,7 @@ iconv_mime_encode() iconv.internal_charset=iso-8859-1 --FILE-- <?php -function my_error_handler($errno, $errmsg, $filename, $linenum, $vars) +function my_error_handler($errno, $errmsg, $filename, $linenum) { echo "$errno: $errmsg\n"; } diff --git a/ext/iconv/tests/iconv_strpos.phpt b/ext/iconv/tests/iconv_strpos.phpt index 28e3fe2320..92492c7244 100644 --- a/ext/iconv/tests/iconv_strpos.phpt +++ b/ext/iconv/tests/iconv_strpos.phpt @@ -6,7 +6,7 @@ iconv_strpos() iconv.internal_charset=ISO-8859-1 --FILE-- <?php -function my_error_handler($errno, $errmsg, $filename, $linenum, $vars) +function my_error_handler($errno, $errmsg, $filename, $linenum) { echo "$errno: $errmsg\n"; } diff --git a/ext/iconv/tests/iconv_strrpos.phpt b/ext/iconv/tests/iconv_strrpos.phpt index ee977f2c31..76b8323d89 100644 --- a/ext/iconv/tests/iconv_strrpos.phpt +++ b/ext/iconv/tests/iconv_strrpos.phpt @@ -6,7 +6,7 @@ iconv_strrpos() iconv.internal_charset=ISO-8859-1 --FILE-- <?php -function my_error_handler($errno, $errmsg, $filename, $linenum, $vars) +function my_error_handler($errno, $errmsg, $filename, $linenum) { echo "$errno: $errmsg\n"; } diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 0d64efece4..7267ff2e7d 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -96,16 +96,16 @@ static int BreakIterator_compare_objects(zval *object1, /* }}} */ /* {{{ clone handler for BreakIterator */ -static zend_object *BreakIterator_clone_obj(zval *object) +static zend_object *BreakIterator_clone_obj(zend_object *object) { BreakIterator_object *bio_orig, *bio_new; zend_object *ret_val; - bio_orig = Z_INTL_BREAKITERATOR_P(object); + bio_orig = php_intl_breakiterator_fetch_object(object); intl_errors_reset(INTL_DATA_ERROR_P(bio_orig)); - ret_val = BreakIterator_ce_ptr->create_object(Z_OBJCE_P(object)); + ret_val = BreakIterator_ce_ptr->create_object(object->ce); bio_new = php_intl_breakiterator_fetch_object(ret_val); zend_objects_clone_members(&bio_new->zo, &bio_orig->zo); @@ -136,7 +136,7 @@ static zend_object *BreakIterator_clone_obj(zval *object) /* }}} */ /* {{{ get_debug_info handler for BreakIterator */ -static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp) +static HashTable *BreakIterator_get_debug_info(zend_object *object, int *is_temp) { zval val; HashTable *debug_info; @@ -147,7 +147,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp) debug_info = zend_new_array(8); - bio = Z_INTL_BREAKITERATOR_P(object); + bio = php_intl_breakiterator_fetch_object(object); biter = bio->biter; if (biter == NULL) { diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp index 9969561206..e5f5aae74b 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.cpp +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -277,8 +277,6 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator) INTLITERATOR_METHOD_INIT_VARS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "IntlPartsIterator::getBreakIterator: bad arguments", 0); return; } diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index 6d6211db73..34509376c8 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -55,9 +55,6 @@ static void _breakiter_factory(const char *func_name, if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &locale_str, &dummy) == FAILURE) { - spprintf(&msg, 0, "%s: bad arguments", func_name); - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1); - efree(msg); RETURN_NULL(); } @@ -118,8 +115,6 @@ U_CFUNC PHP_FUNCTION(breakiter_create_code_point_instance) intl_error_reset(NULL); if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_create_code_point_instance: bad arguments", 0); RETURN_NULL(); } @@ -133,8 +128,6 @@ U_CFUNC PHP_FUNCTION(breakiter_get_text) object = ZEND_THIS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_get_text: bad arguments", 0); RETURN_FALSE; } @@ -155,8 +148,6 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &text) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_set_text: bad arguments", 0); RETURN_FALSE; } @@ -189,9 +180,6 @@ static void _breakiter_no_args_ret_int32( object = ZEND_THIS; if (zend_parse_parameters_none() == FAILURE) { - spprintf(&msg, 0, "%s: bad arguments", func_name); - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1); - efree(msg); RETURN_FALSE; } @@ -213,9 +201,6 @@ static void _breakiter_int32_ret_int32( object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &arg) == FAILURE) { - spprintf(&msg, 0, "%s: bad arguments", func_name); - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1); - efree(msg); RETURN_FALSE; } @@ -290,8 +275,6 @@ U_CFUNC PHP_FUNCTION(breakiter_current) object = ZEND_THIS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_current: bad arguments", 0); RETURN_FALSE; } @@ -324,8 +307,6 @@ U_CFUNC PHP_FUNCTION(breakiter_is_boundary) if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &offset) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_is_boundary: bad arguments", 0); RETURN_FALSE; } @@ -350,8 +331,6 @@ U_CFUNC PHP_FUNCTION(breakiter_get_locale) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &locale_type) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_get_locale: bad arguments", 0); RETURN_FALSE; } @@ -378,8 +357,6 @@ U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &key_type) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_get_parts_iterator: bad arguments", 0); RETURN_FALSE; } @@ -403,8 +380,6 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_code) object = ZEND_THIS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_get_error_code: bad arguments", 0); RETURN_FALSE; } @@ -423,8 +398,6 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_message) object = ZEND_THIS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "breakiter_get_error_message: bad arguments", 0 ); RETURN_FALSE; } diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp index f1dd0960e6..dac50dcab6 100644 --- a/ext/intl/breakiterator/codepointiterator_methods.cpp +++ b/ext/intl/breakiterator/codepointiterator_methods.cpp @@ -33,8 +33,6 @@ U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point) object = ZEND_THIS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "cpbi_get_last_code_point: bad arguments", 0); RETURN_FALSE; } diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 5529d06718..65023af089 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -43,8 +43,6 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS) if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|b", &rules, &rules_len, &compiled) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "rbbi_create_instance: bad arguments", 0); return; } @@ -105,8 +103,6 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rules) object = ZEND_THIS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "rbbi_get_rules: bad arguments", 0); RETURN_FALSE; } @@ -132,8 +128,6 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status) object = ZEND_THIS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "rbbi_get_rule_status: bad arguments", 0); RETURN_FALSE; } @@ -148,8 +142,6 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) object = ZEND_THIS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "rbbi_get_rule_status_vec: bad arguments", 0); RETURN_FALSE; } @@ -188,8 +180,6 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules) object = ZEND_THIS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "rbbi_get_binary_rules: bad arguments", 0); RETURN_FALSE; } diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index 29eb9eef44..f7cb8739e0 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -78,17 +78,17 @@ U_CFUNC void calendar_object_construct(zval *object, } /* {{{ clone handler for Calendar */ -static zend_object *Calendar_clone_obj(zval *object) +static zend_object *Calendar_clone_obj(zend_object *object) { Calendar_object *co_orig, *co_new; zend_object *ret_val; intl_error_reset(NULL); - co_orig = Z_INTL_CALENDAR_P(object); + co_orig = php_intl_calendar_fetch_object(object); intl_error_reset(INTL_DATA_ERROR_P(co_orig)); - ret_val = Calendar_ce_ptr->create_object(Z_OBJCE_P(object)); + ret_val = Calendar_ce_ptr->create_object(object->ce); co_new = php_intl_calendar_fetch_object(ret_val); zend_objects_clone_members(&co_new->zo, &co_orig->zo); @@ -147,7 +147,7 @@ static const struct { }; /* {{{ get_debug_info handler for Calendar */ -static HashTable *Calendar_get_debug_info(zval *object, int *is_temp) +static HashTable *Calendar_get_debug_info(zend_object *object, int *is_temp) { zval zv, zfields; @@ -159,7 +159,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp) debug_info = zend_new_array(8); - co = Z_INTL_CALENDAR_P(object); + co = php_intl_calendar_fetch_object(object); cal = co->ucal; if (cal == NULL) { @@ -179,7 +179,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp) HashTable *debug_info_tz; timezone_object_construct(&cal->getTimeZone(), &ztz , 0); - debug_info_tz = Z_OBJ_HANDLER(ztz, get_debug_info)(&ztz, &is_tmp); + debug_info_tz = Z_OBJ_HANDLER(ztz, get_debug_info)(Z_OBJ(ztz), &is_tmp); assert(is_tmp == 1); array_init(&ztz_debug); diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index dfe34a4f03..0571b62c7d 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -63,8 +63,6 @@ U_CFUNC PHP_FUNCTION(intlcal_create_instance) if (zend_parse_parameters(ZEND_NUM_ARGS(), "|zs!", &zv_timezone, &locale_str, &dummy) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_create_calendar: bad arguments", 0); RETURN_NULL(); } @@ -154,8 +152,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_keyword_values_for_locale) if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssb", &key, &key_len, &locale, &locale_len, &commonly_used) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_keyword_values_for_locale: bad arguments", 0); RETURN_FALSE; } @@ -190,8 +186,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_now) intl_error_reset(NULL); if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_now: bad arguments", 0); RETURN_FALSE; } @@ -203,8 +197,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_available_locales) intl_error_reset(NULL); if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_available_locales: bad arguments", 0); RETURN_FALSE; } @@ -228,9 +220,6 @@ static void _php_intlcal_field_uec_ret_in32t_method( if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { - spprintf(&message, 0, "%s: bad arguments", method_name); - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1); - efree(message); RETURN_FALSE; } @@ -262,8 +251,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_time) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_time: bad arguments", 0); RETURN_FALSE; } @@ -283,8 +270,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Od", &object, Calendar_ce_ptr, &time_arg) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set_time: bad arguments", 0); RETURN_FALSE; } @@ -304,8 +289,6 @@ U_CFUNC PHP_FUNCTION(intlcal_add) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_add: bad arguments", 0); RETURN_FALSE; } @@ -336,8 +319,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time_zone) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oz!", &object, Calendar_ce_ptr, &zv_timezone) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set_time_zone: bad arguments", 0); RETURN_FALSE; } @@ -370,8 +351,6 @@ static void _php_intlcal_before_after( if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, Calendar_ce_ptr, &when_object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_before/after: bad arguments", 0); RETURN_FALSE; } @@ -430,8 +409,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set) zend_parse_method_parameters(ZEND_NUM_ARGS(), object, "Oll|llll", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set: bad arguments", 0); RETURN_FALSE; } @@ -489,15 +466,11 @@ U_CFUNC PHP_FUNCTION(intlcal_roll) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), object, "Olb", &object, Calendar_ce_ptr, &field, &bool_variant_val) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_roll: bad arguments", 0); RETURN_FALSE; } bool_variant_val = Z_TYPE(args[1]) == IS_TRUE? 1 : 0; } else if (zend_parse_method_parameters(ZEND_NUM_ARGS(), object, "Oll", &object, Calendar_ce_ptr, &field, &value) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_roll: bad arguments", 0); RETURN_FALSE; } @@ -535,8 +508,6 @@ U_CFUNC PHP_FUNCTION(intlcal_clear) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|l!", &object, Calendar_ce_ptr, &field, &field_is_null) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_clear: bad arguments", 0); RETURN_FALSE; } @@ -565,8 +536,6 @@ U_CFUNC PHP_FUNCTION(intlcal_field_difference) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Odl", &object, Calendar_ce_ptr, &when, &field) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_field_difference: bad arguments", 0); RETURN_FALSE; } @@ -605,8 +574,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_day_of_week_type: bad arguments", 0); RETURN_FALSE; } @@ -632,8 +599,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_first_day_of_week: bad arguments", 0); RETURN_FALSE; } @@ -657,9 +622,6 @@ static void _php_intlcal_field_ret_in32t_method( if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { - spprintf(&message, 0, "%s: bad arguments", method_name); - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1); - efree(message); RETURN_FALSE; } @@ -697,8 +659,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_locale) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, Calendar_ce_ptr, &locale_type) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_locale: bad arguments", 0); RETURN_FALSE; } @@ -730,8 +690,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_minimal_days_in_first_week: bad arguments", 0); RETURN_FALSE; } @@ -756,8 +714,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_time_zone) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_time_zone: bad arguments", 0); RETURN_FALSE; } @@ -779,8 +735,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_type) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_type: bad arguments", 0); RETURN_FALSE; } @@ -796,8 +750,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_weekend_transition: bad arguments", 0); RETURN_FALSE; } @@ -823,8 +775,6 @@ U_CFUNC PHP_FUNCTION(intlcal_in_daylight_time) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_in_daylight_time: bad arguments", 0); RETURN_FALSE; } @@ -846,8 +796,6 @@ U_CFUNC PHP_FUNCTION(intlcal_is_equivalent_to) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, Calendar_ce_ptr, &other_object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_is_equivalent_to: bad arguments", 0); RETURN_FALSE; } @@ -869,8 +817,6 @@ U_CFUNC PHP_FUNCTION(intlcal_is_lenient) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_is_lenient: bad arguments", 0); RETURN_FALSE; } @@ -886,8 +832,6 @@ U_CFUNC PHP_FUNCTION(intlcal_is_set) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_is_set: bad arguments", 0); RETURN_FALSE; } @@ -910,8 +854,6 @@ U_CFUNC PHP_FUNCTION(intlcal_is_weekend) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|d!", &object, Calendar_ce_ptr, &date, &date_is_null) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_is_weekend: bad arguments", 0); RETURN_FALSE; } @@ -935,8 +877,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_first_day_of_week) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set_first_day_of_week: bad arguments", 0); RETURN_FALSE; } @@ -960,8 +900,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_lenient) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ob", &object, Calendar_ce_ptr, &is_lenient) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set_lenient: bad arguments", 0); RETURN_FALSE; } @@ -979,8 +917,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_minimal_days_in_first_week) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set_minimal_days_in_first_week: bad arguments", 0); RETURN_FALSE; } @@ -1007,8 +943,6 @@ U_CFUNC PHP_FUNCTION(intlcal_equals) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, Calendar_ce_ptr, &other_object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_equals: bad arguments", 0); RETURN_FALSE; } @@ -1032,8 +966,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_repeated_wall_time_option) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_repeated_wall_time_option: bad arguments", 0); RETURN_FALSE; } @@ -1048,8 +980,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_skipped_wall_time_option: bad arguments", 0); RETURN_FALSE; } @@ -1065,8 +995,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set_repeated_wall_time_option: bad arguments", 0); RETURN_FALSE; } @@ -1090,8 +1018,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_skipped_wall_time_option) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set_skipped_wall_time_option: bad arguments", 0); RETURN_FALSE; } @@ -1125,15 +1051,13 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|s!", &zv_arg, &locale_str, &locale_str_len) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_from_date_time: bad arguments", 0); RETURN_NULL(); } if (!(Z_TYPE_P(zv_arg) == IS_OBJECT && instanceof_function( Z_OBJCE_P(zv_arg), php_date_get_date_ce()))) { object_init_ex(&zv_tmp, php_date_get_date_ce()); - zend_call_method_with_1_params(&zv_tmp, NULL, &Z_OBJCE(zv_tmp)->constructor, "__construct", NULL, zv_arg); + zend_call_method_with_1_params(Z_OBJ(zv_tmp), NULL, &Z_OBJCE(zv_tmp)->constructor, "__construct", NULL, zv_arg); zv_datetime = &zv_tmp; if (EG(exception)) { zend_object_store_ctor_failed(Z_OBJ(zv_tmp)); @@ -1151,7 +1075,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) goto error; } - zend_call_method_with_0_params(zv_datetime, php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp); + zend_call_method_with_0_params(Z_OBJ_P(zv_datetime), php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp); if (Z_TYPE(zv_timestamp) != IS_LONG) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_from_date_time: bad DateTime; call to " @@ -1206,8 +1130,6 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_to_date_time: bad arguments", 0); RETURN_FALSE; } @@ -1249,7 +1171,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time) /* Finally, instantiate object and call constructor */ object_init_ex(return_value, php_date_get_date_ce()); - zend_call_method_with_2_params(return_value, NULL, &Z_OBJCE_P(return_value)->constructor, "__construct", NULL, &ts_zval, timezone_zval); + zend_call_method_with_2_params(Z_OBJ_P(return_value), NULL, &Z_OBJCE_P(return_value)->constructor, "__construct", NULL, &ts_zval, timezone_zval); if (EG(exception)) { intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR, "intlcal_to_date_time: DateTime constructor has thrown exception", @@ -1264,7 +1186,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time) zval_ptr_dtor(&ts_zval); /* due to bug #40743, we have to set the time zone again */ - zend_call_method_with_1_params(return_value, NULL, NULL, "settimezone", + zend_call_method_with_1_params(Z_OBJ_P(return_value), NULL, NULL, "settimezone", &retval, timezone_zval); if (Z_ISUNDEF(retval) || Z_TYPE(retval) == IS_FALSE) { intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR, @@ -1286,8 +1208,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_code) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_error_code: bad arguments", 0); RETURN_FALSE; } @@ -1306,8 +1226,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_message) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_get_error_message: bad arguments", 0 ); RETURN_FALSE; } diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index d96fffda6f..0c0c80b1cd 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -56,7 +56,6 @@ static void _php_intlgregcal_constructor_body( zend_long largs[6]; UErrorCode status = U_ZERO_ERROR; int variant; - int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; intl_error_reset(NULL); // parameter number validation / variant determination @@ -86,10 +85,8 @@ static void _php_intlgregcal_constructor_body( // argument parsing if (variant <= 2) { - if (zend_parse_parameters_ex(zpp_flags, MIN(ZEND_NUM_ARGS(), 2), + if (zend_parse_parameters(MIN(ZEND_NUM_ARGS(), 2), "|z!s!", &tz_object, &locale, &locale_len) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlgregcal_create_instance: bad arguments", 0); if (!is_constructor) { zval_ptr_dtor(return_value); RETVAL_NULL(); @@ -97,11 +94,9 @@ static void _php_intlgregcal_constructor_body( return; } } - if (variant > 2 && zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(), + if (variant > 2 && zend_parse_parameters(ZEND_NUM_ARGS(), "lll|lll", &largs[0], &largs[1], &largs[2], &largs[3], &largs[4], &largs[5]) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlgregcal_create_instance: bad arguments", 0); if (!is_constructor) { zval_ptr_dtor(return_value); RETVAL_NULL(); @@ -232,8 +227,6 @@ U_CFUNC PHP_FUNCTION(intlgregcal_set_gregorian_change) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Od", &object, GregorianCalendar_ce_ptr, &date) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlgregcal_set_gregorian_change: bad arguments", 0); RETURN_FALSE; } @@ -252,8 +245,6 @@ U_CFUNC PHP_FUNCTION(intlgregcal_get_gregorian_change) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, GregorianCalendar_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlgregcal_get_gregorian_change: bad arguments", 0); RETURN_FALSE; } @@ -269,8 +260,6 @@ U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlgregcal_is_leap_year: bad arguments", 0); RETURN_FALSE; } diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c index 5170d4c720..6710a60b15 100644 --- a/ext/intl/collator/collator_attr.c +++ b/ext/intl/collator/collator_attr.c @@ -41,9 +41,6 @@ PHP_FUNCTION( collator_get_attribute ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol", &object, Collator_ce_ptr, &attribute ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_get_attribute: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -72,9 +69,6 @@ PHP_FUNCTION( collator_set_attribute ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oll", &object, Collator_ce_ptr, &attribute, &value ) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_set_attribute: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -102,9 +96,6 @@ PHP_FUNCTION( collator_get_strength ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, Collator_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_get_strength: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -131,9 +122,6 @@ PHP_FUNCTION( collator_set_strength ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol", &object, Collator_ce_ptr, &strength ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_set_strength: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c index c95d144f1a..c3f6b3bc52 100644 --- a/ext/intl/collator/collator_compare.c +++ b/ext/intl/collator/collator_compare.c @@ -49,9 +49,6 @@ PHP_FUNCTION( collator_compare ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oss", &object, Collator_ce_ptr, &str1, &str1_len, &str2, &str2_len ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_compare: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index 2f0a80468e..fc9d7da41f 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -228,7 +228,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv ) /* Try object's handlers. */ if( Z_OBJ_HT_P(obj)->get ) { - zstr = Z_OBJ_HT_P(obj)->get( obj, rv ); + zstr = Z_OBJ_HT_P(obj)->get( Z_OBJ_P(obj), rv ); switch( Z_TYPE_P( zstr ) ) { @@ -252,7 +252,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv ) { zstr = rv; - if( Z_OBJ_HT_P(obj)->cast_object( obj, zstr, IS_STRING ) == FAILURE ) + if( Z_OBJ_HT_P(obj)->cast_object( Z_OBJ_P(obj), zstr, IS_STRING ) == FAILURE ) { /* cast_object failed => bail out. */ zval_ptr_dtor( zstr ); diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index cb2ff183e2..e5bc724b48 100644 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -31,16 +31,13 @@ static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor) size_t locale_len = 0; zval* object; Collator_object* co; - int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; intl_error_reset( NULL ); object = return_value; /* Parse parameters. */ - if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "s", + if( zend_parse_parameters( ZEND_NUM_ARGS(), "s", &locale, &locale_len ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_create: unable to parse input params", 0 ); return FAILURE; } diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c index b485cf14f1..6781f13d8e 100644 --- a/ext/intl/collator/collator_error.c +++ b/ext/intl/collator/collator_error.c @@ -36,9 +36,6 @@ PHP_FUNCTION( collator_get_error_code ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, Collator_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_get_error_code: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -67,9 +64,6 @@ PHP_FUNCTION( collator_get_error_message ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, Collator_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_get_error_message: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c index 2a379bc977..2c9bf72b30 100644 --- a/ext/intl/collator/collator_locale.c +++ b/ext/intl/collator/collator_locale.c @@ -42,9 +42,6 @@ PHP_FUNCTION( collator_get_locale ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol", &object, Collator_ce_ptr, &type ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_get_locale: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c index 292391c43b..e3f9675375 100644 --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -303,9 +303,6 @@ static void collator_sort_internal( int renumber, INTERNAL_FUNCTION_PARAMETERS ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oa/|l", &object, Collator_ce_ptr, &array, &sort_flags ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_sort_internal: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -397,9 +394,6 @@ PHP_FUNCTION( collator_sort_with_sort_keys ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oa", &object, Collator_ce_ptr, &array ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_sort_with_sort_keys: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -563,9 +557,6 @@ PHP_FUNCTION( collator_get_sort_key ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os", &object, Collator_ce_ptr, &str, &str_len ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "collator_get_sort_key: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp index 5c5e1ca990..0fc7b31cde 100644 --- a/ext/intl/common/common_enum.cpp +++ b/ext/intl/common/common_enum.cpp @@ -211,8 +211,6 @@ static PHP_METHOD(IntlIterator, current) INTLITERATOR_METHOD_INIT_VARS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "IntlIterator::current: bad arguments", 0); return; } @@ -228,8 +226,6 @@ static PHP_METHOD(IntlIterator, key) INTLITERATOR_METHOD_INIT_VARS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "IntlIterator::key: bad arguments", 0); return; } @@ -247,8 +243,6 @@ static PHP_METHOD(IntlIterator, next) INTLITERATOR_METHOD_INIT_VARS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "IntlIterator::next: bad arguments", 0); return; } @@ -264,8 +258,6 @@ static PHP_METHOD(IntlIterator, rewind) INTLITERATOR_METHOD_INIT_VARS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "IntlIterator::rewind: bad arguments", 0); return; } @@ -283,8 +275,6 @@ static PHP_METHOD(IntlIterator, valid) INTLITERATOR_METHOD_INIT_VARS; if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "IntlIterator::valid: bad arguments", 0); return; } diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c index a4a4e56b0a..29b15d456d 100644 --- a/ext/intl/common/common_error.c +++ b/ext/intl/common/common_error.c @@ -54,9 +54,6 @@ PHP_FUNCTION( intl_is_failure ) if( zend_parse_parameters( ZEND_NUM_ARGS(), "l", &err_code ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intl_is_failure: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -76,9 +73,6 @@ PHP_FUNCTION( intl_error_name ) if( zend_parse_parameters( ZEND_NUM_ARGS(), "l", &err_code ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intl_error_name: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index 992a1bade7..6eab9a1713 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -586,8 +586,6 @@ static PHP_METHOD(UConverter, setSubstChars) { int ret = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &chars, &chars_len) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "UConverter::setSubstChars(): bad arguments", 0); RETURN_FALSE; } intl_errors_reset(&objval->error); @@ -721,8 +719,6 @@ static PHP_METHOD(UConverter, reasonText) { zend_long reason; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &reason) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "UConverter::reasonText(): bad arguments", 0); RETURN_FALSE; } intl_error_reset(NULL); @@ -756,8 +752,6 @@ static PHP_METHOD(UConverter, convert) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &str, &str_len, &reverse) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "UConverter::convert(): bad arguments", 0); RETURN_FALSE; } intl_errors_reset(&objval->error); @@ -790,8 +784,6 @@ static PHP_METHOD(UConverter, transcode) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|a!", &str, &str_len, &dest, &dest_len, &src, &src_len, &options) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "UConverter::transcode(): bad arguments", 0); RETURN_FALSE; } intl_error_reset(NULL); @@ -910,8 +902,6 @@ static PHP_METHOD(UConverter, getAliases) { uint16_t i, count; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "UConverter::getAliases(): bad arguments", 0); RETURN_FALSE; } intl_error_reset(NULL); @@ -1042,9 +1032,9 @@ static zend_object *php_converter_create_object(zend_class_entry *ce) { return retval; } -static zend_object *php_converter_clone_object(zval *object) { - php_converter_object *objval, *oldobj = Z_INTL_CONVERTER_P(object); - zend_object *retval = php_converter_object_ctor(Z_OBJCE_P(object), &objval); +static zend_object *php_converter_clone_object(zend_object *object) { + php_converter_object *objval, *oldobj = php_converter_fetch_object(object); + zend_object *retval = php_converter_object_ctor(object->ce, &objval); UErrorCode error = U_ZERO_ERROR; intl_errors_reset(&oldobj->error); diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c index b1821ce0d3..e64b687a5b 100644 --- a/ext/intl/dateformat/dateformat.c +++ b/ext/intl/dateformat/dateformat.c @@ -77,8 +77,6 @@ PHP_FUNCTION( datefmt_get_error_code ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_error_code: unable to parse input params", 0 ); RETURN_FALSE; } @@ -103,9 +101,6 @@ PHP_FUNCTION( datefmt_get_error_message ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_error_message: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c index d44b3d1789..5e8f3b4454 100644 --- a/ext/intl/dateformat/dateformat_attr.c +++ b/ext/intl/dateformat/dateformat_attr.c @@ -38,8 +38,6 @@ PHP_FUNCTION( datefmt_get_datetype ) /* Parse parameters. */ if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_datetype: unable to parse input params", 0 ); RETURN_FALSE; } @@ -64,8 +62,6 @@ PHP_FUNCTION( datefmt_get_timetype ) /* Parse parameters. */ if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_timetype: unable to parse input params", 0 ); RETURN_FALSE; } @@ -95,8 +91,6 @@ PHP_FUNCTION( datefmt_get_pattern ) /* Parse parameters. */ if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_pattern: unable to parse input params", 0 ); RETURN_FALSE; } @@ -140,8 +134,6 @@ PHP_FUNCTION( datefmt_set_pattern ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os", &object, IntlDateFormatter_ce_ptr, &value, &value_len ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_pattern: unable to parse input params", 0); RETURN_FALSE; } @@ -178,8 +170,6 @@ PHP_FUNCTION( datefmt_get_locale ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O|l", &object, IntlDateFormatter_ce_ptr,&loc_type) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_locale: unable to parse input params", 0 ); RETURN_FALSE; } @@ -207,8 +197,6 @@ PHP_FUNCTION( datefmt_is_lenient ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_is_lenient: unable to parse input params", 0 ); RETURN_FALSE; } @@ -235,8 +223,6 @@ PHP_FUNCTION( datefmt_set_lenient ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ob", &object, IntlDateFormatter_ce_ptr,&isLenient ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_lenient: unable to parse input params", 0 ); RETURN_FALSE; } diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp index fec8eb1a67..c6cae6757b 100644 --- a/ext/intl/dateformat/dateformat_attrcpp.cpp +++ b/ext/intl/dateformat/dateformat_attrcpp.cpp @@ -49,8 +49,6 @@ U_CFUNC PHP_FUNCTION(datefmt_get_timezone_id) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_get_timezone_" - "id: unable to parse input params", 0); RETURN_FALSE; } @@ -75,8 +73,6 @@ U_CFUNC PHP_FUNCTION(datefmt_get_timezone) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_timezone: unable to parse input params", 0 ); RETURN_FALSE; } @@ -105,8 +101,6 @@ U_CFUNC PHP_FUNCTION(datefmt_set_timezone) if ( zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oz", &object, IntlDateFormatter_ce_ptr, &timezone_zv) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_set_timezone: " - "unable to parse input params", 0); RETURN_FALSE; } @@ -132,8 +126,6 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_calendar: unable to parse input params", 0); RETURN_FALSE; } @@ -159,9 +151,6 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar_object) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_get_calendar_object: unable to parse input params", - 0); RETURN_FALSE; } @@ -196,8 +185,6 @@ U_CFUNC PHP_FUNCTION(datefmt_set_calendar) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oz", &object, IntlDateFormatter_ce_ptr, &calendar_zv) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "datefmt_set_calendar: unable to parse input params", 0); RETURN_FALSE; } diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index b923f70508..036641cf95 100644 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -77,14 +77,14 @@ zend_object *IntlDateFormatter_object_create(zend_class_entry *ce) /* }}} */ /* {{{ IntlDateFormatter_object_clone */ -zend_object *IntlDateFormatter_object_clone(zval *object) +zend_object *IntlDateFormatter_object_clone(zend_object *object) { IntlDateFormatter_object *dfo, *new_dfo; zend_object *new_obj; - DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; + dfo = php_intl_dateformatter_fetch_object(object); - new_obj = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object)); + new_obj = IntlDateFormatter_ce_ptr->create_object(object->ce); new_dfo = php_intl_dateformatter_fetch_object(new_obj); /* clone standard parts */ zend_objects_clone_members(&new_dfo->zo, &dfo->zo); diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index 9268b9ddf5..fbff95743e 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -65,16 +65,13 @@ static int datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor) UChar* svalue = NULL; /* UTF-16 pattern_str */ int32_t slength = 0; IntlDateFormatter_object* dfo; - int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; intl_error_reset(NULL); object = return_value; /* Parse parameters. */ - if (zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(), "sll|zzs", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll|zzs", &locale_str, &locale_len, &date_type, &time_type, &timezone_zv, &calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: " - "unable to parse input parameters", 0); return FAILURE; } diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c index af96095242..2507713c8a 100644 --- a/ext/intl/dateformat/dateformat_parse.c +++ b/ext/intl/dateformat/dateformat_parse.c @@ -137,7 +137,6 @@ PHP_FUNCTION(datefmt_parse) /* Parse parameters. */ if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os|z!", &object, IntlDateFormatter_ce_ptr, &text_to_parse, &text_len, &z_parse_pos ) == FAILURE ){ - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_parse: unable to parse input params", 0 ); RETURN_FALSE; } @@ -182,7 +181,6 @@ PHP_FUNCTION(datefmt_localtime) /* Parse parameters. */ if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os|z!", &object, IntlDateFormatter_ce_ptr, &text_to_parse, &text_len, &z_parse_pos ) == FAILURE ){ - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_parse_to_localtime: unable to parse input params", 0 ); RETURN_FALSE; } diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c index b04c33eaad..049304d385 100644 --- a/ext/intl/formatter/formatter_attr.c +++ b/ext/intl/formatter/formatter_attr.c @@ -39,9 +39,6 @@ PHP_FUNCTION( numfmt_get_attribute ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol", &object, NumberFormatter_ce_ptr, &attribute ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_get_attribute: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -112,9 +109,6 @@ PHP_FUNCTION( numfmt_get_text_attribute ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol", &object, NumberFormatter_ce_ptr, &attribute ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_get_text_attribute: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -153,9 +147,6 @@ PHP_FUNCTION( numfmt_set_attribute ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Olz", &object, NumberFormatter_ce_ptr, &attribute, &value ) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_set_attribute: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -216,9 +207,6 @@ PHP_FUNCTION( numfmt_set_text_attribute ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ols", &object, NumberFormatter_ce_ptr, &attribute, &value, &len ) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_set_text_attribute: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -257,9 +245,6 @@ PHP_FUNCTION( numfmt_get_symbol ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol", &object, NumberFormatter_ce_ptr, &symbol ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_get_symbol: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -306,9 +291,6 @@ PHP_FUNCTION( numfmt_set_symbol ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ols", &object, NumberFormatter_ce_ptr, &symbol, &value, &value_len ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_set_symbol: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -351,9 +333,6 @@ PHP_FUNCTION( numfmt_get_pattern ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, NumberFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_get_pattern: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -394,9 +373,6 @@ PHP_FUNCTION( numfmt_set_pattern ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os", &object, NumberFormatter_ce_ptr, &value, &value_len ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_set_pattern: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -432,9 +408,6 @@ PHP_FUNCTION( numfmt_get_locale ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O|l", &object, NumberFormatter_ce_ptr, &type ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_get_locale: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c index ad39f39392..31ef45a0fd 100644 --- a/ext/intl/formatter/formatter_class.c +++ b/ext/intl/formatter/formatter_class.c @@ -61,13 +61,13 @@ zend_object *NumberFormatter_object_create(zend_class_entry *ce) /* }}} */ /* {{{ NumberFormatter_object_clone */ -zend_object *NumberFormatter_object_clone(zval *object) +zend_object *NumberFormatter_object_clone(zend_object *object) { NumberFormatter_object *nfo, *new_nfo; zend_object *new_obj; - FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj = NumberFormatter_ce_ptr->create_object(Z_OBJCE_P(object)); + nfo = php_intl_number_format_fetch_object(object); + new_obj = NumberFormatter_ce_ptr->create_object(object->ce); new_nfo = php_intl_number_format_fetch_object(new_obj); /* clone standard parts */ zend_objects_clone_members(&new_nfo->zo, &nfo->zo); diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c index 05ef6789ef..2f812d3dde 100644 --- a/ext/intl/formatter/formatter_format.c +++ b/ext/intl/formatter/formatter_format.c @@ -44,9 +44,6 @@ PHP_FUNCTION( numfmt_format ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oz|l", &object, NumberFormatter_ce_ptr, &number, &type ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_format: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -150,9 +147,6 @@ PHP_FUNCTION( numfmt_format_currency ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ods", &object, NumberFormatter_ce_ptr, &number, ¤cy, ¤cy_len ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_format_currency: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index a4671c093a..959fcd71dd 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -33,15 +33,12 @@ static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor) zend_long style; UChar* spattern = NULL; int32_t spattern_len = 0; - int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "sl|s", + if( zend_parse_parameters( ZEND_NUM_ARGS(), "sl|s", &locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_create: unable to parse input parameters", 0 ); return FAILURE; } @@ -117,9 +114,6 @@ PHP_FUNCTION( numfmt_get_error_code ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, NumberFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_get_error_code: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -144,9 +138,6 @@ PHP_FUNCTION( numfmt_get_error_message ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, NumberFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "numfmt_get_error_message: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c index a2a20f147d..68fcd36e2a 100644 --- a/ext/intl/formatter/formatter_parse.c +++ b/ext/intl/formatter/formatter_parse.c @@ -54,9 +54,6 @@ PHP_FUNCTION( numfmt_parse ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os|lz!", &object, NumberFormatter_ce_ptr, &str, &str_len, &type, &zposition ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "number_parse: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -139,9 +136,6 @@ PHP_FUNCTION( numfmt_parse_currency ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Osz/|z!", &object, NumberFormatter_ce_ptr, &str, &str_len, &zcurrency, &zposition ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "number_parse_currency: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c index 6e5fc4ffb4..0417958b26 100644 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -63,8 +63,6 @@ PHP_FUNCTION(grapheme_strlen) UErrorCode status; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &string, &string_len) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "grapheme_strlen: unable to parse input param", 0 ); RETURN_FALSE; } @@ -116,8 +114,6 @@ PHP_FUNCTION(grapheme_strpos) zend_long ret_pos; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "grapheme_strpos: unable to parse input param", 0 ); RETURN_FALSE; } @@ -179,8 +175,6 @@ PHP_FUNCTION(grapheme_stripos) int is_ascii; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "grapheme_stripos: unable to parse input param", 0 ); RETURN_FALSE; } @@ -248,8 +242,6 @@ PHP_FUNCTION(grapheme_strrpos) int is_ascii; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "grapheme_strrpos: unable to parse input param", 0 ); RETURN_FALSE; } @@ -311,8 +303,6 @@ PHP_FUNCTION(grapheme_strripos) int is_ascii; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "grapheme_strrpos: unable to parse input param", 0 ); RETURN_FALSE; } @@ -391,8 +381,6 @@ PHP_FUNCTION(grapheme_substr) zend_bool no_length = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l!", &str, &str_len, &lstart, &length, &no_length) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "grapheme_substr: unable to parse input param", 0 ); RETURN_FALSE; } @@ -598,10 +586,6 @@ static void strstr_common_handler(INTERNAL_FUNCTION_PARAMETERS, int f_ignore_cas zend_bool part = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|b", &haystack, &haystack_len, &needle, &needle_len, &part) == FAILURE) { - - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "grapheme_strstr: unable to parse input param", 0 ); - RETURN_FALSE; } @@ -789,8 +773,6 @@ PHP_FUNCTION(grapheme_extract) zval *next = NULL; /* return offset of next part of the string */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|llz", &str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "grapheme_extract: unable to parse input param", 0 ); RETURN_FALSE; } diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c index 1bd0d069bf..513b2187cc 100644 --- a/ext/intl/idn/idn.c +++ b/ext/intl/idn/idn.c @@ -33,8 +33,7 @@ /* }}} */ enum { - INTL_IDN_VARIANT_2003 = 0, - INTL_IDN_VARIANT_UTS46 + INTL_IDN_VARIANT_UTS46 = 1 }; /* {{{ grapheme_register_constants @@ -73,7 +72,6 @@ void idn_register_constants( INIT_FUNC_ARGS ) REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT); /* VARIANTS */ - REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT); /* PINFO ERROR CODES */ @@ -176,98 +174,22 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, uidna_close(uts46); } -static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS, - const zend_string *domain, uint32_t option, int mode) -{ - UChar* ustring = NULL; - int ustring_len = 0; - UErrorCode status; - zend_string *u8str; - - /* convert the string to UTF-16. */ - status = U_ZERO_ERROR; - intl_convert_utf8_to_utf16(&ustring, &ustring_len, ZSTR_VAL(domain), ZSTR_LEN(domain), &status); - - if (U_FAILURE(status)) { - intl_error_set_code(NULL, status); - - /* Set error messages. */ - intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 ); - if (ustring) { - efree(ustring); - } - RETURN_FALSE; - } else { - UChar converted[MAXPATHLEN]; - int32_t converted_ret_len; - - status = U_ZERO_ERROR; - -#if U_ICU_VERSION_MAJOR_NUM >= 55 - UIDNAInfo info = UIDNA_INFO_INITIALIZER; - UIDNA *idna = uidna_openUTS46((int32_t)option, &status); - - if (U_FAILURE(status)) { - intl_error_set( NULL, status, "idn_to_ascii: failed to create an UIDNA instance", 0 ); - RETURN_FALSE; - } - - if (mode == INTL_IDN_TO_ASCII) { - converted_ret_len = uidna_nameToASCII(idna, ustring, ustring_len, converted, MAXPATHLEN, &info, &status); - } else { - converted_ret_len = uidna_nameToUnicode(idna, ustring, ustring_len, converted, MAXPATHLEN, &info, &status); - } - uidna_close(idna); -#else - UParseError parse_error; - if (mode == INTL_IDN_TO_ASCII) { - converted_ret_len = uidna_IDNToASCII(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status); - } else { - converted_ret_len = uidna_IDNToUnicode(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status); - } -#endif - efree(ustring); - - if (U_FAILURE(status)) { - intl_error_set( NULL, status, "idn_to_ascii: cannot convert to ASCII", 0 ); - RETURN_FALSE; - } - - status = U_ZERO_ERROR; - u8str = intl_convert_utf16_to_utf8(converted, converted_ret_len, &status); - - if (!u8str) { - /* Set global error code. */ - intl_error_set_code(NULL, status); - - /* Set error messages. */ - intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 ); - RETURN_FALSE; - } - } - - /* return the allocated string, not a duplicate */ - RETVAL_NEW_STR(u8str); -} - static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode) { zend_string *domain; zend_long option = 0, - variant = INTL_IDN_VARIANT_UTS46; + variant = INTL_IDN_VARIANT_UTS46; zval *idna_info = NULL; intl_error_reset(NULL); if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|llz", &domain, &option, &variant, &idna_info) == FAILURE) { - php_intl_bad_args("bad arguments"); RETURN_NULL(); /* don't set FALSE because that's not the way it was before... */ } - if (variant != INTL_IDN_VARIANT_2003 && variant != INTL_IDN_VARIANT_UTS46) { - php_intl_bad_args("invalid variant, must be one of {" - "INTL_IDNA_VARIANT_2003, INTL_IDNA_VARIANT_UTS46}"); + if (variant != INTL_IDN_VARIANT_UTS46) { + php_intl_bad_args("invalid variant, must be INTL_IDNA_VARIANT_UTS46"); RETURN_FALSE; } @@ -281,29 +203,14 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode) } /* don't check options; it wasn't checked before */ - if (variant == INTL_IDN_VARIANT_2003) { - php_error_docref(NULL, E_DEPRECATED, "INTL_IDNA_VARIANT_2003 is deprecated"); - } - if (idna_info != NULL) { - if (variant == INTL_IDN_VARIANT_2003) { - php_error_docref0(NULL, E_NOTICE, - "4 arguments were provided, but INTL_IDNA_VARIANT_2003 only " - "takes 3 - extra argument ignored"); - } else { - idna_info = zend_try_array_init(idna_info); - if (!idna_info) { - return; - } + idna_info = zend_try_array_init(idna_info); + if (!idna_info) { + return; } } - if (variant == INTL_IDN_VARIANT_2003) { - php_intl_idn_to(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode); - } - else { - php_intl_idn_to_46(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode, idna_info); - } + php_intl_idn_to_46(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode, idna_info); } /* {{{ proto string idn_to_ascii(string domain[, int options[, int variant[, array &idna_info]]]) diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index f03aa72928..20a156af91 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -227,9 +227,6 @@ PHP_NAMED_FUNCTION(zif_locale_set_default) if(zend_parse_parameters( ZEND_NUM_ARGS(), "S", &locale_name) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "locale_set_default: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -397,10 +394,6 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) if(zend_parse_parameters( ZEND_NUM_ARGS(), "s", &loc_name ,&loc_name_len ) == FAILURE) { - spprintf(&msg , 0, "locale_get_%s : unable to parse input params", tag_name ); - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, msg , 1 ); - efree(msg); - RETURN_FALSE; } @@ -506,9 +499,6 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME &loc_name, &loc_name_len , &disp_loc_name ,&disp_loc_name_len ) == FAILURE) { - spprintf(&msg , 0, "locale_get_display_%s : unable to parse input params", tag_name ); - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, msg , 1 ); - efree(msg); RETURN_FALSE; } @@ -698,9 +688,6 @@ PHP_FUNCTION( locale_get_keywords ) if(zend_parse_parameters( ZEND_NUM_ARGS(), "s", &loc_name, &loc_name_len ) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "locale_get_keywords: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -920,8 +907,6 @@ PHP_FUNCTION(locale_compose) if(zend_parse_parameters( ZEND_NUM_ARGS(), "a", &arr) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "locale_compose: unable to parse input params", 0 ); RETURN_FALSE; } @@ -1108,9 +1093,6 @@ PHP_FUNCTION(locale_parse) if(zend_parse_parameters( ZEND_NUM_ARGS(), "s", &loc_name, &loc_name_len ) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "locale_parse: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -1158,9 +1140,6 @@ PHP_FUNCTION(locale_get_all_variants) if(zend_parse_parameters( ZEND_NUM_ARGS(), "s", &loc_name, &loc_name_len ) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "locale_parse: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -1264,9 +1243,6 @@ PHP_FUNCTION(locale_filter_matches) &lang_tag, &lang_tag_len , &loc_range , &loc_range_len , &boolCanonical) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "locale_filter_matches: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -1540,7 +1516,6 @@ PHP_FUNCTION(locale_lookup) if(zend_parse_parameters( ZEND_NUM_ARGS(), "as|bS", &arr, &loc_range, &loc_range_len, &boolCanonical, &fallback_loc_str) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_lookup: unable to parse input params", 0 ); RETURN_FALSE; } @@ -1594,8 +1569,6 @@ PHP_FUNCTION(locale_accept_from_http) if(zend_parse_parameters( ZEND_NUM_ARGS(), "s", &http_accept, &http_accept_len) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "locale_accept_from_http: unable to parse input parameters", 0 ); RETURN_FALSE; } if(http_accept_len > ULOC_FULLNAME_CAPACITY) { diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 2439b5855a..dd4420a6ad 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -36,16 +36,13 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor) int spattern_len = 0; zval* object; MessageFormatter_object* mfo; - int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; intl_error_reset( NULL ); object = return_value; /* Parse parameters. */ - if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "ss", + if( zend_parse_parameters( ZEND_NUM_ARGS(), "ss", &locale, &locale_len, &pattern, &pattern_len ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_create: unable to parse input parameters", 0 ); return FAILURE; } @@ -137,9 +134,6 @@ PHP_FUNCTION( msgfmt_get_error_code ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, MessageFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_get_error_code: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -165,9 +159,6 @@ PHP_FUNCTION( msgfmt_get_error_message ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, MessageFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_get_error_message: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c index 51d9df049f..d9f36c6ac3 100644 --- a/ext/intl/msgformat/msgformat_attr.c +++ b/ext/intl/msgformat/msgformat_attr.c @@ -38,8 +38,6 @@ PHP_FUNCTION( msgfmt_get_pattern ) /* Parse parameters. */ if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, MessageFormatter_ce_ptr ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_get_pattern: unable to parse input params", 0 ); RETURN_FALSE; } @@ -71,8 +69,6 @@ PHP_FUNCTION( msgfmt_set_pattern ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os", &object, MessageFormatter_ce_ptr, &value, &value_len ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_set_pattern: unable to parse input params", 0); RETURN_FALSE; } @@ -127,9 +123,6 @@ PHP_FUNCTION( msgfmt_get_locale ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, MessageFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_get_locale: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index a6d5b593a6..854fb95fc3 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -61,13 +61,13 @@ zend_object *MessageFormatter_object_create(zend_class_entry *ce) /* }}} */ /* {{{ MessageFormatter_object_clone */ -zend_object *MessageFormatter_object_clone(zval *object) +zend_object *MessageFormatter_object_clone(zend_object *object) { MessageFormatter_object *mfo, *new_mfo; zend_object *new_obj; - MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; - new_obj = MessageFormatter_ce_ptr->create_object(Z_OBJCE_P(object)); + mfo = php_intl_messageformatter_fetch_object(object); + new_obj = MessageFormatter_ce_ptr->create_object(object->ce); new_mfo = php_intl_messageformatter_fetch_object(new_obj); /* clone standard parts */ zend_objects_clone_members(&new_mfo->zo, &mfo->zo); diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index a11c167a4b..58c5dcb99a 100644 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -65,9 +65,6 @@ PHP_FUNCTION( msgfmt_format ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oa", &object, MessageFormatter_ce_ptr, &args ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_format: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -99,9 +96,6 @@ PHP_FUNCTION( msgfmt_format_message ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "ssa", &slocale, &slocale_len, &pattern, &pattern_len, &args ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_format_message: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c index c517288bff..e1de6a883f 100644 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -69,9 +69,6 @@ PHP_FUNCTION( msgfmt_parse ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os", &object, MessageFormatter_ce_ptr, &source, &source_len ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_parse: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -104,9 +101,6 @@ PHP_FUNCTION( msgfmt_parse_message ) if( zend_parse_parameters( ZEND_NUM_ARGS(), "sss", &slocale, &slocale_len, &pattern, &pattern_len, &source, &src_len ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_parse_message: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c index e05c45875b..8609f8e437 100644 --- a/ext/intl/normalizer/normalizer.c +++ b/ext/intl/normalizer/normalizer.c @@ -42,7 +42,6 @@ void normalizer_register_constants( INIT_FUNC_ARGS ) #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value ); /* Normalization form constants */ - NORMALIZER_EXPOSE_CLASS_CONST( NONE ); NORMALIZER_EXPOSE_CLASS_CONST( FORM_D ); NORMALIZER_EXPOSE_CLASS_CONST( NFD ); NORMALIZER_EXPOSE_CLASS_CONST( FORM_KD ); diff --git a/ext/intl/normalizer/normalizer.h b/ext/intl/normalizer/normalizer.h index 57f0466782..945dfd9656 100644 --- a/ext/intl/normalizer/normalizer.h +++ b/ext/intl/normalizer/normalizer.h @@ -22,7 +22,6 @@ #if U_ICU_VERSION_MAJOR_NUM < 56 #include <unicode/unorm.h> -#define NORMALIZER_NONE UNORM_NONE #define NORMALIZER_FORM_D UNORM_NFD #define NORMALIZER_NFD UNORM_NFD #define NORMALIZER_FORM_KD UNORM_NFKD @@ -35,7 +34,6 @@ #else #include <unicode/unorm2.h> -#define NORMALIZER_NONE 0x2 #define NORMALIZER_FORM_D 0x4 #define NORMALIZER_NFD NORMALIZER_FORM_D #define NORMALIZER_FORM_KD 0x8 diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c index f8336d0101..a6aa66e385 100644 --- a/ext/intl/normalizer/normalizer_normalize.c +++ b/ext/intl/normalizer/normalizer_normalize.c @@ -59,26 +59,8 @@ static const UNormalizer2 *intl_get_normalizer(zend_long form, UErrorCode *err) static int32_t intl_normalize(zend_long form, const UChar *src, int32_t src_len, UChar *dst, int32_t dst_len, UErrorCode *err) {/*{{{*/ - const UNormalizer2 *norm; - - /* Mimic the behavior of ICU < 56. */ - if (UNEXPECTED(NORMALIZER_NONE == form)) { - /* FIXME This is a noop which should be removed somewhen after PHP 7.3.*/ - zend_error(E_DEPRECATED, "Normalizer::NONE is obsolete with ICU 56 and above and will be removed in later PHP versions"); - - if (dst_len >= src_len) { - memmove(dst, src, sizeof(UChar) * src_len); - dst[src_len] = '\0'; - *err = U_ZERO_ERROR; - return src_len; - } - - *err = U_BUFFER_OVERFLOW_ERROR; - return -1; - } - - norm = intl_get_normalizer(form, err); - if(U_FAILURE(*err)) { + const UNormalizer2 *norm = intl_get_normalizer(form, err); + if (U_FAILURE(*err)) { return -1; } @@ -127,17 +109,12 @@ PHP_FUNCTION( normalizer_normalize ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "s|l", &input, &input_len, &form ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "normalizer_normalize: unable to parse input params", 0 ); - RETURN_FALSE; } expansion_factor = 1; switch(form) { - case NORMALIZER_NONE: - break; case NORMALIZER_FORM_D: expansion_factor = 3; break; @@ -269,15 +246,10 @@ PHP_FUNCTION( normalizer_is_normalized ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "s|l", &input, &input_len, &form) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "normalizer_is_normalized: unable to parse input params", 0 ); - RETURN_FALSE; } switch(form) { - /* case NORMALIZER_NONE: not allowed - doesn't make sense */ - case NORMALIZER_FORM_D: case NORMALIZER_FORM_KD: case NORMALIZER_FORM_C: diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 2feb6edb13..d20fe7d55f 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -82,18 +82,15 @@ static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constr const char *locale; size_t locale_len = 0; zend_bool fallback = 1; - int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; zval *object = return_value; ResourceBundle_object *rb = Z_INTL_RESOURCEBUNDLE_P( object ); intl_error_reset( NULL ); - if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "s!s!|b", + if( zend_parse_parameters( ZEND_NUM_ARGS(), "s!s!|b", &locale, &locale_len, &bundlename, &bundlename_len, &fallback ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "resourcebundle_ctor: unable to parse input parameters", 0 ); return FAILURE; } @@ -176,7 +173,7 @@ PHP_FUNCTION( resourcebundle_create ) /* }}} */ /* {{{ resourcebundle_array_fetch */ -static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback) +static void resourcebundle_array_fetch(zend_object *object, zval *offset, zval *return_value, int fallback) { int32_t meindex = 0; char * mekey = NULL; @@ -185,7 +182,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_ ResourceBundle_object *rb; intl_error_reset( NULL ); - RESOURCEBUNDLE_METHOD_FETCH_OBJECT; + rb = php_intl_resourcebundle_fetch_object(object); if(Z_TYPE_P(offset) == IS_LONG) { is_numeric = 1; @@ -230,7 +227,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_ /* }}} */ /* {{{ resourcebundle_array_get */ -zval *resourcebundle_array_get(zval *object, zval *offset, int type, zval *rv) +zval *resourcebundle_array_get(zend_object *object, zval *offset, int type, zval *rv) { if(offset == NULL) { php_error( E_ERROR, "Cannot apply [] to ResourceBundle object" ); @@ -259,20 +256,17 @@ PHP_FUNCTION( resourcebundle_get ) zval * object; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oz|b", &object, ResourceBundle_ce_ptr, &offset, &fallback ) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "resourcebundle_get: unable to parse input params", 0); RETURN_FALSE; } - resourcebundle_array_fetch(object, offset, return_value, fallback); + resourcebundle_array_fetch(Z_OBJ_P(object), offset, return_value, fallback); } /* }}} */ /* {{{ resourcebundle_array_count */ -int resourcebundle_array_count(zval *object, zend_long *count) +int resourcebundle_array_count(zend_object *object, zend_long *count) { - ResourceBundle_object *rb; - RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK; + ResourceBundle_object *rb = php_intl_resourcebundle_fetch_object(object); if (rb->me == NULL) { intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR, @@ -301,8 +295,6 @@ PHP_FUNCTION( resourcebundle_count ) RESOURCEBUNDLE_METHOD_INIT_VARS; if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, ResourceBundle_ce_ptr ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "resourcebundle_count: unable to parse input params", 0); RETURN_FALSE; } @@ -335,8 +327,6 @@ PHP_FUNCTION( resourcebundle_locales ) if( zend_parse_parameters(ZEND_NUM_ARGS(), "s", &bundlename, &bundlename_len ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "resourcebundle_locales: unable to parse input params", 0); RETURN_FALSE; } @@ -380,8 +370,6 @@ PHP_FUNCTION( resourcebundle_get_error_code ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, ResourceBundle_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "resourcebundle_get_error_code: unable to parse input params", 0 ); RETURN_FALSE; } @@ -408,8 +396,6 @@ PHP_FUNCTION( resourcebundle_get_error_message ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, ResourceBundle_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "resourcebundle_get_error_message: unable to parse input params", 0 ); RETURN_FALSE; } diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c index d8bca44dba..52632ed122 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.c +++ b/ext/intl/spoofchecker/spoofchecker_class.c @@ -108,15 +108,15 @@ static const zend_function_entry Spoofchecker_class_functions[] = { }; /* }}} */ -static zend_object *spoofchecker_clone_obj(zval *object) /* {{{ */ +static zend_object *spoofchecker_clone_obj(zend_object *object) /* {{{ */ { zend_object *new_obj_val; Spoofchecker_object *sfo, *new_sfo; - sfo = Z_INTL_SPOOFCHECKER_P(object); + sfo = php_intl_spoofchecker_fetch_object(object); intl_error_reset(SPOOFCHECKER_ERROR_P(sfo)); - new_obj_val = Spoofchecker_ce_ptr->create_object(Z_OBJCE_P(object)); + new_obj_val = Spoofchecker_ce_ptr->create_object(object->ce); new_sfo = php_intl_spoofchecker_fetch_object(new_obj_val); /* clone standard parts */ zend_objects_clone_members(&new_sfo->zo, &sfo->zo); diff --git a/ext/intl/tests/breakiter_createCodePointInstance_error.phpt b/ext/intl/tests/breakiter_createCodePointInstance_error.phpt deleted file mode 100644 index 13adc53b03..0000000000 --- a/ext/intl/tests/breakiter_createCodePointInstance_error.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -IntlBreakIterator::createCodePointInstance(): bad arguments ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -var_dump(IntlBreakIterator::createCodePointInstance(array())); ---EXPECTF-- -Warning: IntlBreakIterator::createCodePointInstance() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlBreakIterator::createCodePointInstance(): breakiter_create_code_point_instance: bad arguments in %s on line %d -NULL diff --git a/ext/intl/tests/breakiter_factories_error.phpt b/ext/intl/tests/breakiter_factories_error.phpt deleted file mode 100644 index 4f3a912a15..0000000000 --- a/ext/intl/tests/breakiter_factories_error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -IntlBreakIterator factory methods: argument errors ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -var_dump(IntlBreakIterator::createWordInstance(array())); -var_dump(IntlBreakIterator::createSentenceInstance(NULL, 2)); -var_dump(IntlBreakIterator::createCharacterInstance(NULL, 2)); -var_dump(IntlBreakIterator::createTitleInstance(NULL, 2)); -var_dump(IntlBreakIterator::createLineInstance(NULL, 2)); ---EXPECTF-- -Warning: IntlBreakIterator::createWordInstance() expects parameter 1 to be string, array given in %s on line %d - -Warning: IntlBreakIterator::createWordInstance(): breakiter_create_word_instance: bad arguments in %s on line %d -NULL - -Warning: IntlBreakIterator::createSentenceInstance() expects at most 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::createSentenceInstance(): breakiter_create_sentence_instance: bad arguments in %s on line %d -NULL - -Warning: IntlBreakIterator::createCharacterInstance() expects at most 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::createCharacterInstance(): breakiter_create_character_instance: bad arguments in %s on line %d -NULL - -Warning: IntlBreakIterator::createTitleInstance() expects at most 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::createTitleInstance(): breakiter_create_title_instance: bad arguments in %s on line %d -NULL - -Warning: IntlBreakIterator::createLineInstance() expects at most 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::createLineInstance(): breakiter_create_line_instance: bad arguments in %s on line %d -NULL diff --git a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt deleted file mode 100644 index da37ffea78..0000000000 --- a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -IntlBreakIterator::first()/last()/previous()/current(): arg errors ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;'); -$bi->setText("\x80sdfé\x90d888 dfsa9"); - -var_dump($bi->first(1)); -var_dump($bi->last(1)); -var_dump($bi->previous(1)); -var_dump($bi->current(1)); ---EXPECTF-- -Warning: IntlBreakIterator::first() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlBreakIterator::first(): breakiter_first: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::last() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlBreakIterator::last(): breakiter_last: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::previous() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlBreakIterator::previous(): breakiter_previous: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::current() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlBreakIterator::current(): breakiter_current: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt deleted file mode 100644 index 56ed60ffcf..0000000000 --- a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -IntlBreakIterator::following()/preceding()/isBoundary(): arg errors ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;'); -$bi->setText("\x80sdfé\x90d888 dfsa9"); - -var_dump($bi->following(1, 2)); -var_dump($bi->following(array())); -var_dump($bi->preceding(1, 2)); -var_dump($bi->preceding(array())); -var_dump($bi->isBoundary(1, 2)); -var_dump($bi->isBoundary(array())); ---EXPECTF-- -Warning: IntlBreakIterator::following() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::following(): breakiter_following: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::following() expects parameter 1 to be int, array given in %s on line %d - -Warning: IntlBreakIterator::following(): breakiter_following: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::preceding() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::preceding() expects parameter 1 to be int, array given in %s on line %d - -Warning: IntlBreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::isBoundary() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::isBoundary() expects parameter 1 to be int, array given in %s on line %d - -Warning: IntlBreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/breakiter_getLocale_error.phpt b/ext/intl/tests/breakiter_getLocale_error.phpt deleted file mode 100644 index f318743948..0000000000 --- a/ext/intl/tests/breakiter_getLocale_error.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -IntlBreakIterator::getLocale(): arg errors ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;'); -$bi->setText("\x80sdfé\x90d888 dfsa9"); - -var_dump($bi->getLocale(1, 2)); -var_dump($bi->getLocale(array())); -var_dump($bi->getLocale()); ---EXPECTF-- -Warning: IntlBreakIterator::getLocale() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::getLocale() expects parameter 1 to be int, array given in %s on line %d - -Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::getLocale() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/breakiter_getPartsIterator_error.phpt b/ext/intl/tests/breakiter_getPartsIterator_error.phpt index b756540578..506b376c19 100644 --- a/ext/intl/tests/breakiter_getPartsIterator_error.phpt +++ b/ext/intl/tests/breakiter_getPartsIterator_error.phpt @@ -10,23 +10,11 @@ ini_set("intl.error_level", E_WARNING); ini_set("intl.default_locale", "pt_PT"); $it = IntlBreakIterator::createWordInstance(NULL); -var_dump($it->getPartsIterator(array())); -var_dump($it->getPartsIterator(1, 2)); var_dump($it->getPartsIterator(-1)); ?> ==DONE== --EXPECTF-- -Warning: IntlBreakIterator::getPartsIterator() expects parameter 1 to be int, array given in %s on line %d - -Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::getPartsIterator() expects at most 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad arguments in %s on line %d -bool(false) - Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad key type in %s on line %d bool(false) ==DONE== diff --git a/ext/intl/tests/breakiter_getText_error.phpt b/ext/intl/tests/breakiter_getText_error.phpt deleted file mode 100644 index d66b4bb69f..0000000000 --- a/ext/intl/tests/breakiter_getText_error.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -IntlBreakIterator::getText(): arg errors ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -$bi = new IntlRuleBasedBreakIterator('[\p{Letter}]+;'); -var_dump($bi->getText(array())); ---EXPECTF-- -Warning: IntlBreakIterator::getText() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlBreakIterator::getText(): breakiter_get_text: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/breakiter_next_error.phpt b/ext/intl/tests/breakiter_next_error.phpt deleted file mode 100644 index eb4664308c..0000000000 --- a/ext/intl/tests/breakiter_next_error.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -IntlBreakIterator::next(): arg errors ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;'); -$bi->setText("\x80sdfé\x90d888 dfsa9"); - -var_dump($bi->next(1, 2)); -var_dump($bi->next(array())); ---EXPECTF-- -Warning: IntlBreakIterator::next() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::next(): breakiter_next: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::next() expects parameter 1 to be int, array given in %s on line %d - -Warning: IntlBreakIterator::next(): breakiter_next: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/breakiter_setText_error.phpt b/ext/intl/tests/breakiter_setText_error.phpt deleted file mode 100644 index c94a8433f1..0000000000 --- a/ext/intl/tests/breakiter_setText_error.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -IntlBreakIterator::setText(): arg errors ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -$bi = new IntlRuleBasedBreakIterator('[\p{Letter}]+;'); -var_dump($bi->setText()); -var_dump($bi->setText(array())); -var_dump($bi->setText(1,2)); - -class A { -function __destruct() { var_dump('destructed'); throw new Exception('e'); } -function __tostring() { return 'foo'; } -} - -try { -var_dump($bi->setText(new A)); -} catch (Exception $e) { -var_dump($e->getMessage()); -} ---EXPECTF-- -Warning: IntlBreakIterator::setText() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::setText() expects parameter 1 to be string, array given in %s on line %d - -Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d -bool(false) - -Warning: IntlBreakIterator::setText() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d -bool(false) -string(10) "destructed" -string(1) "e" diff --git a/ext/intl/tests/calendar_add_error.phpt b/ext/intl/tests/calendar_add_error.phpt index 017551821d..1fc12828e1 100644 --- a/ext/intl/tests/calendar_add_error.phpt +++ b/ext/intl/tests/calendar_add_error.phpt @@ -10,33 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->add(1, 2, 3)); -var_dump($c->add(-1, 2)); -var_dump($c->add(1)); - -var_dump(intlcal_add($c, 1, 2, 3)); var_dump(intlcal_add(1, 2, 3)); --EXPECTF-- -Warning: IntlCalendar::add() expects exactly 2 parameters, 3 given in %s on line %d - -Warning: IntlCalendar::add(): intlcal_add: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::add(): intlcal_add: invalid field in %s on line %d -bool(false) - -Warning: IntlCalendar::add() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::add(): intlcal_add: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_add() expects exactly 3 parameters, 4 given in %s on line %d - -Warning: intlcal_add(): intlcal_add: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_add() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_add(1, 2, 3) diff --git a/ext/intl/tests/calendar_before_after_error.phpt b/ext/intl/tests/calendar_before_after_error.phpt index 279e3d816e..805f064841 100644 --- a/ext/intl/tests/calendar_before_after_error.phpt +++ b/ext/intl/tests/calendar_before_after_error.phpt @@ -61,25 +61,18 @@ try { echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- -error: 2, IntlCalendar::after() expects exactly 1 parameter, 0 given -error: 2, IntlCalendar::after(): intlcal_before/after: bad arguments -bool(false) -error: 2, IntlCalendar::before() expects exactly 1 parameter, 0 given -error: 2, IntlCalendar::before(): intlcal_before/after: bad arguments -bool(false) +error: 0, IntlCalendar::after() expects exactly 1 parameter, 0 given + +error: 0, IntlCalendar::before() expects exactly 1 parameter, 0 given + error: 0, Argument 1 passed to IntlCalendar::after() must be an instance of IntlCalendar, int given error: 0, Argument 1 passed to IntlCalendar::before() must be an instance of IntlCalendar, int given -error: 2, IntlCalendar::after() expects exactly 1 parameter, 2 given -error: 2, IntlCalendar::after(): intlcal_before/after: bad arguments -bool(false) -error: 2, IntlCalendar::before() expects exactly 1 parameter, 2 given -error: 2, IntlCalendar::before(): intlcal_before/after: bad arguments -bool(false) -error: 2, intlcal_after() expects exactly 2 parameters, 1 given -error: 2, intlcal_after(): intlcal_before/after: bad arguments -bool(false) -error: 2, intlcal_before() expects exactly 2 parameters, 1 given -error: 2, intlcal_before(): intlcal_before/after: bad arguments -bool(false) +error: 0, IntlCalendar::after() expects exactly 1 parameter, 2 given + +error: 0, IntlCalendar::before() expects exactly 1 parameter, 2 given + +error: 0, intlcal_after() expects exactly 2 parameters, 1 given + +error: 0, intlcal_before() expects exactly 2 parameters, 1 given diff --git a/ext/intl/tests/calendar_clear_error.phpt b/ext/intl/tests/calendar_clear_error.phpt index bffa103eac..e91b7a6326 100644 --- a/ext/intl/tests/calendar_clear_error.phpt +++ b/ext/intl/tests/calendar_clear_error.phpt @@ -12,17 +12,11 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->clear(1, 2)); var_dump($c->clear(-1)); var_dump(intlcal_clear($c, -1)); var_dump(intlcal_clear(1, 2)); --EXPECTF-- -Warning: IntlCalendar::clear() expects at most 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::clear(): intlcal_clear: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::clear(): intlcal_clear: invalid field in %s on line %d bool(false) diff --git a/ext/intl/tests/calendar_createInstance_error.phpt b/ext/intl/tests/calendar_createInstance_error.phpt index 5cb9fa1c63..516cc9260e 100644 --- a/ext/intl/tests/calendar_createInstance_error.phpt +++ b/ext/intl/tests/calendar_createInstance_error.phpt @@ -12,25 +12,7 @@ class X extends IntlTimeZone { function __construct() {} } -var_dump(IntlCalendar::createInstance(1, 2, 3)); -var_dump(intlcal_create_instance(1, 2, 3)); var_dump(intlcal_create_instance(new X, NULL)); -var_dump(intlcal_create_instance(NULL, array())); --EXPECTF-- -Warning: IntlCalendar::createInstance() expects at most 2 parameters, 3 given in %s on line %d - -Warning: IntlCalendar::createInstance(): intlcal_create_calendar: bad arguments in %s on line %d -NULL - -Warning: intlcal_create_instance() expects at most 2 parameters, 3 given in %s on line %d - -Warning: intlcal_create_instance(): intlcal_create_calendar: bad arguments in %s on line %d -NULL - Warning: intlcal_create_instance(): intlcal_create_instance: passed IntlTimeZone is not properly constructed in %s on line %d NULL - -Warning: intlcal_create_instance() expects parameter 2 to be string, array given in %s on line %d - -Warning: intlcal_create_instance(): intlcal_create_calendar: bad arguments in %s on line %d -NULL diff --git a/ext/intl/tests/calendar_equals_error.phpt b/ext/intl/tests/calendar_equals_error.phpt index 4c585a6018..d716c1a698 100644 --- a/ext/intl/tests/calendar_equals_error.phpt +++ b/ext/intl/tests/calendar_equals_error.phpt @@ -45,9 +45,8 @@ try { echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- -error: 2, IntlCalendar::equals() expects exactly 1 parameter, 0 given -error: 2, IntlCalendar::equals(): intlcal_equals: bad arguments -bool(false) +error: 0, IntlCalendar::equals() expects exactly 1 parameter, 0 given + error: 0, Argument 1 passed to IntlCalendar::equals() must be an instance of IntlCalendar, instance of stdClass given error: 0, Argument 1 passed to IntlCalendar::equals() must be an instance of IntlCalendar, int given diff --git a/ext/intl/tests/calendar_fieldDifference_error.phpt b/ext/intl/tests/calendar_fieldDifference_error.phpt index 4f3fc351cb..fa88605348 100644 --- a/ext/intl/tests/calendar_fieldDifference_error.phpt +++ b/ext/intl/tests/calendar_fieldDifference_error.phpt @@ -12,30 +12,25 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->fieldDifference($c, 2, 3)); +try { + var_dump($c->fieldDifference($c, 2, 3)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($c->fieldDifference(INF, 2)); -var_dump($c->fieldDifference(1)); -var_dump(intlcal_field_difference($c, 0, 1, 2)); +try { + var_dump(intlcal_field_difference($c, 0, 1, 2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(intlcal_field_difference(1, 0, 1)); --EXPECTF-- -Warning: IntlCalendar::fieldDifference() expects exactly 2 parameters, 3 given in %s on line %d - -Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: bad arguments in %s on line %d -bool(false) +IntlCalendar::fieldDifference() expects exactly 2 parameters, 3 given Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: Call to ICU method has failed in %s on line %d bool(false) - -Warning: IntlCalendar::fieldDifference() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_field_difference() expects exactly 3 parameters, 4 given in %s on line %d - -Warning: intlcal_field_difference(): intlcal_field_difference: bad arguments in %s on line %d -bool(false) +intlcal_field_difference() expects exactly 3 parameters, 4 given Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_field_difference() must be an instance of IntlCalendar, int given in %s:%d Stack trace: diff --git a/ext/intl/tests/calendar_fromDateTime_error.phpt b/ext/intl/tests/calendar_fromDateTime_error.phpt index 1074159687..6fbaeb57f8 100644 --- a/ext/intl/tests/calendar_fromDateTime_error.phpt +++ b/ext/intl/tests/calendar_fromDateTime_error.phpt @@ -10,13 +10,10 @@ ini_set("intl.error_level", E_WARNING); ini_set("intl.default_locale", "nl"); date_default_timezone_set('Europe/Lisbon'); -var_dump(IntlCalendar::fromDateTime()); -var_dump(IntlCalendar::fromDateTime(0,1,2)); - try { -IntlCalendar::fromDateTime("foobar"); + IntlCalendar::fromDateTime("foobar"); } catch (Exception $e) { - echo "threw exception, OK"; + echo "threw exception, OK"; } class A extends DateTime { function __construct() {} @@ -29,18 +26,7 @@ var_dump(IntlCalendar::fromDateTime($date)); $date = new DateTime('2012-01-01 00:00:00 WEST'); var_dump(IntlCalendar::fromDateTime($date)); - -var_dump(intlcal_from_date_time()); --EXPECTF-- -Warning: IntlCalendar::fromDateTime() expects at least 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d -NULL - -Warning: IntlCalendar::fromDateTime() expects at most 2 parameters, 3 given in %s on line %d - -Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d -NULL threw exception, OK Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: DateTime object is unconstructed in %s on line %d NULL @@ -50,8 +36,3 @@ NULL Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d NULL - -Warning: intlcal_from_date_time() expects at least 1 parameter, 0 given in %s on line %d - -Warning: intlcal_from_date_time(): intlcal_from_date_time: bad arguments in %s on line %d -NULL diff --git a/ext/intl/tests/calendar_getAvailableLocales_error.phpt b/ext/intl/tests/calendar_getAvailableLocales_error.phpt deleted file mode 100644 index 3aee500fea..0000000000 --- a/ext/intl/tests/calendar_getAvailableLocales_error.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -IntlCalendar::getAvailableLocales(): bad arguments ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -var_dump(intlcal_get_available_locales(1)); -var_dump(IntlCalendar::getAvailableLocales(2)); ---EXPECTF-- -Warning: intlcal_get_available_locales() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: intlcal_get_available_locales(): intlcal_get_available_locales: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getAvailableLocales() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getAvailableLocales(): intlcal_get_available_locales: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/calendar_getDayOfWeekType_error.phpt b/ext/intl/tests/calendar_getDayOfWeekType_error.phpt index 46fe17d9cd..2722f54052 100644 --- a/ext/intl/tests/calendar_getDayOfWeekType_error.phpt +++ b/ext/intl/tests/calendar_getDayOfWeekType_error.phpt @@ -12,31 +12,13 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->getDayOfWeekType(1, 2)); var_dump($c->getDayOfWeekType(0)); -var_dump($c->getDayOfWeekType()); -var_dump(intlcal_get_day_of_week_type($c, "foo")); var_dump(intlcal_get_day_of_week_type(1, 1)); --EXPECTF-- -Warning: IntlCalendar::getDayOfWeekType() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::getDayOfWeekType(): intlcal_get_day_of_week_type: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::getDayOfWeekType(): intlcal_get_day_of_week_type: invalid day of week in %s on line %d bool(false) -Warning: IntlCalendar::getDayOfWeekType() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::getDayOfWeekType(): intlcal_get_day_of_week_type: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_get_day_of_week_type() expects parameter 2 to be int, string given in %s on line %d - -Warning: intlcal_get_day_of_week_type(): intlcal_get_day_of_week_type: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_day_of_week_type() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_get_day_of_week_type(1, 1) diff --git a/ext/intl/tests/calendar_getErrorCode_error.phpt b/ext/intl/tests/calendar_getErrorCode_error.phpt index fd999fbbbf..56e748fa12 100644 --- a/ext/intl/tests/calendar_getErrorCode_error.phpt +++ b/ext/intl/tests/calendar_getErrorCode_error.phpt @@ -10,17 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->getErrorCode(array())); - var_dump(intlcal_get_error_code(null)); --EXPECTF-- -Warning: IntlCalendar::getErrorCode() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getErrorCode(): intlcal_get_error_code: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_error_code() must be an instance of IntlCalendar, null given in %s:%d Stack trace: #0 %s(%d): intlcal_get_error_code(NULL) diff --git a/ext/intl/tests/calendar_getErrorMessage_error.phpt b/ext/intl/tests/calendar_getErrorMessage_error.phpt index cc52449d94..8cdbb1f34b 100644 --- a/ext/intl/tests/calendar_getErrorMessage_error.phpt +++ b/ext/intl/tests/calendar_getErrorMessage_error.phpt @@ -10,17 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->getErrorMessage(array())); - var_dump(intlcal_get_error_message(null)); --EXPECTF-- -Warning: IntlCalendar::getErrorMessage() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getErrorMessage(): intlcal_get_error_message: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_error_message() must be an instance of IntlCalendar, null given in %s:%d Stack trace: #0 %s(%d): intlcal_get_error_message(NULL) diff --git a/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt b/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt index ca2dc4a9f2..68e0fd9074 100644 --- a/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt +++ b/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt @@ -10,23 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->getFirstDayOfWeek(1)); - -var_dump(intlcal_get_first_day_of_week($c, 1)); var_dump(intlcal_get_first_day_of_week(1)); --EXPECTF-- -Warning: IntlCalendar::getFirstDayOfWeek() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getFirstDayOfWeek(): intlcal_get_first_day_of_week: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_get_first_day_of_week() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlcal_get_first_day_of_week(): intlcal_get_first_day_of_week: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_first_day_of_week() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_get_first_day_of_week(1) diff --git a/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt b/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt deleted file mode 100644 index 717c435be7..0000000000 --- a/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -IntlCalendar::getKeywordValuesForLocale(): bad arguments ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -var_dump(intlcal_get_keyword_values_for_locale(1, 2)); -var_dump(IntlCalendar::getKeywordValuesForLocale(1, 2, array())); ---EXPECTF-- -Warning: intlcal_get_keyword_values_for_locale() expects exactly 3 parameters, 2 given in %s on line %d - -Warning: intlcal_get_keyword_values_for_locale(): intlcal_get_keyword_values_for_locale: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getKeywordValuesForLocale() expects parameter 3 to be bool, array given in %s on line %d - -Warning: IntlCalendar::getKeywordValuesForLocale(): intlcal_get_keyword_values_for_locale: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/calendar_getLocale_error.phpt b/ext/intl/tests/calendar_getLocale_error.phpt index 008e1b756e..c033d82cf3 100644 --- a/ext/intl/tests/calendar_getLocale_error.phpt +++ b/ext/intl/tests/calendar_getLocale_error.phpt @@ -10,33 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->getLocale()); -var_dump($c->getLocale(2)); -var_dump($c->getLocale(2, 3)); - -var_dump(intlcal_get_locale($c)); var_dump(intlcal_get_locale(1)); --EXPECTF-- -Warning: IntlCalendar::getLocale() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::getLocale(): intlcal_get_locale: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getLocale(): intlcal_get_locale: invalid locale type in %s on line %d -bool(false) - -Warning: IntlCalendar::getLocale() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::getLocale(): intlcal_get_locale: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_get_locale() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: intlcal_get_locale(): intlcal_get_locale: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_locale() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_get_locale(1) diff --git a/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt b/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt index a1190e5ce0..fe3825ad68 100644 --- a/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt +++ b/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt @@ -10,23 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->getMinimalDaysInFirstWeek(1)); - -var_dump(intlcal_get_minimal_days_in_first_week($c, 1)); var_dump(intlcal_get_minimal_days_in_first_week(1)); --EXPECTF-- -Warning: IntlCalendar::getMinimalDaysInFirstWeek() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getMinimalDaysInFirstWeek(): intlcal_get_minimal_days_in_first_week: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_get_minimal_days_in_first_week() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlcal_get_minimal_days_in_first_week(): intlcal_get_minimal_days_in_first_week: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_minimal_days_in_first_week() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_get_minimal_days_in_first_week(1) diff --git a/ext/intl/tests/calendar_getNow_error.phpt b/ext/intl/tests/calendar_getNow_error.phpt deleted file mode 100644 index 712e210851..0000000000 --- a/ext/intl/tests/calendar_getNow_error.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -IntlCalendar::getNow(): bad arguments ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -var_dump(intlcal_get_now(1)); -var_dump(IntlCalendar::getNow(2)); ---EXPECTF-- -Warning: intlcal_get_now() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: intlcal_get_now(): intlcal_get_now: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getNow() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getNow(): intlcal_get_now: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt b/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt index 06aa679c5a..57eca0996e 100644 --- a/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt +++ b/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt @@ -10,36 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->getSkippedWallTimeOption(1)); -var_dump($c->getRepeatedWallTimeOption(1)); - -var_dump(intlcal_get_skipped_wall_time_option($c, 1)); -var_dump(intlcal_get_repeated_wall_time_option($c, 1)); - var_dump(intlcal_get_skipped_wall_time_option(1)); --EXPECTF-- -Warning: IntlCalendar::getSkippedWallTimeOption() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getSkippedWallTimeOption(): intlcal_get_skipped_wall_time_option: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getRepeatedWallTimeOption() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getRepeatedWallTimeOption(): intlcal_get_repeated_wall_time_option: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_get_skipped_wall_time_option() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlcal_get_skipped_wall_time_option(): intlcal_get_skipped_wall_time_option: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_get_repeated_wall_time_option() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlcal_get_repeated_wall_time_option(): intlcal_get_repeated_wall_time_option: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_skipped_wall_time_option() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_get_skipped_wall_time_option(1) diff --git a/ext/intl/tests/calendar_getTimeZone_error.phpt b/ext/intl/tests/calendar_getTimeZone_error.phpt index ea7e85db4c..f78d93f454 100644 --- a/ext/intl/tests/calendar_getTimeZone_error.phpt +++ b/ext/intl/tests/calendar_getTimeZone_error.phpt @@ -10,23 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->getTimeZone(1)); - -var_dump(intlcal_get_time_zone($c, 1)); var_dump(intlcal_get_time_zone(1)); --EXPECTF-- -Warning: IntlCalendar::getTimeZone() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getTimeZone(): intlcal_get_time_zone: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_get_time_zone() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlcal_get_time_zone(): intlcal_get_time_zone: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_time_zone() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_get_time_zone(1) diff --git a/ext/intl/tests/calendar_getTime_error.phpt b/ext/intl/tests/calendar_getTime_error.phpt index 61eaea97dc..51cb0cfe7e 100644 --- a/ext/intl/tests/calendar_getTime_error.phpt +++ b/ext/intl/tests/calendar_getTime_error.phpt @@ -10,23 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->getTime(1)); - -var_dump(intlcal_get_time($c, 1)); var_dump(intlcal_get_time(1)); --EXPECTF-- -Warning: IntlCalendar::getTime() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getTime(): intlcal_get_time: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_get_time() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlcal_get_time(): intlcal_get_time: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_time() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_get_time(1) diff --git a/ext/intl/tests/calendar_getType_error.phpt b/ext/intl/tests/calendar_getType_error.phpt index c124151893..abc5f17fdd 100644 --- a/ext/intl/tests/calendar_getType_error.phpt +++ b/ext/intl/tests/calendar_getType_error.phpt @@ -10,23 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->getType(1)); - -var_dump(intlcal_get_type($c, 1)); var_dump(intlcal_get_type(1)); --EXPECTF-- -Warning: IntlCalendar::getType() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::getType(): intlcal_get_type: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_get_type() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlcal_get_type(): intlcal_get_type: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_type() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_get_type(1) diff --git a/ext/intl/tests/calendar_getWeekendTransition_error.phpt b/ext/intl/tests/calendar_getWeekendTransition_error.phpt index d61c9d5a25..f6a4a71c18 100644 --- a/ext/intl/tests/calendar_getWeekendTransition_error.phpt +++ b/ext/intl/tests/calendar_getWeekendTransition_error.phpt @@ -11,32 +11,13 @@ if (!extension_loaded('intl')) ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->getWeekendTransition()); -var_dump($c->getWeekendTransition(1, 2)); var_dump($c->getWeekendTransition(0)); -var_dump(intlcal_get_weekend_transition($c)); var_dump(intlcal_get_weekend_transition(1, 1)); --EXPECTF-- -Warning: IntlCalendar::getWeekendTransition() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::getWeekendTransition(): intlcal_get_weekend_transition: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getWeekendTransition() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::getWeekendTransition(): intlcal_get_weekend_transition: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::getWeekendTransition(): intlcal_get_weekend_transition: invalid day of week in %s on line %d bool(false) -Warning: intlcal_get_weekend_transition() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: intlcal_get_weekend_transition(): intlcal_get_weekend_transition: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_weekend_transition() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_get_weekend_transition(1, 1) diff --git a/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt b/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt index 6c6f67f953..9612862119 100644 --- a/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt +++ b/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt @@ -12,11 +12,6 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->getLeastMaximum()); -var_dump($c->getMaximum()); -var_dump($c->getGreatestMinimum()); -var_dump($c->getMinimum()); - var_dump($c->getLeastMaximum(-1)); var_dump($c->getMaximum(-1)); var_dump($c->getGreatestMinimum(-1)); @@ -53,26 +48,6 @@ try { echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECTF-- -Warning: IntlCalendar::getLeastMaximum() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::getLeastMaximum(): intlcal_get_least_maximum: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getMaximum() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::getMaximum(): intlcal_get_maximum: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getGreatestMinimum() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::getGreatestMinimum(): intlcal_get_greatest_minimum: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getMinimum() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::getMinimum(): intlcal_get_minimum: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::getLeastMaximum(): intlcal_get_least_maximum: invalid field in %s on line %d bool(false) diff --git a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt index d7d20ed6cd..3853d612a3 100644 --- a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt +++ b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt @@ -12,37 +12,12 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->get()); -var_dump($c->getActualMaximum()); -var_dump($c->getActualMinimum()); - var_dump($c->get(-1)); var_dump($c->getActualMaximum(-1)); var_dump($c->getActualMinimum(-1)); -var_dump($c->get("s")); -var_dump($c->getActualMaximum("s")); -var_dump($c->getActualMinimum("s")); - -var_dump($c->get(1, 2)); -var_dump($c->getActualMaximum(1, 2)); -var_dump($c->getActualMinimum(1, 2)); +?> --EXPECTF-- -Warning: IntlCalendar::get() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::get(): intlcal_get: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getActualMaximum() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::getActualMaximum(): intlcal_get_actual_maximum: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getActualMinimum() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::get(): intlcal_get: invalid field in %s on line %d bool(false) @@ -51,33 +26,3 @@ bool(false) Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: invalid field in %s on line %d bool(false) - -Warning: IntlCalendar::get() expects parameter 1 to be int, string given in %s on line %d - -Warning: IntlCalendar::get(): intlcal_get: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getActualMaximum() expects parameter 1 to be int, string given in %s on line %d - -Warning: IntlCalendar::getActualMaximum(): intlcal_get_actual_maximum: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getActualMinimum() expects parameter 1 to be int, string given in %s on line %d - -Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::get() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::get(): intlcal_get: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getActualMaximum() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::getActualMaximum(): intlcal_get_actual_maximum: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::getActualMinimum() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt index 37e3816fef..98408a4327 100644 --- a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt +++ b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt @@ -81,30 +81,24 @@ try { echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- -error: 2, intlcal_get() expects exactly 2 parameters, 1 given -error: 2, intlcal_get(): intlcal_get: bad arguments -bool(false) -error: 2, intlcal_get_actual_maximum() expects exactly 2 parameters, 1 given -error: 2, intlcal_get_actual_maximum(): intlcal_get_actual_maximum: bad arguments -bool(false) -error: 2, intlcal_get_actual_minimum() expects exactly 2 parameters, 1 given -error: 2, intlcal_get_actual_minimum(): intlcal_get_actual_minimum: bad arguments -bool(false) +error: 0, intlcal_get() expects exactly 2 parameters, 1 given + +error: 0, intlcal_get_actual_maximum() expects exactly 2 parameters, 1 given + +error: 0, intlcal_get_actual_minimum() expects exactly 2 parameters, 1 given + error: 2, intlcal_get(): intlcal_get: invalid field bool(false) error: 2, intlcal_get_actual_maximum(): intlcal_get_actual_maximum: invalid field bool(false) error: 2, intlcal_get_actual_minimum(): intlcal_get_actual_minimum: invalid field bool(false) -error: 2, intlcal_get() expects parameter 2 to be int, string given -error: 2, intlcal_get(): intlcal_get: bad arguments -bool(false) -error: 2, intlcal_get_actual_maximum() expects parameter 2 to be int, string given -error: 2, intlcal_get_actual_maximum(): intlcal_get_actual_maximum: bad arguments -bool(false) -error: 2, intlcal_get_actual_minimum() expects parameter 2 to be int, string given -error: 2, intlcal_get_actual_minimum(): intlcal_get_actual_minimum: bad arguments -bool(false) +error: 0, intlcal_get() expects parameter 2 to be int, string given + +error: 0, intlcal_get_actual_maximum() expects parameter 2 to be int, string given + +error: 0, intlcal_get_actual_minimum() expects parameter 2 to be int, string given + error: 0, Argument 1 passed to intlcal_get() must be an instance of IntlCalendar, int given error: 0, Argument 1 passed to intlcal_get_actual_maximum() must be an instance of IntlCalendar, int given diff --git a/ext/intl/tests/calendar_inDaylightTime_error.phpt b/ext/intl/tests/calendar_inDaylightTime_error.phpt index 6644f477ea..bbcfcaabb1 100644 --- a/ext/intl/tests/calendar_inDaylightTime_error.phpt +++ b/ext/intl/tests/calendar_inDaylightTime_error.phpt @@ -10,23 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->inDaylightTime(1)); - -var_dump(intlcal_in_daylight_time($c, 1)); var_dump(intlcal_in_daylight_time(1)); --EXPECTF-- -Warning: IntlCalendar::inDaylightTime() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::inDaylightTime(): intlcal_in_daylight_time: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_in_daylight_time() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlcal_in_daylight_time(): intlcal_in_daylight_time: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_in_daylight_time() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_in_daylight_time(1) diff --git a/ext/intl/tests/calendar_isEquivalentTo_error.phpt b/ext/intl/tests/calendar_isEquivalentTo_error.phpt index c7e30fd645..254d1dab84 100644 --- a/ext/intl/tests/calendar_isEquivalentTo_error.phpt +++ b/ext/intl/tests/calendar_isEquivalentTo_error.phpt @@ -51,14 +51,12 @@ try { --EXPECT-- error: 0, Argument 1 passed to IntlCalendar::isEquivalentTo() must be an instance of IntlCalendar, int given -error: 2, IntlCalendar::isEquivalentTo() expects exactly 1 parameter, 2 given -error: 2, IntlCalendar::isEquivalentTo(): intlcal_is_equivalent_to: bad arguments -bool(false) +error: 0, IntlCalendar::isEquivalentTo() expects exactly 1 parameter, 2 given + error: 0, Argument 1 passed to IntlCalendar::isEquivalentTo() must be an instance of IntlCalendar, int given -error: 2, intlcal_is_equivalent_to() expects exactly 2 parameters, 1 given -error: 2, intlcal_is_equivalent_to(): intlcal_is_equivalent_to: bad arguments -bool(false) +error: 0, intlcal_is_equivalent_to() expects exactly 2 parameters, 1 given + error: 0, Argument 2 passed to intlcal_is_equivalent_to() must be an instance of IntlCalendar, int given error: 0, Argument 1 passed to intlcal_is_equivalent_to() must be an instance of IntlCalendar, int given diff --git a/ext/intl/tests/calendar_isLenient_error.phpt b/ext/intl/tests/calendar_isLenient_error.phpt index 263d82bb37..6fec307349 100644 --- a/ext/intl/tests/calendar_isLenient_error.phpt +++ b/ext/intl/tests/calendar_isLenient_error.phpt @@ -10,23 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->isLenient(1)); - -var_dump(intlcal_is_lenient($c, 1)); var_dump(intlcal_is_lenient(1)); --EXPECTF-- -Warning: IntlCalendar::isLenient() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::isLenient(): intlcal_is_lenient: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_is_lenient() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlcal_is_lenient(): intlcal_is_lenient: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_is_lenient() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_is_lenient(1) diff --git a/ext/intl/tests/calendar_isSet_error.phpt b/ext/intl/tests/calendar_isSet_error.phpt index 7e5b2beaa6..9cb266f742 100644 --- a/ext/intl/tests/calendar_isSet_error.phpt +++ b/ext/intl/tests/calendar_isSet_error.phpt @@ -12,31 +12,13 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->isSet()); -var_dump($c->isSet(1, 2)); var_dump($c->isSet(-1)); -var_dump(intlcal_is_set($c)); var_dump(intlcal_is_set(1, 2)); --EXPECTF-- -Warning: IntlCalendar::isSet() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::isSet(): intlcal_is_set: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::isSet() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::isSet(): intlcal_is_set: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::isSet(): intlcal_is_set: invalid field in %s on line %d bool(false) -Warning: intlcal_is_set() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: intlcal_is_set(): intlcal_is_set: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_is_set() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_is_set(1, 2) diff --git a/ext/intl/tests/calendar_isWeekend_error.phpt b/ext/intl/tests/calendar_isWeekend_error.phpt index c1f8180fa3..de40b2aee6 100644 --- a/ext/intl/tests/calendar_isWeekend_error.phpt +++ b/ext/intl/tests/calendar_isWeekend_error.phpt @@ -10,29 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->isWeekend(1, 2)); -var_dump($c->isWeekend("jhhk")); - -var_dump(intlcal_is_weekend($c, "jj")); var_dump(intlcal_is_weekend(1)); --EXPECTF-- -Warning: IntlCalendar::isWeekend() expects at most 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::isWeekend(): intlcal_is_weekend: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::isWeekend() expects parameter 1 to be float, string given in %s on line %d - -Warning: IntlCalendar::isWeekend(): intlcal_is_weekend: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_is_weekend() expects parameter 2 to be float, string given in %s on line %d - -Warning: intlcal_is_weekend(): intlcal_is_weekend: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_is_weekend() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_is_weekend(1) diff --git a/ext/intl/tests/calendar_roll_error.phpt b/ext/intl/tests/calendar_roll_error.phpt index 27160ee8ca..bc00896d8b 100644 --- a/ext/intl/tests/calendar_roll_error.phpt +++ b/ext/intl/tests/calendar_roll_error.phpt @@ -12,27 +12,13 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->roll(1, 2, 3)); var_dump($c->roll(-1, 2)); -var_dump($c->roll(1)); -var_dump(intlcal_roll($c, 1, 2, 3)); var_dump(intlcal_roll(1, 2, 3)); --EXPECTF-- -Warning: IntlCalendar::roll(): intlcal_set: too many arguments in %s on line %d -bool(false) - Warning: IntlCalendar::roll(): intlcal_roll: invalid field in %s on line %d bool(false) -Warning: IntlCalendar::roll() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::roll(): intlcal_roll: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_roll(): intlcal_set: too many arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_roll() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_roll(1, 2, 3) diff --git a/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt b/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt index a22c3b2842..6dcff918a7 100644 --- a/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt +++ b/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt @@ -12,23 +12,11 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->setFirstDayOfWeek()); -var_dump($c->setFirstDayOfWeek(1, 2)); var_dump($c->setFirstDayOfWeek(0)); var_dump(intlcal_set_first_day_of_week($c, 0)); var_dump(intlcal_set_first_day_of_week(1, 2)); --EXPECTF-- -Warning: IntlCalendar::setFirstDayOfWeek() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::setFirstDayOfWeek(): intlcal_set_first_day_of_week: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setFirstDayOfWeek() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::setFirstDayOfWeek(): intlcal_set_first_day_of_week: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::setFirstDayOfWeek(): intlcal_set_first_day_of_week: invalid day of week in %s on line %d bool(false) diff --git a/ext/intl/tests/calendar_setLenient_error.phpt b/ext/intl/tests/calendar_setLenient_error.phpt index b2a6f25d5d..2d73857c2b 100644 --- a/ext/intl/tests/calendar_setLenient_error.phpt +++ b/ext/intl/tests/calendar_setLenient_error.phpt @@ -10,35 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->setLenient()); -var_dump($c->setLenient(array())); -var_dump($c->setLenient(1, 2)); - -var_dump(intlcal_set_lenient($c, array())); var_dump(intlcal_set_lenient(1, false)); --EXPECTF-- -Warning: IntlCalendar::setLenient() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::setLenient(): intlcal_set_lenient: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setLenient() expects parameter 1 to be bool, array given in %s on line %d - -Warning: IntlCalendar::setLenient(): intlcal_set_lenient: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setLenient() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::setLenient(): intlcal_set_lenient: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_set_lenient() expects parameter 2 to be bool, array given in %s on line %d - -Warning: intlcal_set_lenient(): intlcal_set_lenient: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_lenient() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_set_lenient(1, false) diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt index 48d18bf28d..430fc953bd 100644 --- a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt +++ b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt @@ -12,23 +12,11 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->setMinimalDaysInFirstWeek()); -var_dump($c->setMinimalDaysInFirstWeek(1, 2)); var_dump($c->setMinimalDaysInFirstWeek(0)); var_dump(intlcal_set_minimal_days_in_first_week($c, 0)); var_dump(intlcal_set_minimal_days_in_first_week(1, 2)); --EXPECTF-- -Warning: IntlCalendar::setMinimalDaysInFirstWeek() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setMinimalDaysInFirstWeek() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: invalid number of days; must be between 1 and 7 in %s on line %d bool(false) diff --git a/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt b/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt index 776cb8b825..e3d03815dc 100644 --- a/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt +++ b/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt @@ -12,69 +12,17 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->setSkippedWallTimeOption()); -var_dump($c->setRepeatedWallTimeOption()); - -var_dump($c->setSkippedWallTimeOption(1, 2)); -var_dump($c->setRepeatedWallTimeOption(1, 2)); - -var_dump($c->setSkippedWallTimeOption(array())); -var_dump($c->setRepeatedWallTimeOption(array())); - var_dump($c->setSkippedWallTimeOption(3)); var_dump($c->setRepeatedWallTimeOption(2)); -var_dump(intlcal_set_skipped_wall_time_option($c)); -var_dump(intlcal_set_repeated_wall_time_option($c)); - var_dump(intlcal_set_repeated_wall_time_option(1, 1)); --EXPECTF-- -Warning: IntlCalendar::setSkippedWallTimeOption() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setRepeatedWallTimeOption() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setSkippedWallTimeOption() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setRepeatedWallTimeOption() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setSkippedWallTimeOption() expects parameter 1 to be int, array given in %s on line %d - -Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setRepeatedWallTimeOption() expects parameter 1 to be int, array given in %s on line %d - -Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: invalid option in %s on line %d bool(false) Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: invalid option in %s on line %d bool(false) -Warning: intlcal_set_skipped_wall_time_option() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: intlcal_set_skipped_wall_time_option(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_set_repeated_wall_time_option() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: intlcal_set_repeated_wall_time_option(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_repeated_wall_time_option() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_set_repeated_wall_time_option(1, 1) diff --git a/ext/intl/tests/calendar_setTimeZone_error.phpt b/ext/intl/tests/calendar_setTimeZone_error.phpt index dee773d377..1cace3b4ea 100644 --- a/ext/intl/tests/calendar_setTimeZone_error.phpt +++ b/ext/intl/tests/calendar_setTimeZone_error.phpt @@ -41,13 +41,10 @@ try{ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- -error: 2, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given -error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments -bool(false) -error: 2, IntlCalendar::setTimeZone() expects exactly 1 parameter, 0 given -error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments -bool(false) -error: 2, intlcal_set_time_zone() expects exactly 2 parameters, 3 given -error: 2, intlcal_set_time_zone(): intlcal_set_time_zone: bad arguments -bool(false) +error: 0, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given + +error: 0, IntlCalendar::setTimeZone() expects exactly 1 parameter, 0 given + +error: 0, intlcal_set_time_zone() expects exactly 2 parameters, 3 given + error: 0, Argument 1 passed to intlcal_set_time_zone() must be an instance of IntlCalendar, int given diff --git a/ext/intl/tests/calendar_setTime_error.phpt b/ext/intl/tests/calendar_setTime_error.phpt index d3fa46c591..6ecbd698bf 100644 --- a/ext/intl/tests/calendar_setTime_error.phpt +++ b/ext/intl/tests/calendar_setTime_error.phpt @@ -10,29 +10,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -var_dump($c->setTime(1, 2)); -var_dump($c->setTime("jjj")); - -var_dump(intlcal_set_time($c, 1, 2)); var_dump(intlcal_set_time(1)); --EXPECTF-- -Warning: IntlCalendar::setTime() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::setTime(): intlcal_set_time: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setTime() expects parameter 1 to be float, string given in %s on line %d - -Warning: IntlCalendar::setTime(): intlcal_set_time: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_set_time() expects exactly 2 parameters, 3 given in %s on line %d - -Warning: intlcal_set_time(): intlcal_set_time: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_time() must be an instance of IntlCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlcal_set_time(1) diff --git a/ext/intl/tests/calendar_set_error.phpt b/ext/intl/tests/calendar_set_error.phpt index 5827ad41ec..2116786d32 100644 --- a/ext/intl/tests/calendar_set_error.phpt +++ b/ext/intl/tests/calendar_set_error.phpt @@ -12,22 +12,12 @@ ini_set("intl.error_level", E_WARNING); $c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->set(1)); -var_dump($c->set(1, 2, 3, 4)); var_dump($c->set(1, 2, 3, 4, 5, 6, 7)); var_dump($c->set(-1, 2)); var_dump(intlcal_set($c, -1, 2)); var_dump(intlcal_set(1, 2, 3)); --EXPECTF-- -Warning: IntlCalendar::set() expects at least 2 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::set(): intlcal_set: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::set(): intlcal_set: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::set(): intlcal_set: too many arguments in %s on line %d bool(false) diff --git a/ext/intl/tests/calendar_toDateTime_error.phpt b/ext/intl/tests/calendar_toDateTime_error.phpt index 584bd28f65..e251c501b6 100644 --- a/ext/intl/tests/calendar_toDateTime_error.phpt +++ b/ext/intl/tests/calendar_toDateTime_error.phpt @@ -9,11 +9,6 @@ if (!extension_loaded('intl')) ini_set("intl.error_level", E_WARNING); ini_set('date.timezone', 'Europe/Lisbon'); -$cal = new IntlGregorianCalendar(); -var_dump($cal->toDateTime(3)); - -var_dump(intlcal_to_date_time($cal, 3)); - $cal = new IntlGregorianCalendar("Etc/Unknown"); try { var_dump($cal->toDateTime()); @@ -23,16 +18,6 @@ var_dump("exception: {$e->getMessage()}"); var_dump(intlcal_to_date_time(3)); --EXPECTF-- -Warning: IntlCalendar::toDateTime() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: bad arguments in %s on line %d -bool(false) - -Warning: intlcal_to_date_time() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlcal_to_date_time(): intlcal_to_date_time: bad arguments in %s on line %d -bool(false) - Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: DateTimeZone constructor threw exception in %s on line %d string(77) "exception: DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)" diff --git a/ext/intl/tests/cpbi_getLastCodePoint_error.phpt b/ext/intl/tests/cpbi_getLastCodePoint_error.phpt deleted file mode 100644 index 505a076ca3..0000000000 --- a/ext/intl/tests/cpbi_getLastCodePoint_error.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -IntlBreakIterator::getLastCodePoint(): bad args ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -$it = IntlBreakIterator::createCodePointInstance(); -var_dump($it->getLastCodePoint(array())); ---EXPECTF-- -Warning: IntlCodePointBreakIterator::getLastCodePoint() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlCodePointBreakIterator::getLastCodePoint(): cpbi_get_last_code_point: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/dateformat_formatObject_error.phpt b/ext/intl/tests/dateformat_formatObject_error.phpt index bfcc951b73..24be090035 100644 --- a/ext/intl/tests/dateformat_formatObject_error.phpt +++ b/ext/intl/tests/dateformat_formatObject_error.phpt @@ -10,8 +10,6 @@ ini_set("intl.error_level", E_WARNING); ini_set("intl.default_locale", "pt_PT"); ini_set("date.timezone", "Europe/Lisbon"); -var_dump(IntlDateFormatter::formatObject()); -var_dump(IntlDateFormatter::formatObject(1)); var_dump(IntlDateFormatter::formatObject(new stdclass)); class A extends IntlCalendar {function __construct(){}} @@ -26,17 +24,10 @@ var_dump(IntlDateFormatter::formatObject($cal, array(1,2,3))); var_dump(IntlDateFormatter::formatObject($cal, array(array(), 1))); var_dump(IntlDateFormatter::formatObject($cal, array(1, -2))); var_dump(IntlDateFormatter::formatObject($cal, "")); -var_dump(IntlDateFormatter::formatObject($cal, "YYYY", array())); ?> ==DONE== --EXPECTF-- -Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: IntlDateFormatter::formatObject() expects parameter 1 to be object, int given in %s on line %d -bool(false) - Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the passed object must be an instance of either IntlCalendar or DateTime in %s on line %d bool(false) @@ -65,7 +56,4 @@ bool(false) Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the format is empty in %s on line %d bool(false) - -Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d -bool(false) ==DONE== diff --git a/ext/intl/tests/dateformat_getCalendarObject_error.phpt b/ext/intl/tests/dateformat_getCalendarObject_error.phpt deleted file mode 100644 index d5a7833ded..0000000000 --- a/ext/intl/tests/dateformat_getCalendarObject_error.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -IntlDateFormatter::getCalendarObject(): bad args ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); -ini_set("intl.default_locale", "pt_PT"); -ini_set("date.timezone", 'Atlantic/Azores'); - -$df = new IntlDateFormatter(NULL, 0, 0); - -var_dump($df->getCalendarObject(9)); -var_dump(datefmt_get_calendar_object($df, 9)); -var_dump(datefmt_get_calendar_object($df, 9)); -var_dump(datefmt_get_calendar_object(new stdclass)); - -?> -==DONE== ---EXPECTF-- -Warning: IntlDateFormatter::getCalendarObject() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlDateFormatter::getCalendarObject(): datefmt_get_calendar_object: unable to parse input params in %s on line %d -bool(false) - -Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d -bool(false) - -Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d -bool(false) - -Warning: datefmt_get_calendar_object() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d - -Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d -bool(false) -==DONE== diff --git a/ext/intl/tests/dateformat_getTimeZone_error.phpt b/ext/intl/tests/dateformat_getTimeZone_error.phpt deleted file mode 100644 index d2ab92d86a..0000000000 --- a/ext/intl/tests/dateformat_getTimeZone_error.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -IntlDateFormatter::getTimeZone(): bad args ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); -ini_set("intl.default_locale", "pt_PT"); -ini_set("date.timezone", 'Atlantic/Azores'); - -$df = new IntlDateFormatter(NULL, 0, 0); - -var_dump($df->getTimeZone(9)); -var_dump(datefmt_get_timezone($df, 9)); -var_dump(datefmt_get_timezone($df, 9)); -var_dump(datefmt_get_timezone(new stdclass)); - -?> -==DONE== ---EXPECTF-- -Warning: IntlDateFormatter::getTimeZone() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlDateFormatter::getTimeZone(): datefmt_get_timezone: unable to parse input params in %s on line %d -bool(false) - -Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d -bool(false) - -Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d -bool(false) - -Warning: datefmt_get_timezone() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d - -Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d -bool(false) -==DONE== diff --git a/ext/intl/tests/dateformat_setTimeZone_error.phpt b/ext/intl/tests/dateformat_setTimeZone_error.phpt index b58d159088..e5ba550910 100644 --- a/ext/intl/tests/dateformat_setTimeZone_error.phpt +++ b/ext/intl/tests/dateformat_setTimeZone_error.phpt @@ -12,41 +12,17 @@ ini_set("date.timezone", 'Atlantic/Azores'); $df = new IntlDateFormatter(NULL, 0, 0); -var_dump($df->setTimeZone()); -var_dump(datefmt_set_timezone()); var_dump($df->setTimeZone(array())); -var_dump($df->setTimeZone(1, 2)); var_dump($df->setTimeZone('non existing timezone')); -var_dump(datefmt_set_timezone(new stdclass, 'UTC')); ?> ==DONE== --EXPECTF-- -Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to parse input params in %s on line %d -bool(false) - -Warning: datefmt_set_timezone() expects exactly 2 parameters, 0 given in %s on line %d - -Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input params in %s on line %d -bool(false) - Notice: Array to string conversion in %s on line %d Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'Array' in %s on line %d bool(false) -Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to parse input params in %s on line %d -bool(false) - Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'non existing timezone' in %s on line %d bool(false) - -Warning: datefmt_set_timezone() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d - -Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input params in %s on line %d -bool(false) ==DONE== diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt b/ext/intl/tests/dateformat_set_timezone_id2.phpt index 3d22f7d03d..57658610d5 100644 --- a/ext/intl/tests/dateformat_set_timezone_id2.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt @@ -9,7 +9,6 @@ date.timezone=Atlantic/Azores <?php ini_set("intl.error_level", E_WARNING); -ini_set("error_reporting", ~E_DEPRECATED); /* * Test for the datefmt_set_timezone_id function diff --git a/ext/intl/tests/dateformat_set_timezone_id3.phpt b/ext/intl/tests/dateformat_set_timezone_id3.phpt index e25b9bfd7e..8c6a0c341c 100644 --- a/ext/intl/tests/dateformat_set_timezone_id3.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id3.phpt @@ -9,7 +9,6 @@ date.timezone=Atlantic/Azores <?php ini_set("intl.error_level", E_WARNING); -ini_set("error_reporting", ~E_DEPRECATED); /* * Test for the datefmt_set_timezone_id function diff --git a/ext/intl/tests/formatter_fail.phpt b/ext/intl/tests/formatter_fail.phpt index 9cfc6f5054..0a8d7f398b 100644 --- a/ext/intl/tests/formatter_fail.phpt +++ b/ext/intl/tests/formatter_fail.phpt @@ -27,10 +27,20 @@ function crt($t, $l, $s) { } break; case $t == "C": - return NumberFormatter::create($l, $s); + try { + return NumberFormatter::create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } break; case $t == "P": - return numfmt_create($l, $s); + try { + return numfmt_create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } break; } } @@ -50,9 +60,19 @@ try { $fmt = null; } err($fmt); -$fmt = numfmt_create(); +try { + $fmt = numfmt_create(); +} catch (TypeError $e) { + print_exception($e); + $fmt = null; +} err($fmt); -$fmt = NumberFormatter::create(); +try { + $fmt = NumberFormatter::create(); +} catch (TypeError $e) { + print_exception($e); + $fmt = null; +} err($fmt); foreach($args as $arg) { @@ -67,34 +87,34 @@ foreach($args as $arg) { ?> --EXPECTF-- ArgumentCountError: NumberFormatter::__construct() expects at least 2 parameters, 0 given in %s on line %d -'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +'U_ZERO_ERROR' -Warning: numfmt_create() expects at least 2 parameters, 0 given in %s on line %d -'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +ArgumentCountError: numfmt_create() expects at least 2 parameters, 0 given in %s on line %d +'U_ZERO_ERROR' -Warning: NumberFormatter::create() expects at least 2 parameters, 0 given in %s on line %d -'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +ArgumentCountError: NumberFormatter::create() expects at least 2 parameters, 0 given in %s on line %d +'U_ZERO_ERROR' -IntlException: Constructor failed in %sformatter_fail.php on line %d +IntlException: Constructor failed in %s on line %d 'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR' 'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR' 'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR' TypeError: NumberFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d -'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +'U_ZERO_ERROR' -Warning: NumberFormatter::create() expects parameter 1 to be string, array given in %s on line %d -'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +TypeError: NumberFormatter::create() expects parameter 1 to be string, array given in %s on line %d +'U_ZERO_ERROR' -Warning: numfmt_create() expects parameter 1 to be string, array given in %s on line %d -'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +TypeError: numfmt_create() expects parameter 1 to be string, array given in %s on line %d +'U_ZERO_ERROR' -IntlException: Constructor failed in %sformatter_fail.php on line %d +IntlException: Constructor failed in %s on line %d 'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR' 'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR' 'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR' -IntlException: Constructor failed in %sformatter_fail.php on line %d +IntlException: Constructor failed in %s on line %d 'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR' 'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR' 'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR' diff --git a/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt b/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt index a1cfb593d7..3353690d1c 100644 --- a/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt +++ b/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt @@ -10,22 +10,10 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->getGregorianChange(1)); - -var_dump(intlgregcal_get_gregorian_change($c, 1)); var_dump(intlgregcal_get_gregorian_change(1)); ---EXPECTF-- -Warning: IntlGregorianCalendar::getGregorianChange() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlGregorianCalendar::getGregorianChange(): intlgregcal_get_gregorian_change: bad arguments in %s on line %d -bool(false) - -Warning: intlgregcal_get_gregorian_change() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: intlgregcal_get_gregorian_change(): intlgregcal_get_gregorian_change: bad arguments in %s on line %d -bool(false) +?> +--EXPECTF-- Fatal error: Uncaught TypeError: Argument 1 passed to intlgregcal_get_gregorian_change() must be an instance of IntlGregorianCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlgregcal_get_gregorian_change(1) diff --git a/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt b/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt index 9da5aaf418..701e643e00 100644 --- a/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt +++ b/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt @@ -10,40 +10,10 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); -var_dump($c->isLeapYear(2000, 2011)); -var_dump($c->isLeapYear()); -var_dump($c->isLeapYear("fgdf")); - -var_dump(intlgregcal_is_leap_year($c, 1, 2)); -var_dump(intlgregcal_is_leap_year($c)); var_dump(intlgregcal_is_leap_year(1, 2)); ---EXPECTF-- -Warning: IntlGregorianCalendar::isLeapYear() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlGregorianCalendar::isLeapYear(): intlgregcal_is_leap_year: bad arguments in %s on line %d -bool(false) - -Warning: IntlGregorianCalendar::isLeapYear() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlGregorianCalendar::isLeapYear(): intlgregcal_is_leap_year: bad arguments in %s on line %d -bool(false) - -Warning: IntlGregorianCalendar::isLeapYear() expects parameter 1 to be int, string given in %s on line %d - -Warning: IntlGregorianCalendar::isLeapYear(): intlgregcal_is_leap_year: bad arguments in %s on line %d -bool(false) - -Warning: intlgregcal_is_leap_year() expects exactly 2 parameters, 3 given in %s on line %d - -Warning: intlgregcal_is_leap_year(): intlgregcal_is_leap_year: bad arguments in %s on line %d -bool(false) - -Warning: intlgregcal_is_leap_year() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: intlgregcal_is_leap_year(): intlgregcal_is_leap_year: bad arguments in %s on line %d -bool(false) +?> +--EXPECTF-- Fatal error: Uncaught TypeError: Argument 1 passed to intlgregcal_is_leap_year() must be an instance of IntlGregorianCalendar, int given in %s:%d Stack trace: #0 %s(%d): intlgregcal_is_leap_year(1, 2) diff --git a/ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt b/ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt deleted file mode 100644 index 0dd27802b5..0000000000 --- a/ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -IntlGregorianCalendar::setGregorianChange(): bad arguments ---INI-- -date.timezone=Atlantic/Azores ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -$c = new IntlGregorianCalendar(); -var_dump($c->setGregorianChange()); -var_dump($c->setGregorianChange(1, 2)); -var_dump($c->setGregorianChange("sdfds")); - -var_dump(intlgregcal_set_gregorian_change($c)); -var_dump(intlgregcal_set_gregorian_change(1, 4.)); ---EXPECTF-- -Warning: IntlGregorianCalendar::setGregorianChange() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlGregorianCalendar::setGregorianChange(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d -bool(false) - -Warning: IntlGregorianCalendar::setGregorianChange() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlGregorianCalendar::setGregorianChange(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d -bool(false) - -Warning: IntlGregorianCalendar::setGregorianChange() expects parameter 1 to be float, string given in %s on line %d - -Warning: IntlGregorianCalendar::setGregorianChange(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d -bool(false) - -Warning: intlgregcal_set_gregorian_change() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: intlgregcal_set_gregorian_change(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d -bool(false) - -Fatal error: Uncaught TypeError: Argument 1 passed to intlgregcal_set_gregorian_change() must be an instance of IntlGregorianCalendar, int given in %s:%d -Stack trace: -#0 %s(%d): intlgregcal_set_gregorian_change(1, 4) -#1 {main} - thrown in %s on line %d diff --git a/ext/intl/tests/idn_uts46_errors.phpt b/ext/intl/tests/idn_uts46_errors.phpt index 6a99bde649..e468e8caf8 100644 --- a/ext/intl/tests/idn_uts46_errors.phpt +++ b/ext/intl/tests/idn_uts46_errors.phpt @@ -11,19 +11,12 @@ IDN UTS #46 API error tests ini_set("intl.error_level", E_WARNING); echo "=> PHP level errors", "\n"; -echo "bad args:", "\n"; -var_dump(idn_to_ascii("", 0, array())); -var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46, $foo, null)); - echo "bad variant:", "\n"; var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46 + 10)); echo "empty domain:", "\n"; var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46)); -echo "fourth arg for 2003 variant (only notice raised):", "\n"; -var_dump(idn_to_ascii("foo.com", 0, INTL_IDNA_VARIANT_2003, $foo)); - echo "with error, but no details arg:", "\n"; var_dump(idn_to_ascii("www.fußball.com-", 0, INTL_IDNA_VARIANT_UTS46)); @@ -39,33 +32,18 @@ var_dump(idn_to_ascii( INTL_IDNA_VARIANT_UTS46, $foo)); var_dump($foo); var_dump($foo["errors"]==IDNA_ERROR_CONTEXTJ); + +?> --EXPECTF-- => PHP level errors -bad args: - -Warning: idn_to_ascii() expects parameter 3 to be int, array given in %s on line %d - -Warning: idn_to_ascii(): idn_to_ascii: bad arguments in %s on line %d -NULL - -Warning: idn_to_ascii() expects at most 4 parameters, 5 given in %s on line %d - -Warning: idn_to_ascii(): idn_to_ascii: bad arguments in %s on line %d -NULL bad variant: -Warning: idn_to_ascii(): idn_to_ascii: invalid variant, must be one of {INTL_IDNA_VARIANT_2003, INTL_IDNA_VARIANT_UTS46} in %s on line %d +Warning: idn_to_ascii(): idn_to_ascii: invalid variant, must be INTL_IDNA_VARIANT_UTS46 in %s on line %d bool(false) empty domain: Warning: idn_to_ascii(): idn_to_ascii: empty domain name in %s on line %d bool(false) -fourth arg for 2003 variant (only notice raised): - -Deprecated: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated in %s on line %d - -Notice: idn_to_ascii(): 4 arguments were provided, but INTL_IDNA_VARIANT_2003 only takes 3 - extra argument ignored in %s on line %d -string(7) "foo.com" with error, but no details arg: bool(false) with error, with details arg: diff --git a/ext/intl/tests/intl_get_error_code.phpt b/ext/intl/tests/intl_get_error_code.phpt index 6cd361ba71..797aee4fb7 100644 --- a/ext/intl/tests/intl_get_error_code.phpt +++ b/ext/intl/tests/intl_get_error_code.phpt @@ -11,7 +11,7 @@ intl_get_error_code() // Suppress warning messages. error_reporting( E_ERROR ); -if( collator_get_locale() !== false ) +if( collator_get_locale(new Collator('en_US'), -1) !== false ) echo "failed\n"; else { diff --git a/ext/intl/tests/intl_get_error_message.phpt b/ext/intl/tests/intl_get_error_message.phpt index f81b5c03d5..e03fb80658 100644 --- a/ext/intl/tests/intl_get_error_message.phpt +++ b/ext/intl/tests/intl_get_error_message.phpt @@ -11,11 +11,11 @@ intl_get_error_message() // Suppress warning messages. error_reporting( E_ERROR ); -if( collator_get_locale() !== false ) +if( collator_get_locale(new Collator('en_US'), -1) !== false ) echo "failed\n"; else printf( "%s\n", intl_get_error_message() ); ?> --EXPECT-- -collator_get_locale: unable to parse input params: U_ILLEGAL_ARGUMENT_ERROR +Error getting locale by type: U_ILLEGAL_ARGUMENT_ERROR diff --git a/ext/intl/tests/locale_accept.phpt b/ext/intl/tests/locale_accept.phpt index a2834d8ade..6a29cd6723 100644 --- a/ext/intl/tests/locale_accept.phpt +++ b/ext/intl/tests/locale_accept.phpt @@ -19,7 +19,6 @@ function ut_main() 'zh, en-us;q=0.8, en;q=0.7', 'xx, fr-FR;q=0.3, de-DE;q=0.5', 'none', - array() ); foreach($http_acc as $http) { @@ -34,13 +33,9 @@ include_once( 'ut_common.inc' ); ut_run(); ?> ---EXPECTF-- -Warning: Locale::acceptFromHttp() expects parameter 1 to be string, array given in %s on line %d - -Warning: locale_accept_from_http() expects parameter 1 to be string, array given in %s on line %d +--EXPECT-- Accepting en-us,en;q=0.5: en_US Accepting da, en-gb;q=0.8, en;q=0.7: da Accepting zh, en-us;q=0.8, en;q=0.7: zh Accepting xx, fr-FR;q=0.3, de-DE;q=0.5: de_DE Accepting none: -Accepting Array: diff --git a/ext/intl/tests/msgfmt_fail2.phpt b/ext/intl/tests/msgfmt_fail2.phpt index 0016de4bb7..688e65a861 100644 --- a/ext/intl/tests/msgfmt_fail2.phpt +++ b/ext/intl/tests/msgfmt_fail2.phpt @@ -27,10 +27,20 @@ function crt($t, $l, $s) { } break; case $t == "C": - return MessageFormatter::create($l, $s); + try { + return MessageFormatter::create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } break; case $t == "P": - return msgfmt_create($l, $s); + try { + return msgfmt_create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } break; } } @@ -51,9 +61,19 @@ try { $fmt = null; } err($fmt); -$fmt = msgfmt_create(); +try { + $fmt = msgfmt_create(); +} catch (TypeError $e) { + print_exception($e); + $fmt = null; +} err($fmt); -$fmt = MessageFormatter::create(); +try { + $fmt = MessageFormatter::create(); +} catch (TypeError $e) { + print_exception($e); + $fmt = null; +} err($fmt); try { $fmt = new MessageFormatter('en'); @@ -62,9 +82,19 @@ try { $fmt = null; } err($fmt); -$fmt = msgfmt_create('en'); +try { + $fmt = msgfmt_create('en'); +} catch (TypeError $e) { + print_exception($e); + $fmt = null; +} err($fmt); -$fmt = MessageFormatter::create('en'); +try { + $fmt = MessageFormatter::create('en'); +} catch (TypeError $e) { + print_exception($e); + $fmt = null; +} err($fmt); foreach($args as $arg) { @@ -79,53 +109,53 @@ foreach($args as $arg) { ?> --EXPECTF-- ArgumentCountError: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d -'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +'U_ZERO_ERROR' -Warning: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d -'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +ArgumentCountError: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d +'U_ZERO_ERROR' -Warning: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d -'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +ArgumentCountError: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d +'U_ZERO_ERROR' ArgumentCountError: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d -'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +'U_ZERO_ERROR' -Warning: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d -'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +ArgumentCountError: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d +'U_ZERO_ERROR' -Warning: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d -'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +ArgumentCountError: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d +'U_ZERO_ERROR' -IntlException: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %s on line %d 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR' 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR' 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR' -IntlException: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %s on line %d 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR' 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR' 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR' TypeError: MessageFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d -'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +'U_ZERO_ERROR' -Warning: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d -'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +TypeError: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d +'U_ZERO_ERROR' -Warning: msgfmt_create() expects parameter 1 to be string, array given in %s on line %d -'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' +TypeError: msgfmt_create() expects parameter 1 to be string, array given in %s on line %d +'U_ZERO_ERROR' -IntlException: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %s on line %d 'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR' 'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR' 'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR' -IntlException: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %s on line %d 'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES' 'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES' 'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES' -IntlException: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %s on line %d 'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND' 'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND' 'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND' diff --git a/ext/intl/tests/normalizer_normalize.phpt b/ext/intl/tests/normalizer_normalize.phpt index 5f8c25ec2f..8f15ffb1d8 100644 --- a/ext/intl/tests/normalizer_normalize.phpt +++ b/ext/intl/tests/normalizer_normalize.phpt @@ -19,7 +19,6 @@ function ut_main() Normalizer::FORM_D, Normalizer::FORM_KC, Normalizer::FORM_KD, - Normalizer::NONE, ); $forms_str = array ( @@ -27,15 +26,13 @@ function ut_main() Normalizer::FORM_D => 'UNORM_FORM_D', Normalizer::FORM_KC => 'UNORM_FORM_KC', Normalizer::FORM_KD => 'UNORM_FORM_KD', - Normalizer::NONE => 'UNORM_NONE', ); /* just make sure all the form constants are defined as in the api spec */ if ( Normalizer::FORM_C != Normalizer::NFC || Normalizer::FORM_D != Normalizer::NFD || Normalizer::FORM_KC != Normalizer::NFKC || - Normalizer::FORM_KD != Normalizer::NFKD || - Normalizer::NONE == Normalizer::FORM_C ) { + Normalizer::FORM_KD != Normalizer::NFKD) { $res_str .= "Invalid normalization form declarations!\n"; } @@ -69,12 +66,7 @@ function ut_main() { foreach( $strs as $str ) { - if (Normalizer::NONE == $form) { - /* Hide deprecation warning. */ - $str_norm = @ut_norm_normalize( $str, $form ); - } else { - $str_norm = ut_norm_normalize( $str, $form ); - } + $str_norm = ut_norm_normalize( $str, $form ); $error_code = intl_get_error_code(); $error_message = intl_get_error_message(); @@ -150,15 +142,3 @@ ut_run(); is in form 'UNORM_FORM_KD'? = no error info: 'U_ZERO_ERROR' (0) '%E1%BA%9B' normalized to form 'UNORM_FORM_KD' is 's%CC%87' error info: 'U_ZERO_ERROR' (0) is in form 'UNORM_FORM_KD'? = no error info: 'U_ZERO_ERROR' (0) -'ABC' normalized to form 'UNORM_NONE' is 'ABC' error info: 'U_ZERO_ERROR' (0) - is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1) -'%C3%A4%7C%7C%C3%A5%7C%7C%C3%B6' normalized to form 'UNORM_NONE' is '%C3%A4%7C%7C%C3%A5%7C%7C%C3%B6' error info: 'U_ZERO_ERROR' (0) - is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1) -'%E2%84%AB%7C%7C%C3%85%7C%7CA%CC%8A' normalized to form 'UNORM_NONE' is '%E2%84%AB%7C%7C%C3%85%7C%7CA%CC%8A' error info: 'U_ZERO_ERROR' (0) - is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1) -'%E2%84%A6%7C%7C%CE%A9' normalized to form 'UNORM_NONE' is '%E2%84%A6%7C%7C%CE%A9' error info: 'U_ZERO_ERROR' (0) - is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1) -'%EF%AC%81' normalized to form 'UNORM_NONE' is '%EF%AC%81' error info: 'U_ZERO_ERROR' (0) - is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1) -'%E1%BA%9B' normalized to form 'UNORM_NONE' is '%E1%BA%9B' error info: 'U_ZERO_ERROR' (0) - is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1) diff --git a/ext/intl/tests/normalizer_normalize_kc_cf.phpt b/ext/intl/tests/normalizer_normalize_kc_cf.phpt index 246e41baa2..c7a46e617d 100644 --- a/ext/intl/tests/normalizer_normalize_kc_cf.phpt +++ b/ext/intl/tests/normalizer_normalize_kc_cf.phpt @@ -58,12 +58,7 @@ function ut_main() { foreach( $strs as $str ) { - if (Normalizer::NONE == $form) { - /* Hide deprecation warning. */ - $str_norm = @ut_norm_normalize( $str, $form ); - } else { - $str_norm = ut_norm_normalize( $str, $form ); - } + $str_norm = ut_norm_normalize( $str, $form ); $error_code = intl_get_error_code(); $error_message = intl_get_error_message(); diff --git a/ext/intl/tests/timezone_countEquivalentIDs_error.phpt b/ext/intl/tests/timezone_countEquivalentIDs_error.phpt index 3087f49cbe..4fc9b02a1d 100644 --- a/ext/intl/tests/timezone_countEquivalentIDs_error.phpt +++ b/ext/intl/tests/timezone_countEquivalentIDs_error.phpt @@ -8,25 +8,7 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -var_dump(IntlTimeZone::countEquivalentIDs()); -var_dump(IntlTimeZone::countEquivalentIDs(array())); var_dump(IntlTimeZone::countEquivalentIDs("foo\x80")); -var_dump(IntlTimeZone::countEquivalentIDs("foo bar", 7)); --EXPECTF-- -Warning: IntlTimeZone::countEquivalentIDs() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::countEquivalentIDs() expects parameter 1 to be string, array given in %s on line %d - -Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: bad arguments in %s on line %d -bool(false) - Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: could not convert time zone id to UTF-16 in %s on line %d bool(false) - -Warning: IntlTimeZone::countEquivalentIDs() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/timezone_createDefault_error.phpt b/ext/intl/tests/timezone_createDefault_error.phpt deleted file mode 100644 index f2f2e021b9..0000000000 --- a/ext/intl/tests/timezone_createDefault_error.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -IntlTimeZone::createDefault(): errors ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -var_dump(IntlTimeZone::createDefault(4)); ---EXPECTF-- -Warning: IntlTimeZone::createDefault() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::createDefault(): intltz_create_default: bad arguments in %s on line %d -NULL diff --git a/ext/intl/tests/timezone_createEnumeration_error.phpt b/ext/intl/tests/timezone_createEnumeration_error.phpt index ea92e28d95..4e190129d4 100644 --- a/ext/intl/tests/timezone_createEnumeration_error.phpt +++ b/ext/intl/tests/timezone_createEnumeration_error.phpt @@ -9,12 +9,7 @@ if (!extension_loaded('intl')) ini_set("intl.error_level", E_WARNING); var_dump(IntlTimeZone::createEnumeration(array())); -var_dump(IntlTimeZone::createEnumeration(1, 2)); +?> --EXPECTF-- Warning: IntlTimeZone::createEnumeration(): intltz_create_enumeration: invalid argument type in %s on line %d bool(false) - -Warning: IntlTimeZone::createEnumeration() expects at most 1 parameter, 2 given in %s on line %d - -Warning: IntlTimeZone::createEnumeration(): intltz_create_enumeration: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt index 5edfaeaf6b..2b847ec841 100644 --- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt +++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt @@ -8,31 +8,7 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -var_dump(IntlTimeZone::createTimeZoneIDEnumeration()); -var_dump(IntlTimeZone::createTimeZoneIDEnumeration(array())); var_dump(IntlTimeZone::createTimeZoneIDEnumeration(-1)); -var_dump(IntlTimeZone::createTimeZoneIDEnumeration(IntlTimeZone::TYPE_ANY, array())); -var_dump(IntlTimeZone::createTimeZoneIDEnumeration(IntlTimeZone::TYPE_ANY, "PT", "a80")); --EXPECTF-- -Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects at least 1 parameter, 0 given in %s on line %d - -Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects parameter 1 to be int, array given in %s on line %d - -Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d -bool(false) - Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad zone type in %s on line %d bool(false) - -Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects parameter 2 to be string, array given in %s on line %d - -Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects parameter 3 to be int, string given in %s on line %d - -Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/timezone_createTimeZone_error.phpt b/ext/intl/tests/timezone_createTimeZone_error.phpt index 553223ee4c..a06f26b128 100644 --- a/ext/intl/tests/timezone_createTimeZone_error.phpt +++ b/ext/intl/tests/timezone_createTimeZone_error.phpt @@ -8,25 +8,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -var_dump(IntlTimeZone::createTimeZone()); -var_dump(IntlTimeZone::createTimeZone(new stdClass)); -var_dump(IntlTimeZone::createTimeZone("foo bar", 4)); var_dump(IntlTimeZone::createTimeZone("foo\x80")); +?> --EXPECTF-- -Warning: IntlTimeZone::createTimeZone() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: bad arguments in %s on line %d -NULL - -Warning: IntlTimeZone::createTimeZone() expects parameter 1 to be string, object given in %s on line %d - -Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: bad arguments in %s on line %d -NULL - -Warning: IntlTimeZone::createTimeZone() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: bad arguments in %s on line %d -NULL - Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: could not convert time zone id to UTF-16 in %s on line %d NULL diff --git a/ext/intl/tests/timezone_fromDateTimeZone_error.phpt b/ext/intl/tests/timezone_fromDateTimeZone_error.phpt index f50e59f97c..54a70d1f17 100644 --- a/ext/intl/tests/timezone_fromDateTimeZone_error.phpt +++ b/ext/intl/tests/timezone_fromDateTimeZone_error.phpt @@ -10,39 +10,9 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -var_dump(IntlTimeZone::fromDateTimeZone()); -var_dump(IntlTimeZone::fromDateTimeZone(1,2)); -var_dump(IntlTimeZone::fromDateTimeZone('sdfds')); -var_dump(IntlTimeZone::fromDateTimeZone(new stdclass)); $dt = new DateTime('2012-08-01 00:00:00 WEST'); var_dump(IntlTimeZone::fromDateTimeZone($dt->getTimeZone())); - -var_dump(intltz_from_date_time_zone()); +?> --EXPECTF-- -Warning: IntlTimeZone::fromDateTimeZone() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d -NULL - -Warning: IntlTimeZone::fromDateTimeZone() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d -NULL - -Warning: IntlTimeZone::fromDateTimeZone() expects parameter 1 to be DateTimeZone, string given in %s on line %d - -Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d -NULL - -Warning: IntlTimeZone::fromDateTimeZone() expects parameter 1 to be DateTimeZone, object given in %s on line %d - -Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d -NULL - Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d NULL - -Warning: intltz_from_date_time_zone() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: intltz_from_date_time_zone(): intltz_from_date_time_zone: bad arguments in %s on line %d -NULL diff --git a/ext/intl/tests/timezone_getCanonicalID_error.phpt b/ext/intl/tests/timezone_getCanonicalID_error.phpt index 684d946b1e..c1f7b6927a 100644 --- a/ext/intl/tests/timezone_getCanonicalID_error.phpt +++ b/ext/intl/tests/timezone_getCanonicalID_error.phpt @@ -8,19 +8,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -var_dump(IntlTimeZone::getCanonicalID()); -var_dump(IntlTimeZone::getCanonicalID(array())); var_dump(IntlTimeZone::getCanonicalID("foo\x81")); +?> --EXPECTF-- -Warning: IntlTimeZone::getCanonicalID() expects at least 1 parameter, 0 given in %s on line %d - -Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::getCanonicalID() expects parameter 1 to be string, array given in %s on line %d - -Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: bad arguments in %s on line %d -bool(false) - Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: could not convert time zone id to UTF-16 in %s on line %d bool(false) diff --git a/ext/intl/tests/timezone_getDSTSavings_error.phpt b/ext/intl/tests/timezone_getDSTSavings_error.phpt index 9df04f08c1..ebb0eb7776 100644 --- a/ext/intl/tests/timezone_getDSTSavings_error.phpt +++ b/ext/intl/tests/timezone_getDSTSavings_error.phpt @@ -8,16 +8,9 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$tz = IntlTimeZone::createTimeZone('Europe/Lisbon'); -var_dump($tz->getDSTSavings(array())); - var_dump(intltz_get_dst_savings(null)); +?> --EXPECTF-- -Warning: IntlTimeZone::getDSTSavings() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::getDSTSavings(): intltz_get_dst_savings: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_dst_savings() must be an instance of IntlTimeZone, null given in %s:%d Stack trace: #0 %s(%d): intltz_get_dst_savings(NULL) diff --git a/ext/intl/tests/timezone_getDisplayName_error.phpt b/ext/intl/tests/timezone_getDisplayName_error.phpt index 8d30f8840f..108530d2c3 100644 --- a/ext/intl/tests/timezone_getDisplayName_error.phpt +++ b/ext/intl/tests/timezone_getDisplayName_error.phpt @@ -9,37 +9,13 @@ if (!extension_loaded('intl')) ini_set("intl.error_level", E_WARNING); $tz = IntlTimeZone::createTimeZone('Europe/Lisbon'); -var_dump($tz->getDisplayName(array())); -var_dump($tz->getDisplayName(false, array())); var_dump($tz->getDisplayName(false, -1)); -var_dump($tz->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT, array())); -var_dump($tz->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT, NULL, NULL)); var_dump(intltz_get_display_name(null, IntlTimeZone::DISPLAY_SHORT, false, 'pt_PT')); --EXPECTF-- -Warning: IntlTimeZone::getDisplayName() expects parameter 1 to be bool, array given in %s on line %d - -Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::getDisplayName() expects parameter 2 to be int, array given in %s on line %d - -Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d -bool(false) - Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: wrong display type in %s on line %d bool(false) -Warning: IntlTimeZone::getDisplayName() expects parameter 3 to be string, array given in %s on line %d - -Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::getDisplayName() expects at most 3 parameters, 4 given in %s on line %d - -Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_display_name() must be an instance of IntlTimeZone, null given in %s:%d Stack trace: #0 %s(%d): intltz_get_display_name(NULL, 1, false, 'pt_PT') diff --git a/ext/intl/tests/timezone_getEquivalentID_error.phpt b/ext/intl/tests/timezone_getEquivalentID_error.phpt index facb8fe8cf..12afaee2fa 100644 --- a/ext/intl/tests/timezone_getEquivalentID_error.phpt +++ b/ext/intl/tests/timezone_getEquivalentID_error.phpt @@ -8,25 +8,8 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -var_dump(IntlTimeZone::getEquivalentID('foo')); -var_dump(IntlTimeZone::getEquivalentID('foo', 'bar')); -var_dump(IntlTimeZone::getEquivalentID('Europe/Lisbon', 0, 1)); var_dump(IntlTimeZone::getEquivalentID("foo\x80", 0)); +?> --EXPECTF-- -Warning: IntlTimeZone::getEquivalentID() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::getEquivalentID() expects parameter 2 to be int, string given in %s on line %d - -Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::getEquivalentID() expects exactly 2 parameters, 3 given in %s on line %d - -Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: bad arguments in %s on line %d -bool(false) - Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: could not convert time zone id to UTF-16 in %s on line %d bool(false) diff --git a/ext/intl/tests/timezone_getErrorCode_error.phpt b/ext/intl/tests/timezone_getErrorCode_error.phpt index f5b06b0757..657e09b240 100644 --- a/ext/intl/tests/timezone_getErrorCode_error.phpt +++ b/ext/intl/tests/timezone_getErrorCode_error.phpt @@ -8,16 +8,9 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$tz = IntlTimeZone::createTimeZone('Europe/Lisbon'); -var_dump($tz->getErrorCode(array())); - var_dump(intltz_get_error_code(null)); +?> --EXPECTF-- -Warning: IntlTimeZone::getErrorCode() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::getErrorCode(): intltz_get_error_code: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_error_code() must be an instance of IntlTimeZone, null given in %s:%d Stack trace: #0 %s(%d): intltz_get_error_code(NULL) diff --git a/ext/intl/tests/timezone_getErrorMessage_error.phpt b/ext/intl/tests/timezone_getErrorMessage_error.phpt index 6b8ce7d5c8..3ea812050b 100644 --- a/ext/intl/tests/timezone_getErrorMessage_error.phpt +++ b/ext/intl/tests/timezone_getErrorMessage_error.phpt @@ -8,16 +8,9 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$tz = IntlTimeZone::createTimeZone('Europe/Lisbon'); -var_dump($tz->getErrorMessage(array())); - var_dump(intltz_get_error_message(null)); +?> --EXPECTF-- -Warning: IntlTimeZone::getErrorMessage() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::getErrorMessage(): intltz_get_error_message: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_error_message() must be an instance of IntlTimeZone, null given in %s:%d Stack trace: #0 %s(%d): intltz_get_error_message(NULL) diff --git a/ext/intl/tests/timezone_getGMT_error.phpt b/ext/intl/tests/timezone_getGMT_error.phpt deleted file mode 100644 index ca478a10d1..0000000000 --- a/ext/intl/tests/timezone_getGMT_error.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -IntlTimeZone::getGMT(): errors ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -var_dump(IntlTimeZone::getGMT(4)); ---EXPECTF-- -Warning: IntlTimeZone::getGMT() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::getGMT(): intltz_get_gmt: bad arguments in %s on line %d -NULL diff --git a/ext/intl/tests/timezone_getID_error.phpt b/ext/intl/tests/timezone_getID_error.phpt index 4d0ffeb96f..81d36b9d0b 100644 --- a/ext/intl/tests/timezone_getID_error.phpt +++ b/ext/intl/tests/timezone_getID_error.phpt @@ -8,15 +8,9 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$tz = IntlTimeZone::createTimeZone('Europe/Lisbon'); -var_dump($tz->getID('foo')); intltz_get_id(null); +?> --EXPECTF-- -Warning: IntlTimeZone::getID() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::getID(): intltz_get_id: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_id() must be an instance of IntlTimeZone, null given in %s:%d Stack trace: #0 %s(%d): intltz_get_id(NULL) diff --git a/ext/intl/tests/timezone_getOffset_error.phpt b/ext/intl/tests/timezone_getOffset_error.phpt index d66716e552..3ae06e4ce0 100644 --- a/ext/intl/tests/timezone_getOffset_error.phpt +++ b/ext/intl/tests/timezone_getOffset_error.phpt @@ -10,24 +10,13 @@ ini_set("intl.error_level", E_WARNING); $tz = IntlTimeZone::createTimeZone('Europe/Lisbon'); var_dump($tz->getOffset(INF, true, $a, $a)); -var_dump($tz->getOffset(time()*1000, true, $a)); -var_dump($tz->getOffset(time()*1000, true, $a, $a, $a)); intltz_get_offset(null, time()*1000, false, $a, $a); +?> --EXPECTF-- Warning: IntlTimeZone::getOffset(): intltz_get_offset: error obtaining offset in %s on line %d bool(false) -Warning: IntlTimeZone::getOffset() expects exactly 4 parameters, 3 given in %s on line %d - -Warning: IntlTimeZone::getOffset(): intltz_get_offset: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::getOffset() expects exactly 4 parameters, 5 given in %s on line %d - -Warning: IntlTimeZone::getOffset(): intltz_get_offset: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_offset() must be an instance of IntlTimeZone, null given in %s:%d Stack trace: #0 %s(%d): intltz_get_offset(NULL, %d, false, NULL, NULL) diff --git a/ext/intl/tests/timezone_getRawOffset_error.phpt b/ext/intl/tests/timezone_getRawOffset_error.phpt index dc7df51cca..9e0691f39d 100644 --- a/ext/intl/tests/timezone_getRawOffset_error.phpt +++ b/ext/intl/tests/timezone_getRawOffset_error.phpt @@ -8,16 +8,9 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$tz = IntlTimeZone::createTimeZone('Europe/Lisbon'); -var_dump($tz->getRawOffset('foo')); - intltz_get_raw_offset(null); +?> --EXPECTF-- -Warning: IntlTimeZone::getRawOffset() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::getRawOffset(): intltz_get_raw_offset: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_raw_offset() must be an instance of IntlTimeZone, null given in %s:%d Stack trace: #0 %s(%d): intltz_get_raw_offset(NULL) diff --git a/ext/intl/tests/timezone_getRegion_error.phpt b/ext/intl/tests/timezone_getRegion_error.phpt index 7a9e1e1ca7..28fd73c1a7 100644 --- a/ext/intl/tests/timezone_getRegion_error.phpt +++ b/ext/intl/tests/timezone_getRegion_error.phpt @@ -8,27 +8,10 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -var_dump(IntlTimeZone::getRegion()); -var_dump(IntlTimeZone::getRegion(array())); -var_dump(IntlTimeZone::getRegion('Europe/Lisbon', 4)); var_dump(IntlTimeZone::getRegion("foo\x81")); var_dump(IntlTimeZone::getRegion("foo")); +?> --EXPECTF-- -Warning: IntlTimeZone::getRegion() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlTimeZone::getRegion(): intltz_get_region: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::getRegion() expects parameter 1 to be string, array given in %s on line %d - -Warning: IntlTimeZone::getRegion(): intltz_get_region: bad arguments in %s on line %d -bool(false) - -Warning: IntlTimeZone::getRegion() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlTimeZone::getRegion(): intltz_get_region: bad arguments in %s on line %d -bool(false) - Warning: IntlTimeZone::getRegion(): intltz_get_region: could not convert time zone id to UTF-16 in %s on line %d bool(false) diff --git a/ext/intl/tests/timezone_getTZDataVersion_error.phpt b/ext/intl/tests/timezone_getTZDataVersion_error.phpt deleted file mode 100644 index eab4573a36..0000000000 --- a/ext/intl/tests/timezone_getTZDataVersion_error.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -IntlTimeZone::getTZDataVersion(): errors ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -var_dump(IntlTimeZone::getTZDataVersion('foo')); ---EXPECTF-- -Warning: IntlTimeZone::getTZDataVersion() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::getTZDataVersion(): intltz_get_tz_data_version: bad arguments in %s on line %d -bool(false) diff --git a/ext/intl/tests/timezone_getUnknown_error.phpt b/ext/intl/tests/timezone_getUnknown_error.phpt deleted file mode 100644 index 57773c256b..0000000000 --- a/ext/intl/tests/timezone_getUnknown_error.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -IntlCalendar::getUnknown(): bad arguments ---INI-- -date.timezone=Atlantic/Azores ---SKIPIF-- -<?php -if (!extension_loaded('intl')) - die('skip intl extension not enabled'); ---FILE-- -<?php -ini_set("intl.error_level", E_WARNING); - -$c = new IntlGregorianCalendar(NULL, 'pt_PT'); - -IntlTimeZone::getUnknown(1); - -intltz_get_unknown(1); ---EXPECTF-- -Warning: IntlTimeZone::getUnknown() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::getUnknown(): intltz_get_unknown: bad arguments in %s on line %d - -Warning: intltz_get_unknown() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: intltz_get_unknown(): intltz_get_unknown: bad arguments in %s on line %d diff --git a/ext/intl/tests/timezone_toDateTimeZone_error.phpt b/ext/intl/tests/timezone_toDateTimeZone_error.phpt index d00e78fd3a..c402dec673 100644 --- a/ext/intl/tests/timezone_toDateTimeZone_error.phpt +++ b/ext/intl/tests/timezone_toDateTimeZone_error.phpt @@ -10,29 +10,17 @@ ini_set("intl.error_level", E_WARNING); $tz = IntlTimeZone::createTimeZone('Etc/Unknown'); -var_dump($tz->toDateTimeZone('')); try { var_dump($tz->toDateTimeZone()); } catch (Exception $e) { var_dump($e->getMessage()); } -var_dump(intltz_to_date_time_zone()); var_dump(intltz_to_date_time_zone(1)); --EXPECTF-- -Warning: IntlTimeZone::toDateTimeZone() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::toDateTimeZone(): intltz_to_date_time_zone: bad arguments in %s on line %d -bool(false) - Warning: IntlTimeZone::toDateTimeZone(): intltz_to_date_time_zone: DateTimeZone constructor threw exception in %s on line %d string(66) "DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)" -Warning: intltz_to_date_time_zone() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: intltz_to_date_time_zone(): intltz_to_date_time_zone: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intltz_to_date_time_zone() must be an instance of IntlTimeZone, int given in %s:%d Stack trace: #0 %s(%d): intltz_to_date_time_zone(1) diff --git a/ext/intl/tests/timezone_useDaylightTime_error.phpt b/ext/intl/tests/timezone_useDaylightTime_error.phpt index c6ab2eefe5..b872dcb18b 100644 --- a/ext/intl/tests/timezone_useDaylightTime_error.phpt +++ b/ext/intl/tests/timezone_useDaylightTime_error.phpt @@ -8,15 +8,9 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); -$tz = IntlTimeZone::createTimeZone('Europe/Lisbon'); -var_dump($tz->useDaylightTime('foo')); intltz_use_daylight_time(null); +?> --EXPECTF-- -Warning: IntlTimeZone::useDaylightTime() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: IntlTimeZone::useDaylightTime(): intltz_use_daylight_time: bad arguments in %s on line %d -bool(false) - Fatal error: Uncaught TypeError: Argument 1 passed to intltz_use_daylight_time() must be an instance of IntlTimeZone, null given in %s:%d Stack trace: #0 %s(%d): intltz_use_daylight_time(NULL) diff --git a/ext/intl/tests/transliterator_create_from_rule_error.phpt b/ext/intl/tests/transliterator_create_from_rule_error.phpt index d1549ec1b6..64c57da854 100644 --- a/ext/intl/tests/transliterator_create_from_rule_error.phpt +++ b/ext/intl/tests/transliterator_create_from_rule_error.phpt @@ -6,12 +6,6 @@ Transliterator::createFromRules (error) <?php ini_set("intl.error_level", E_WARNING); -$t = Transliterator::createFromRules(); -echo intl_get_error_message(),"\n"; - -$t = Transliterator::createFromRules("a","b"); -echo intl_get_error_message(),"\n"; - $t = Transliterator::createFromRules("\x8Fss"); echo intl_get_error_message(),"\n"; @@ -31,16 +25,6 @@ $t = Transliterator::createFromRules($rules); echo intl_get_error_message(),"\n"; echo "Done.\n"; --EXPECTF-- -Warning: Transliterator::createFromRules() expects at least 1 parameter, 0 given in %s on line %d - -Warning: Transliterator::createFromRules(): transliterator_create_from_rules: bad arguments in %s on line %d -transliterator_create_from_rules: bad arguments: U_ILLEGAL_ARGUMENT_ERROR - -Warning: Transliterator::createFromRules() expects parameter 2 to be int, string given in %s on line %d - -Warning: Transliterator::createFromRules(): transliterator_create_from_rules: bad arguments in %s on line %d -transliterator_create_from_rules: bad arguments: U_ILLEGAL_ARGUMENT_ERROR - Warning: Transliterator::createFromRules(): String conversion of rules to UTF-16 failed in %s on line %d String conversion of rules to UTF-16 failed: U_INVALID_CHAR_FOUND diff --git a/ext/intl/tests/transliterator_create_inverse_error.phpt b/ext/intl/tests/transliterator_create_inverse_error.phpt index 1a1e80ba68..a7fffa62b1 100644 --- a/ext/intl/tests/transliterator_create_inverse_error.phpt +++ b/ext/intl/tests/transliterator_create_inverse_error.phpt @@ -7,16 +7,9 @@ Transliterator::createInverse (error) ini_set("intl.error_level", E_WARNING); -$tr = Transliterator::create("Katakana-Latin"); -$tr->createInverse(array()); - -$tr = Transliterator::create("Katakana-Latin"); transliterator_create_inverse("jj"); +?> --EXPECTF-- -Warning: Transliterator::createInverse() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: Transliterator::createInverse(): transliterator_create_inverse: bad arguments in %s on line %d - Fatal error: Uncaught TypeError: Argument 1 passed to transliterator_create_inverse() must be an instance of Transliterator, string given in %s:%d Stack trace: #0 %s(%d): transliterator_create_inverse('jj') diff --git a/ext/intl/tests/transliterator_get_error_code_error.phpt b/ext/intl/tests/transliterator_get_error_code_error.phpt index e700d2b172..813c8c480e 100644 --- a/ext/intl/tests/transliterator_get_error_code_error.phpt +++ b/ext/intl/tests/transliterator_get_error_code_error.phpt @@ -5,21 +5,9 @@ Transliterator::getErrorCode (error) --FILE-- <?php ini_set("intl.error_level", E_WARNING); -$t = Transliterator::create("[\p{Bidi_Mirrored}] Hex"); -echo transliterator_get_error_code(), "\n"; -echo $t->getErrorCode(null), "\n"; echo transliterator_get_error_code(array()), "\n"; +?> --EXPECTF-- -Warning: transliterator_get_error_code() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: transliterator_get_error_code(): transliterator_get_error_code: unable to parse input params in %s on line %d - - -Warning: Transliterator::getErrorCode() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: Transliterator::getErrorCode(): transliterator_get_error_code: unable to parse input params in %s on line %d - - Fatal error: Uncaught TypeError: Argument 1 passed to transliterator_get_error_code() must be an instance of Transliterator, array given in %s:%d Stack trace: #0 %s(%d): transliterator_get_error_code(Array) diff --git a/ext/intl/tests/transliterator_get_error_message_error.phpt b/ext/intl/tests/transliterator_get_error_message_error.phpt index ec8282447a..7bcc7df169 100644 --- a/ext/intl/tests/transliterator_get_error_message_error.phpt +++ b/ext/intl/tests/transliterator_get_error_message_error.phpt @@ -5,21 +5,9 @@ Transliterator::getErrorMessage (error) --FILE-- <?php ini_set("intl.error_level", E_WARNING); -$t = Transliterator::create("[\p{Bidi_Mirrored}] Hex"); -echo transliterator_get_error_message(), "\n"; -echo $t->getErrorMessage(null), "\n"; echo transliterator_get_error_message(array()), "\n"; +?> --EXPECTF-- -Warning: transliterator_get_error_message() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: transliterator_get_error_message(): transliterator_get_error_message: unable to parse input params in %s on line %d - - -Warning: Transliterator::getErrorMessage() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: Transliterator::getErrorMessage(): transliterator_get_error_message: unable to parse input params in %s on line %d - - Fatal error: Uncaught TypeError: Argument 1 passed to transliterator_get_error_message() must be an instance of Transliterator, array given in %s:%d Stack trace: #0 %s(%d): transliterator_get_error_message(Array) diff --git a/ext/intl/tests/transliterator_list_ids_error.phpt b/ext/intl/tests/transliterator_list_ids_error.phpt deleted file mode 100644 index fa651387f1..0000000000 --- a/ext/intl/tests/transliterator_list_ids_error.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Transliterator::listIDs (error) ---SKIPIF-- -<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> ---FILE-- -<?php - -ini_set("intl.error_level", E_WARNING); -var_dump(transliterator_list_ids(array())); - -echo "Done.\n"; ---EXPECTF-- -Warning: transliterator_list_ids() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: transliterator_list_ids(): transliterator_list_ids: bad arguments in %s on line %d -bool(false) -Done. diff --git a/ext/intl/tests/transliterator_transliterate_error.phpt b/ext/intl/tests/transliterator_transliterate_error.phpt index cdddcfb87b..da9a887455 100644 --- a/ext/intl/tests/transliterator_transliterate_error.phpt +++ b/ext/intl/tests/transliterator_transliterate_error.phpt @@ -10,51 +10,19 @@ ini_set("intl.error_level", E_WARNING); $tr = Transliterator::create("latin"); //Arguments -var_dump(transliterator_transliterate()); -var_dump(transliterator_transliterate($tr,array())); var_dump(transliterator_transliterate($tr,"str",7)); var_dump(transliterator_transliterate($tr,"str",7,6)); -var_dump(transliterator_transliterate($tr,"str",2,-1,"extra")); - -//Arguments -var_dump($tr->transliterate()); -var_dump($tr->transliterate(array())); //bad UTF-8 transliterator_transliterate($tr, "\x80\x03"); echo "Done.\n"; --EXPECTF-- -Warning: transliterator_transliterate() expects at least 2 parameters, 0 given in %s on line %d - -Warning: transliterator_transliterate(): transliterator_transliterate: bad arguments in %s on line %d -bool(false) - -Warning: transliterator_transliterate() expects parameter 2 to be string, array given in %s on line %d - -Warning: transliterator_transliterate(): transliterator_transliterate: bad arguments in %s on line %d -bool(false) - Warning: transliterator_transliterate(): transliterator_transliterate: Neither "start" nor the "end" arguments can exceed the number of UTF-16 code units (in this case, 3) in %s on line %d bool(false) Warning: transliterator_transliterate(): transliterator_transliterate: "start" argument should be non-negative and not bigger than "end" (if defined) in %s on line %d bool(false) -Warning: transliterator_transliterate() expects at most 4 parameters, 5 given in %s on line %d - -Warning: transliterator_transliterate(): transliterator_transliterate: bad arguments in %s on line %d -bool(false) - -Warning: Transliterator::transliterate() expects at least 1 parameter, 0 given in %s on line %d - -Warning: Transliterator::transliterate(): transliterator_transliterate: bad arguments in %s on line %d -bool(false) - -Warning: Transliterator::transliterate() expects parameter 1 to be string, array given in %s on line %d - -Warning: Transliterator::transliterate(): transliterator_transliterate: bad arguments in %s on line %d -bool(false) - Warning: transliterator_transliterate(): String conversion of string to UTF-16 failed in %s on line %d Done. diff --git a/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt b/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt deleted file mode 100644 index 4e381289b3..0000000000 --- a/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Check the function UConverter::getAvailable with parameter wrong ---SKIPIF-- -<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> ---FILE-- -<?php UConverter::getAvailable("This is an ascii string"); ?> ---EXPECTF-- -Warning: UConverter::getAvailable() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index aabb0f3f55..6caf42cacd 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -98,7 +98,7 @@ U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone, goto error; } ZVAL_STR(&arg, u8str); - zend_call_method_with_1_params(ret, NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg); + zend_call_method_with_1_params(Z_OBJ_P(ret), NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg); if (EG(exception)) { spprintf(&message, 0, "%s: DateTimeZone constructor threw exception", func); @@ -221,17 +221,17 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, /* }}} */ /* {{{ clone handler for TimeZone */ -static zend_object *TimeZone_clone_obj(zval *object) +static zend_object *TimeZone_clone_obj(zend_object *object) { TimeZone_object *to_orig, *to_new; zend_object *ret_val; intl_error_reset(NULL); - to_orig = Z_INTL_TIMEZONE_P(object); + to_orig = php_intl_timezone_fetch_object(object); intl_error_reset(TIMEZONE_ERROR_P(to_orig)); - ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object)); + ret_val = TimeZone_ce_ptr->create_object(object->ce); to_new = php_intl_timezone_fetch_object(ret_val); zend_objects_clone_members(&to_new->zo, &to_orig->zo); @@ -285,7 +285,7 @@ static int TimeZone_compare_objects(zval *object1, zval *object2) /* }}} */ /* {{{ get_debug_info handler for TimeZone */ -static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp) +static HashTable *TimeZone_get_debug_info(zend_object *object, int *is_temp) { zval zv; TimeZone_object *to; @@ -299,7 +299,7 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp) debug_info = zend_new_array(8); - to = Z_INTL_TIMEZONE_P(object); + to = php_intl_timezone_fetch_object(object); tz = to->utimezone; if (tz == NULL) { diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index 3f91db3130..e70c9b4195 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -55,8 +55,6 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone) intl_error_reset(NULL); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str_id, &str_id_len) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_create_time_zone: bad arguments", 0); RETURN_NULL(); } @@ -82,8 +80,6 @@ U_CFUNC PHP_FUNCTION(intltz_from_date_time_zone) if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zv_timezone, php_date_get_timezone_ce()) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_from_date_time_zone: bad arguments", 0); RETURN_NULL(); } @@ -109,8 +105,6 @@ U_CFUNC PHP_FUNCTION(intltz_create_default) intl_error_reset(NULL); if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_create_default: bad arguments", 0); RETURN_NULL(); } @@ -123,8 +117,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_gmt) intl_error_reset(NULL); if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_gmt: bad arguments", 0); RETURN_NULL(); } @@ -136,8 +128,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_unknown) intl_error_reset(NULL); if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_unknown: bad arguments", 0); RETURN_NULL(); } @@ -153,8 +143,6 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration) /* double indirection to have the zend engine destroy the new zval that * results from separation */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_create_enumeration: bad arguments", 0); RETURN_FALSE; } @@ -213,8 +201,6 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids) if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str_id, &str_id_len) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_count_equivalent_ids: bad arguments", 0); RETURN_FALSE; } @@ -244,8 +230,6 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration) if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|s!l!", &zoneType, ®ion, ®ion_len, &offset_arg, &arg3isnull) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_create_time_zone_id_enumeration: bad arguments", 0); RETURN_FALSE; } @@ -285,8 +269,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id) if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &str_id, &str_id_len, &is_systemid) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_canonical_id: bad arguments", 0); RETURN_FALSE; } @@ -324,8 +306,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_region) if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str_id, &str_id_len) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_region: bad arguments", 0); RETURN_FALSE; } @@ -348,8 +328,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_tz_data_version) intl_error_reset(NULL); if (zend_parse_parameters_none() == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_tz_data_version: bad arguments", 0); RETURN_FALSE; } @@ -371,8 +349,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_equivalent_id) if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &str_id, &str_id_len, &index) == FAILURE || index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_equivalent_id: bad arguments", 0); RETURN_FALSE; } @@ -399,8 +375,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_id) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, TimeZone_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_id: bad arguments", 0); RETURN_FALSE; } @@ -424,8 +398,6 @@ U_CFUNC PHP_FUNCTION(intltz_use_daylight_time) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, TimeZone_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_use_daylight_time: bad arguments", 0); RETURN_FALSE; } @@ -447,8 +419,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Odbz/z/", &object, TimeZone_ce_ptr, &date, &local, &rawOffsetArg, &dstOffsetArg) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_offset: bad arguments", 0); RETURN_FALSE; } @@ -473,8 +443,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_raw_offset) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, TimeZone_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_raw_offset: bad arguments", 0); RETURN_FALSE; } @@ -492,8 +460,6 @@ U_CFUNC PHP_FUNCTION(intltz_has_same_rules) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, TimeZone_ce_ptr, &other_object, TimeZone_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_has_same_rules: bad arguments", 0); RETURN_FALSE; } TIMEZONE_METHOD_FETCH_OBJECT; @@ -525,8 +491,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_display_name) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|bls!", &object, TimeZone_ce_ptr, &daylight, &display_type, &locale_str, &dummy) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_display_name: bad arguments", 0); RETURN_FALSE; } @@ -564,8 +528,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_dst_savings) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, TimeZone_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_dst_savings: bad arguments", 0); RETURN_FALSE; } @@ -581,8 +543,6 @@ U_CFUNC PHP_FUNCTION(intltz_to_date_time_zone) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, TimeZone_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_to_date_time_zone: bad arguments", 0); RETURN_FALSE; } @@ -604,8 +564,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_code) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, TimeZone_ce_ptr) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_error_code: bad arguments", 0); RETURN_FALSE; } @@ -624,8 +582,6 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_message) if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, TimeZone_ce_ptr) == FAILURE) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intltz_get_error_message: bad arguments", 0 ); RETURN_FALSE; } diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index a662dcee7d..c9e0f83c0b 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -130,16 +130,16 @@ static zend_object *Transliterator_object_create( zend_class_entry *ce ) */ /* {{{ clone handler for Transliterator */ -static zend_object *Transliterator_clone_obj( zval *object ) +static zend_object *Transliterator_clone_obj( zend_object *object ) { Transliterator_object *to_orig, *to_new; zend_object *ret_val; intl_error_reset( NULL ); - to_orig = Z_INTL_TRANSLITERATOR_P( object ); + to_orig = php_intl_transliterator_fetch_object( object ); intl_error_reset( INTL_DATA_ERROR_P( to_orig ) ); - ret_val = Transliterator_ce_ptr->create_object( Z_OBJCE_P( object ) ); + ret_val = Transliterator_ce_ptr->create_object( object->ce ); to_new = php_intl_transliterator_fetch_object( ret_val ); zend_objects_clone_members( &to_new->zo, &to_orig->zo ); @@ -189,76 +189,52 @@ err: } /* }}} */ -#define TRANSLITERATOR_PROPERTY_HANDLER_PROLOG \ - zval tmp_member; \ - if( Z_TYPE_P( member ) != IS_STRING ) \ - { \ - ZVAL_STR(&tmp_member, \ - zval_get_string_func(member)); \ - member = &tmp_member; \ - cache_slot = NULL; \ - } - -#define TRANSLITERATOR_PROPERTY_HANDLER_EPILOG \ - if( member == &tmp_member ) \ - { \ - zval_ptr_dtor_str( &tmp_member ); \ - } - /* {{{ get_property_ptr_ptr handler */ -static zval *Transliterator_get_property_ptr_ptr( zval *object, zval *member, int type, void **cache_slot ) +static zval *Transliterator_get_property_ptr_ptr( zend_object *object, zend_string *name, int type, void **cache_slot ) { zval *retval; - TRANSLITERATOR_PROPERTY_HANDLER_PROLOG; - if(zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) + ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) { retval = NULL; /* fallback to read_property */ } else { - retval = zend_std_get_property_ptr_ptr( object, member, type, cache_slot ); + retval = zend_std_get_property_ptr_ptr( object, name, type, cache_slot ); } - TRANSLITERATOR_PROPERTY_HANDLER_EPILOG; - return retval; } /* }}} */ /* {{{ read_property handler */ -static zval *Transliterator_read_property( zval *object, zval *member, int type, void **cache_slot, zval *rv ) +static zval *Transliterator_read_property( zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv ) { zval *retval; - TRANSLITERATOR_PROPERTY_HANDLER_PROLOG; - if( ( type != BP_VAR_R && type != BP_VAR_IS ) && ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) ) + ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) ) { php_error_docref0( NULL, E_WARNING, "The property \"id\" is read-only" ); retval = &EG( uninitialized_zval ); } else { - retval = zend_std_read_property( object, member, type, cache_slot, rv ); + retval = zend_std_read_property( object, name, type, cache_slot, rv ); } - TRANSLITERATOR_PROPERTY_HANDLER_EPILOG; - return retval; } /* }}} */ /* {{{ write_property handler */ -static zval *Transliterator_write_property( zval *object, zval *member, zval *value, void **cache_slot ) +static zval *Transliterator_write_property( zend_object *object, zend_string *name, zval *value, + void **cache_slot ) { zend_class_entry *scope; - TRANSLITERATOR_PROPERTY_HANDLER_PROLOG; if (EG(fake_scope)) { scope = EG(fake_scope); @@ -267,17 +243,15 @@ static zval *Transliterator_write_property( zval *object, zval *member, zval *va } if( ( scope != Transliterator_ce_ptr ) && ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) ) + ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) ) { php_error_docref0( NULL, E_WARNING, "The property \"id\" is read-only" ); } else { - value = zend_std_write_property( object, member, value, cache_slot ); + value = zend_std_write_property( object, name, value, cache_slot ); } - TRANSLITERATOR_PROPERTY_HANDLER_EPILOG; - return value; } /* }}} */ diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index 25d0b9a4da..fb438e2362 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -115,8 +115,6 @@ PHP_FUNCTION( transliterator_create ) if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|l", &str_id, &str_id_len, &direction ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "transliterator_create: bad arguments", 0 ); RETURN_NULL(); } @@ -149,8 +147,6 @@ PHP_FUNCTION( transliterator_create_from_rules ) if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|l", &str_rules, &str_rules_len, &direction ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "transliterator_create_from_rules: bad arguments", 0 ); RETURN_NULL(); } @@ -214,8 +210,6 @@ PHP_FUNCTION( transliterator_create_inverse ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, Transliterator_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "transliterator_create_inverse: bad arguments", 0 ); RETURN_NULL(); } @@ -250,12 +244,7 @@ PHP_FUNCTION( transliterator_list_ids ) if( zend_parse_parameters_none() == FAILURE ) { - /* seems to be the convention in this lib to return false instead of - * null on bad parameter types, except on constructors and factory - * methods */ - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "transliterator_list_ids: bad arguments", 0 ); - RETURN_FALSE; + return; } en = utrans_openIDs( &status ); @@ -317,8 +306,6 @@ PHP_FUNCTION( transliterator_transliterate ) if( zend_parse_parameters( ZEND_NUM_ARGS(), "zs|ll", &arg1, &str, &str_len, &start, &limit ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "transliterator_transliterate: bad arguments", 0 ); RETURN_FALSE; } @@ -352,8 +339,6 @@ PHP_FUNCTION( transliterator_transliterate ) else if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|ll", &str, &str_len, &start, &limit ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "transliterator_transliterate: bad arguments", 0 ); RETURN_FALSE; } @@ -480,9 +465,6 @@ PHP_FUNCTION( transliterator_get_error_code ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, Transliterator_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "transliterator_get_error_code: unable to parse input params", 0 ); - RETURN_FALSE; } @@ -508,9 +490,6 @@ PHP_FUNCTION( transliterator_get_error_message ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, Transliterator_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, - "transliterator_get_error_message: unable to parse input params", 0 ); - RETURN_FALSE; } diff --git a/ext/json/json_parser.y b/ext/json/json_parser.y index aa37c03658..e251d6e0d4 100644 --- a/ext/json/json_parser.y +++ b/ext/json/json_parser.y @@ -274,7 +274,6 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object, if (Z_TYPE_P(object) == IS_ARRAY) { zend_symtable_update(Z_ARRVAL_P(object), key, zvalue); } else { - zval zkey; if (ZSTR_LEN(key) > 0 && ZSTR_VAL(key)[0] == '\0') { parser->scanner.errcode = PHP_JSON_ERROR_INVALID_PROPERTY_NAME; zend_string_release_ex(key, 0); @@ -282,8 +281,7 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object, zval_ptr_dtor_nogc(object); return FAILURE; } - ZVAL_NEW_STR(&zkey, key); - zend_std_write_property(object, &zkey, zvalue, NULL); + zend_std_write_property(Z_OBJ_P(object), key, zvalue, NULL); Z_TRY_DELREF_P(zvalue); } zend_string_release_ex(key, 0); diff --git a/ext/json/tests/001.phpt b/ext/json/tests/001.phpt index e908b44349..63a303998a 100644 --- a/ext/json/tests/001.phpt +++ b/ext/json/tests/001.phpt @@ -5,7 +5,6 @@ json_decode() tests --FILE-- <?php -var_dump(json_decode()); var_dump(json_decode("")); var_dump(json_decode("", 1)); var_dump(json_decode("", 0)); @@ -26,8 +25,6 @@ var_dump(json_decode('{ "": "": "" } }')); ?> ===DONE=== --EXPECTF-- -Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d -NULL NULL NULL NULL diff --git a/ext/json/tests/json_decode_error.phpt b/ext/json/tests/json_decode_error.phpt index 9906a2b0d4..4089a7897f 100644 --- a/ext/json/tests/json_decode_error.phpt +++ b/ext/json/tests/json_decode_error.phpt @@ -6,13 +6,6 @@ Test json_decode() function : error conditions <?php echo "*** Testing json_decode() : error conditions ***\n"; -echo "\n-- Testing json_decode() function with no arguments --\n"; -var_dump(json_decode()); - -echo "\n-- Testing json_decode() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump(json_decode('"abc"', true, 512, 0, $extra_arg)); - echo "\n-- Testing json_decode() function with depth below 0 --\n"; var_dump(json_decode('"abc"', true, -1)); @@ -21,16 +14,6 @@ var_dump(json_decode('"abc"', true, -1)); --EXPECTF-- *** Testing json_decode() : error conditions *** --- Testing json_decode() function with no arguments -- - -Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing json_decode() function with more than expected no. of arguments -- - -Warning: json_decode() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing json_decode() function with depth below 0 -- Warning: json_decode(): Depth must be greater than zero in %s on line %d diff --git a/ext/json/tests/json_last_error_error.phpt b/ext/json/tests/json_last_error_error.phpt index e733b32854..cd88ef8a9e 100644 --- a/ext/json/tests/json_last_error_error.phpt +++ b/ext/json/tests/json_last_error_error.phpt @@ -6,15 +6,14 @@ json_last_error() failures <?php var_dump(json_last_error()); -var_dump(json_last_error(true)); -var_dump(json_last_error('some', 4, 'args', 'here')); + +try { + var_dump(json_last_error(true)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- +--EXPECT-- int(0) - -Warning: json_last_error() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: json_last_error() expects exactly 0 parameters, 4 given in %s on line %d -NULL +json_last_error() expects exactly 0 parameters, 1 given diff --git a/ext/json/tests/json_last_error_msg_error.phpt b/ext/json/tests/json_last_error_msg_error.phpt index 719e9fc50c..75b06f72a2 100644 --- a/ext/json/tests/json_last_error_msg_error.phpt +++ b/ext/json/tests/json_last_error_msg_error.phpt @@ -6,15 +6,14 @@ json_last_error_msg() failures <?php var_dump(json_last_error_msg()); -var_dump(json_last_error_msg(true)); -var_dump(json_last_error_msg('some', 4, 'args', 'here')); + +try { + var_dump(json_last_error_msg(true)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- string(8) "No error" - -Warning: json_last_error_msg() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: json_last_error_msg() expects exactly 0 parameters, 4 given in %s on line %d -NULL +json_last_error_msg() expects exactly 0 parameters, 1 given diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4 index 8b94c06225..3fe0321702 100644 --- a/ext/ldap/config.m4 +++ b/ext/ldap/config.m4 @@ -96,7 +96,7 @@ PHP_ARG_WITH([ldap-sasl], if test "$PHP_LDAP" != "no"; then - PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,,-DLDAP_DEPRECATED=1 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) + PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) if test "$PHP_LDAP" = "yes"; then for i in /usr/local /usr; do diff --git a/ext/ldap/config.w32 b/ext/ldap/config.w32 index 49f740bd65..59aff718bf 100644 --- a/ext/ldap/config.w32 +++ b/ext/ldap/config.w32 @@ -18,7 +18,6 @@ if (PHP_LDAP != "no") { AC_DEFINE('HAVE_LDAP', 1); AC_DEFINE('HAVE_LDAP_SASL', 1); AC_DEFINE('HAVE_LDAP_SASL_SASL_H', 1); - AC_DEFINE('LDAP_DEPRECATED', 1); AC_DEFINE('HAVE_LDAP_CONTROL_FIND', 1); AC_DEFINE('HAVE_LDAP_PARSE_EXTENDED_RESULT', 1); AC_DEFINE('HAVE_LDAP_EXTENDED_OPERATION_S', 1); diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index f191fb8345..c60c33b829 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -2943,39 +2943,6 @@ cleanup: } /* }}} */ -/* {{{ proto bool ldap_sort(resource link, resource result, string sortfilter) - Sort LDAP result entries */ -PHP_FUNCTION(ldap_sort) -{ - zval *link, *result; - ldap_linkdata *ld; - char *sortfilter; - size_t sflen; - zend_resource *le; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs", &link, &result, &sortfilter, &sflen) != SUCCESS) { - RETURN_FALSE; - } - - if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; - } - - le = Z_RES_P(result); - if (le->type != le_result) { - php_error_docref(NULL, E_WARNING, "Supplied resource is not a valid ldap result resource"); - RETURN_FALSE; - } - - if (ldap_sort_entries(ld->link, (LDAPMessage **) &le->ptr, sflen ? sortfilter : NULL, strcmp) != LDAP_SUCCESS) { - php_error_docref(NULL, E_WARNING, "%s", ldap_err2string(errno)); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP /* {{{ proto bool ldap_get_option(resource link, int option, mixed retval) Get the current value of various session-wide parameters */ @@ -4619,12 +4586,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_compare, 0, 0, 4) ZEND_ARG_INFO(0, servercontrols) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_sort, 0, 0, 3) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(0, sortfilter) -ZEND_END_ARG_INFO() - #ifdef LDAP_CONTROL_PAGEDRESULTS ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_result, 0, 0, 2) ZEND_ARG_INFO(0, link) @@ -4823,7 +4784,6 @@ static const zend_function_entry ldap_functions[] = { PHP_FE(ldap_err2str, arginfo_ldap_err2str) PHP_FE(ldap_error, arginfo_ldap_resource) PHP_FE(ldap_compare, arginfo_ldap_compare) - PHP_DEP_FE(ldap_sort, arginfo_ldap_sort) #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP PHP_FE(ldap_rename, arginfo_ldap_rename) diff --git a/ext/ldap/tests/ldap_sort_basic.phpt b/ext/ldap/tests/ldap_sort_basic.phpt deleted file mode 100644 index e14381f8c7..0000000000 --- a/ext/ldap/tests/ldap_sort_basic.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -ldap_sort() - Basic ldap_sort test ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> -<?php require_once('skipifbindfailure.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link, $base); -ldap_add($link, "cn=userC,$base", array( - "objectclass" => "person", - "cn" => "userC", - "sn" => "zzz", - "userPassword" => "oops", - "description" => "a user", -)); -ldap_add($link, "cn=userD,$base", array( - "objectclass" => "person", - "cn" => "userD", - "sn" => "aaa", - "userPassword" => "oops", - "description" => "another user", -)); -ldap_add($link, "cn=userE,$base", array( - "objectclass" => "person", - "cn" => "userE", - "sn" => "a", - "userPassword" => "oops", - "description" => "yet another user", -)); -$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description")); -var_dump( - ldap_sort($link, $result, "sn"), - ldap_get_entries($link, $result) -); -?> -===DONE=== ---CLEAN-- -<?php -include "connect.inc"; - -$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "cn=userC,$base"); -ldap_delete($link, "cn=userD,$base"); -ldap_delete($link, "cn=userE,$base"); -remove_dummy_data($link, $base); -?> ---EXPECTF-- -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d -bool(true) -array(7) { - ["count"]=> - int(6) - [0]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(1) "a" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(16) "yet another user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userE,%s" - } - [1]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(3) "aaa" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(12) "another user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userD,%s" - } - [2]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN1" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "user A" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userA,%s" - } - [3]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN2" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "user B" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userB,%s" - } - [4]=> - array(4) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN3" - } - [0]=> - string(2) "sn" - ["count"]=> - int(1) - ["dn"]=> - string(%d) "cn=userC,cn=userB,%s" - } - [5]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(3) "zzz" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "a user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userC,%s" - } -} -===DONE=== diff --git a/ext/ldap/tests/ldap_sort_error.phpt b/ext/ldap/tests/ldap_sort_error.phpt deleted file mode 100644 index c41b56ab51..0000000000 --- a/ext/ldap/tests/ldap_sort_error.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -ldap_sort() - Testing ldap_sort() that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -var_dump(ldap_sort($link)); -var_dump(ldap_sort($link, $link)); -var_dump(ldap_sort($link, $link, $link, $link)); -var_dump(ldap_sort($link, $link, $link)); -var_dump(ldap_sort($link, $link, "sn")); -?> -===DONE=== ---EXPECTF-- -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d - -Warning: ldap_sort() expects exactly 3 parameters, 1 given in %s on line %d -bool(false) - -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d - -Warning: ldap_sort() expects exactly 3 parameters, 2 given in %s on line %d -bool(false) - -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d - -Warning: ldap_sort() expects exactly 3 parameters, 4 given in %s on line %d -bool(false) - -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d - -Warning: ldap_sort() expects parameter 3 to be string, resource given in %s on line %d -bool(false) - -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d - -Warning: ldap_sort(): Supplied resource is not a valid ldap result resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_sort_variation.phpt b/ext/ldap/tests/ldap_sort_variation.phpt deleted file mode 100644 index bb121b63cb..0000000000 --- a/ext/ldap/tests/ldap_sort_variation.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -ldap_sort() - Basic ldap_sort test ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> -<?php require_once('skipifbindfailure.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link, $base); -ldap_add($link, "cn=userC,$base", array( - "objectclass" => "person", - "cn" => "userC", - "sn" => "zzz", - "userPassword" => "oops", - "description" => "a user", -)); -ldap_add($link, "cn=userD,$base", array( - "objectclass" => "person", - "cn" => "userD", - "sn" => "aaa", - "userPassword" => "oops", - "description" => "another user", -)); -ldap_add($link, "cn=userE,$base", array( - "objectclass" => "person", - "cn" => "userE", - "sn" => "a", - "userPassword" => "oops", - "description" => "yet another user", -)); -$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description")); -var_dump( - ldap_sort($link, $result, "description"), - ldap_get_entries($link, $result) -); -?> -===DONE=== ---CLEAN-- -<?php -include "connect.inc"; - -$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "cn=userC,$base"); -ldap_delete($link, "cn=userD,$base"); -ldap_delete($link, "cn=userE,$base"); -remove_dummy_data($link, $base); -?> ---EXPECTF-- -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d -bool(true) -array(7) { - ["count"]=> - int(6) - [0]=> - array(4) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN3" - } - [0]=> - string(2) "sn" - ["count"]=> - int(1) - ["dn"]=> - string(%d) "cn=userC,cn=userB,%s" - } - [1]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(3) "zzz" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "a user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userC,%s" - } - [2]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(3) "aaa" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(12) "another user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userD,%s" - } - [3]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN1" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "user A" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userA,%s" - } - [4]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN2" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "user B" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userB,%s" - } - [5]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(1) "a" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(16) "yet another user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userE,%s" - } -} -===DONE=== diff --git a/ext/libxml/tests/001.phpt b/ext/libxml/tests/001.phpt index b636ab7adc..7914ef509b 100644 --- a/ext/libxml/tests/001.phpt +++ b/ext/libxml/tests/001.phpt @@ -8,7 +8,6 @@ libxml_use_internal_errors() var_dump(libxml_use_internal_errors(false)); var_dump(libxml_use_internal_errors(true)); var_dump(libxml_use_internal_errors()); -var_dump(libxml_use_internal_errors(new stdclass)); var_dump(libxml_get_errors()); var_dump(libxml_get_last_error()); @@ -17,13 +16,10 @@ var_dump(libxml_clear_errors()); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- bool(false) bool(false) bool(true) - -Warning: libxml_use_internal_errors() expects parameter 1 to be bool, object given in %s001.php on line 6 -NULL array(0) { } bool(false) diff --git a/ext/libxml/tests/004.phpt b/ext/libxml/tests/004.phpt index 9d5121089d..9338bc90d4 100644 --- a/ext/libxml/tests/004.phpt +++ b/ext/libxml/tests/004.phpt @@ -18,7 +18,11 @@ $ctxs = array( foreach ($ctxs as $ctx) { - var_dump(libxml_set_streams_context($ctx)); + try { + var_dump(libxml_set_streams_context($ctx)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $dom = new DOMDocument(); var_dump($dom->load(dirname(__FILE__).'/test.xml')); } @@ -28,25 +32,15 @@ echo "Done\n"; ?> --EXPECTF-- Warning: stream_context_create(): options should have the form ["wrappername"]["optionname"] = $value in %s004.php on line %d - -Warning: libxml_set_streams_context() expects parameter 1 to be resource, null given in %s004.php on line %d -NULL +libxml_set_streams_context() expects parameter 1 to be resource, null given bool(true) - -Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %s004.php on line %d -NULL +libxml_set_streams_context() expects parameter 1 to be resource, string given bool(true) - -Warning: libxml_set_streams_context() expects parameter 1 to be resource, int given in %s004.php on line %d -NULL +libxml_set_streams_context() expects parameter 1 to be resource, int given bool(true) - -Warning: libxml_set_streams_context() expects parameter 1 to be resource, object given in %s004.php on line %d -NULL +libxml_set_streams_context() expects parameter 1 to be resource, object given bool(true) - -Warning: libxml_set_streams_context() expects parameter 1 to be resource, array given in %s004.php on line %d -NULL +libxml_set_streams_context() expects parameter 1 to be resource, array given bool(true) NULL bool(true) diff --git a/ext/libxml/tests/bug63389.phpt b/ext/libxml/tests/bug63389.phpt index e9498aae08..df7af1b2b6 100644 --- a/ext/libxml/tests/bug63389.phpt +++ b/ext/libxml/tests/bug63389.phpt @@ -6,9 +6,13 @@ Bug #63389 (Missing context check on libxml_set_streams_context() causes memleak <?php $fp = fopen("php://input", "r"); libxml_set_streams_context($fp); -libxml_set_streams_context("a"); +try { + libxml_set_streams_context("a"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "okey"; ?> ---EXPECTF-- -Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %sbug63389.php on line %d +--EXPECT-- +libxml_set_streams_context() expects parameter 1 to be resource, string given okey diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt index 40b31ea85d..9a6826ca54 100644 --- a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt +++ b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt @@ -12,10 +12,6 @@ XML; $dd = new DOMDocument; $r = $dd->loadXML($xml); -var_dump(libxml_set_external_entity_loader([])); -var_dump(libxml_set_external_entity_loader()); -var_dump(libxml_set_external_entity_loader(function() {}, 2)); - var_dump(libxml_set_external_entity_loader(function($a, $b, $c, $d) {})); try { var_dump($dd->validate()); @@ -25,14 +21,6 @@ try { echo "Done.\n"; --EXPECTF-- -Warning: libxml_set_external_entity_loader() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: libxml_set_external_entity_loader() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: libxml_set_external_entity_loader() expects exactly 1 parameter, 2 given in %s on line %d -NULL bool(true) Warning: DOMDocument::validate(): Could not load the external subset "http://example.com/foobar" in %s on line %d diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 004a1d40d6..52da36c2cf 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -171,25 +171,6 @@ static const php_mb_nls_ident_list php_mb_default_identify_list[] = { /* }}} */ -/* {{{ mb_overload_def mb_ovld[] */ -static const struct mb_overload_def mb_ovld[] = { - {MB_OVERLOAD_MAIL, "mail", "mb_send_mail", "mb_orig_mail"}, - {MB_OVERLOAD_STRING, "strlen", "mb_strlen", "mb_orig_strlen"}, - {MB_OVERLOAD_STRING, "strpos", "mb_strpos", "mb_orig_strpos"}, - {MB_OVERLOAD_STRING, "strrpos", "mb_strrpos", "mb_orig_strrpos"}, - {MB_OVERLOAD_STRING, "stripos", "mb_stripos", "mb_orig_stripos"}, - {MB_OVERLOAD_STRING, "strripos", "mb_strripos", "mb_orig_strripos"}, - {MB_OVERLOAD_STRING, "strstr", "mb_strstr", "mb_orig_strstr"}, - {MB_OVERLOAD_STRING, "strrchr", "mb_strrchr", "mb_orig_strrchr"}, - {MB_OVERLOAD_STRING, "stristr", "mb_stristr", "mb_orig_stristr"}, - {MB_OVERLOAD_STRING, "substr", "mb_substr", "mb_orig_substr"}, - {MB_OVERLOAD_STRING, "strtolower", "mb_strtolower", "mb_orig_strtolower"}, - {MB_OVERLOAD_STRING, "strtoupper", "mb_strtoupper", "mb_orig_strtoupper"}, - {MB_OVERLOAD_STRING, "substr_count", "mb_substr_count", "mb_orig_substr_count"}, - {0, NULL, NULL, NULL} -}; -/* }}} */ - /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_language, 0, 0, 0) ZEND_ARG_INFO(0, language) @@ -219,7 +200,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_preferred_mime_name, 0, 0, 1) ZEND_ARG_INFO(0, encoding) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_parse_str, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_parse_str, 0, 0, 2) ZEND_ARG_INFO(0, encoded_string) ZEND_ARG_INFO(1, result) ZEND_END_ARG_INFO() @@ -1490,8 +1471,6 @@ PHP_INI_BEGIN() PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output) STD_PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding, internal_encoding_name, zend_mbstring_globals, mbstring_globals) PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character) - STD_PHP_INI_ENTRY("mbstring.func_overload", "0", - PHP_INI_SYSTEM, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals) STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0", PHP_INI_SYSTEM | PHP_INI_PERDIR, @@ -1539,7 +1518,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); mbstring_globals->current_filter_illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; mbstring_globals->current_filter_illegal_substchar = 0x3f; /* '?' */ mbstring_globals->illegalchars = 0; - mbstring_globals->func_overload = 0; mbstring_globals->encoding_translation = 0; mbstring_globals->strict_detection = 0; mbstring_globals->outconv = NULL; @@ -1588,10 +1566,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); sapi_register_post_entries(mbstr_post_entries); } - REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT); @@ -1617,39 +1591,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); php_mb_rfc1867_getword_conf, php_mb_rfc1867_basename); - /* override original function (deprecated). */ - if (MBSTRG(func_overload)){ - zend_function *func, *orig; - const struct mb_overload_def *p; - zend_string *str; - - p = &(mb_ovld[0]); - while (p->type > 0) { - if ((MBSTRG(func_overload) & p->type) == p->type && - !zend_hash_str_exists(CG(function_table), p->save_func, strlen(p->save_func)) - ) { - func = zend_hash_str_find_ptr(CG(function_table), p->ovld_func, strlen(p->ovld_func)); - - if ((orig = zend_hash_str_find_ptr(CG(function_table), p->orig_func, strlen(p->orig_func))) == NULL) { - php_error_docref("ref.mbstring", E_WARNING, "mbstring couldn't find function %s.", p->orig_func); - return FAILURE; - } else { - ZEND_ASSERT(orig->type == ZEND_INTERNAL_FUNCTION); - str = zend_string_init_interned(p->save_func, strlen(p->save_func), 1); - zend_hash_add_mem(CG(function_table), str, orig, sizeof(zend_internal_function)); - zend_string_release_ex(str, 1); - function_add_ref(orig); - - str = zend_string_init_interned(p->orig_func, strlen(p->orig_func), 1); - zend_hash_update_mem(CG(function_table), str, func, sizeof(zend_internal_function)); - zend_string_release_ex(str, 1); - function_add_ref(func); - } - } - p++; - } - } - return SUCCESS; } /* }}} */ @@ -1657,24 +1598,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); /* {{{ PHP_MSHUTDOWN_FUNCTION(mbstring) */ PHP_MSHUTDOWN_FUNCTION(mbstring) { - /* clear overloaded function. */ - if (MBSTRG(func_overload)){ - const struct mb_overload_def *p; - zend_function *orig; - - p = &(mb_ovld[0]); - while (p->type > 0) { - if ((MBSTRG(func_overload) & p->type) == p->type && - (orig = zend_hash_str_find_ptr(CG(function_table), p->save_func, strlen(p->save_func)))) { - - zend_hash_str_update_mem(CG(function_table), p->orig_func, strlen(p->orig_func), orig, sizeof(zend_internal_function)); - function_add_ref(orig); - zend_hash_str_del(CG(function_table), p->save_func, strlen(p->save_func)); - } - p++; - } - } - UNREGISTER_INI_ENTRIES(); zend_multibyte_restore_functions(); @@ -1699,12 +1622,6 @@ PHP_RINIT_FUNCTION(mbstring) php_mb_populate_current_detect_order_list(); - /* override original function. */ - if (MBSTRG(func_overload)){ - zend_error(E_DEPRECATED, "The mbstring.func_overload directive is deprecated"); - - CG(compiler_options) |= ZEND_COMPILE_NO_BUILTIN_STRLEN; - } #if HAVE_MBREGEX PHP_RINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU); #endif @@ -2117,26 +2034,24 @@ PHP_FUNCTION(mb_preferred_mime_name) #define IS_SJIS1(c) ((((c)>=0x81 && (c)<=0x9f) || ((c)>=0xe0 && (c)<=0xf5)) ? 1 : 0) #define IS_SJIS2(c) ((((c)>=0x40 && (c)<=0x7e) || ((c)>=0x80 && (c)<=0xfc)) ? 1 : 0) -/* {{{ proto bool mb_parse_str(string encoded_string [, array result]) +/* {{{ proto bool mb_parse_str(string encoded_string, array &result) Parses GET/POST/COOKIE data and sets global variables */ PHP_FUNCTION(mb_parse_str) { - zval *track_vars_array = NULL; - char *encstr = NULL; + zval *track_vars_array; + char *encstr; size_t encstr_len; php_mb_encoding_handler_info_t info; const mbfl_encoding *detected; track_vars_array = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &encstr, &encstr_len, &track_vars_array) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &encstr, &encstr_len, &track_vars_array) == FAILURE) { return; } - if (track_vars_array != NULL) { - track_vars_array = zend_try_array_init(track_vars_array); - if (!track_vars_array) { - return; - } + track_vars_array = zend_try_array_init(track_vars_array); + if (!track_vars_array) { + return; } encstr = estrndup(encstr, encstr_len); @@ -2150,22 +2065,7 @@ PHP_FUNCTION(mb_parse_str) info.num_from_encodings = MBSTRG(http_input_list_size); info.from_language = MBSTRG(language); - if (track_vars_array != NULL) { - detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr); - } else { - zval tmp; - zend_array *symbol_table; - if (zend_forbid_dynamic_call("mb_parse_str() with a single argument") == FAILURE) { - efree(encstr); - return; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling mb_parse_str() without the result argument is deprecated"); - - symbol_table = zend_rebuild_symbol_table(); - ZVAL_ARR(&tmp, symbol_table); - detected = _php_mb_encoding_handler_ex(&info, &tmp, encstr); - } + detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr); MBSTRG(http_input_identify) = detected; @@ -2942,11 +2842,6 @@ PHP_FUNCTION(mb_substr) real_len = 0; } - if (((MBSTRG(func_overload) & MB_OVERLOAD_STRING) == MB_OVERLOAD_STRING) - && (real_from > mbfl_strlen(&string))) { - RETURN_FALSE; - } - ret = mbfl_substr(&string, &result, real_from, real_len); if (NULL == ret) { RETURN_FALSE; @@ -4571,8 +4466,7 @@ PHP_FUNCTION(mb_get_info) size_t typ_len; size_t n; char *name; - const struct mb_overload_def *over_func; - zval row1, row2; + zval row; const mbfl_language *lang = mbfl_no2language(MBSTRG(language)); const mbfl_encoding **entry; @@ -4594,20 +4488,6 @@ PHP_FUNCTION(mb_get_info) if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) { add_assoc_string(return_value, "http_output_conv_mimetypes", name); } - add_assoc_long(return_value, "func_overload", MBSTRG(func_overload)); - if (MBSTRG(func_overload)){ - over_func = &(mb_ovld[0]); - array_init(&row1); - while (over_func->type > 0) { - if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) { - add_assoc_string(&row1, over_func->orig_func, over_func->ovld_func); - } - over_func++; - } - add_assoc_zval(return_value, "func_overload_list", &row1); - } else { - add_assoc_string(return_value, "func_overload_list", "no overload"); - } if (lang != NULL) { if ((name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) { add_assoc_string(return_value, "mail_charset", name); @@ -4632,12 +4512,12 @@ PHP_FUNCTION(mb_get_info) entry = MBSTRG(current_detect_order_list); if (n > 0) { size_t i; - array_init(&row2); + array_init(&row); for (i = 0; i < n; i++) { - add_next_index_string(&row2, (*entry)->name); + add_next_index_string(&row, (*entry)->name); entry++; } - add_assoc_zval(return_value, "detect_order", &row2); + add_assoc_zval(return_value, "detect_order", &row); } if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { add_assoc_string(return_value, "substitute_character", "none"); @@ -4669,21 +4549,6 @@ PHP_FUNCTION(mb_get_info) if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) { RETVAL_STRING(name); } - } else if (!strcasecmp("func_overload", typ)) { - RETVAL_LONG(MBSTRG(func_overload)); - } else if (!strcasecmp("func_overload_list", typ)) { - if (MBSTRG(func_overload)){ - over_func = &(mb_ovld[0]); - array_init(return_value); - while (over_func->type > 0) { - if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) { - add_assoc_string(return_value, over_func->orig_func, over_func->ovld_func); - } - over_func++; - } - } else { - RETVAL_STRING("no overload"); - } } else if (!strcasecmp("mail_charset", typ)) { if (lang != NULL && (name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) { RETVAL_STRING(name); diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h index 7321525064..a39d7b85c2 100644 --- a/ext/mbstring/mbstring.h +++ b/ext/mbstring/mbstring.h @@ -156,7 +156,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring) int filter_illegal_substchar; int current_filter_illegal_mode; int current_filter_illegal_substchar; - zend_long func_overload; enum mbfl_no_language language; zend_bool encoding_translation; zend_bool strict_detection; @@ -170,17 +169,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring) const mbfl_encoding *last_used_encoding; ZEND_END_MODULE_GLOBALS(mbstring) -#define MB_OVERLOAD_MAIL 1 -#define MB_OVERLOAD_STRING 2 -#define MB_OVERLOAD_REGEX 4 - -struct mb_overload_def { - int type; - char *orig_func; - char *ovld_func; - char *save_func; -}; - #define MBSTRG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mbstring, v) #if defined(ZTS) && defined(COMPILE_DL_MBSTRING) diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 5128fabc34..02d7e21378 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -856,16 +856,16 @@ PHP_FUNCTION(mb_regex_encoding) /* {{{ _php_mb_regex_ereg_exec */ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) { - zval *arg_pattern, *array = NULL; - char *string; - size_t string_len; + zval *array = NULL; + char *arg_pattern, *string; + size_t arg_pattern_len, string_len; php_mb_regex_t *re; OnigRegion *regs = NULL; int i, match_len, beg, end; OnigOptionType options; char *str; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs|z", &arg_pattern, &string, &string_len, &array) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &arg_pattern, &arg_pattern_len, &string, &string_len, &array) == FAILURE) { RETURN_FALSE; } @@ -889,23 +889,13 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) options |= ONIG_OPTION_IGNORECASE; } - /* compile the regular expression from the supplied regex */ - if (Z_TYPE_P(arg_pattern) != IS_STRING) { - /* we convert numbers to integers and treat them as a string */ - if (Z_TYPE_P(arg_pattern) == IS_DOUBLE) { - convert_to_long_ex(arg_pattern); /* get rid of decimal places */ - } - convert_to_string_ex(arg_pattern); - /* don't bother doing an extended regex with just a number */ - } - - if (Z_STRLEN_P(arg_pattern) == 0) { + if (arg_pattern_len == 0) { php_error_docref(NULL, E_WARNING, "empty pattern"); RETVAL_FALSE; goto out; } - re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRLEN_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax)); + re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, options, MBREX(current_mbctype), MBREX(regex_default_syntax)); if (re == NULL) { RETVAL_FALSE; goto out; @@ -970,8 +960,6 @@ PHP_FUNCTION(mb_eregi) /* {{{ _php_mb_regex_ereg_replace_exec */ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOptionType options, int is_callable) { - zval *arg_pattern_zval; - char *arg_pattern; size_t arg_pattern_len; @@ -994,7 +982,6 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp OnigUChar *pos; OnigUChar *string_lim; char *description = NULL; - char pat_buf[6]; const mbfl_encoding *enc; @@ -1013,16 +1000,16 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp size_t option_str_len = 0; if (!is_callable) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zss|s", - &arg_pattern_zval, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|s", + &arg_pattern, &arg_pattern_len, &replace, &replace_len, &string, &string_len, &option_str, &option_str_len) == FAILURE) { RETURN_FALSE; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zfs|s", - &arg_pattern_zval, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sfs|s", + &arg_pattern, &arg_pattern_len, &arg_replace_fci, &arg_replace_fci_cache, &string, &string_len, &option_str, &option_str_len) == FAILURE) { @@ -1046,28 +1033,10 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp } } if (eval && !is_callable) { - php_error_docref(NULL, E_DEPRECATED, "The 'e' option is deprecated, use mb_ereg_replace_callback instead"); - } - if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) { - arg_pattern = Z_STRVAL_P(arg_pattern_zval); - arg_pattern_len = Z_STRLEN_P(arg_pattern_zval); - } else { - php_error_docref(NULL, E_DEPRECATED, - "Non-string patterns will be interpreted as strings in the future. " - "Use an explicit chr() call to preserve the current behavior"); - - /* FIXME: this code is not multibyte aware! */ - convert_to_long_ex(arg_pattern_zval); - pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval); - pat_buf[1] = '\0'; - pat_buf[2] = '\0'; - pat_buf[3] = '\0'; - pat_buf[4] = '\0'; - pat_buf[5] = '\0'; - - arg_pattern = pat_buf; - arg_pattern_len = 1; + php_error_docref(NULL, E_WARNING, "The 'e' option is no longer supported, use mb_ereg_replace_callback instead"); + RETURN_FALSE; } + /* create regex pattern buffer */ re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, options, MBREX(current_mbctype), syntax); if (re == NULL) { diff --git a/ext/mbstring/php_mbregex.h b/ext/mbstring/php_mbregex.h index 497458e603..e1ddeedae8 100644 --- a/ext/mbstring/php_mbregex.h +++ b/ext/mbstring/php_mbregex.h @@ -41,21 +41,7 @@ PHP_FE(mb_ereg_search_init, arginfo_mb_ereg_search_init) \ PHP_FE(mb_ereg_search_getregs, arginfo_mb_ereg_search_getregs) \ PHP_FE(mb_ereg_search_getpos, arginfo_mb_ereg_search_getpos) \ - PHP_FE(mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) \ - PHP_DEP_FALIAS(mbregex_encoding, mb_regex_encoding, arginfo_mb_regex_encoding) \ - PHP_DEP_FALIAS(mbereg, mb_ereg, arginfo_mb_ereg) \ - PHP_DEP_FALIAS(mberegi, mb_eregi, arginfo_mb_eregi) \ - PHP_DEP_FALIAS(mbereg_replace, mb_ereg_replace, arginfo_mb_ereg_replace) \ - PHP_DEP_FALIAS(mberegi_replace, mb_eregi_replace, arginfo_mb_eregi_replace) \ - PHP_DEP_FALIAS(mbsplit, mb_split, arginfo_mb_split) \ - PHP_DEP_FALIAS(mbereg_match, mb_ereg_match, arginfo_mb_ereg_match) \ - PHP_DEP_FALIAS(mbereg_search, mb_ereg_search, arginfo_mb_ereg_search) \ - PHP_DEP_FALIAS(mbereg_search_pos, mb_ereg_search_pos, arginfo_mb_ereg_search_pos) \ - PHP_DEP_FALIAS(mbereg_search_regs, mb_ereg_search_regs, arginfo_mb_ereg_search_regs) \ - PHP_DEP_FALIAS(mbereg_search_init, mb_ereg_search_init, arginfo_mb_ereg_search_init) \ - PHP_DEP_FALIAS(mbereg_search_getregs, mb_ereg_search_getregs, arginfo_mb_ereg_search_getregs) \ - PHP_DEP_FALIAS(mbereg_search_getpos, mb_ereg_search_getpos, arginfo_mb_ereg_search_getpos) \ - PHP_DEP_FALIAS(mbereg_search_setpos, mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) + PHP_FE(mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) /* }}} */ #define PHP_MBREGEX_MAXCACHE 50 diff --git a/ext/mbstring/tests/bug20087.phpt b/ext/mbstring/tests/bug20087.phpt deleted file mode 100644 index 1f62f08fd8..0000000000 --- a/ext/mbstring/tests/bug20087.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Bug #20087 (Assertion failure) ---SKIPIF-- -<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> ---FILE-- -<?php -$testmoo = "blah blah"; -var_dump(mb_parse_str("testmoo")); -var_dump($testmoo); -var_dump(mb_parse_str("test=moo")); -var_dump($test); -?> ---EXPECTF-- -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -bool(true) -string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -bool(true) -string(3) "moo" diff --git a/ext/mbstring/tests/bug43301.phpt b/ext/mbstring/tests/bug43301.phpt deleted file mode 100644 index 6da3dd6bbe..0000000000 --- a/ext/mbstring/tests/bug43301.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Bug #43301 (mb_ereg*_replace() crashes when replacement string is invalid PHP expression and 'e' option is used) ---SKIPIF-- -<?php -extension_loaded('mbstring') or die('skip mbstring not available'); -if (!function_exists('mb_ereg')) die('skip mbregex support not available'); -?> ---FILE-- -<?php - -$ptr = 'hello'; - -$txt = <<<doc -hello, I have got a cr*sh on you -doc; - -echo mb_ereg_replace($ptr,'$1',$txt,'e'); - -?> ---EXPECTF-- -Deprecated: mb_ereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback instead in %s%ebug43301.php on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '1' (T_LNUMBER), expecting variable (T_VARIABLE) or '{' or '$' in %sbug43301.php(%d) : mbregex replace:1 -Stack trace: -#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have g...', 'e') -#1 {main} - -Next Error: Failed evaluating code: -$1 in %sbug43301.php:%d -Stack trace: -#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have g...', 'e') -#1 {main} - thrown in %sbug43301.php on line %d diff --git a/ext/mbstring/tests/bug48697.phpt b/ext/mbstring/tests/bug48697.phpt index 93644a5f05..77d1c7a710 100644 --- a/ext/mbstring/tests/bug48697.phpt +++ b/ext/mbstring/tests/bug48697.phpt @@ -2,8 +2,6 @@ Bug #48697 (mb_internal_encoding() value gets reset by parse_str() or mb_parse_str() --SKIPIF-- <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> ---INI-- -error_reporting=E_ALL & ~E_DEPRECATED --FILE-- <?php ini_set('mbstring.internal_encoding', 'ISO-8859-15'); @@ -11,14 +9,15 @@ ini_set('mbstring.encoding_translation', true); var_dump(mb_internal_encoding()); mb_internal_encoding('UTF-8'); var_dump(mb_internal_encoding()); -parse_str('a=b'); +parse_str('a=b', $ary); var_dump(mb_internal_encoding()); mb_internal_encoding('UTF-8'); var_dump(mb_internal_encoding()); -parse_str('a=b'); +parse_str('a=b', $ary); var_dump(mb_internal_encoding()); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: ini_set(): Use of mbstring.internal_encoding is deprecated in %s on line %d string(11) "ISO-8859-15" string(5) "UTF-8" string(5) "UTF-8" diff --git a/ext/mbstring/tests/bug52931.phpt b/ext/mbstring/tests/bug52931.phpt deleted file mode 100644 index ab8c8df723..0000000000 --- a/ext/mbstring/tests/bug52931.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #52931 (strripos not overloaded with function overloading enabled) ---SKIPIF-- -<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> ---INI-- -mbstring.func_overload = 7 -mbstring.internal_encoding = utf-8 ---FILE-- -<?php - -$string = '<body>Umlauttest öüä</body>'; - -var_dump(strlen($string)); -var_dump(mb_strlen($string)); - -var_dump(strripos($string, '</body>')); -var_dump(mb_strripos($string, '</body>')); - -?> ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -int(27) -int(27) -int(20) -int(20) diff --git a/ext/mbstring/tests/bug72164.phpt b/ext/mbstring/tests/bug72164.phpt index 018754e335..f90fe89938 100644 --- a/ext/mbstring/tests/bug72164.phpt +++ b/ext/mbstring/tests/bug72164.phpt @@ -14,5 +14,5 @@ $var8 = mb_ereg_replace($var2,$var3,$var3,$var0); var_dump($var8); ?> --EXPECTF-- -Deprecated: mb_ereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback instead in %s%ebug72164.php on line %d -string(0) "" +Warning: mb_ereg_replace(): The 'e' option is no longer supported, use mb_ereg_replace_callback instead in %s on line %d +bool(false) diff --git a/ext/mbstring/tests/bug72994.phpt b/ext/mbstring/tests/bug72994.phpt deleted file mode 100644 index c9d2c9acf2..0000000000 --- a/ext/mbstring/tests/bug72994.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #72994 (mbc_to_code() out of bounds read) ---SKIPIF-- -<?php -if (!extension_loaded('mbstring')) die('skip mbstring extension not available'); -if (!function_exists('mb_ereg_replace')) die('skip mb_ereg_replace() not available'); -?> ---FILE-- -<?php -$var1 = mb_ereg_replace($var-232338951,NULL,NULL,NULL); -var_dump($var1); -?> -===DONE=== ---EXPECTF-- -Notice: Undefined variable: var in %s on line %d - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d -bool(false) -===DONE=== diff --git a/ext/mbstring/tests/mb_convert_encoding.phpt b/ext/mbstring/tests/mb_convert_encoding.phpt index f2fda35124..ac5d0d32a6 100644 --- a/ext/mbstring/tests/mb_convert_encoding.phpt +++ b/ext/mbstring/tests/mb_convert_encoding.phpt @@ -99,11 +99,6 @@ $s = $euc_jp; $s = mb_convert_encoding($s, 'BAD'); print("BAD: $s\n"); // BAD -$s = $euc_jp; -$s = mb_convert_encoding($s); -print("MP: $s\n"); // Missing parameter - - ?> --EXPECTF-- == BASIC TEST == @@ -129,6 +124,3 @@ EUC-JP: Warning: mb_convert_encoding(): Unknown encoding "BAD" in %s on line %d BAD: - -Warning: mb_convert_encoding() expects at least 2 parameters, 1 given in %s on line %d -MP: diff --git a/ext/mbstring/tests/mb_detect_encoding.phpt b/ext/mbstring/tests/mb_detect_encoding.phpt index 0c8015d86d..9a8f51281b 100644 --- a/ext/mbstring/tests/mb_detect_encoding.phpt +++ b/ext/mbstring/tests/mb_detect_encoding.phpt @@ -87,11 +87,6 @@ $s = $euc_jp; $s = mb_detect_encoding($s, 'BAD'); print("BAD: $s\n"); // BAD -$s = $euc_jp; -$s = mb_detect_encoding(); -print("MP: $s\n"); // Missing parameter - - ?> --EXPECTF-- == BASIC TEST == @@ -113,6 +108,3 @@ EUC-JP: EUC-JP Warning: mb_detect_encoding(): Illegal argument in %s on line %d BAD: EUC-JP - -Warning: mb_detect_encoding() expects at least 1 parameter, 0 given in %s on line %d -MP: diff --git a/ext/mbstring/tests/mb_encoding_aliases.phpt b/ext/mbstring/tests/mb_encoding_aliases.phpt index 8bc0453350..798bdeb5ca 100644 --- a/ext/mbstring/tests/mb_encoding_aliases.phpt +++ b/ext/mbstring/tests/mb_encoding_aliases.phpt @@ -4,7 +4,6 @@ mb_encoding_aliases() <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> --FILE-- <?php -mb_encoding_aliases(); $list = mb_encoding_aliases("ASCII"); sort($list); var_dump($list); @@ -13,7 +12,6 @@ var_dump(mb_encoding_aliases("8bit")); var_dump(mb_encoding_aliases("BAD")); ?> --EXPECTF-- -Warning: mb_encoding_aliases() expects exactly 1 parameter, 0 given in %s on line 2 array(11) { [0]=> string(14) "ANSI_X3.4-1968" diff --git a/ext/mbstring/tests/mb_ereg1.phpt b/ext/mbstring/tests/mb_ereg1.phpt index 59ef788a77..05b3486545 100644 --- a/ext/mbstring/tests/mb_ereg1.phpt +++ b/ext/mbstring/tests/mb_ereg1.phpt @@ -14,7 +14,11 @@ $a = array( ); foreach ($a as $args) { - var_dump(mb_ereg($args[0], $args[1], $args[2])); + try { + var_dump(mb_ereg($args[0], $args[1], $args[2])); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } var_dump($args); } ?> @@ -42,9 +46,7 @@ array(3) { array(0) { } } - -Notice: Array to string conversion in %s on line %d -bool(false) +mb_ereg() expects parameter 1 to be string, array given array(3) { [0]=> array(0) { @@ -52,12 +54,9 @@ array(3) { [1]=> int(1) [2]=> - array(0) { - } + &string(0) "" } - -Warning: mb_ereg() expects parameter 2 to be string, array given in %s on line %d -bool(false) +mb_ereg() expects parameter 2 to be string, array given array(3) { [0]=> int(1) @@ -65,7 +64,7 @@ array(3) { array(0) { } [2]=> - string(0) "" + &string(0) "" } bool(false) array(3) { diff --git a/ext/mbstring/tests/mb_ereg2.phpt b/ext/mbstring/tests/mb_ereg2.phpt index 30e857eed7..22e3cd36c5 100644 --- a/ext/mbstring/tests/mb_ereg2.phpt +++ b/ext/mbstring/tests/mb_ereg2.phpt @@ -15,12 +15,9 @@ var_dump($a, $b, $c); mb_eregi($a, $b, $c); var_dump($a, $b, $c); -mb_ereg_search_init($a, $b, $c); -var_dump($a, $b, $c); - echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- int(-1) int(-1) array(1) { @@ -33,12 +30,4 @@ array(1) { [0]=> string(2) "-1" } - -Warning: mb_ereg_search_init() expects parameter 3 to be string, array given in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} Done diff --git a/ext/mbstring/tests/mb_ereg3.phpt b/ext/mbstring/tests/mb_ereg3.phpt deleted file mode 100644 index c591563444..0000000000 --- a/ext/mbstring/tests/mb_ereg3.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -mb_ereg() returning matches ---SKIPIF-- -<?php -if (!extension_loaded('mbstring')) die('skip mbstring not enabled'); -if (!function_exists("mb_ereg")) print "skip mb_ereg() not available"; -?> ---FILE-- -<?php - -// Note: This test is identical to mb_ereg2.phpt, but using deprecated mbereg_* aliases. -// Deleted it once the deprecated aliases have been removed. - -$a = -1; $b = -1; $c = -1; -mbereg($a, $b, $c); -var_dump($a, $b, $c); - -mberegi($a, $b, $c); -var_dump($a, $b, $c); - -mbereg_search_init($a, $b, $c); -var_dump($a, $b, $c); - -echo "Done\n"; -?> ---EXPECTF-- -Deprecated: Function mbereg() is deprecated in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} - -Deprecated: Function mberegi() is deprecated in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} - -Deprecated: Function mbereg_search_init() is deprecated in %s on line %d - -Warning: mbereg_search_init() expects parameter 3 to be string, array given in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} -Done diff --git a/ext/mbstring/tests/mb_ereg_replace_variation1.phpt b/ext/mbstring/tests/mb_ereg_replace_variation1.phpt index 4c6e177b3e..c61e47723d 100644 --- a/ext/mbstring/tests/mb_ereg_replace_variation1.phpt +++ b/ext/mbstring/tests/mb_ereg_replace_variation1.phpt @@ -96,87 +96,53 @@ foreach($inputs as $input) { echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing mb_ereg_replace() : usage variations *** -- Iteration 1 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 2 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 3 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 4 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d -bool(false) +string(10) "string_val" -- Iteration 5 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 6 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d -bool(false) +string(10) "string_val" -- Iteration 7 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 8 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 9 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 10 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" -- Iteration 11 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" -- Iteration 12 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 13 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" -- Iteration 14 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 15 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" -- Iteration 16 -- string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" @@ -194,17 +160,11 @@ string(10) "string_val" string(10) "string_val" -- Iteration 21 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 22 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" -- Iteration 23 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" Done diff --git a/ext/mbstring/tests/mb_ereg_variation1.phpt b/ext/mbstring/tests/mb_ereg_variation1.phpt deleted file mode 100644 index 60baf8743e..0000000000 --- a/ext/mbstring/tests/mb_ereg_variation1.phpt +++ /dev/null @@ -1,178 +0,0 @@ ---TEST-- -Test mb_ereg() function : usage variations - pass different data types to $pattern argument ---SKIPIF-- -<?php -extension_loaded('mbstring') or die('skip'); -function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build"); -?> ---FILE-- -<?php -/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers]) - * Description: Regular expression match for multibyte string - * Source code: ext/mbstring/php_mbregex.c - */ - -/* - * Pass different data types to $pattern argument - */ - -echo "*** Testing mb_ereg() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$string = 'string value'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $pattern argument -$inputs = array( - -// int data -/*1*/ 0, - 1, - 12345, - -2345, - -// float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - -// boolean data -/*10*/ true, - TRUE, - -// string data -/*12*/ "string", - 'string', - $heredoc, - -// object data -/*15*/ new classA(), - -// resource variable -/*16*/ $fp -); - -// loop through each element of $inputs to check the behavior of mb_ereg() -$iterator = 1; -foreach($inputs as $input) { - if (@is_array($regs)){ - $regs = null; - } - echo "\n-- Iteration $iterator --\n"; - var_dump( mb_ereg($input, $string, $regs) ); - var_dump($regs); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECT-- -*** Testing mb_ereg() : usage variations *** - --- Iteration 1 -- -bool(false) -array(0) { -} - --- Iteration 2 -- -bool(false) -array(0) { -} - --- Iteration 3 -- -bool(false) -array(0) { -} - --- Iteration 4 -- -bool(false) -array(0) { -} - --- Iteration 5 -- -bool(false) -array(0) { -} - --- Iteration 6 -- -bool(false) -array(0) { -} - --- Iteration 7 -- -bool(false) -array(0) { -} - --- Iteration 8 -- -bool(false) -array(0) { -} - --- Iteration 9 -- -bool(false) -array(0) { -} - --- Iteration 10 -- -bool(false) -array(0) { -} - --- Iteration 11 -- -bool(false) -array(0) { -} - --- Iteration 12 -- -int(6) -array(1) { - [0]=> - string(6) "string" -} - --- Iteration 13 -- -int(6) -array(1) { - [0]=> - string(6) "string" -} - --- Iteration 14 -- -bool(false) -array(0) { -} - --- Iteration 15 -- -bool(false) -array(0) { -} - --- Iteration 16 -- -bool(false) -array(0) { -} -Done diff --git a/ext/mbstring/tests/mb_get_info.phpt b/ext/mbstring/tests/mb_get_info.phpt index 5b9c0c0aef..4b08b9943f 100644 --- a/ext/mbstring/tests/mb_get_info.phpt +++ b/ext/mbstring/tests/mb_get_info.phpt @@ -9,7 +9,6 @@ mbstring.internal_encoding=UTF-8 mbstring.http_input=ISO-8859-1 mbstring.http_output=ISO-8859-15 mbstring.http_output_conv_mimetypes=abc -mbstring.func_overload=2 mbstring.detect_order=UTF-8,ISO-8859-15,ISO-8859-1,ASCII mbstring.substitute_character=123 mbstring.strict_detection=1 @@ -24,8 +23,7 @@ foreach (array_keys($result) as $key) { } ?> --EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -array(15) { +array(13) { ["internal_encoding"]=> string(5) "UTF-8" ["http_input"]=> @@ -34,35 +32,6 @@ array(15) { string(11) "ISO-8859-15" ["http_output_conv_mimetypes"]=> string(3) "abc" - ["func_overload"]=> - int(2) - ["func_overload_list"]=> - array(12) { - ["strlen"]=> - string(9) "mb_strlen" - ["strpos"]=> - string(9) "mb_strpos" - ["strrpos"]=> - string(10) "mb_strrpos" - ["stripos"]=> - string(10) "mb_stripos" - ["strripos"]=> - string(11) "mb_strripos" - ["strstr"]=> - string(9) "mb_strstr" - ["strrchr"]=> - string(10) "mb_strrchr" - ["stristr"]=> - string(10) "mb_stristr" - ["substr"]=> - string(9) "mb_substr" - ["strtolower"]=> - string(13) "mb_strtolower" - ["strtoupper"]=> - string(13) "mb_strtoupper" - ["substr_count"]=> - string(15) "mb_substr_count" - } ["mail_charset"]=> string(11) "ISO-2022-KR" ["mail_header_encoding"]=> @@ -99,60 +68,6 @@ string(11) "ISO-8859-15" string(11) "ISO-8859-15" string(3) "abc" string(3) "abc" -int(2) -int(2) -array(12) { - ["strlen"]=> - string(9) "mb_strlen" - ["strpos"]=> - string(9) "mb_strpos" - ["strrpos"]=> - string(10) "mb_strrpos" - ["stripos"]=> - string(10) "mb_stripos" - ["strripos"]=> - string(11) "mb_strripos" - ["strstr"]=> - string(9) "mb_strstr" - ["strrchr"]=> - string(10) "mb_strrchr" - ["stristr"]=> - string(10) "mb_stristr" - ["substr"]=> - string(9) "mb_substr" - ["strtolower"]=> - string(13) "mb_strtolower" - ["strtoupper"]=> - string(13) "mb_strtoupper" - ["substr_count"]=> - string(15) "mb_substr_count" -} -array(12) { - ["strlen"]=> - string(9) "mb_strlen" - ["strpos"]=> - string(9) "mb_strpos" - ["strrpos"]=> - string(10) "mb_strrpos" - ["stripos"]=> - string(10) "mb_stripos" - ["strripos"]=> - string(11) "mb_strripos" - ["strstr"]=> - string(9) "mb_strstr" - ["strrchr"]=> - string(10) "mb_strrchr" - ["stristr"]=> - string(10) "mb_stristr" - ["substr"]=> - string(9) "mb_substr" - ["strtolower"]=> - string(13) "mb_strtolower" - ["strtoupper"]=> - string(13) "mb_strtoupper" - ["substr_count"]=> - string(15) "mb_substr_count" -} string(11) "ISO-2022-KR" string(11) "ISO-2022-KR" string(6) "BASE64" diff --git a/ext/mbstring/tests/mb_http_output.phpt b/ext/mbstring/tests/mb_http_output.phpt index 71af8b094d..c3dab5e35f 100644 --- a/ext/mbstring/tests/mb_http_output.phpt +++ b/ext/mbstring/tests/mb_http_output.phpt @@ -47,16 +47,6 @@ $r = mb_http_output('BAD_NAME'); $enc = mb_http_output(); print "$enc\n"; -$r = mb_http_output($t_ary); -($r === NULL) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n"; -$enc = mb_http_output(); -print "$enc\n"; - -$r = mb_http_output($t_obj); -($r === NULL) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n"; -$enc = mb_http_output(); -print "$enc\n"; - ?> --EXPECTF-- OK_ASCII_SET @@ -74,11 +64,3 @@ EUC-JP Warning: mb_http_output(): Unknown encoding "BAD_NAME" in %s on line %d OK_BAD_SET EUC-JP - -Warning: mb_http_output() expects parameter 1 to be string, array given in %s on line %d -OK_BAD_ARY_SET -EUC-JP - -Warning: mb_http_output() expects parameter 1 to be string, object given in %s on line %d -OK_BAD_OBJ_SET -EUC-JP diff --git a/ext/mbstring/tests/mb_internal_encoding.phpt b/ext/mbstring/tests/mb_internal_encoding.phpt index 8b332b0594..22fe919cbc 100644 --- a/ext/mbstring/tests/mb_internal_encoding.phpt +++ b/ext/mbstring/tests/mb_internal_encoding.phpt @@ -35,16 +35,6 @@ $r = mb_internal_encoding('BAD'); $enc = mb_internal_encoding(); print "$enc\n"; -$r = mb_internal_encoding($t_ary); -($r === NULL) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n"; -$enc = mb_internal_encoding(); -print "$enc\n"; - -$r = mb_internal_encoding($t_obj); -($r === NULL) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n"; -$enc = mb_internal_encoding(); -print "$enc\n"; - ?> --EXPECTF-- OK_EUC-JP_SET @@ -58,11 +48,3 @@ ASCII Warning: mb_internal_encoding(): Unknown encoding "BAD" in %s on line %d OK_BAD_SET ASCII - -Warning: mb_internal_encoding() expects parameter 1 to be string, array given in %s on line %d -OK_BAD_ARY_SET -ASCII - -Warning: mb_internal_encoding() expects parameter 1 to be string, object given in %s on line %d -OK_BAD_OBJ_SET -ASCII diff --git a/ext/mbstring/tests/mb_parse_str.phpt b/ext/mbstring/tests/mb_parse_str.phpt index 8580ac52c5..ab504f918f 100644 --- a/ext/mbstring/tests/mb_parse_str.phpt +++ b/ext/mbstring/tests/mb_parse_str.phpt @@ -18,9 +18,6 @@ function test($query) { var_dump($array); var_dump($foo); var_dump($bar); - mb_parse_str($query); - var_dump($foo); - var_dump($bar); } foreach ($queries as $query) { test($query); @@ -35,10 +32,6 @@ array(2) { } string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(3) "abc" -string(3) "def" array(2) { ["+foo"]=> string(3) "def" @@ -47,10 +40,6 @@ array(2) { } string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(0) "" -string(0) "" array(2) { ["foo"]=> array(3) { @@ -69,17 +58,3 @@ array(2) { } string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -array(3) { - [0]=> - string(3) "abc" - [1]=> - string(3) "def" - [2]=> - string(3) "ghi" -} -array(1) { - [0]=> - string(3) "jkl" -} diff --git a/ext/mbstring/tests/mb_parse_str02.phpt b/ext/mbstring/tests/mb_parse_str02.phpt index e1871bf596..bad388ee90 100644 --- a/ext/mbstring/tests/mb_parse_str02.phpt +++ b/ext/mbstring/tests/mb_parse_str02.phpt @@ -20,10 +20,6 @@ function test($query) { var_dump($foo); var_dump($bar); var_dump($fubar); - mb_parse_str($query); - var_dump($foo); - var_dump($bar); - var_dump($fubar); } foreach ($queries as $query) { test($query); @@ -41,11 +37,6 @@ array(3) { string(0) "" string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(3) "abc" -string(3) "def" -string(3) "ghi" array(3) { ["+foo"]=> string(3) "def" @@ -57,11 +48,6 @@ array(3) { string(0) "" string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(0) "" -string(0) "" -string(0) "" array(3) { ["foo"]=> array(4) { @@ -88,23 +74,3 @@ array(3) { string(0) "" string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -array(4) { - [0]=> - string(3) "abc" - [1]=> - string(3) "def" - [2]=> - string(3) "ghi" - [3]=> - string(0) "" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "=" -} diff --git a/ext/mbstring/tests/mb_split.phpt b/ext/mbstring/tests/mb_split.phpt index d2476658da..9e9cd4080b 100644 --- a/ext/mbstring/tests/mb_split.phpt +++ b/ext/mbstring/tests/mb_split.phpt @@ -5,8 +5,6 @@ mb_split() extension_loaded('mbstring') or die('skip mbstring not available'); function_exists('mb_split') or die("skip mb_split() is not available in this build"); ?> ---INI-- -mbstring.func_overload=0 --FILE-- <?php mb_regex_set_options( '' ); diff --git a/ext/mbstring/tests/mb_stripos.phpt b/ext/mbstring/tests/mb_stripos.phpt index 9da6456992..067c3f2826 100644 --- a/ext/mbstring/tests/mb_stripos.phpt +++ b/ext/mbstring/tests/mb_stripos.phpt @@ -125,18 +125,6 @@ $r = mb_stripos($euc_jp, 'ڹ'); $r = mb_stripos($euc_jp, "\n"); ($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n"; - -// Invalid Parameters -echo "== INVALID PARAMETER TEST ==\n"; - -$r = mb_stripos($euc_jp,'','EUC-JP'); -($r === NULL) ? print("OK_NULL\n") : print("NG_NULL\n"); -$r = mb_stripos($euc_jp, $t_ary, 'EUC-JP'); -($r === NULL) ? print("OK_ARRAY\n") : print("NG_ARRAY\n"); -$r = mb_stripos($euc_jp, $t_obj, 'EUC-JP'); -($r === NULL) ? print("OK_OBJECT\n") : print("NG_OBJECT\n"); -$r = mb_stripos($euc_jp, $t_obj, 'BAD_ENCODING'); -($r === NULL) ? print("OK_BAD_ENCODING\n") : print("NG_BAD_ENCODING\n"); ?> ==DONE== --EXPECTF-- @@ -213,17 +201,4 @@ OK_NEWLINE 0 OK_STR OK_NEWLINE -== INVALID PARAMETER TEST == - -Warning: mb_stripos() expects parameter 3 to be int, string given in %s on line %d -OK_NULL - -Warning: mb_stripos() expects parameter 2 to be string, array given in %s on line %d -OK_ARRAY - -Warning: mb_stripos() expects parameter 2 to be string, object given in %s on line %d -OK_OBJECT - -Warning: mb_stripos() expects parameter 2 to be string, object given in %s on line %d -OK_BAD_ENCODING ==DONE== diff --git a/ext/mbstring/tests/mb_strlen.phpt b/ext/mbstring/tests/mb_strlen.phpt index ab93273e55..2decf18fca 100644 --- a/ext/mbstring/tests/mb_strlen.phpt +++ b/ext/mbstring/tests/mb_strlen.phpt @@ -2,8 +2,6 @@ mb_strlen() --SKIPIF-- <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> ---INI-- -mbstring.func_overload=0 --FILE-- <?php // TODO: Add more encodings @@ -55,14 +53,6 @@ print strlen($utf8) . "\n"; // Wrong Parameters echo "== WRONG PARAMETERS ==\n"; -// Array -// Note: PHP Warning, strlen() expects parameter 1 to be string, array given -$r = strlen($t_ary); -echo $r."\n"; -// Object -// Note: PHP Warning, strlen() expects parameter 1 to be string, object given -$r = strlen($t_obj); -echo $r."\n"; // Wrong encoding mb_internal_encoding('EUC-JP'); $r = mb_strlen($euc_jp, 'BAD_NAME'); @@ -88,10 +78,4 @@ echo $r."\n"; 101 == WRONG PARAMETERS == -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - - -Warning: strlen() expects parameter 1 to be string, object given in %s on line %d - - Warning: mb_strlen(): Unknown encoding "BAD_NAME" in %s on line %d diff --git a/ext/mbstring/tests/mb_strpos.phpt b/ext/mbstring/tests/mb_strpos.phpt index 9bca0ba390..c86b77e7de 100644 --- a/ext/mbstring/tests/mb_strpos.phpt +++ b/ext/mbstring/tests/mb_strpos.phpt @@ -125,18 +125,6 @@ $r = mb_strpos($euc_jp, 'ڹ'); $r = mb_strpos($euc_jp, "\n"); ($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n"; - -// Invalid Parameters -echo "== INVALID PARAMETER TEST ==\n"; - -$r = mb_strpos($euc_jp,'','EUC-JP'); -($r === NULL) ? print("OK_NULL\n") : print("NG_NULL\n"); -$r = mb_strpos($euc_jp, $t_ary, 'EUC-JP'); -($r === NULL) ? print("OK_ARRAY\n") : print("NG_ARRAY\n"); -$r = mb_strpos($euc_jp, $t_obj, 'EUC-JP'); -($r === NULL) ? print("OK_OBJECT\n") : print("NG_OBJECT\n"); -$r = mb_strpos($euc_jp, $t_obj, 'BAD_ENCODING'); -($r === NULL) ? print("OK_BAD_ENCODING\n") : print("NG_BAD_ENCODING\n"); ?> ==DONE== --EXPECTF-- @@ -213,17 +201,4 @@ OK_NEWLINE 0 OK_STR OK_NEWLINE -== INVALID PARAMETER TEST == - -Warning: mb_strpos() expects parameter 3 to be int, string given in %s on line %d -OK_NULL - -Warning: mb_strpos() expects parameter 2 to be string, array given in %s on line %d -OK_ARRAY - -Warning: mb_strpos() expects parameter 2 to be string, object given in %s on line %d -OK_OBJECT - -Warning: mb_strpos() expects parameter 2 to be string, object given in %s on line %d -OK_BAD_ENCODING ==DONE== diff --git a/ext/mbstring/tests/mb_substitute_character_variation1.phpt b/ext/mbstring/tests/mb_substitute_character_variation1.phpt index f738876469..69912eca50 100644 --- a/ext/mbstring/tests/mb_substitute_character_variation1.phpt +++ b/ext/mbstring/tests/mb_substitute_character_variation1.phpt @@ -16,8 +16,8 @@ function_exists('mb_substitute_character') or die("skip mb_substitute_character( echo "*** Testing mb_substitute_character() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/mbstring/tests/mb_substr.phpt b/ext/mbstring/tests/mb_substr.phpt index 28b35ea910..ab4f7c17d6 100644 --- a/ext/mbstring/tests/mb_substr.phpt +++ b/ext/mbstring/tests/mb_substr.phpt @@ -4,7 +4,6 @@ mb_substr() <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> --INI-- output_handler= -mbstring.func_overload=0 --FILE-- <?php // TODO: Add more encodings diff --git a/ext/mbstring/tests/overload01.phpt b/ext/mbstring/tests/overload01.phpt deleted file mode 100644 index 4e6802b930..0000000000 --- a/ext/mbstring/tests/overload01.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -Function overloading test 1 ---SKIPIF-- -<?php - extension_loaded('mbstring') or die('skip mbstring not available'); -?> ---INI-- -output_handler= -mbstring.func_overload=7 -mbstring.internal_encoding=EUC-JP ---FILE-- -<?php -echo mb_internal_encoding()."\n"; - -$ngchars = array('ǽ','ɽ','',''); -$str = 'ϽܻҺɽǽɽ˽ŽչʸͽƬե'; -var_dump(strlen($str)); -var_dump(mb_strlen($str)); ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -EUC-JP -int(33) -int(33) diff --git a/ext/mbstring/tests/overload02.phpt b/ext/mbstring/tests/overload02.phpt deleted file mode 100644 index 2aa30ad025..0000000000 --- a/ext/mbstring/tests/overload02.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Function overloading test 2 ---SKIPIF-- -<?php - extension_loaded('mbstring') or die('skip mbstring not available'); - if (!function_exists("mb_ereg_replace")) { - die('skip mb_ereg_replace() function is not available.'); - } -?> ---INI-- -output_handler= -mbstring.func_overload=7 -mbstring.internal_encoding=EUC-JP ---FILE-- -<?php -echo mb_internal_encoding()."\n"; - -$ngchars = array('ǽ','ɽ','',''); -$str = 'ϽܻҺɽǽɽ˽ŽչʸͽƬե'; -$converted_str = mb_convert_encoding($str, 'Shift_JIS'); -mb_regex_encoding('Shift_JIS'); -foreach($ngchars as $c) { - $c = mb_convert_encoding($c, 'Shift_JIS'); - $replaced = mb_convert_encoding(str_replace($c, '!!', $converted_str), mb_internal_encoding(), 'Shift_JIS'); - var_dump(strpos($replaced, '!!')); -} -?> ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -EUC-JP -int(10) -int(8) -int(3) -int(29) diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 394a838512..61d97b2a9b 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -297,22 +297,16 @@ static int mysqli_write_na(mysqli_object *obj, zval *newval) /* }}} */ /* {{{ mysqli_read_property */ -zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) +zval *mysqli_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) { - zval tmp_member; zval *retval; mysqli_object *obj; mysqli_prop_handler *hnd = NULL; - obj = Z_MYSQLI_P(object); - - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - } + obj = php_mysqli_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd) { @@ -321,11 +315,7 @@ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_sl retval = &EG(uninitialized_zval); } } else { - retval = zend_std_read_property(object, member, type, cache_slot, rv); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + retval = zend_std_read_property(object, name, type, cache_slot, rv); } return retval; @@ -333,31 +323,21 @@ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_sl /* }}} */ /* {{{ mysqli_write_property */ -zval *mysqli_write_property(zval *object, zval *member, zval *value, void **cache_slot) +zval *mysqli_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) { - zval tmp_member; mysqli_object *obj; mysqli_prop_handler *hnd = NULL; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - } - - obj = Z_MYSQLI_P(object); + obj = php_mysqli_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd) { hnd->write_func(obj, value); } else { - value = zend_std_write_property(object, member, value, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + value = zend_std_write_property(object, name, value, cache_slot); } return value; @@ -376,20 +356,20 @@ void mysqli_add_property(HashTable *h, const char *pname, size_t pname_len, mysq } /* }}} */ -static int mysqli_object_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */ +static int mysqli_object_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */ { - mysqli_object *obj = Z_MYSQLI_P(object); + mysqli_object *obj = php_mysqli_fetch_object(object); mysqli_prop_handler *p; int ret = 0; - if ((p = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member))) != NULL) { + if ((p = zend_hash_find_ptr(obj->prop_handler, name)) != NULL) { switch (has_set_exists) { case ZEND_PROPERTY_EXISTS: ret = 1; break; case ZEND_PROPERTY_NOT_EMPTY: { zval rv; - zval *value = mysqli_read_property(object, member, BP_VAR_IS, cache_slot, &rv); + zval *value = mysqli_read_property(object, name, BP_VAR_IS, cache_slot, &rv); if (value != &EG(uninitialized_zval)) { convert_to_boolean(value); ret = Z_TYPE_P(value) == IS_TRUE ? 1 : 0; @@ -398,7 +378,7 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex } case ZEND_PROPERTY_ISSET: { zval rv; - zval *value = mysqli_read_property(object, member, BP_VAR_IS, cache_slot, &rv); + zval *value = mysqli_read_property(object, name, BP_VAR_IS, cache_slot, &rv); if (value != &EG(uninitialized_zval)) { ret = Z_TYPE_P(value) != IS_NULL? 1 : 0; zval_ptr_dtor(value); @@ -409,27 +389,26 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex php_error_docref(NULL, E_WARNING, "Invalid value for has_set_exists"); } } else { - ret = zend_std_has_property(object, member, has_set_exists, cache_slot); + ret = zend_std_has_property(object, name, has_set_exists, cache_slot); } return ret; } /* }}} */ -HashTable *mysqli_object_get_debug_info(zval *object, int *is_temp) +HashTable *mysqli_object_get_debug_info(zend_object *object, int *is_temp) { - mysqli_object *obj = Z_MYSQLI_P(object); + mysqli_object *obj = php_mysqli_fetch_object(object); HashTable *retval, *props = obj->prop_handler; mysqli_prop_handler *entry; retval = zend_new_array(zend_hash_num_elements(props) + 1); ZEND_HASH_FOREACH_PTR(props, entry) { - zval rv, member; + zval rv; zval *value; - ZVAL_STR(&member, entry->name); - value = mysqli_read_property(object, &member, BP_VAR_IS, 0, &rv); + value = mysqli_read_property(object, entry->name, BP_VAR_IS, 0, &rv); if (value != &EG(uninitialized_zval)) { - zend_hash_add(retval, Z_STR(member), value); + zend_hash_add(retval, entry->name, value); } } ZEND_HASH_FOREACH_END(); diff --git a/ext/mysqli/tests/057.phpt b/ext/mysqli/tests/057.phpt index dab3dfa78d..e0dd351d4c 100644 --- a/ext/mysqli/tests/057.phpt +++ b/ext/mysqli/tests/057.phpt @@ -40,7 +40,6 @@ require_once('skipifconnectfailure.inc'); var_dump(mysqli_stmt_execute($stmt)); var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM test_store_result"), mysqli_error($link)); - var_dump(mysqli_stmt_reset($stmt)); $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"); mysqli_stmt_execute($stmt); @@ -102,9 +101,6 @@ object(mysqli_stmt)#%d (%d) { bool(true) bool(false) string(0) "" - -Warning: mysqli_stmt_reset() expects parameter 1 to be mysqli_stmt, bool given in %s on line %d -NULL Rows: 3 array(1) { [0]=> diff --git a/ext/mysqli/tests/mysqli_affected_rows.phpt b/ext/mysqli/tests/mysqli_affected_rows.phpt index 95c3bb3426..81a7f5b6de 100644 --- a/ext/mysqli/tests/mysqli_affected_rows.phpt +++ b/ext/mysqli/tests/mysqli_affected_rows.phpt @@ -10,18 +10,6 @@ mysqli_affected_rows() <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_affected_rows())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_affected_rows($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_affected_rows($link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); diff --git a/ext/mysqli/tests/mysqli_autocommit.phpt b/ext/mysqli/tests/mysqli_autocommit.phpt index cc41786bdb..ea91408b60 100644 --- a/ext/mysqli/tests/mysqli_autocommit.phpt +++ b/ext/mysqli/tests/mysqli_autocommit.phpt @@ -19,18 +19,6 @@ mysqli_autocommit() <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_autocommit())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_autocommit($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_autocommit($link, $link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); diff --git a/ext/mysqli/tests/mysqli_begin_transaction.phpt b/ext/mysqli/tests/mysqli_begin_transaction.phpt index b316ca9fe3..8a0dac8816 100644 --- a/ext/mysqli/tests/mysqli_begin_transaction.phpt +++ b/ext/mysqli/tests/mysqli_begin_transaction.phpt @@ -17,31 +17,10 @@ if (!have_innodb($link)) <?php require_once("connect.inc"); /* {{{ proto bool mysqli_begin_transaction(object link, [int flags [, string name]]) */ - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_begin_transaction())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_begin_transaction($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_begin_transaction($link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if (!is_null($tmp = @mysqli_begin_transaction($link, $link))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_begin_transaction($link, 0, $link))) - printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_begin_transaction($link, 0, "mytrx", $link))) - printf("[007] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_change_user.phpt b/ext/mysqli/tests/mysqli_change_user.phpt index 7b9f23cf9e..bf1515e645 100644 --- a/ext/mysqli/tests/mysqli_change_user.phpt +++ b/ext/mysqli/tests/mysqli_change_user.phpt @@ -10,24 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_change_user())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_change_user($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_change_user($link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_change_user($link, $link, $link))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_change_user($link, $link, $link, $link, $link))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); diff --git a/ext/mysqli/tests/mysqli_character_set_name.phpt b/ext/mysqli/tests/mysqli_character_set_name.phpt index 90dd46fa73..4e7153e5b0 100644 --- a/ext/mysqli/tests/mysqli_character_set_name.phpt +++ b/ext/mysqli/tests/mysqli_character_set_name.phpt @@ -11,18 +11,6 @@ require_once('skipifconnectfailure.inc'); /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */ require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_character_set_name())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_character_set_name($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_character_set_name($link, $link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); @@ -65,10 +53,6 @@ require_once('skipifconnectfailure.inc'); if (false !== ($tmp = @mysqli_character_set_name($link))) printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - /* Make sure that the function alias exists */ - if (!is_null($tmp = @mysqli_character_set_name())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; ?> --EXPECT-- diff --git a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt index 5d303fd503..4b760ec5bb 100644 --- a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt +++ b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt @@ -18,9 +18,6 @@ mysqli_chararcter_set_name(), mysql_client_encoding() [alias] printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if (!is_null($tmp = @$mysqli->character_set_name($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = $mysqli->query('SELECT version() AS server_version')) printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); $tmp = $res->fetch_assoc(); diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt index 7367a5cd7c..b8ab4a4af5 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt @@ -128,9 +128,6 @@ require_once('skipifconnectfailure.inc'); if (!is_object($res = new mysqli_result($link, MYSQLI_USE_RESULT))) printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_object($res = new mysqli_result($link, 'invalid'))) - printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT); do { $mode = mt_rand(-1000, 1000); @@ -146,12 +143,6 @@ require_once('skipifconnectfailure.inc'); printf("[009] Expecting warning because of invalid resultmode\n"); } - if (!is_object($res = new mysqli_result('foo'))) - printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - - if (!is_object($res = @new mysqli_result($link, MYSQLI_STORE_RESULT, 1))) - printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - print "done!"; ?> --EXPECTF-- @@ -186,8 +177,4 @@ Access to undefined properties: mysqli_result->unknown = '' Constructor: - -Warning: mysqli_result::__construct() expects parameter 2 to be int, string given in %s on line %d - -Warning: mysqli_result::__construct() expects parameter 1 to be mysqli, string given in %s on line %d done! diff --git a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt index 8fc4583a4c..3e3301361d 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt @@ -123,16 +123,6 @@ printf("stmt->unknown = '%s'\n", @$stmt->unknown); @$stmt->unknown = 13; printf("stmt->unknown = '%s'\n", @$stmt->unknown); -printf("\nPrepare using the constructor:\n"); -$stmt = new mysqli_stmt($link, 'SELECT id FROM test ORDER BY id'); -if (!$stmt->execute()) -printf("[002] [%d] %s\n", $stmt->errno, $stmt->error); -$stmt->close(); - -$obj = new stdClass(); -if (!is_object($stmt = new mysqli_stmt($link, $obj))) -printf("[003] Expecting NULL got %s/%s\n", gettype($stmt), $stmt); - print "done!"; ?> --EXPECTF-- @@ -191,8 +181,4 @@ stmt->sqlstate = '00000' Access to undefined properties: stmt->unknown = '' stmt->unknown = '13' - -Prepare using the constructor: - -Warning: mysqli_stmt::__construct() expects parameter 2 to be string, object given in %s on line %d done! diff --git a/ext/mysqli/tests/mysqli_close.phpt b/ext/mysqli/tests/mysqli_close.phpt index a300fb8314..0110847334 100644 --- a/ext/mysqli/tests/mysqli_close.phpt +++ b/ext/mysqli/tests/mysqli_close.phpt @@ -10,23 +10,10 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_close())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_close($link, $link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - $tmp = @mysqli_close(NULL); - if (NULL !== $tmp) - printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - $tmp = mysqli_close($link); if (true !== $tmp) printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_close_oo.phpt b/ext/mysqli/tests/mysqli_close_oo.phpt index 305d5edf88..be189ba232 100644 --- a/ext/mysqli/tests/mysqli_close_oo.phpt +++ b/ext/mysqli/tests/mysqli_close_oo.phpt @@ -17,9 +17,6 @@ require_once('skipifconnectfailure.inc'); printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if (!is_null($tmp = @$mysqli->close($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - $tmp = $mysqli->close(); if (true !== $tmp) printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_commit.phpt b/ext/mysqli/tests/mysqli_commit.phpt index 27ae3a928a..73a9cdf25d 100644 --- a/ext/mysqli/tests/mysqli_commit.phpt +++ b/ext/mysqli/tests/mysqli_commit.phpt @@ -17,18 +17,6 @@ if (!have_innodb($link)) <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_commit())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_commit($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_commit($link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); diff --git a/ext/mysqli/tests/mysqli_connect.phpt b/ext/mysqli/tests/mysqli_connect.phpt index 66cd94bd54..d5e4febbef 100644 --- a/ext/mysqli/tests/mysqli_connect.phpt +++ b/ext/mysqli/tests/mysqli_connect.phpt @@ -19,10 +19,6 @@ require_once('skipifconnectfailure.inc'); $exptype = ($anon_allow) ? "mysqli_object" : "false"; - $obj = new stdClass(); - if (!is_null($tmp = @mysqli_connect($obj))) - printf("[001] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - $tmp = @mysqli_connect($link); if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) { printf("[002] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_data_seek.phpt b/ext/mysqli/tests/mysqli_data_seek.phpt index 9bc3b12f73..0859ee61d5 100644 --- a/ext/mysqli/tests/mysqli_data_seek.phpt +++ b/ext/mysqli/tests/mysqli_data_seek.phpt @@ -10,18 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (NULL !== ($tmp = @mysqli_data_seek())) - printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_data_seek($link))) - printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_data_seek($link, $link))) - printf("[003] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT)) printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_data_seek_oo.phpt b/ext/mysqli/tests/mysqli_data_seek_oo.phpt index 7fb14f0956..2c4377d845 100644 --- a/ext/mysqli/tests/mysqli_data_seek_oo.phpt +++ b/ext/mysqli/tests/mysqli_data_seek_oo.phpt @@ -9,10 +9,6 @@ require_once('skipifconnectfailure.inc'); --FILE-- <?php require_once("connect.inc"); - - $tmp = NULL; - $link = NULL; - require('table.inc'); if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) @@ -26,15 +22,6 @@ require_once('skipifconnectfailure.inc'); if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT)) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (NULL !== ($tmp = @$res->data_seek())) - printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @$res->data_seek($link))) - printf("[005] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @$res->data_seek($link, $link))) - printf("[006] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = $res->data_seek(3))) printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_debug.phpt b/ext/mysqli/tests/mysqli_debug.phpt index aa455d7f6e..478dcf7d08 100644 --- a/ext/mysqli/tests/mysqli_debug.phpt +++ b/ext/mysqli/tests/mysqli_debug.phpt @@ -19,9 +19,6 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) <?php require_once('connect.inc'); - if (NULL !== ($tmp = @mysqli_debug())) - printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - // NOTE: documentation is not clear on this: function always return NULL or TRUE if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir())))) printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_dump_debug_info.phpt b/ext/mysqli/tests/mysqli_dump_debug_info.phpt index b3fbde7fd9..d9c894dfff 100644 --- a/ext/mysqli/tests/mysqli_dump_debug_info.phpt +++ b/ext/mysqli/tests/mysqli_dump_debug_info.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (NULL !== ($tmp = @mysqli_dump_debug_info())) - printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_dump_debug_info($link))) - printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); diff --git a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt index a0b5365432..58eb63cb2b 100644 --- a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt +++ b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt @@ -16,9 +16,6 @@ require_once('skipifconnectfailure.inc'); if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if (NULL !== ($tmp = @$mysqli->dump_debug_info($link))) - printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!is_bool($tmp = $mysqli->dump_debug_info())) printf("[003] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n", gettype($tmp), $tmp, diff --git a/ext/mysqli/tests/mysqli_errno.phpt b/ext/mysqli/tests/mysqli_errno.phpt index 0a9c245341..f26a30e089 100644 --- a/ext/mysqli/tests/mysqli_errno.phpt +++ b/ext/mysqli/tests/mysqli_errno.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_errno())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_errno($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); diff --git a/ext/mysqli/tests/mysqli_error.phpt b/ext/mysqli/tests/mysqli_error.phpt index fd61f0f5d2..4154f45f1d 100644 --- a/ext/mysqli/tests/mysqli_error.phpt +++ b/ext/mysqli/tests/mysqli_error.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_error())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_error($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); diff --git a/ext/mysqli/tests/mysqli_error_unicode.phpt b/ext/mysqli/tests/mysqli_error_unicode.phpt index f4d8da9110..8127931882 100644 --- a/ext/mysqli/tests/mysqli_error_unicode.phpt +++ b/ext/mysqli/tests/mysqli_error_unicode.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_error())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_error($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); diff --git a/ext/mysqli/tests/mysqli_fetch_all.phpt b/ext/mysqli/tests/mysqli_fetch_all.phpt index f9a7ee3770..9f18499454 100644 --- a/ext/mysqli/tests/mysqli_fetch_all.phpt +++ b/ext/mysqli/tests/mysqli_fetch_all.phpt @@ -12,15 +12,6 @@ if (!function_exists('mysqli_fetch_all')) <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_fetch_all())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_fetch_all($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) { printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_fetch_array.phpt b/ext/mysqli/tests/mysqli_fetch_array.phpt index e9dd1602b5..775c6f20c4 100644 --- a/ext/mysqli/tests/mysqli_fetch_array.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array.phpt @@ -9,14 +9,6 @@ require_once('skipifconnectfailure.inc'); --FILE-- <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_fetch_array())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_fetch_array($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) { diff --git a/ext/mysqli/tests/mysqli_fetch_assoc.phpt b/ext/mysqli/tests/mysqli_fetch_assoc.phpt index 6b98b5f51c..3097eb2bc4 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc.phpt @@ -10,17 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test - if (!is_null($tmp = @mysqli_fetch_assoc())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_fetch_assoc($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) { printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt index e4f6465176..db3457a4a0 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt @@ -24,9 +24,6 @@ require_once('skipifconnectfailure.inc'); printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if (!is_null($tmp = @$res->fetch_assoc($link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) { printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error); } diff --git a/ext/mysqli/tests/mysqli_fetch_field.phpt b/ext/mysqli/tests/mysqli_fetch_field.phpt index 684795a48e..5035cf70d2 100644 --- a/ext/mysqli/tests/mysqli_fetch_field.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field.phpt @@ -10,15 +10,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test - if (!is_null($tmp = @mysqli_fetch_field())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_fetch_field($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt index be883ef625..5acc3b75d4 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt @@ -10,18 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_fetch_field_direct())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_fetch_field_direct($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_fetch_field_direct($link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) { diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt index c240050e17..c1220c7832 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt @@ -10,13 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - $mysqli = new mysqli(); $res = @new mysqli_result($mysqli); - if (!is_null($tmp = @$res->fetch_field_direct())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); @@ -28,15 +23,6 @@ require_once('skipifconnectfailure.inc'); printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } - if (!is_null($tmp = @$res->fetch_field_direct())) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @$res->fetch_field_direct($link))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @$res->fetch_field_direct($link, $link))) - printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - var_dump($res->fetch_field_direct(-1)); var_dump($res->fetch_field_direct(0)); var_dump($res->fetch_field_direct(2)); diff --git a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt index 2293c9581a..35fdbb050e 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt @@ -10,23 +10,15 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test $mysqli = new mysqli(); $res = @new mysqli_result($mysqli); - if (false !== ($tmp = @$res->fetch_field())) - printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if (!is_null($tmp = @$res->fetch_field($link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - // Make sure that client, connection and result charsets are all the // same. Not sure whether this is strictly necessary. if (!$mysqli->set_charset('utf8')) diff --git a/ext/mysqli/tests/mysqli_fetch_fields.phpt b/ext/mysqli/tests/mysqli_fetch_fields.phpt index c79555c3a1..6dee8108f9 100644 --- a/ext/mysqli/tests/mysqli_fetch_fields.phpt +++ b/ext/mysqli/tests/mysqli_fetch_fields.phpt @@ -10,15 +10,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test - if (!is_null($tmp = @mysqli_fetch_fields())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_fetch_fields($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require('table.inc'); diff --git a/ext/mysqli/tests/mysqli_fetch_lengths.phpt b/ext/mysqli/tests/mysqli_fetch_lengths.phpt index 85921f800d..b407d91894 100644 --- a/ext/mysqli/tests/mysqli_fetch_lengths.phpt +++ b/ext/mysqli/tests/mysqli_fetch_lengths.phpt @@ -15,12 +15,6 @@ require_once('skipifconnectfailure.inc'); $host, $user, $db, $port, $socket); } - if (!is_null($tmp = @mysqli_fetch_lengths())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_fetch_lengths($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) { printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_fetch_object.phpt b/ext/mysqli/tests/mysqli_fetch_object.phpt index 09ea19161a..262b48d49f 100644 --- a/ext/mysqli/tests/mysqli_fetch_object.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object.phpt @@ -12,15 +12,6 @@ require_once('skipifconnectfailure.inc'); set_error_handler('handle_catchable_fatal'); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_fetch_object())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_fetch_object($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) { printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -145,8 +136,6 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -[E_WARNING] mysqli_fetch_object() expects at least 1 parameter, 0 given in %s on line %d -[E_WARNING] mysqli_fetch_object() expects parameter 1 to be mysqli_result, null given in %s on line %d Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 0 passed and exactly 2 expected Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 1 passed and exactly 2 expected NULL diff --git a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt index d8c8cc70fd..2688f050fa 100644 --- a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt @@ -11,9 +11,6 @@ require_once('skipifconnectfailure.inc'); require_once("connect.inc"); set_error_handler('handle_catchable_fatal'); - $tmp = NULL; - $link = NULL; - $mysqli = new mysqli(); $res = @new mysqli_result($mysqli); if (false !== ($tmp = @$res->fetch_object())) @@ -28,9 +25,6 @@ require_once('skipifconnectfailure.inc'); printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error); } - if (!is_null($tmp = @$res->fetch_object($link))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - try { if (!is_null($tmp = @$res->fetch_object($link, $link))) printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); @@ -132,7 +126,6 @@ require_once('skipifconnectfailure.inc'); [E_WARNING] mysqli_result::__construct(): invalid object or resource mysql%s %s on line %d [E_WARNING] mysqli_result::fetch_object(): Couldn't fetch mysqli_result in %s on line %d -[E_WARNING] mysqli_result::fetch_object() expects parameter 1 to be string, object given in %s on line %d [0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d [0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d [0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, null given in %s on line %d diff --git a/ext/mysqli/tests/mysqli_fetch_row.phpt b/ext/mysqli/tests/mysqli_fetch_row.phpt index 7ca1b9a132..c16ca1da77 100644 --- a/ext/mysqli/tests/mysqli_fetch_row.phpt +++ b/ext/mysqli/tests/mysqli_fetch_row.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_fetch_row())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_fetch_row($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, "SELECT id, label, id AS _id FROM test ORDER BY id LIMIT 1")) { printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_field_count.phpt b/ext/mysqli/tests/mysqli_field_count.phpt index d6581c6699..18fc3c9ec1 100644 --- a/ext/mysqli/tests/mysqli_field_count.phpt +++ b/ext/mysqli/tests/mysqli_field_count.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_field_count())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_field_count($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); var_dump(mysqli_field_count($link)); diff --git a/ext/mysqli/tests/mysqli_field_seek.phpt b/ext/mysqli/tests/mysqli_field_seek.phpt index c34cf3f647..3cd60c7ce9 100644 --- a/ext/mysqli/tests/mysqli_field_seek.phpt +++ b/ext/mysqli/tests/mysqli_field_seek.phpt @@ -56,15 +56,6 @@ require_once('skipifconnectfailure.inc'); require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_field_seek())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_field_seek($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); // Make sure that client, connection and result charsets are all the @@ -99,10 +90,6 @@ require_once('skipifconnectfailure.inc'); var_dump(mysqli_field_tell($res)); var_dump(mysqli_field_seek($res, 2)); var_dump(mysqli_fetch_field($res)); - var_dump(mysqli_field_seek($res, PHP_INT_MAX + 1)); - - if (!is_null($tmp = @mysqli_field_seek($res, 0, "too many"))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); mysqli_free_result($res); @@ -217,9 +204,6 @@ int(2) Warning: mysqli_field_seek(): Invalid field offset in %s on line %d bool(false) bool(false) - -Warning: mysqli_field_seek() expects parameter 2 to be int, float given in %s on line %d -NULL bool(true) object(stdClass)#%d (13) { ["name"]=> diff --git a/ext/mysqli/tests/mysqli_field_tell.phpt b/ext/mysqli/tests/mysqli_field_tell.phpt index 9885c1d9d8..0b1d3bd0c1 100644 --- a/ext/mysqli/tests/mysqli_field_tell.phpt +++ b/ext/mysqli/tests/mysqli_field_tell.phpt @@ -10,31 +10,17 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_field_tell())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_field_tell($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) { printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } var_dump(mysqli_field_tell($res)); - var_dump(mysqli_field_seek(1)); var_dump(mysqli_field_tell($res)); var_dump(mysqli_fetch_field($res)); var_dump(mysqli_fetch_field($res)); var_dump(mysqli_field_tell($res)); - if (!is_null($tmp = @mysqli_field_tell($res, 'too many arguments'))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - var_dump(mysqli_field_seek($res, 2)); var_dump(mysqli_field_tell($res)); @@ -60,9 +46,6 @@ require_once('skipifconnectfailure.inc'); ?> --EXPECTF-- int(0) - -Warning: mysqli_field_seek() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(0) object(stdClass)#%d (13) { ["name"]=> diff --git a/ext/mysqli/tests/mysqli_free_result.phpt b/ext/mysqli/tests/mysqli_free_result.phpt index 6cd7778319..be377a8817 100644 --- a/ext/mysqli/tests/mysqli_free_result.phpt +++ b/ext/mysqli/tests/mysqli_free_result.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_free_result())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_free_result($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -33,7 +24,7 @@ require_once('skipifconnectfailure.inc'); printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } print "c\n"; - var_dump($res = mysqli_store_result($link)); + var_dump(mysqli_store_result($link)); var_dump(mysqli_error($link)); print "[005]\n"; var_dump(mysqli_free_result($res)); @@ -42,7 +33,7 @@ require_once('skipifconnectfailure.inc'); printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } print "d\n"; - var_dump($res = mysqli_use_result($link)); + var_dump(mysqli_use_result($link)); var_dump(mysqli_error($link)); print "[007]\n"; var_dump(mysqli_free_result($res)); @@ -63,16 +54,12 @@ Warning: mysqli_free_result(): Couldn't fetch mysqli_result in %s on line %d bool(false) c bool(false) -%s(0) "" +string(0) "" [005] - -Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, bool given in %s on line %d NULL d bool(false) -%s(0) "" +string(0) "" [007] - -Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, bool given in %s on line %d NULL done! diff --git a/ext/mysqli/tests/mysqli_get_charset.phpt b/ext/mysqli/tests/mysqli_get_charset.phpt index 537809dd70..cd7cfb3ae4 100644 --- a/ext/mysqli/tests/mysqli_get_charset.phpt +++ b/ext/mysqli/tests/mysqli_get_charset.phpt @@ -12,18 +12,6 @@ if (!function_exists('mysqli_get_charset')) <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_get_charset())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_get_charset($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_set_charset($link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, 'SELECT version() AS server_version')) diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt index 07ef78f296..6df6e2bee7 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt @@ -81,10 +81,6 @@ mysqli.allow_local_infile=1 } - $tmp = $link = null; - if (!is_null($tmp = @mysqli_get_client_stats($link))) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require_once("connect.inc"); if (!is_array($info = mysqli_get_client_stats()) || empty($info)) diff --git a/ext/mysqli/tests/mysqli_get_connection_stats.phpt b/ext/mysqli/tests/mysqli_get_connection_stats.phpt index 80875a44e6..45d09b1baf 100644 --- a/ext/mysqli/tests/mysqli_get_connection_stats.phpt +++ b/ext/mysqli/tests/mysqli_get_connection_stats.phpt @@ -14,13 +14,6 @@ if (!function_exists('mysqli_get_connection_stats')) { ?> --FILE-- <?php - $tmp = $link = null; - if (!is_null($tmp = @mysqli_get_connection_stats())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_get_connection_stats($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require("table.inc"); if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info)) diff --git a/ext/mysqli/tests/mysqli_get_host_info.phpt b/ext/mysqli/tests/mysqli_get_host_info.phpt index ada57f7d9f..534765808b 100644 --- a/ext/mysqli/tests/mysqli_get_host_info.phpt +++ b/ext/mysqli/tests/mysqli_get_host_info.phpt @@ -10,12 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - if (!is_null($tmp = @mysqli_get_host_info())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_get_host_info(NULL))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require "table.inc"; if (!is_string($info = mysqli_get_host_info($link)) || ('' === $info)) printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info); diff --git a/ext/mysqli/tests/mysqli_get_proto_info.phpt b/ext/mysqli/tests/mysqli_get_proto_info.phpt index b24ab11fbd..c46fe30379 100644 --- a/ext/mysqli/tests/mysqli_get_proto_info.phpt +++ b/ext/mysqli/tests/mysqli_get_proto_info.phpt @@ -10,19 +10,10 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - if (!is_null($tmp = @mysqli_get_proto_info())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_get_proto_info(NULL))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require "table.inc"; if (!is_int($info = mysqli_get_proto_info($link)) || ($info < 1)) printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info); - if (!is_null($tmp = @mysqli_get_proto_info('too many', 'arguments'))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; ?> --EXPECT-- diff --git a/ext/mysqli/tests/mysqli_get_server_info.phpt b/ext/mysqli/tests/mysqli_get_server_info.phpt index 3ea1b4a70d..25278528a6 100644 --- a/ext/mysqli/tests/mysqli_get_server_info.phpt +++ b/ext/mysqli/tests/mysqli_get_server_info.phpt @@ -10,19 +10,10 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - if (!is_null($tmp = @mysqli_get_server_info())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_get_server_info(NULL))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require "table.inc"; if (!is_string($info = mysqli_get_server_info($link)) || ('' === $info)) printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info); - if (!is_null($tmp = @mysqli_get_server_info('too', 'many arguments'))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; ?> --CLEAN-- diff --git a/ext/mysqli/tests/mysqli_get_server_version.phpt b/ext/mysqli/tests/mysqli_get_server_version.phpt index ddbf4e73bb..6589e335b4 100644 --- a/ext/mysqli/tests/mysqli_get_server_version.phpt +++ b/ext/mysqli/tests/mysqli_get_server_version.phpt @@ -10,12 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - if (!is_null($tmp = @mysqli_get_server_version())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_get_server_version(NULL))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require "table.inc"; /* 5.1.5 -> 50105 -- major_version*10000 + minor_version *100 + sub_version */ /* < 30000 = pre 3.2.3, very unlikely! */ diff --git a/ext/mysqli/tests/mysqli_info.phpt b/ext/mysqli/tests/mysqli_info.phpt index 56ee2cce05..b3a090b6e8 100644 --- a/ext/mysqli/tests/mysqli_info.phpt +++ b/ext/mysqli/tests/mysqli_info.phpt @@ -12,12 +12,6 @@ mysqli.allow_local_infile=1 <?php require_once("connect.inc"); - if (!is_null($tmp = @mysqli_info())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_info(NULL))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require "table.inc"; if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_insert_id.phpt b/ext/mysqli/tests/mysqli_insert_id.phpt index 7d4c0e085c..383ed087b7 100644 --- a/ext/mysqli/tests/mysqli_insert_id.phpt +++ b/ext/mysqli/tests/mysqli_insert_id.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_insert_id())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_insert_id($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (0 !== ($tmp = mysqli_insert_id($link))) diff --git a/ext/mysqli/tests/mysqli_kill.phpt b/ext/mysqli/tests/mysqli_kill.phpt index 85eb90e65a..7d96ac9426 100644 --- a/ext/mysqli/tests/mysqli_kill.phpt +++ b/ext/mysqli/tests/mysqli_kill.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_kill())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_kill($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); // Zend will cast the NULL to 0 diff --git a/ext/mysqli/tests/mysqli_max_links.phpt b/ext/mysqli/tests/mysqli_max_links.phpt index f3469e20e6..8586cb9276 100644 --- a/ext/mysqli/tests/mysqli_max_links.phpt +++ b/ext/mysqli/tests/mysqli_max_links.phpt @@ -25,14 +25,6 @@ mysqli.max_links=1 $i, mysqli_connect_errno(), mysqli_connect_error(), mysqli_errno($links[$i]), mysqli_error($links[$i])); - for ($i = 1; $i <= 5; $i++) { - if ($res = mysqli_query($links[$i], 'SELECT id FROM test LIMIT 1')) { - printf("[%03d] Can run query on link %d\n", 5 + $i, $i); - mysqli_free_result($res); - } - mysqli_close($links[$i]); - } - mysqli_close($link); print "done!"; ?> @@ -53,24 +45,4 @@ Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d - -Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d - -Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d - -Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d - -Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d - -Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d - -Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d - -Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d - -Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d - -Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d - -Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d done! diff --git a/ext/mysqli/tests/mysqli_more_results.phpt b/ext/mysqli/tests/mysqli_more_results.phpt index 4ce6a19c79..50a09c0fef 100644 --- a/ext/mysqli/tests/mysqli_more_results.phpt +++ b/ext/mysqli/tests/mysqli_more_results.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_more_results())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_more_results($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); print "[004]\n"; diff --git a/ext/mysqli/tests/mysqli_multi_query.phpt b/ext/mysqli/tests/mysqli_multi_query.phpt index 28898b1dcb..12ffe2c38d 100644 --- a/ext/mysqli/tests/mysqli_multi_query.phpt +++ b/ext/mysqli/tests/mysqli_multi_query.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_multi_query())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_multi_query($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (false !== ($tmp = mysqli_multi_query($link, ""))) diff --git a/ext/mysqli/tests/mysqli_next_result.phpt b/ext/mysqli/tests/mysqli_next_result.phpt index e01f507c20..2967d12983 100644 --- a/ext/mysqli/tests/mysqli_next_result.phpt +++ b/ext/mysqli/tests/mysqli_next_result.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_next_result())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_next_result($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (false !== ($tmp = mysqli_next_result($link))) diff --git a/ext/mysqli/tests/mysqli_num_fields.phpt b/ext/mysqli/tests/mysqli_num_fields.phpt index f891b309c2..1f33b4d2d9 100644 --- a/ext/mysqli/tests/mysqli_num_fields.phpt +++ b/ext/mysqli/tests/mysqli_num_fields.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_num_fields())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_num_fields($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); function func_test_mysqli_num_fields($link, $query, $expected, $offset, $test_free = false) { diff --git a/ext/mysqli/tests/mysqli_num_rows.phpt b/ext/mysqli/tests/mysqli_num_rows.phpt index c6e646e4c3..15d3f90257 100644 --- a/ext/mysqli/tests/mysqli_num_rows.phpt +++ b/ext/mysqli/tests/mysqli_num_rows.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_num_rows())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_num_rows($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); function func_test_mysqli_num_rows($link, $query, $expected, $offset, $test_free = false) { @@ -28,16 +19,17 @@ require_once('skipifconnectfailure.inc'); return; } - if ($expected !== ($tmp = mysqli_num_rows($res))) - printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1, - gettype($expected), $expected, - gettype($tmp), $tmp); - - mysqli_free_result($res); + if (!is_bool($res)) { + if ($expected !== ($tmp = mysqli_num_rows($res))) + printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1, + gettype($expected), $expected, + gettype($tmp), $tmp); - if ($test_free && (false !== ($tmp = mysqli_num_rows($res)))) - printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp); + mysqli_free_result($res); + if ($test_free && (false !== ($tmp = mysqli_num_rows($res)))) + printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp); + } } func_test_mysqli_num_rows($link, "SELECT 1 AS a", 1, 5); @@ -78,10 +70,6 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in %s on line %d - -Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, bool given in %s on line %d - Warning: mysqli_num_rows(): Couldn't fetch mysqli_result in %s on line %d run_tests.php don't fool me with your 'ungreedy' expression '.+?'! diff --git a/ext/mysqli/tests/mysqli_options.phpt b/ext/mysqli/tests/mysqli_options.phpt index 6d5247943b..13590bf5a9 100644 --- a/ext/mysqli/tests/mysqli_options.phpt +++ b/ext/mysqli/tests/mysqli_options.phpt @@ -27,30 +27,12 @@ require_once('skipifconnectfailure.inc'); if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) $valid_options[] = constant('MYSQLI_OPT_INT_AND_FLOAT_NATIVE'); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_options())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_options($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - $link = mysqli_init(); /* set it twice, checking if memory for the previous one is correctly freed */ mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "utf8"); mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "latin1"); - if (!is_null($tmp = @mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_options($link, "s", 'extra_my.cnf'))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo'))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); diff --git a/ext/mysqli/tests/mysqli_ping.phpt b/ext/mysqli/tests/mysqli_ping.phpt index 6ddb29efef..93deeebfa3 100644 --- a/ext/mysqli/tests/mysqli_ping.phpt +++ b/ext/mysqli/tests/mysqli_ping.phpt @@ -10,17 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_ping())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); - if (!is_null($tmp = @mysqli_ping($link, $link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - var_dump(mysqli_ping($link)); // provoke an error to check if mysqli_ping resets it diff --git a/ext/mysqli/tests/mysqli_poll.phpt b/ext/mysqli/tests/mysqli_poll.phpt index b9c66381f9..f6d99c8e13 100644 --- a/ext/mysqli/tests/mysqli_poll.phpt +++ b/ext/mysqli/tests/mysqli_poll.phpt @@ -25,29 +25,6 @@ if (!$IS_MYSQLND) if (!$link = get_connection()) printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (NULL !== ($tmp = @mysqli_poll())) - printf("[002] Expecting NULL got %s\n", var_export($tmp, true)); - - $l = array($link); - if (NULL !== ($tmp = @mysqli_poll($l))) - printf("[003] Expecting NULL got %s\n", var_export($tmp, true)); - - $l = array($link); $n = NULL; - if (NULL !== ($tmp = @mysqli_poll($l, $n))) - printf("[004] Expecting NULL got %s\n", var_export($tmp, true)); - - $l = array($link); $n = NULL; - if (NULL !== ($tmp = @mysqli_poll($l, $n, $n))) - printf("[005] Expecting NULL got %s\n", var_export($tmp, true)); - - $l = array($link); $e = NULL; $r = NULL; - if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, -1))) - printf("[007] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true)); - - $l = array($link); $e = NULL; $r = NULL; - if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, 0, -1))) - printf("[008] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true)); - $read = $error = $reject = array($link); if (0 !== ($tmp = (mysqli_poll($read, $error, $reject, 0, 1)))) printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true)); diff --git a/ext/mysqli/tests/mysqli_prepare.phpt b/ext/mysqli/tests/mysqli_prepare.phpt index 0c3bedf5b5..c6400e0b17 100644 --- a/ext/mysqli/tests/mysqli_prepare.phpt +++ b/ext/mysqli/tests/mysqli_prepare.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_prepare())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_prepare($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (false !== ($tmp = @mysqli_prepare($link, false))) @@ -105,15 +96,8 @@ require_once('skipifconnectfailure.inc'); var_dump(mysqli_stmt_prepare($stmt, 'SELECT 1; SELECT 2')); mysqli_stmt_close($stmt); - - if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test', 'foo'))) - printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); - if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test'))) - printf("[024] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; ?> --CLEAN-- diff --git a/ext/mysqli/tests/mysqli_query.phpt b/ext/mysqli/tests/mysqli_query.phpt index bfa703bb01..cf6d282c63 100644 --- a/ext/mysqli/tests/mysqli_query.phpt +++ b/ext/mysqli/tests/mysqli_query.phpt @@ -10,23 +10,11 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_query())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_query($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (false !== ($tmp = @mysqli_query($link, ''))) printf("[002a] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); - if (NULL !== ($tmp = @mysqli_query($link, "SELECT 1 AS a", MYSQLI_USE_RESULT, "foo"))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_query($link, 'THIS IS NOT SQL'))) printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_query_unicode.phpt b/ext/mysqli/tests/mysqli_query_unicode.phpt index 819a849d94..f167b4373a 100644 --- a/ext/mysqli/tests/mysqli_query_unicode.phpt +++ b/ext/mysqli/tests/mysqli_query_unicode.phpt @@ -16,23 +16,11 @@ mysqli_close($link); <?php include_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_query())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_query($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require_once('table.inc'); if (TRUE !== ($tmp = @mysqli_query($link, "set names utf8"))) printf("[002.5] Expecting TRUE, got %s/%s\n", gettype($tmp), $tmp); - if (NULL !== ($tmp = @mysqli_query($link, "SELECT 1 AS колона", MYSQLI_USE_RESULT, "foo"))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_query($link, 'това не е ескюел'))) printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_real_connect.phpt b/ext/mysqli/tests/mysqli_real_connect.phpt index 5e4b56173b..32c37b9a14 100644 --- a/ext/mysqli/tests/mysqli_real_connect.phpt +++ b/ext/mysqli/tests/mysqli_real_connect.phpt @@ -12,34 +12,7 @@ mysqli.allow_local_infile=1 <?php include("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (NULL !== ($tmp = @mysqli_real_connect($link))) - printf("[001a] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_real_connect($link, $link))) - printf("[001b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link))) - printf("[001c] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link))) - printf("[001d] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link))) - printf("[001e] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link))) - printf("[001f] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link, $link))) - printf("[001g] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - // ( mysqli link [, string hostname [, string username [, string passwd [, string dbname [, int port [, string socket [, int flags]]]]]]] - if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link, $link, $link))) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = mysqli_init()) printf("[002] mysqli_init() failed\n"); diff --git a/ext/mysqli/tests/mysqli_real_escape_string.phpt b/ext/mysqli/tests/mysqli_real_escape_string.phpt index 05588cac63..57ab99eb89 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string.phpt @@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (NULL !== ($tmp = @mysqli_real_escape_string())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_real_escape_string($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); - if (NULL !== ($tmp =@mysqli_real_escape_string($link, "foo", "foo"))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\'))) printf("[004] Expecting \\\\, got %s\n", $tmp); @@ -47,10 +35,6 @@ require_once('skipifconnectfailure.inc'); if (false !== ($tmp = mysqli_real_escape_string($link, 'foo'))) printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - /* Make sure that the function alias exists */ - if (NULL !== ($tmp = @mysqli_escape_string())) - printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; ?> --EXPECTF-- diff --git a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt index b3465ad2b1..3db0ecce62 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt @@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (NULL !== ($tmp = @mysqli_real_escape_string())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (NULL !== ($tmp = @mysqli_real_escape_string($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); - if (NULL !== ($tmp =@mysqli_real_escape_string($link, "фуу", "бар"))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if ('фу\\\\бар' !== ($tmp = mysqli_real_escape_string($link, 'фу\\бар'))) printf("[004] Expecting фу\\\\бар, got %s\n", $tmp); diff --git a/ext/mysqli/tests/mysqli_real_query.phpt b/ext/mysqli/tests/mysqli_real_query.phpt index 9b99435d42..4515810310 100644 --- a/ext/mysqli/tests/mysqli_real_query.phpt +++ b/ext/mysqli/tests/mysqli_real_query.phpt @@ -9,20 +9,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_real_query())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_real_query($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); - if (NULL !== ($tmp = @mysqli_real_query($link, "SELECT 1 AS a", MYSQLI_USE_RESULT, "foo"))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_real_query($link, 'THIS IS NOT SQL'))) printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_reap_async_query.phpt b/ext/mysqli/tests/mysqli_reap_async_query.phpt index b43b6b2478..5f13c2bbd9 100644 --- a/ext/mysqli/tests/mysqli_reap_async_query.phpt +++ b/ext/mysqli/tests/mysqli_reap_async_query.phpt @@ -25,16 +25,6 @@ if (!$IS_MYSQLND) if (!$link = get_connection()) printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - if (NULL !== ($tmp = @mysqli_reap_async_query())) - printf("[002] Expecting NULL got %s\n", var_export($tmp, true)); - - $l = array($link); - if (NULL !== ($tmp = @mysqli_reap_async_query($l))) - printf("[003] Expecting NULL got %s\n", var_export($tmp, true)); - - if (NULL !== ($tmp = @mysqli_reap_async_query($link, $link))) - printf("[004] Expecting NULL got %s\n", var_export($tmp, true)); - function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) { diff --git a/ext/mysqli/tests/mysqli_release_savepoint.phpt b/ext/mysqli/tests/mysqli_release_savepoint.phpt index bb9a77a0af..219b5975b4 100644 --- a/ext/mysqli/tests/mysqli_release_savepoint.phpt +++ b/ext/mysqli/tests/mysqli_release_savepoint.phpt @@ -20,23 +20,10 @@ if (!have_innodb($link)) $tmp = NULL; $link = NULL; - if (!is_null($tmp = @mysqli_release_savepoint())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_release_savepoint($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - $name = array(); - if (!is_null($tmp = @mysqli_release_savepoint($link, $name))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_release_savepoint($link, 'foo', $link))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_release_savepoint($link, ''))) printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_report.phpt b/ext/mysqli/tests/mysqli_report.phpt index 889fda5fbd..6215e6508c 100644 --- a/ext/mysqli/tests/mysqli_report.phpt +++ b/ext/mysqli/tests/mysqli_report.phpt @@ -10,12 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (NULL !== ($tmp = @mysqli_report())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_report(-1))) printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_rollback.phpt b/ext/mysqli/tests/mysqli_rollback.phpt index 15fc21c16a..72a79cfcaa 100644 --- a/ext/mysqli/tests/mysqli_rollback.phpt +++ b/ext/mysqli/tests/mysqli_rollback.phpt @@ -17,22 +17,10 @@ mysqli_rollback() <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_rollback())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_rollback($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if (!is_null($tmp = @mysqli_rollback($link, 'foo'))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (true !== ($tmp = mysqli_autocommit($link, false))) printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_savepoint.phpt b/ext/mysqli/tests/mysqli_savepoint.phpt index cb0d1169c8..00e51deb6e 100644 --- a/ext/mysqli/tests/mysqli_savepoint.phpt +++ b/ext/mysqli/tests/mysqli_savepoint.phpt @@ -17,26 +17,11 @@ if (!have_innodb($link)) <?php require_once("connect.inc"); /* {{{ proto bool mysqli_savepoint(object link, string name) */ - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_savepoint())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_savepoint($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - $name = array(); - if (!is_null($tmp = @mysqli_savepoint($link, $name))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_savepoint($link, 'foo', $link))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_savepoint($link, ''))) printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_select_db.phpt b/ext/mysqli/tests/mysqli_select_db.phpt index 041b7fbb22..e023866c17 100644 --- a/ext/mysqli/tests/mysqli_select_db.phpt +++ b/ext/mysqli/tests/mysqli_select_db.phpt @@ -11,22 +11,10 @@ require_once('skipifconnectfailure.inc'); require_once("connect.inc"); require_once("table.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_select_db())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_select_db($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if (!is_null($tmp = @mysqli_select_db($link, $db, "foo"))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - /* does not make too much sense, unless we have access to at least one more database than $db */ if (!mysqli_select_db($link, $db)) printf("[005] Cannot select DB %s, [%d] %s\n", $db, mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_set_charset.phpt b/ext/mysqli/tests/mysqli_set_charset.phpt index df90333867..33ebb8347b 100644 --- a/ext/mysqli/tests/mysqli_set_charset.phpt +++ b/ext/mysqli/tests/mysqli_set_charset.phpt @@ -48,18 +48,6 @@ if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STOR <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_set_charset())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_set_charset($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_set_charset($link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation')) diff --git a/ext/mysqli/tests/mysqli_set_opt.phpt b/ext/mysqli/tests/mysqli_set_opt.phpt index 757b8490b7..6769d2c530 100644 --- a/ext/mysqli/tests/mysqli_set_opt.phpt +++ b/ext/mysqli/tests/mysqli_set_opt.phpt @@ -10,26 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_set_opt())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_set_opt($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - $link = mysqli_init(); - if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_set_opt($link, "s", 'extra_my.cnf'))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo'))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); diff --git a/ext/mysqli/tests/mysqli_sqlstate.phpt b/ext/mysqli/tests/mysqli_sqlstate.phpt index b36291872e..55dd115403 100644 --- a/ext/mysqli/tests/mysqli_sqlstate.phpt +++ b/ext/mysqli/tests/mysqli_sqlstate.phpt @@ -10,19 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_sqlstate())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_sqlstate($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); - var_dump(@mysqli_sqlstate($link, "foo")); - var_dump(mysqli_sqlstate($link)); mysqli_query($link, "SELECT unknown_column FROM test"); var_dump(mysqli_sqlstate($link)); @@ -40,7 +29,6 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -NULL %s(5) "00000" %s(5) "42S22" %s(5) "00000" diff --git a/ext/mysqli/tests/mysqli_ssl_set.phpt b/ext/mysqli/tests/mysqli_ssl_set.phpt index 8463cc58b8..4f28350ef5 100644 --- a/ext/mysqli/tests/mysqli_ssl_set.phpt +++ b/ext/mysqli/tests/mysqli_ssl_set.phpt @@ -12,27 +12,6 @@ if (!function_exists('mysqli_ssl_set')) <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_ssl_set())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_ssl_set($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_ssl_set($link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link, $link))) - printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link, $link, $link))) - printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - /* This function always returns TRUE value. diff --git a/ext/mysqli/tests/mysqli_stat.phpt b/ext/mysqli/tests/mysqli_stat.phpt index 2507a4c8f8..71f7af5a54 100644 --- a/ext/mysqli/tests/mysqli_stat.phpt +++ b/ext/mysqli/tests/mysqli_stat.phpt @@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stat())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stat($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); - if (!is_null($tmp = @mysqli_stat($link, "foo"))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp)) printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysql_error($link)); diff --git a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt index 1e08f0dec3..cfe5d53516 100644 --- a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt +++ b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_affected_rows())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_affected_rows($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); diff --git a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt index 92937a15ce..f3634a7621 100644 --- a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt +++ b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt @@ -10,23 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_attr_get())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_attr_get($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_attr_get($link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); - if (!is_null($tmp = @mysqli_stmt_attr_get($link, $link))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - $valid_attr = array("max_length" => MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); if (mysqli_get_client_version() > 50003) $valid_attr["cursor_type"] = MYSQLI_STMT_ATTR_CURSOR_TYPE; diff --git a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt index b3d60380cb..6e5710a0fc 100644 --- a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt +++ b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt @@ -8,22 +8,7 @@ require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php - require_once("connect.inc"); - - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_attr_set())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_attr_set($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link, $link))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); +require_once("connect.inc"); require('table.inc'); diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt index d2d825438e..027460fc5f 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt @@ -19,18 +19,6 @@ require_once('skipifconnectfailure.inc'); */ require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_bind_param())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_bind_param($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_bind_param($link, $link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); $stmt = mysqli_stmt_init($link); @@ -379,10 +367,6 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); mysqli_close($link); - /* Check that the function alias exists. It's a deprecated function, - but we have not announce the removal so far, therefore we need to check for it */ - if (!is_null($tmp = @mysqli_stmt_bind_param())) - printf("[021] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); print "done!"; ?> --CLEAN-- diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt index dcd05e5f68..c166d91c48 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt @@ -9,25 +9,12 @@ require_once('skipifconnectfailure.inc'); --FILE-- <?php require_once("connect.inc"); - - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_bind_result())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_bind_result($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); $stmt = mysqli_stmt_init($link); if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1")) printf("[002a] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_null($tmp = mysqli_stmt_bind_result($stmt))) - printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - mysqli_stmt_close($stmt); $stmt = mysqli_stmt_init($link); @@ -295,11 +282,6 @@ require_once('skipifconnectfailure.inc'); if (mysqli_get_server_version($link) >= 50600) func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", "13:31:34.123456", 1770, "13:31:34"); - /* Check that the function alias exists. It's a deprecated function, - but we have not announce the removal so far, therefore we need to check for it */ - if (!is_null($tmp = @mysqli_stmt_bind_result())) - printf("[3000] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - $stmt = mysqli_stmt_init($link); if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1000, 'z')")) printf("[3001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -318,8 +300,6 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_stmt_bind_result() expects at least 2 parameters, 1 given in %s on line %d - Warning: mysqli_stmt_bind_result(): invalid object or resource mysqli_stmt in %s on line %d diff --git a/ext/mysqli/tests/mysqli_stmt_close.phpt b/ext/mysqli/tests/mysqli_stmt_close.phpt index 6ea64e815a..dfeab7075d 100644 --- a/ext/mysqli/tests/mysqli_stmt_close.phpt +++ b/ext/mysqli/tests/mysqli_stmt_close.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_close())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_close($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) diff --git a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt index f9224eef62..23ecea0be3 100644 --- a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt +++ b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_data_seek())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_data_seek($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) diff --git a/ext/mysqli/tests/mysqli_stmt_errno.phpt b/ext/mysqli/tests/mysqli_stmt_errno.phpt index d98a98b87a..39760e3003 100644 --- a/ext/mysqli/tests/mysqli_stmt_errno.phpt +++ b/ext/mysqli/tests/mysqli_stmt_errno.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_errno())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_errno($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) diff --git a/ext/mysqli/tests/mysqli_stmt_error.phpt b/ext/mysqli/tests/mysqli_stmt_error.phpt index ad8efef602..49e03c8aee 100644 --- a/ext/mysqli/tests/mysqli_stmt_error.phpt +++ b/ext/mysqli/tests/mysqli_stmt_error.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_error())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_error($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) diff --git a/ext/mysqli/tests/mysqli_stmt_execute.phpt b/ext/mysqli/tests/mysqli_stmt_execute.phpt index d97111a6fd..fd0fd3c628 100644 --- a/ext/mysqli/tests/mysqli_stmt_execute.phpt +++ b/ext/mysqli/tests/mysqli_stmt_execute.phpt @@ -16,15 +16,6 @@ if (mysqli_get_server_version($link) <= 40100) { <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_execute())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_execute($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) diff --git a/ext/mysqli/tests/mysqli_stmt_fetch.phpt b/ext/mysqli/tests/mysqli_stmt_fetch.phpt index 4b41c9213d..25a1f52eb1 100644 --- a/ext/mysqli/tests/mysqli_stmt_fetch.phpt +++ b/ext/mysqli/tests/mysqli_stmt_fetch.phpt @@ -15,15 +15,6 @@ require_once('skipifconnectfailure.inc'); */ require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_fetch())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_fetch($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) @@ -78,11 +69,6 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - /* Check that the function alias exists. It's a deprecated function, - but we have not announce the removal so far, therefore we need to check for it */ - if (!is_null($tmp = @mysqli_stmt_fetch())) - printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; ?> --CLEAN-- diff --git a/ext/mysqli/tests/mysqli_stmt_field_count.phpt b/ext/mysqli/tests/mysqli_stmt_field_count.phpt index 847fe04a3b..2fa8a8ac80 100644 --- a/ext/mysqli/tests/mysqli_stmt_field_count.phpt +++ b/ext/mysqli/tests/mysqli_stmt_field_count.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_field_count())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_field_count($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); $stmt = mysqli_stmt_init($link); diff --git a/ext/mysqli/tests/mysqli_stmt_free_result.phpt b/ext/mysqli/tests/mysqli_stmt_free_result.phpt index 292905ab63..9d28d8a116 100644 --- a/ext/mysqli/tests/mysqli_stmt_free_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_free_result.phpt @@ -15,15 +15,6 @@ require_once('skipifconnectfailure.inc'); */ require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_free_result())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_free_result($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) diff --git a/ext/mysqli/tests/mysqli_stmt_get_result.phpt b/ext/mysqli/tests/mysqli_stmt_get_result.phpt index e8f2843920..594e112cac 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result.phpt @@ -18,15 +18,6 @@ if (!function_exists('mysqli_stmt_get_result')) */ require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_get_result())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_get_result($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) diff --git a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt index 00ed7adee4..ab261bd82b 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt @@ -17,23 +17,11 @@ if (!function_exists('mysqli_stmt_get_result')) */ require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_get_result())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_get_result($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!is_null($tmp = @mysqli_stmt_get_result($stmt, "foo"))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt index 51198523c9..c63a91487b 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt @@ -67,9 +67,6 @@ if (!function_exists('mysqli_stmt_get_result')) if (false !== ($tmp = $res->data_seek($res->num_rows + 1))) printf("[012] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); - if (NULL !== ($tmp = $res->data_seek(PHP_INT_MAX + 1))) - printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - for ($i = 0; $i < 100; $i++) { /* intentionally out of range! */ $pos = mt_rand(-1, 4); @@ -118,8 +115,6 @@ if (!function_exists('mysqli_stmt_get_result')) require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_result::data_seek() expects parameter 1 to be int, float given in %s on line %d - Warning: mysqli_data_seek(): Couldn't fetch mysqli_result in %s on line %d Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d diff --git a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt index 1ebe6d051f..958a278554 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt @@ -26,15 +26,6 @@ mysqli_query($link, "DROP TABLE IF EXISTS test"); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_get_warnings())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_get_warnings($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) diff --git a/ext/mysqli/tests/mysqli_stmt_init.phpt b/ext/mysqli/tests/mysqli_stmt_init.phpt index b82a855dd2..c16f708fe6 100644 --- a/ext/mysqli/tests/mysqli_stmt_init.phpt +++ b/ext/mysqli/tests/mysqli_stmt_init.phpt @@ -15,15 +15,6 @@ require_once('skipifconnectfailure.inc'); */ require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_init())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_init($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!is_object($stmt = mysqli_stmt_init($link))) @@ -34,9 +25,6 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (NULL !== ($tmp = mysqli_stmt_init($stmt))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); if (false !== ($tmp = mysqli_stmt_init($link))) @@ -52,7 +40,5 @@ require_once('skipifconnectfailure.inc'); Warning: mysqli_stmt_close(): invalid object or resource mysqli_stmt in %s on line %d -Warning: mysqli_stmt_init() expects parameter 1 to be mysqli, object given in %s on line %d - Warning: mysqli_stmt_init(): Couldn't fetch mysqli in %s on line %d done! diff --git a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt index e3ef9a25ec..fedf305650 100644 --- a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt +++ b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt @@ -10,16 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_insert_id())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - $stmt = @new mysqli_stmt($link); - if (!is_null($tmp = @mysqli_insert_id($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); $stmt = mysqli_stmt_init($link); diff --git a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt index 5355b3deb7..f798e22f71 100644 --- a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt +++ b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_num_rows())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_num_rows($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) diff --git a/ext/mysqli/tests/mysqli_stmt_param_count.phpt b/ext/mysqli/tests/mysqli_stmt_param_count.phpt index e847d165f6..4176de60c5 100644 --- a/ext/mysqli/tests/mysqli_stmt_param_count.phpt +++ b/ext/mysqli/tests/mysqli_stmt_param_count.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_param_count())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_param_count($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) @@ -53,11 +44,6 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - /* Check that the function alias exists. It's a deprecated function, - but we have not announce the removal so far, therefore we need to check for it */ - if (!is_null($tmp = @mysqli_stmt_param_count())) - printf("[041] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - print "done!"; ?> --CLEAN-- diff --git a/ext/mysqli/tests/mysqli_stmt_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_prepare.phpt index d0e38075d9..52c7597ef6 100644 --- a/ext/mysqli/tests/mysqli_stmt_prepare.phpt +++ b/ext/mysqli/tests/mysqli_stmt_prepare.phpt @@ -16,23 +16,11 @@ require_once('skipifconnectfailure.inc'); // fetch tests, because the fetch tests would have to call prepare/execute etc. // anyway. - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_prepare())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_prepare($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (NULL !== ($tmp = @mysqli_stmt_prepare($stmt))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_stmt_prepare($stmt, ''))) printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_stmt_reset.phpt b/ext/mysqli/tests/mysqli_stmt_reset.phpt index b7ec4e3ed7..339b885b72 100644 --- a/ext/mysqli/tests/mysqli_stmt_reset.phpt +++ b/ext/mysqli/tests/mysqli_stmt_reset.phpt @@ -16,15 +16,6 @@ require_once('skipifconnectfailure.inc'); // fetch tests, because the fetch tests would have to call prepare/execute etc. // anyway. - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_reset())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_reset($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) diff --git a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt index 8f4e13ef39..adb7f6f726 100644 --- a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt +++ b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_result_metadata())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_result_metadata($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) @@ -85,11 +76,6 @@ require_once('skipifconnectfailure.inc'); if (false !== ($tmp = mysqli_stmt_result_metadata($stmt))) printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - /* Check that the function alias exists. It's a deprecated function, - but we have not announce the removal so far, therefore we need to check for it */ - if (!is_null($tmp = @mysqli_stmt_result_metadata())) - printf("[018] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); print "done!"; ?> diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt index 1fc2745511..b42e393503 100644 --- a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt +++ b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt @@ -10,23 +10,11 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_send_long_data())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_send_long_data($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$stmt = mysqli_stmt_init($link)) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, ''))) - printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -80,10 +68,6 @@ require_once('skipifconnectfailure.inc'); printf("[012] Expecting boolean/false, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, PHP_INT_MAX + 1, $blob))) - printf("[013] Expecting NULL, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 999, $blob))) printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -115,14 +99,6 @@ require_once('skipifconnectfailure.inc'); if ($blob != $row['label']) printf("[021] Blob value has not been stored properly!\n"); - if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, ''))) - printf("[022] Expecting NULL, got %s/%s\n"); - - /* Check that the function alias exists. It's a deprecated function, - but we have not announce the removal so far, therefore we need to check for it */ - if (!is_null($tmp = @mysqli_stmt_send_long_data())) - printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); print "done!"; ?> diff --git a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt index 1784106162..2740195931 100644 --- a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt +++ b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt @@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_sqlstate())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_sqlstate($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); - if (!is_null($tmp = @mysqli_stmt_sqlstate($link, ''))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$stmt = mysqli_stmt_init($link)) printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_stmt_store_result.phpt b/ext/mysqli/tests/mysqli_stmt_store_result.phpt index 89b8ed3bf8..a6634e56f9 100644 --- a/ext/mysqli/tests/mysqli_stmt_store_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_store_result.phpt @@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_stmt_store_result())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_stmt_store_result($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); - if (false !== ($tmp = @mysqli_stmt_store_result(new mysqli_stmt()))) - printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - if (!$stmt = mysqli_stmt_init($link)) printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_store_result.phpt b/ext/mysqli/tests/mysqli_store_result.phpt index b87d147e38..5ee8a14f6b 100644 --- a/ext/mysqli/tests/mysqli_store_result.phpt +++ b/ext/mysqli/tests/mysqli_store_result.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_store_result())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_store_result($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) diff --git a/ext/mysqli/tests/mysqli_thread_id.phpt b/ext/mysqli/tests/mysqli_thread_id.phpt index 4a71d60f41..f8e286b54c 100644 --- a/ext/mysqli/tests/mysqli_thread_id.phpt +++ b/ext/mysqli/tests/mysqli_thread_id.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_thread_id())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_thread_id($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp)) diff --git a/ext/mysqli/tests/mysqli_use_result.phpt b/ext/mysqli/tests/mysqli_use_result.phpt index 190cafa5d5..650a130c89 100644 --- a/ext/mysqli/tests/mysqli_use_result.phpt +++ b/ext/mysqli/tests/mysqli_use_result.phpt @@ -10,15 +10,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_use_result())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_use_result($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) diff --git a/ext/mysqli/tests/mysqli_warning_count.phpt b/ext/mysqli/tests/mysqli_warning_count.phpt index 9d59f26e52..5e6a2e2381 100644 --- a/ext/mysqli/tests/mysqli_warning_count.phpt +++ b/ext/mysqli/tests/mysqli_warning_count.phpt @@ -10,20 +10,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("connect.inc"); - $tmp = NULL; - $link = NULL; - - if (!is_null($tmp = @mysqli_warning_count())) - printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - - if (!is_null($tmp = @mysqli_warning_count($link))) - printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - require('table.inc'); - if (NULL !== ($tmp = @mysqli_warning_count($link, "too_many"))) - printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, "SELECT id, label FROM test")) printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/odbc/tests/odbc_free_result_001.phpt b/ext/odbc/tests/odbc_free_result_001.phpt index cdc421117d..e17b4de1b9 100644 --- a/ext/odbc/tests/odbc_free_result_001.phpt +++ b/ext/odbc/tests/odbc_free_result_001.phpt @@ -23,7 +23,6 @@ var_dump(odbc_fetch_row($res)); var_dump(odbc_result($res, 'test')); var_dump(odbc_free_result($res)); var_dump(odbc_free_result($conn)); -var_dump(odbc_free_result(NULL)); var_dump(odbc_fetch_row($res)); var_dump(odbc_result($res, 'test')); @@ -40,9 +39,6 @@ bool(true) Warning: odbc_free_result(): supplied resource is not a valid ODBC result resource in %s on line %d bool(false) -Warning: odbc_free_result() expects parameter 1 to be resource, null given in %s on line %d -NULL - Warning: odbc_fetch_row(): supplied resource is not a valid ODBC result resource in %s on line %d bool(false) diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index b8b122bf48..a1813bac5c 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -33,27 +33,9 @@ /* Checks if a constant (like "true") may be replaced by its value */ int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy) { - zend_constant *c; - char *lookup_name; - int retval = 1; - ALLOCA_FLAG(use_heap); - - if ((c = zend_hash_find_ptr(EG(zend_constants), name)) == NULL) { - lookup_name = do_alloca(ZSTR_LEN(name) + 1, use_heap); - memcpy(lookup_name, ZSTR_VAL(name), ZSTR_LEN(name) + 1); - zend_str_tolower(lookup_name, ZSTR_LEN(name)); - - if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, ZSTR_LEN(name))) != NULL) { - if (!(ZEND_CONSTANT_FLAGS(c) & CONST_CT_SUBST) || (ZEND_CONSTANT_FLAGS(c) & CONST_CS)) { - retval = 0; - } - } else { - retval = 0; - } - free_alloca(lookup_name, use_heap); - } - - if (retval) { + zval *zv; + zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name); + if (c) { if ((ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) && (!(ZEND_CONSTANT_FLAGS(c) & CONST_NO_FILE_CACHE) || !(CG(compiler_options) & ZEND_COMPILE_WITH_FILE_CACHE))) { @@ -61,12 +43,19 @@ int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int if (copy) { Z_TRY_ADDREF_P(result); } + return 1; } else { - retval = 0; + return 0; } } - return retval; + /* Special constants null/true/false can always be substituted. */ + zv = zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name)); + if (zv) { + ZVAL_COPY_VALUE(result, zv); + return 1; + } + return 0; } /* CFG back references management */ diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index a841563f84..70d51fc832 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -168,13 +168,13 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx LITERAL_INFO(opline->op1.constant, LITERAL_CLASS, 2); break; case ZEND_DEFINED: - LITERAL_INFO(opline->op1.constant, LITERAL_CONST, 2); + LITERAL_INFO(opline->op1.constant, LITERAL_CONST, 1); break; case ZEND_FETCH_CONSTANT: - if ((opline->op1.num & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) { - LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 5); - } else { + if (opline->op1.num & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) { LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 3); + } else { + LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 2); } break; case ZEND_FETCH_CLASS_CONSTANT: diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index 3cbaa87b4c..69f4883d5a 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -834,8 +834,7 @@ static inline int ct_eval_func_call( } else if (zend_string_equals_literal(name, "strpos")) { if (Z_TYPE_P(args[0]) != IS_STRING || Z_TYPE_P(args[1]) != IS_STRING - || !Z_STRLEN_P(args[1]) - || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) { + || !Z_STRLEN_P(args[1])) { return FAILURE; } /* pass */ @@ -914,8 +913,7 @@ static inline int ct_eval_func_call( /* pass */ } else if (zend_string_equals_literal(name, "substr")) { if (Z_TYPE_P(args[0]) != IS_STRING - || Z_TYPE_P(args[1]) != IS_LONG - || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) { + || Z_TYPE_P(args[1]) != IS_LONG) { return FAILURE; } /* pass */ @@ -959,8 +957,7 @@ static inline int ct_eval_func_call( } else if (zend_string_equals_literal(name, "substr")) { if (Z_TYPE_P(args[0]) != IS_STRING || Z_TYPE_P(args[1]) != IS_LONG - || Z_TYPE_P(args[2]) != IS_LONG - || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) { + || Z_TYPE_P(args[2]) != IS_LONG) { return FAILURE; } /* pass */ diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c index 3bc0650ab4..6f5d8ace18 100644 --- a/ext/opcache/Optimizer/zend_dump.c +++ b/ext/opcache/Optimizer/zend_dump.c @@ -127,11 +127,8 @@ static void zend_dump_unused_op(const zend_op *opline, znode_op op, uint32_t fla } else if (ZEND_VM_OP_CONSTRUCTOR == (flags & ZEND_VM_OP_MASK)) { fprintf(stderr, " CONSTRUCTOR"); } else if (ZEND_VM_OP_CONST_FETCH == (flags & ZEND_VM_EXT_MASK)) { - if (op.num & IS_CONSTANT_UNQUALIFIED) { - fprintf(stderr, " (unqualified)"); - } - if (op.num & IS_CONSTANT_IN_NAMESPACE) { - fprintf(stderr, " (in-namespace)"); + if (op.num & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) { + fprintf(stderr, " (unqualified-in-namespace)"); } } } diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 918422027e..0a2d5e5226 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -228,7 +228,6 @@ static const func_info_t func_infos[] = { FC("strncmp", zend_lb_ssn_info), FC("strcasecmp", zend_l_ss_info), FC("strncasecmp", zend_lb_ssn_info), - F1("each", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_KEY_ANY), F0("error_reporting", MAY_BE_NULL | MAY_BE_LONG), F0("define", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_NULL), // TODO: inline FC("defined", zend_b_s_info), // TODO: inline @@ -258,7 +257,6 @@ static const func_info_t func_infos[] = { I1("get_declared_interfaces", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("get_defined_functions", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY), I1("get_defined_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF), - FN("create_function", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING), F1("get_resource_type", MAY_BE_NULL | MAY_BE_STRING), F1("get_defined_constants", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_RESOURCE | MAY_BE_ARRAY_OF_ARRAY), F0("debug_print_backtrace", MAY_BE_NULL), @@ -342,7 +340,7 @@ static const func_info_t func_infos[] = { #endif FN("substr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), FN("substr_replace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING), - F1("quotemeta", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING), + F1("quotemeta", MAY_BE_NULL | MAY_BE_STRING), FN("ucfirst", MAY_BE_NULL | MAY_BE_STRING), FN("lcfirst", MAY_BE_NULL | MAY_BE_STRING), F1("ucwords", MAY_BE_NULL | MAY_BE_STRING), @@ -617,7 +615,6 @@ static const func_info_t func_infos[] = { F0("feof", MAY_BE_FALSE | MAY_BE_TRUE), F1("fgetc", MAY_BE_FALSE | MAY_BE_STRING), F1("fgets", MAY_BE_FALSE | MAY_BE_STRING), - F1("fgetss", MAY_BE_FALSE | MAY_BE_STRING), F1("fread", MAY_BE_FALSE | MAY_BE_STRING), F1("fopen", MAY_BE_FALSE | MAY_BE_RESOURCE), F0("fpassthru", MAY_BE_FALSE | MAY_BE_LONG), @@ -1263,7 +1260,6 @@ static const func_info_t func_infos[] = { F0("gzeof", MAY_BE_FALSE | MAY_BE_TRUE), F1("gzgetc", MAY_BE_FALSE | MAY_BE_STRING), F1("gzgets", MAY_BE_FALSE | MAY_BE_STRING), - F1("gzgetss", MAY_BE_FALSE | MAY_BE_STRING), F1("gzread", MAY_BE_FALSE | MAY_BE_STRING), F1("gzopen", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE), F0("gzpassthru", MAY_BE_FALSE | MAY_BE_LONG), diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index ccae1b4628..23288746e3 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -1844,9 +1844,7 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{ /* }}} */ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) { - if (alias == PHP_ERRORMSG_ALIAS) { - return MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN; - } else if (alias == HTTP_RESPONSE_HEADER_ALIAS) { + if (alias == HTTP_RESPONSE_HEADER_ALIAS) { return MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_RC1 | MAY_BE_RCN; } else { return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index dceb8c9fd9..8b75ec7d49 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -964,14 +964,8 @@ uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args) return ZEND_FUNC_INDIRECT_VAR_ACCESS; } else if (zend_string_equals_literal(name, "compact")) { return ZEND_FUNC_INDIRECT_VAR_ACCESS; - } else if (zend_string_equals_literal(name, "parse_str") && num_args <= 1) { - return ZEND_FUNC_INDIRECT_VAR_ACCESS; - } else if (zend_string_equals_literal(name, "mb_parse_str") && num_args <= 1) { - return ZEND_FUNC_INDIRECT_VAR_ACCESS; } else if (zend_string_equals_literal(name, "get_defined_vars")) { return ZEND_FUNC_INDIRECT_VAR_ACCESS; - } else if (zend_string_equals_literal(name, "assert")) { - return ZEND_FUNC_INDIRECT_VAR_ACCESS; } else if (zend_string_equals_literal(name, "func_num_args")) { return ZEND_FUNC_VARARG; } else if (zend_string_equals_literal(name, "func_get_arg")) { diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index b87001dc80..cdcec65332 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -1133,8 +1133,6 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_ for (i = 0; i < op_array->last_var; i++) { if ((ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) { ssa_vars[i].alias = SYMTABLE_ALIAS; - } else if (zend_string_equals_literal(op_array->vars[i], "php_errormsg")) { - ssa_vars[i].alias = PHP_ERRORMSG_ALIAS; } else if (zend_string_equals_literal(op_array->vars[i], "http_response_header")) { ssa_vars[i].alias = HTTP_RESPONSE_HEADER_ALIAS; } diff --git a/ext/opcache/Optimizer/zend_ssa.h b/ext/opcache/Optimizer/zend_ssa.h index 5c69e4bd09..2ea72b6f27 100644 --- a/ext/opcache/Optimizer/zend_ssa.h +++ b/ext/opcache/Optimizer/zend_ssa.h @@ -95,7 +95,6 @@ typedef struct _zend_ssa_op { typedef enum _zend_ssa_alias_kind { NO_ALIAS, SYMTABLE_ALIAS, - PHP_ERRORMSG_ALIAS, HTTP_RESPONSE_HEADER_ALIAS } zend_ssa_alias_kind; diff --git a/ext/opcache/tests/bug66251.phpt b/ext/opcache/tests/bug66251.phpt index daa5a89bb2..42c6e2f606 100644 --- a/ext/opcache/tests/bug66251.phpt +++ b/ext/opcache/tests/bug66251.phpt @@ -5,7 +5,7 @@ opcache.enable=1 opcache.enable_cli=1 opcache.optimization_level=-1 --SKIPIF-- -<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?> +<?php if (!extension_loaded('Zend OPcache')) die("skip Zend OPcache extension not loaded"); ?> --FILE-- <?php printf ("A=%s\n", getA()); @@ -13,5 +13,8 @@ const A="hello"; function getA() {return A;} ?> --EXPECTF-- -Warning: Use of undefined constant A - assumed 'A' (this will throw an Error in a future version of PHP) in %sbug66251.php on line 4 -A=A +Fatal error: Uncaught Error: Undefined constant 'A' in %s:%d +Stack trace: +#0 %s(%d): getA() +#1 {main} + thrown in %s on line %d diff --git a/ext/opcache/tests/bug66338.phpt b/ext/opcache/tests/bug66338.phpt index 5cd9693793..40f5634465 100644 --- a/ext/opcache/tests/bug66338.phpt +++ b/ext/opcache/tests/bug66338.phpt @@ -3,7 +3,7 @@ Bug #66338 (Optimization binding of class constants is not safely opcacheable) --INI-- opcache.enable=0 --SKIPIF-- -<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?> +<?php if (!extension_loaded('Zend OPcache')) die("skip Zend OPcache extension not loaded"); ?> --CONFLICTS-- server --FILE-- diff --git a/ext/opcache/tests/bug68252.phpt b/ext/opcache/tests/bug68252.phpt deleted file mode 100644 index bc2e5a0fb6..0000000000 --- a/ext/opcache/tests/bug68252.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #68252 (segfault in Zend/zend_hash.c in function _zend_hash_del_el) ---INI-- -opcache.enable=1 -opcache.enable_cli=1 -opcache.fast_shutdown=1 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -/* run this test script with valgrind */ -function a() { - echo "okey"; -} - -create_function('', 'var_dump("22");'); - -a(); ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -okey diff --git a/ext/opcache/tests/bug68644.phpt b/ext/opcache/tests/bug68644.phpt deleted file mode 100644 index b82615ac4a..0000000000 --- a/ext/opcache/tests/bug68644.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Bug #68644 strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache ---INI-- -opcache.enable=1 -opcache.enable_cli=1 -mbstring.func_overload=2 -mbstring.internal_encoding=UTF-8 ---SKIPIF-- -<?php if (!extension_loaded('Zend OPcache') || !extension_loaded("mbstring")) die("skip"); ?> ---FILE-- -<?php -var_dump(strlen("中国, 北京")); -var_dump(mb_strlen("中国, 北京")); -?> ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -int(6) -int(6) diff --git a/ext/opcache/tests/bug70207.phpt b/ext/opcache/tests/bug70207.phpt index c684ee6d33..806ea7535b 100644 --- a/ext/opcache/tests/bug70207.phpt +++ b/ext/opcache/tests/bug70207.phpt @@ -14,7 +14,7 @@ function bar() { } function foo() { try { return bar(); } - finally { @fclose(null); } + finally { @str_repeat("foo", -10); } } var_dump(foo()); diff --git a/ext/opcache/tests/bug71843.phpt b/ext/opcache/tests/bug71843.phpt index 924fb873fe..0a193425dd 100644 --- a/ext/opcache/tests/bug71843.phpt +++ b/ext/opcache/tests/bug71843.phpt @@ -8,18 +8,15 @@ opcache.optimization_level=0xFFFFBFFF <?php if (!extension_loaded('Zend OPcache')) die("skip"); ?> --FILE-- <?php +define('E', 'E'); +define('R', 'R'); +define('See', 'See'); 0 & ~E & ~R; 6 && ~See ?> okey --EXPECTF-- -Warning: Use of undefined constant E - assumed 'E' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d - Warning: A non-numeric value encountered in %s on line %d -Warning: Use of undefined constant R - assumed 'R' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d - Warning: A non-numeric value encountered in %s on line %d - -Warning: Use of undefined constant See - assumed 'See' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d okey diff --git a/ext/opcache/tests/bug75729.phpt b/ext/opcache/tests/bug75729.phpt deleted file mode 100644 index 81d8f4264b..0000000000 --- a/ext/opcache/tests/bug75729.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Bug #75729: opcache segfault when installing Bitrix ---SKIPIF-- -<?php if (!extension_loaded('mbstring')) die('skip mbstring not loaded'); ?> ---INI-- -opcache.enable_cli=1 -mbstring.func_overload=2 ---FILE-- -<?php - -var_dump(strpos("foo", "o")); -var_dump(substr("foo", 1)); -var_dump(substr("foo", 1, 1)); - -?> ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -int(1) -string(2) "oo" -string(1) "o" diff --git a/ext/opcache/tests/bug75893.phpt b/ext/opcache/tests/bug75893.phpt deleted file mode 100644 index 670993c50c..0000000000 --- a/ext/opcache/tests/bug75893.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug #75893: file_get_contents $http_response_header variable bugged with opcache ---INI-- -opcache.enable_cli=1 -track_errors=1 ---FILE-- -<?php - -function test() { - echo $undef; - $foo = $php_errormsg; - var_dump($foo[0]); -} - -test(); - -?> ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: undef in %s on line %d -string(1) "U" diff --git a/ext/opcache/tests/issue0115.phpt b/ext/opcache/tests/issue0115.phpt index bc86d0f4fc..b8df30a164 100644 --- a/ext/opcache/tests/issue0115.phpt +++ b/ext/opcache/tests/issue0115.phpt @@ -7,7 +7,6 @@ phar.readonly=0 --SKIPIF-- <?php require_once('skipif.inc'); ?> <?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?> --CONFLICTS-- server --FILE-- diff --git a/ext/opcache/tests/issue0140.phpt b/ext/opcache/tests/issue0140.phpt index 97fc11b3c7..c22898e589 100644 --- a/ext/opcache/tests/issue0140.phpt +++ b/ext/opcache/tests/issue0140.phpt @@ -7,7 +7,6 @@ opcache.revalidate_freq=0 opcache.file_update_protection=0 --SKIPIF-- <?php require_once('skipif.inc'); ?> -<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?> <?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow tests excluded by request") ?> --FILE-- <?php diff --git a/ext/opcache/tests/issue0149.phpt b/ext/opcache/tests/issue0149.phpt index da3b778ef5..0896e39d0c 100644 --- a/ext/opcache/tests/issue0149.phpt +++ b/ext/opcache/tests/issue0149.phpt @@ -7,7 +7,6 @@ phar.readonly=0 --SKIPIF-- <?php require_once('skipif.inc'); ?> <?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?> --CONFLICTS-- server --FILE-- diff --git a/ext/opcache/tests/revalidate_path_01.phpt b/ext/opcache/tests/revalidate_path_01.phpt index b924ba746b..a1d72bbcc5 100644 --- a/ext/opcache/tests/revalidate_path_01.phpt +++ b/ext/opcache/tests/revalidate_path_01.phpt @@ -6,7 +6,6 @@ opcache.enable_cli=1 opcache.revalidate_path=1 --SKIPIF-- <?php require_once('skipif.inc'); ?> -<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?> --CONFLICTS-- server --FILE-- diff --git a/ext/opcache/tests/wrong_inlining_002.phpt b/ext/opcache/tests/wrong_inlining_002.phpt index 4e71a96d10..9aaa60c534 100644 --- a/ext/opcache/tests/wrong_inlining_002.phpt +++ b/ext/opcache/tests/wrong_inlining_002.phpt @@ -20,10 +20,7 @@ class Foo { Foo::test(); ?> --EXPECTF-- -Deprecated: Non-static method Foo::test() should not be called statically in %swrong_inlining_002.php on line 11 - -Fatal error: Uncaught Error: Using $this when not in object context in %swrong_inlining_002.php:7 +Fatal error: Uncaught Error: Non-static method Foo::test() cannot be called statically in %s:%d Stack trace: -#0 %swrong_inlining_002.php(11): Foo::test() -#1 {main} - thrown in %swrong_inlining_002.php on line 7 +#0 {main} + thrown in %s on line %d diff --git a/ext/openssl/tests/bug38255.phpt b/ext/openssl/tests/bug38255.phpt index f49b77485c..03f9f29a03 100644 --- a/ext/openssl/tests/bug38255.phpt +++ b/ext/openssl/tests/bug38255.phpt @@ -20,11 +20,6 @@ $t = new test; var_dump(openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5)); var_dump(openssl_verify("foo", $t, $pub_key_id, OPENSSL_ALGO_MD5)); -var_dump(openssl_verify("foo", new stdClass, $pub_key_id, OPENSSL_ALGO_MD5)); -var_dump(openssl_verify("foo", new stdClass, array(), OPENSSL_ALGO_MD5)); -var_dump(openssl_verify("foo", array(), array(), OPENSSL_ALGO_MD5)); -var_dump(openssl_verify()); -var_dump(openssl_verify(new stdClass, new stdClass, array(), 10000)); echo "Done\n"; @@ -37,19 +32,4 @@ bool(false) Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d bool(false) - -Warning: openssl_verify() expects parameter 2 to be string, object given in %s on line %d -NULL - -Warning: openssl_verify() expects parameter 2 to be string, object given in %s on line %d -NULL - -Warning: openssl_verify() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: openssl_verify() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: openssl_verify() expects parameter 1 to be string, object given in %s on line %d -NULL Done diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt index fa25d93d62..41a881cc86 100644 --- a/ext/openssl/tests/bug38261.phpt +++ b/ext/openssl/tests/bug38261.phpt @@ -17,7 +17,6 @@ $t = new test; var_dump(openssl_x509_parse("foo")); var_dump(openssl_x509_parse($t)); var_dump(openssl_x509_parse(array())); -var_dump(openssl_x509_parse()); var_dump(openssl_x509_parse($cert)); var_dump(openssl_x509_parse(new stdClass)); @@ -26,9 +25,6 @@ var_dump(openssl_x509_parse(new stdClass)); bool(false) bool(false) bool(false) - -Warning: openssl_x509_parse() expects at least 1 parameter, 0 given in %sbug38261.php on line %d -NULL bool(false) Recoverable fatal error: Object of class stdClass could not be converted to string in %sbug38261.php on line %d diff --git a/ext/openssl/tests/openssl_csr_export_bacis.phpt b/ext/openssl/tests/openssl_csr_export_bacis.phpt index 228a173764..e9c89d6c01 100644 --- a/ext/openssl/tests/openssl_csr_export_bacis.phpt +++ b/ext/openssl/tests/openssl_csr_export_bacis.phpt @@ -27,22 +27,20 @@ $args = array( $privkey = openssl_pkey_new($config_arg); $csr = openssl_csr_new($dn, $privkey, $args); var_dump(openssl_csr_export($csr, $output)); -var_dump(openssl_csr_export($wrong, $output)); +try { + var_dump(openssl_csr_export($wrong, $output)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(openssl_csr_export($privkey, $output)); -var_dump(openssl_csr_export(array(), $output)); var_dump(openssl_csr_export($csr, $output, false)); ?> --EXPECTF-- bool(true) - -Warning: openssl_csr_export() expects parameter 1 to be resource, string given in %s on line %d -NULL +openssl_csr_export() expects parameter 1 to be resource, string given Warning: openssl_csr_export(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d Warning: openssl_csr_export(): cannot get CSR from parameter 1 in %s on line %d bool(false) - -Warning: openssl_csr_export() expects parameter 1 to be resource, array given in %s on line %d -NULL bool(true) diff --git a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt index ccbd00f49a..a0c50fc5a1 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt @@ -36,9 +36,12 @@ $privkey_file = 'file://' . dirname(__FILE__) . '/private_rsa_2048.key'; $csr = openssl_csr_new($dn, $privkey_file, $args); var_dump(openssl_csr_export_to_file($csr, $csrfile)); var_dump(file_get_contents($csrfile)); -var_dump(openssl_csr_export_to_file($wrong, $csrfile)); +try { + var_dump(openssl_csr_export_to_file($wrong, $csrfile)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(openssl_csr_export_to_file($dh, $csrfile)); -var_dump(openssl_csr_export_to_file(array(), $csrfile)); var_dump(openssl_csr_export_to_file($csr, $csrfile, false)); ?> --CLEAN-- @@ -69,15 +72,10 @@ sfBgVeqg0P4SWez5fHXqBNcjMdMI5f0bikcDZSIfTHS8FX+PMurLBC8UPB0YNIOl JViHkCA9x6m8RJXAFvqmgLlWlUzbDv/cRrDfjWjR -----END CERTIFICATE REQUEST----- " - -Warning: openssl_csr_export_to_file() expects parameter 1 to be resource, string given in %s on line %d -NULL +openssl_csr_export_to_file() expects parameter 1 to be resource, string given Warning: openssl_csr_export_to_file(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d Warning: openssl_csr_export_to_file(): cannot get CSR from parameter 1 in %s on line %d bool(false) - -Warning: openssl_csr_export_to_file() expects parameter 1 to be resource, array given in %s on line %d -NULL bool(true) diff --git a/ext/openssl/tests/openssl_csr_new_basic.phpt b/ext/openssl/tests/openssl_csr_new_basic.phpt index 816c6f9d90..1fadc00f27 100644 --- a/ext/openssl/tests/openssl_csr_new_basic.phpt +++ b/ext/openssl/tests/openssl_csr_new_basic.phpt @@ -5,9 +5,6 @@ openssl_csr_new() tests --FILE-- <?php -$a = 1; -var_dump(openssl_csr_new(1,$a)); -var_dump(openssl_csr_new(1,$a,1,1)); $a = array(); $conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf'); @@ -26,12 +23,6 @@ var_dump(openssl_csr_new(["countryName" => "DE"], $x, $conf + ["x509_extensions" echo "Done\n"; ?> --EXPECTF-- -Warning: openssl_csr_new() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: openssl_csr_new() expects parameter 1 to be array, int given in %s on line %d -NULL - Warning: openssl_csr_new(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 (failed; check error queue and value of string_mask OpenSSL option if illegal characters are reported) in %s on line %d diff --git a/ext/openssl/tests/openssl_csr_sign_basic.phpt b/ext/openssl/tests/openssl_csr_sign_basic.phpt index 57c9e75c0e..c585eb14f6 100644 --- a/ext/openssl/tests/openssl_csr_sign_basic.phpt +++ b/ext/openssl/tests/openssl_csr_sign_basic.phpt @@ -35,13 +35,10 @@ var_dump(openssl_csr_sign($csr, $cert, $priv, 365, $config_arg)); var_dump(openssl_csr_sign($csr, openssl_x509_read($cert), $priv, 365, $config_arg)); var_dump(openssl_csr_sign($csr, $wrong, $privkey, 365)); var_dump(openssl_csr_sign($csr, null, $wrong, 365)); -var_dump(openssl_csr_sign($csr, null, $privkey, $wrong)); -var_dump(openssl_csr_sign($csr, null, $privkey, 365, $wrong)); var_dump(openssl_csr_sign($wrong, null, $privkey, 365)); var_dump(openssl_csr_sign(array(), null, $privkey, 365)); var_dump(openssl_csr_sign($csr, array(), $privkey, 365)); var_dump(openssl_csr_sign($csr, null, array(), 365)); -var_dump(openssl_csr_sign($csr, null, $privkey, array())); var_dump(openssl_csr_sign($csr, null, $privkey, 365, $config_arg)); ?> --EXPECTF-- @@ -56,12 +53,6 @@ bool(false) Warning: openssl_csr_sign(): cannot get private key from parameter 3 in %s on line %d bool(false) -Warning: openssl_csr_sign() expects parameter 4 to be int, string given in %s on line %d -NULL - -Warning: openssl_csr_sign() expects parameter 5 to be array, string given in %s on line %d -NULL - Warning: openssl_csr_sign(): cannot get CSR from parameter 1 in %s on line %d bool(false) @@ -75,7 +66,4 @@ Warning: openssl_csr_sign(): key array must be of the form array(0 => key, 1 => Warning: openssl_csr_sign(): cannot get private key from parameter 3 in %s on line %d bool(false) - -Warning: openssl_csr_sign() expects parameter 4 to be int, array given in %s on line %d -NULL resource(%d) of type (OpenSSL X.509) diff --git a/ext/openssl/tests/openssl_decrypt_error.phpt b/ext/openssl/tests/openssl_decrypt_error.phpt index be40f8080f..5f79cd86c2 100644 --- a/ext/openssl/tests/openssl_decrypt_error.phpt +++ b/ext/openssl/tests/openssl_decrypt_error.phpt @@ -19,9 +19,6 @@ var_dump(openssl_decrypt($wrong, $method, $password)); var_dump(openssl_decrypt($wrong, $wrong, $password)); var_dump(openssl_decrypt($encrypted, $wrong, $wrong)); var_dump(openssl_decrypt($wrong, $wrong, $wrong)); -var_dump(openssl_decrypt(array(), $method, $password)); -var_dump(openssl_decrypt($encrypted, array(), $password)); -var_dump(openssl_decrypt($encrypted, $method, array())); // invalid using of an authentication tag var_dump(openssl_encrypt($data, $method, $password, 0, $iv, $wrong)); @@ -45,14 +42,5 @@ bool(false) Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d bool(false) -Warning: openssl_decrypt() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: openssl_decrypt() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: openssl_decrypt() expects parameter 3 to be string, array given in %s on line %d -NULL - Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d string(44) "yof6cPPH4mLee6TOc0YQSrh4dvywMqxGUyjp0lV6+aM=" diff --git a/ext/openssl/tests/openssl_encrypt_error.phpt b/ext/openssl/tests/openssl_encrypt_error.phpt index ea39bff604..53bc371f46 100644 --- a/ext/openssl/tests/openssl_encrypt_error.phpt +++ b/ext/openssl/tests/openssl_encrypt_error.phpt @@ -14,12 +14,6 @@ $arr = array(1); // wrong parameters tests var_dump(openssl_encrypt($data, $wrong, $password)); -var_dump(openssl_encrypt($object, $method, $password)); -var_dump(openssl_encrypt($data, $object, $password)); -var_dump(openssl_encrypt($data, $method, $object)); -var_dump(openssl_encrypt($arr, $method, $object)); -var_dump(openssl_encrypt($data, $arr, $object)); -var_dump(openssl_encrypt($data, $method, $arr)); // invalid using of an authentication tag var_dump(openssl_encrypt($data, $method, $password, 0, $iv, $wrong)); @@ -31,24 +25,6 @@ var_dump(openssl_encrypt($data, $method, $password, OPENSSL_DONT_ZERO_PAD_KEY, $ Warning: openssl_encrypt(): Unknown cipher algorithm in %s on line %d bool(false) -Warning: openssl_encrypt() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: openssl_encrypt() expects parameter 2 to be string, object given in %s on line %d -NULL - -Warning: openssl_encrypt() expects parameter 3 to be string, object given in %s on line %d -NULL - -Warning: openssl_encrypt() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: openssl_encrypt() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: openssl_encrypt() expects parameter 3 to be string, array given in %s on line %d -NULL - Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d string(44) "iPR4HulskuaP5Z6me5uImk6BqVyJG73+63tkPauVZYk=" diff --git a/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt b/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt index 2132b402aa..099596c033 100644 --- a/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt +++ b/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt @@ -26,13 +26,11 @@ var_dump(openssl_pkcs7_encrypt($infile, $outfile, openssl_x509_read($single_cert var_dump(openssl_pkcs7_decrypt($outfile, $outfile2, $single_cert, $privkey)); var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $assoc_headers)); var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $empty_headers)); -var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $wrong)); var_dump(openssl_pkcs7_encrypt($wrong, $outfile, $single_cert, $headers)); var_dump(openssl_pkcs7_encrypt($empty, $outfile, $single_cert, $headers)); var_dump(openssl_pkcs7_encrypt($infile, $empty, $single_cert, $headers)); var_dump(openssl_pkcs7_encrypt($infile, $outfile, $wrong, $headers)); var_dump(openssl_pkcs7_encrypt($infile, $outfile, $empty, $headers)); -var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $empty)); var_dump(openssl_pkcs7_encrypt($infile, $outfile, $multi_certs, $headers)); var_dump(openssl_pkcs7_encrypt($infile, $outfile, array_map('openssl_x509_read', $multi_certs) , $headers)); @@ -45,23 +43,17 @@ if (file_exists($outfile2)) { unlink($outfile2); } ?> ---EXPECTF-- +--EXPECT-- bool(true) bool(true) bool(true) bool(true) bool(true) - -Warning: openssl_pkcs7_encrypt() expects parameter 4 to be array, string given in %s on line %d -bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) - -Warning: openssl_pkcs7_encrypt() expects parameter 4 to be array, string given in %s on line %d -bool(false) bool(true) bool(true) true diff --git a/ext/openssl/tests/openssl_pkcs7_read_basic.phpt b/ext/openssl/tests/openssl_pkcs7_read_basic.phpt index 64c7c2c130..9ee745434d 100644 --- a/ext/openssl/tests/openssl_pkcs7_read_basic.phpt +++ b/ext/openssl/tests/openssl_pkcs7_read_basic.phpt @@ -8,19 +8,12 @@ $infile = file_get_contents(dirname(__FILE__) . "/cert.p7b"); $certfile = file_get_contents(dirname(__FILE__) . "/cert.crt"); $result = []; -var_dump(openssl_pkcs7_read()); -var_dump(openssl_pkcs7_read("")); var_dump(openssl_pkcs7_read("", $result)); var_dump(openssl_pkcs7_read($certfile, $result)); var_dump(openssl_pkcs7_read($infile, $result)); var_dump($result); ?> ---EXPECTF-- -Warning: openssl_pkcs7_read() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: openssl_pkcs7_read() expects exactly 2 parameters, 1 given in %s on line %d -NULL +--EXPECT-- bool(false) bool(false) bool(true) diff --git a/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt b/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt index 0e29901c7e..bd8bb48464 100644 --- a/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt +++ b/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt @@ -22,13 +22,11 @@ var_dump(openssl_pkcs7_sign($infile, $outfile, openssl_x509_read($single_cert), var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $headers)); var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $assoc_headers)); var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $empty_headers)); -var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $wrong)); var_dump(openssl_pkcs7_sign($wrong, $outfile, $single_cert, $privkey, $headers)); var_dump(openssl_pkcs7_sign($empty, $outfile, $single_cert, $privkey, $headers)); var_dump(openssl_pkcs7_sign($infile, $empty, $single_cert, $privkey, $headers)); var_dump(openssl_pkcs7_sign($infile, $outfile, $wrong, $privkey, $headers)); var_dump(openssl_pkcs7_sign($infile, $outfile, $empty, $privkey, $headers)); -var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $empty)); var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $wrong, $headers)); if (file_exists($outfile)) { @@ -42,9 +40,6 @@ bool(true) bool(true) bool(true) -Warning: openssl_pkcs7_sign() expects parameter 5 to be array, string given in %s on line %d -NULL - Warning: openssl_pkcs7_sign(): error opening input file %s in %s on line %d bool(false) @@ -60,9 +55,6 @@ bool(false) Warning: openssl_pkcs7_sign(): error getting cert in %s on line %d bool(false) -Warning: openssl_pkcs7_sign() expects parameter 5 to be array, string given in %s on line %d -NULL - Warning: openssl_pkcs7_sign(): error getting private key in %s on line %d bool(false) true diff --git a/ext/openssl/tests/openssl_pkey_new_error.phpt b/ext/openssl/tests/openssl_pkey_new_error.phpt index c7dc193d53..9249f252d8 100644 --- a/ext/openssl/tests/openssl_pkey_new_error.phpt +++ b/ext/openssl/tests/openssl_pkey_new_error.phpt @@ -11,13 +11,23 @@ $rsa = array("rsa" => array()); $dsa = array("dsa" => array()); $dh = array("dh" => array()); -openssl_pkey_get_details(openssl_pkey_new($rsa)); -openssl_pkey_get_details(openssl_pkey_new($dsa)); -openssl_pkey_get_details(openssl_pkey_new($dh)); +try { + openssl_pkey_get_details(openssl_pkey_new($rsa)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + openssl_pkey_get_details(openssl_pkey_new($dsa)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + openssl_pkey_get_details(openssl_pkey_new($dh)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: openssl_pkey_get_details() expects parameter 1 to be resource, bool given in %s on line %d - -Warning: openssl_pkey_get_details() expects parameter 1 to be resource, bool given in %s on line %d - -Warning: openssl_pkey_get_details() expects parameter 1 to be resource, bool given in %s on line %d +--EXPECT-- +openssl_pkey_get_details() expects parameter 1 to be resource, bool given +openssl_pkey_get_details() expects parameter 1 to be resource, bool given +openssl_pkey_get_details() expects parameter 1 to be resource, bool given diff --git a/ext/openssl/tests/openssl_seal_basic.phpt b/ext/openssl/tests/openssl_seal_basic.phpt index 1899ebac3b..c3c79214fe 100644 --- a/ext/openssl/tests/openssl_seal_basic.phpt +++ b/ext/openssl/tests/openssl_seal_basic.phpt @@ -12,8 +12,6 @@ $d = array(1); var_dump(openssl_seal($a, $b, $c, $d)); var_dump(openssl_seal($a, $a, $a, array())); -var_dump(openssl_seal($c, $c, $c, 1)); -var_dump(openssl_seal($b, $b, $b, "")); // tests with cert $data = "openssl_open() test"; @@ -23,7 +21,6 @@ $wrong = "wrong"; var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key))); // no output var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key))); // no output var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong))); -var_dump(openssl_seal($data, $sealed, $ekeys, $pub_key)); var_dump(openssl_seal($data, $sealed, $ekeys, array())); var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong))); @@ -35,21 +32,12 @@ bool(false) Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d bool(false) - -Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d -NULL int(19) int(19) Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d bool(false) -Warning: openssl_seal() expects parameter 4 to be array, string given in %s on line %d -NULL - Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d bool(false) diff --git a/ext/openssl/tests/openssl_sign_basic.phpt b/ext/openssl/tests/openssl_sign_basic.phpt index 0200e5ba6e..36655dd61a 100644 --- a/ext/openssl/tests/openssl_sign_basic.phpt +++ b/ext/openssl/tests/openssl_sign_basic.phpt @@ -10,13 +10,9 @@ $wrong = "wrong"; var_dump(openssl_sign($data, $sign, $privkey)); // no output var_dump(openssl_sign($data, $sign, $wrong)); -var_dump(openssl_sign(array(), $sign, $privkey)); ?> --EXPECTF-- bool(true) Warning: openssl_sign(): supplied key param cannot be coerced into a private key in %s on line %d bool(false) - -Warning: openssl_sign() expects parameter 1 to be string, array given in %s on line %d -NULL diff --git a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt index ceaafc2234..fa3fce36ab 100644 --- a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt +++ b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt @@ -7,9 +7,6 @@ openssl_x509_fingerprint() tests $cert = "file://" . dirname(__FILE__) . "/cert.crt"; -echo "** Testing with no parameters **\n"; -var_dump(openssl_x509_fingerprint()); - echo "** Testing default functionality **\n"; var_dump(openssl_x509_fingerprint($cert)); @@ -29,10 +26,6 @@ echo "** Testing bad hash method **\n"; var_dump(openssl_x509_fingerprint($cert, 'xx45')); ?> --EXPECTF-- -** Testing with no parameters ** - -Warning: openssl_x509_fingerprint() expects at least 1 parameter, 0 given in %s on line %d -NULL ** Testing default functionality ** string(40) "6e6fd1ea10a5a23071d61c728ee9b40df6dbc33c" ** Testing hash method md5 ** diff --git a/ext/openssl/tests/openssl_x509_free_basic.phpt b/ext/openssl/tests/openssl_x509_free_basic.phpt index 663adccc2c..59acb090c3 100644 --- a/ext/openssl/tests/openssl_x509_free_basic.phpt +++ b/ext/openssl/tests/openssl_x509_free_basic.phpt @@ -7,10 +7,7 @@ openssl_x509_free() tests var_dump($res = openssl_x509_read("file://" . dirname(__FILE__) . "/cert.crt")); openssl_x509_free($res); var_dump($res); -openssl_x509_free(false); ?> --EXPECTF-- resource(%d) of type (OpenSSL X.509) resource(%d) of type (Unknown) - -Warning: openssl_x509_free() expects parameter 1 to be resource, bool given in %s on line %d diff --git a/ext/pcntl/tests/pcntl_alarm.phpt b/ext/pcntl/tests/pcntl_alarm.phpt index a9cae1616b..337ba3ad4b 100644 --- a/ext/pcntl/tests/pcntl_alarm.phpt +++ b/ext/pcntl/tests/pcntl_alarm.phpt @@ -8,7 +8,6 @@ max_execution_time=0 <?php pcntl_signal(SIGALRM, function(){}); -var_dump(pcntl_alarm()); pcntl_alarm(0); var_dump(pcntl_alarm(60)); var_dump(pcntl_alarm(1) > 0); @@ -16,8 +15,6 @@ $siginfo = array(); var_dump(pcntl_sigtimedwait(array(SIGALRM),$siginfo,2) === SIGALRM); ?> --EXPECTF-- -Warning: pcntl_alarm() expects exactly 1 parameter, 0 given in %s -NULL int(0) bool(true) bool(true) diff --git a/ext/pcntl/tests/pcntl_exec_3.phpt b/ext/pcntl/tests/pcntl_exec_3.phpt index 5349381d92..7d7f6b5271 100644 --- a/ext/pcntl/tests/pcntl_exec_3.phpt +++ b/ext/pcntl/tests/pcntl_exec_3.phpt @@ -4,14 +4,10 @@ pcntl_exec() 3 <?php if (!extension_loaded("pcntl")) print "skip"; ?> --FILE-- <?php -var_dump(pcntl_exec()); $file = tempnam(sys_get_temp_dir(),"php"); var_dump(pcntl_exec($file, array("foo","bar"), array("foo" => "bar"))); unlink($file); ?> --EXPECTF-- -Warning: pcntl_exec() expects at least 1 parameter, 0 given %s -NULL - Warning: pcntl_exec(): Error has occurred: (errno %d) %s bool(false) diff --git a/ext/pcntl/tests/pcntl_signal.phpt b/ext/pcntl/tests/pcntl_signal.phpt index a6441935c1..5bba18c2a0 100644 --- a/ext/pcntl/tests/pcntl_signal.phpt +++ b/ext/pcntl/tests/pcntl_signal.phpt @@ -17,7 +17,6 @@ pcntl_signal(SIGUSR1, function($signo, $siginfo){ posix_kill(posix_getpid(), SIGUSR1); pcntl_signal_dispatch(); -var_dump(pcntl_signal()); var_dump(pcntl_signal(SIGALRM, SIG_IGN)); var_dump(pcntl_signal(-1, -1)); var_dump(pcntl_signal(-1, function(){})); @@ -31,9 +30,6 @@ echo "ok\n"; --EXPECTF-- signal dispatched got signal from %r\d+|nobody%r - -Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s -NULL bool(true) Warning: pcntl_signal(): Invalid signal %s diff --git a/ext/pcntl/tests/pcntl_wait.phpt b/ext/pcntl/tests/pcntl_wait.phpt index d5ab709b76..c745a21dc7 100644 --- a/ext/pcntl/tests/pcntl_wait.phpt +++ b/ext/pcntl/tests/pcntl_wait.phpt @@ -20,15 +20,6 @@ if ($pid == -1) { var_dump(pcntl_wexitstatus($status)); var_dump(pcntl_wait($status, WNOHANG | WUNTRACED)); - var_dump(pcntl_wait()); - var_dump(pcntl_waitpid()); - - var_dump(pcntl_wifexited()); - var_dump(pcntl_wifstopped()); - var_dump(pcntl_wifsignaled()); - var_dump(pcntl_wexitstatus()); - var_dump(pcntl_wtermsig()); - var_dump(pcntl_wstopsig()); } else { posix_kill(posix_getpid(), SIGSTOP); exit(42); @@ -40,27 +31,3 @@ bool(false) bool(false) int(42) int(-1) - -Warning: pcntl_wait() expects at least 1 parameter, 0 given in %s -NULL - -Warning: pcntl_waitpid() expects at least 2 parameters, 0 given in %s -NULL - -Warning: pcntl_wifexited() expects exactly 1 parameter, 0 given in %s -NULL - -Warning: pcntl_wifstopped() expects exactly 1 parameter, 0 given in %s -NULL - -Warning: pcntl_wifsignaled() expects exactly 1 parameter, 0 given in %s -NULL - -Warning: pcntl_wexitstatus() expects exactly 1 parameter, 0 given in %s -NULL - -Warning: pcntl_wtermsig() expects exactly 1 parameter, 0 given in %s -NULL - -Warning: pcntl_wstopsig() expects exactly 1 parameter, 0 given in %s -NULL diff --git a/ext/pcre/tests/002.phpt b/ext/pcre/tests/002.phpt index d4780447bc..073a7a8d56 100644 --- a/ext/pcre/tests/002.phpt +++ b/ext/pcre/tests/002.phpt @@ -3,11 +3,8 @@ preg_* with bogus vals --FILE-- <?php -var_dump(preg_match()); -var_dump(preg_match_all()); var_dump(preg_match_all('//', '', $dummy, 0xdead)); -var_dump(preg_quote()); var_dump(preg_quote('')); var_dump(preg_replace('/(.)/', '${1}${1', 'abc')); @@ -16,22 +13,13 @@ var_dump(preg_replace('/(.)/e', 'for ($', 'abc')); ?> --EXPECTF-- -Warning: preg_match() expects at least 2 parameters, 0 given in %s002.php on line 3 -bool(false) - -Warning: preg_match_all() expects at least 2 parameters, 0 given in %s002.php on line 4 -bool(false) - -Warning: preg_match_all(): Invalid flags specified in %s002.php on line 5 -NULL - -Warning: preg_quote() expects at least 1 parameter, 0 given in %s002.php on line 7 +Warning: preg_match_all(): Invalid flags specified in %s002.php on line %d NULL string(0) "" string(12) "a${1b${1c${1" -Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line 11 +Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line %d NULL -Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line 12 +Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line %d NULL diff --git a/ext/pcre/tests/grep2.phpt b/ext/pcre/tests/grep2.phpt index a739cb60ac..5aee98b9e4 100644 --- a/ext/pcre/tests/grep2.phpt +++ b/ext/pcre/tests/grep2.phpt @@ -5,8 +5,6 @@ preg_grep() 2nd test --FILE-- <?php -var_dump(preg_grep(1,array(),3,4)); -var_dump(preg_grep(1, 2)); var_dump(preg_grep('/+/', array())); $array = array(5=>'a', 'x' => '1', 'xyz'=>'q6', 'h20'); @@ -21,13 +19,7 @@ var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR); ?> --EXPECTF-- -Warning: preg_grep() expects at most 3 parameters, 4 given in %sgrep2.php on line 3 -NULL - -Warning: preg_grep() expects parameter 2 to be array, int given in %sgrep2.php on line 4 -NULL - -Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %sgrep2.php on line 5 +Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %sgrep2.php on line %d bool(false) array(3) { [5]=> diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt index fcc36e7d91..79fcb98897 100644 --- a/ext/pcre/tests/preg_grep_error1.phpt +++ b/ext/pcre/tests/preg_grep_error1.phpt @@ -20,10 +20,18 @@ $values = array('abcdef', //Regex without delimiter $array = array(123, 'abc', 'test'); foreach($values as $value) { print "\nArg value is $value\n"; - var_dump(preg_grep($value, $array)); + try { + var_dump(preg_grep($value, $array)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } $value = new stdclass(); //Object -var_dump(preg_grep($value, $array)); +try { + var_dump(preg_grep($value, $array)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> --EXPECTF-- @@ -50,9 +58,7 @@ Warning: preg_grep(): Unknown modifier 'F' in %spreg_grep_error1.php on line %d bool(false) Arg value is Array - -Warning: preg_grep() expects parameter 1 to be string, array given in %spreg_grep_error1.php on line %d -NULL +preg_grep() expects parameter 1 to be string, array given Arg value is /[a-zA-Z]/ array(2) { @@ -61,7 +67,5 @@ array(2) { [2]=> string(4) "test" } - -Warning: preg_grep() expects parameter 1 to be string, object given in %spreg_grep_error1.php on line %d -NULL +preg_grep() expects parameter 1 to be string, object given Done diff --git a/ext/pcre/tests/preg_match_all_error1.phpt b/ext/pcre/tests/preg_match_all_error1.phpt index 95ab905d7d..bd0f28c8c4 100644 --- a/ext/pcre/tests/preg_match_all_error1.phpt +++ b/ext/pcre/tests/preg_match_all_error1.phpt @@ -20,11 +20,19 @@ $regex_array = array('abcdef', //Regex without delimiter $subject = 'test'; foreach($regex_array as $regex_value) { print "\nArg value is $regex_value\n"; - var_dump(preg_match_all($regex_value, $subject, $matches1)); + try { + var_dump(preg_match_all($regex_value, $subject, $matches1)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } var_dump($matches1); } $regex_value = new stdclass(); //Object -var_dump(preg_match_all($regex_value, $subject, $matches)); +try { + var_dump(preg_match_all($regex_value, $subject, $matches)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($matches); ?> --EXPECTF-- @@ -55,9 +63,7 @@ bool(false) NULL Arg value is Array - -Warning: preg_match_all() expects parameter 1 to be string, array given in %spreg_match_all_error1.php on line %d -bool(false) +preg_match_all() expects parameter 1 to be string, array given NULL Arg value is /[a-zA-Z]/ @@ -75,7 +81,5 @@ array(1) { string(1) "t" } } - -Warning: preg_match_all() expects parameter 1 to be string, object given in %spreg_match_all_error1.php on line %d -bool(false) +preg_match_all() expects parameter 1 to be string, object given NULL diff --git a/ext/pcre/tests/preg_match_all_error2.phpt b/ext/pcre/tests/preg_match_all_error2.phpt index 1c55cce64e..8c52b73076 100644 --- a/ext/pcre/tests/preg_match_all_error2.phpt +++ b/ext/pcre/tests/preg_match_all_error2.phpt @@ -12,13 +12,14 @@ error_reporting(E_ALL&~E_NOTICE); */ echo "*** Testing preg_match_all() : error conditions ***\n"; $regex = '/[a-zA-Z]/'; -$value = new stdclass(); //Object -var_dump(preg_match_all($regex, $value, $matches)); -var_dump($matches); $input = array(array('this is', 'a subarray'), 'test',); foreach($input as $value) { print "\nArg value is: $value\n"; - var_dump(preg_match_all($regex, $value, $matches)); + try { + var_dump(preg_match_all($regex, $value, $matches)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } var_dump($matches); } echo "Done"; @@ -26,14 +27,8 @@ echo "Done"; --EXPECTF-- *** Testing preg_match_all() : error conditions *** -Warning: preg_match_all() expects parameter 2 to be string, object given in %spreg_match_all_error2.php on line %d -bool(false) -NULL - Arg value is: Array - -Warning: preg_match_all() expects parameter 2 to be string, array given in %spreg_match_all_error2.php on line %d -bool(false) +preg_match_all() expects parameter 2 to be string, array given NULL Arg value is: test diff --git a/ext/pcre/tests/preg_match_error1.phpt b/ext/pcre/tests/preg_match_error1.phpt index 42bb5abd27..23d6829c48 100644 --- a/ext/pcre/tests/preg_match_error1.phpt +++ b/ext/pcre/tests/preg_match_error1.phpt @@ -20,10 +20,18 @@ $regex_array = array('abcdef', //Regex without delimiter $subject = 'this is a test'; foreach($regex_array as $regex_value) { print "\nArg value is $regex_value\n"; - var_dump(preg_match($regex_value, $subject)); + try { + var_dump(preg_match($regex_value, $subject)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } $regex_value = new stdclass(); //Object -var_dump(preg_match($regex_value, $subject)); +try { + var_dump(preg_match($regex_value, $subject)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- *** Testing preg_match() : error conditions *** @@ -49,12 +57,8 @@ Warning: preg_match(): Unknown modifier 'F' in %spreg_match_error1.php on line % bool(false) Arg value is Array - -Warning: preg_match() expects parameter 1 to be string, array given in %spreg_match_error1.php on line %d -bool(false) +preg_match() expects parameter 1 to be string, array given Arg value is /[a-zA-Z]/ int(1) - -Warning: preg_match() expects parameter 1 to be string, object given in %spreg_match_error1.php on line %d -bool(false) +preg_match() expects parameter 1 to be string, object given diff --git a/ext/pcre/tests/preg_match_error2.phpt b/ext/pcre/tests/preg_match_error2.phpt index cb0917a228..9530983e81 100644 --- a/ext/pcre/tests/preg_match_error2.phpt +++ b/ext/pcre/tests/preg_match_error2.phpt @@ -15,10 +15,18 @@ $regex = '/[a-zA-Z]/'; $input = array('this is a string', array('this is', 'a subarray'),); foreach($input as $value) { print "\nArg value is: $value\n"; - var_dump(preg_match($regex, $value)); + try { + var_dump(preg_match($regex, $value)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } $value = new stdclass(); //Object -var_dump(preg_match($regex, $value)); +try { + var_dump(preg_match($regex, $value)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> --EXPECTF-- @@ -28,10 +36,6 @@ Arg value is: this is a string int(1) Arg value is: Array - -Warning: preg_match() expects parameter 2 to be string, array given in %spreg_match_error2.php on line %d -bool(false) - -Warning: preg_match() expects parameter 2 to be string, object given in %spreg_match_error2.php on line %d -bool(false) +preg_match() expects parameter 2 to be string, array given +preg_match() expects parameter 2 to be string, object given Done diff --git a/ext/pcre/tests/preg_replace_callback3.phpt b/ext/pcre/tests/preg_replace_callback3.phpt index f5c87176f9..842dfacb39 100644 --- a/ext/pcre/tests/preg_replace_callback3.phpt +++ b/ext/pcre/tests/preg_replace_callback3.phpt @@ -3,30 +3,14 @@ preg_replace_callback() 3 --FILE-- <?php -var_dump(preg_replace_callback()); -var_dump(preg_replace_callback(1)); -var_dump(preg_replace_callback(1,2)); var_dump(preg_replace_callback(1,2,3)); var_dump(preg_replace_callback(1,2,3,4)); $a = 5; var_dump(preg_replace_callback(1,2,3,4,$a)); -$a = ""; -var_dump(preg_replace_callback("","","","",$a)); -$a = array(); -var_dump(preg_replace_callback($a,$a,$a,$a,$a)); echo "Done\n"; ?> --EXPECTF-- -Warning: preg_replace_callback() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: preg_replace_callback() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: preg_replace_callback() expects at least 3 parameters, 2 given in %s on line %d -NULL - Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d string(1) "3" @@ -35,10 +19,4 @@ string(1) "3" Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d string(1) "3" - -Warning: preg_replace_callback() expects parameter 4 to be int, string given in %s on line %d -NULL - -Warning: preg_replace_callback() expects parameter 4 to be int, array given in %s on line %d -NULL Done diff --git a/ext/pcre/tests/preg_replace_callback_array2.phpt b/ext/pcre/tests/preg_replace_callback_array2.phpt index f2f20ef645..03d7a60eee 100644 --- a/ext/pcre/tests/preg_replace_callback_array2.phpt +++ b/ext/pcre/tests/preg_replace_callback_array2.phpt @@ -3,19 +3,8 @@ preg_replace_callback_array() errors --FILE-- <?php -var_dump(preg_replace_callback_array()); -var_dump(preg_replace_callback_array(1)); -var_dump(preg_replace_callback_array(1,2)); -var_dump(preg_replace_callback_array(1,2,3)); -$a = 5; -var_dump(preg_replace_callback_array(1,2,3,$a)); -$a = ""; -var_dump(preg_replace_callback_array(array("" => ""),"","",$a)); $a = array(); $b = ""; -var_dump(preg_replace_callback($a, $a, $a, $a, $b)); -var_dump($b); -$b = ""; var_dump(preg_replace_callback_array(array("xx" => "s"), $a, -1, $b)); var_dump($b); function f() { @@ -34,28 +23,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: preg_replace_callback_array() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: preg_replace_callback_array() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: preg_replace_callback_array() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: preg_replace_callback() expects parameter 4 to be int, array given in %s on line %d -NULL -string(0) "" - Warning: preg_replace_callback_array(): 's' is not a valid callback in %spreg_replace_callback_array2.php on line %d array(0) { } diff --git a/ext/pcre/tests/preg_split_error1.phpt b/ext/pcre/tests/preg_split_error1.phpt index 79942a9480..1c1e3ec646 100644 --- a/ext/pcre/tests/preg_split_error1.phpt +++ b/ext/pcre/tests/preg_split_error1.phpt @@ -20,10 +20,18 @@ $regex_array = array('abcdef', //Regex without delimiter $subject = '1 2 a 3 4 b 5 6'; foreach($regex_array as $regex_value) { print "\nArg value is $regex_value\n"; - var_dump(preg_split($regex_value, $subject)); + try { + var_dump(preg_split($regex_value, $subject)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } $regex_value = new stdclass(); //Object -var_dump(preg_split($regex_value, $subject)); +try { + var_dump(preg_split($regex_value, $subject)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- *** Testing preg_split() : error conditions *** @@ -49,9 +57,7 @@ Warning: preg_split(): Unknown modifier 'F' in %spreg_split_error1.php on line % bool(false) Arg value is Array - -Warning: preg_split() expects parameter 1 to be string, array given in %spreg_split_error1.php on line %d -bool(false) +preg_split() expects parameter 1 to be string, array given Arg value is /[a-zA-Z]/ array(3) { @@ -62,6 +68,4 @@ array(3) { [2]=> string(4) " 5 6" } - -Warning: preg_split() expects parameter 1 to be string, object given in %spreg_split_error1.php on line %d -bool(false) +preg_split() expects parameter 1 to be string, object given diff --git a/ext/pcre/tests/split.phpt b/ext/pcre/tests/split.phpt index c87d1b03a9..df4b9af92f 100644 --- a/ext/pcre/tests/split.phpt +++ b/ext/pcre/tests/split.phpt @@ -3,7 +3,6 @@ preg_split() --FILE-- <?php -var_dump(preg_split()); var_dump(preg_split('/*/', 'x')); var_dump(preg_split('/[\s, ]+/', 'x yy,zzz')); @@ -17,10 +16,7 @@ var_dump(preg_split('/\d*/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY)); ?> --EXPECTF-- -Warning: preg_split() expects at least 2 parameters, 0 given in %ssplit.php on line 3 -bool(false) - -Warning: preg_split(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %ssplit.php on line 4 +Warning: preg_split(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %ssplit.php on line %d bool(false) array(3) { [0]=> diff --git a/ext/pcre/tests/split2.phpt b/ext/pcre/tests/split2.phpt index b0411e6df2..f4fd60022e 100644 --- a/ext/pcre/tests/split2.phpt +++ b/ext/pcre/tests/split2.phpt @@ -13,7 +13,6 @@ var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPL var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE)); -var_dump(preg_last_error(1)); ini_set('pcre.recursion_limit', 1); var_dump(preg_last_error() == PREG_NO_ERROR); var_dump(preg_split('/(\d*)/', 'ab2c3u')); @@ -306,9 +305,6 @@ array(6) { int(5) } } - -Warning: preg_last_error() expects exactly 0 parameters, 1 given in %s on line %d -NULL bool(true) array(1) { [0]=> diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 0e3f63fe3f..41d7df817d 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -209,7 +209,7 @@ static PHP_METHOD(PDO, dbh_constructor) int call_factory = 1; zend_error_handling zeh; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 4) + ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_STRING(data_source, data_source_len) Z_PARAM_OPTIONAL Z_PARAM_STRING_EX(username, usernamelen, 1, 0) @@ -419,13 +419,13 @@ static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args) /* {{{ */ { zval query_string; - zval z_key; + zend_string *key; ZVAL_STRINGL(&query_string, stmt->query_string, stmt->query_stringlen); - ZVAL_STRINGL(&z_key, "queryString", sizeof("queryString") - 1); - zend_std_write_property(object, &z_key, &query_string, NULL); + key = zend_string_init("queryString", sizeof("queryString") - 1, 0); + zend_std_write_property(Z_OBJ_P(object), key, &query_string, NULL); zval_ptr_dtor(&query_string); - zval_ptr_dtor(&z_key); + zend_string_release_ex(key, 0); if (dbstmt_ce->constructor) { zend_fcall_info fci; @@ -1350,9 +1350,9 @@ static int dbh_compare(zval *object1, zval *object2) return -1; } -static HashTable *dbh_get_gc(zval *object, zval **gc_data, int *gc_count) +static HashTable *dbh_get_gc(zend_object *object, zval **gc_data, int *gc_count) { - pdo_dbh_t *dbh = Z_PDO_DBH_P(object); + pdo_dbh_t *dbh = php_pdo_dbh_fetch_inner(object); *gc_data = &dbh->def_stmt_ctor_args; *gc_count = 1; return zend_std_get_properties(object); diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index c3e79f5b68..eb8577bb94 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -101,6 +101,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_setfetchmode, 0, 0, 1) ZEND_ARG_INFO(0, mode) + ZEND_ARG_INFO(0, param) ZEND_ARG_INFO(0, params) ZEND_END_ARG_INFO() /* }}} */ @@ -2176,30 +2177,26 @@ const zend_function_entry pdo_dbstmt_functions[] = { }; /* {{{ overloaded handlers for PDOStatement class */ -static zval *dbstmt_prop_write(zval *object, zval *member, zval *value, void **cache_slot) +static zval *dbstmt_prop_write(zend_object *object, zend_string *name, zval *value, void **cache_slot) { - pdo_stmt_t *stmt = Z_PDO_STMT_P(object); + pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object); - convert_to_string(member); - - if (strcmp(Z_STRVAL_P(member), "queryString") == 0) { + if (strcmp(ZSTR_VAL(name), "queryString") == 0) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only"); return value; } else { - return zend_std_write_property(object, member, value, cache_slot); + return zend_std_write_property(object, name, value, cache_slot); } } -static void dbstmt_prop_delete(zval *object, zval *member, void **cache_slot) +static void dbstmt_prop_delete(zend_object *object, zend_string *name, void **cache_slot) { - pdo_stmt_t *stmt = Z_PDO_STMT_P(object); + pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object); - convert_to_string(member); - - if (strcmp(Z_STRVAL_P(member), "queryString") == 0) { + if (strcmp(ZSTR_VAL(name), "queryString") == 0) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only"); } else { - zend_std_unset_property(object, member, cache_slot); + zend_std_unset_property(object, name, cache_slot); } } @@ -2246,16 +2243,16 @@ static int dbstmt_compare(zval *object1, zval *object2) return -1; } -static zend_object *dbstmt_clone_obj(zval *zobject) +static zend_object *dbstmt_clone_obj(zend_object *zobject) { pdo_stmt_t *stmt; pdo_stmt_t *old_stmt; - stmt = zend_object_alloc(sizeof(pdo_stmt_t), Z_OBJCE_P(zobject)); - zend_object_std_init(&stmt->std, Z_OBJCE_P(zobject)); - object_properties_init(&stmt->std, Z_OBJCE_P(zobject)); + stmt = zend_object_alloc(sizeof(pdo_stmt_t), zobject->ce); + zend_object_std_init(&stmt->std, zobject->ce); + object_properties_init(&stmt->std, zobject->ce); - old_stmt = Z_PDO_STMT_P(zobject); + old_stmt = php_pdo_stmt_fetch_object(zobject); zend_objects_clone_members(&stmt->std, &old_stmt->std); @@ -2454,12 +2451,44 @@ const zend_function_entry pdo_row_functions[] = { PHP_FE_END }; -static zval *row_prop_read(zval *object, zval *member, int type, void **cache_slot, zval *rv) +static zval *row_prop_read(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) +{ + pdo_row_t *row = (pdo_row_t *)object; + pdo_stmt_t *stmt = row->stmt; + int colno = -1; + zend_long lval; + + ZVAL_NULL(rv); + if (stmt) { + if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) { + if (lval >= 0 && lval < stmt->column_count) { + fetch_value(stmt, rv, lval, NULL); + } + } else { + /* TODO: replace this with a hash of available column names to column + * numbers */ + for (colno = 0; colno < stmt->column_count; colno++) { + if (ZSTR_LEN(stmt->columns[colno].name) == ZSTR_LEN(name) && + strncmp(ZSTR_VAL(stmt->columns[colno].name), ZSTR_VAL(name), ZSTR_LEN(name)) == 0) { + fetch_value(stmt, rv, colno, NULL); + return rv; + } + } + if (strcmp(ZSTR_VAL(name), "queryString") == 0) { + //zval_ptr_dtor(rv); + return zend_std_read_property(&stmt->std, name, type, cache_slot, rv); + } + } + } + + return rv; +} + +static zval *row_dim_read(zend_object *object, zval *member, int type, zval *rv) { - pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object); + pdo_row_t *row = (pdo_row_t *)object; pdo_stmt_t *stmt = row->stmt; int colno = -1; - zval zobj; zend_long lval; ZVAL_NULL(rv); @@ -2485,9 +2514,8 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl } } if (strcmp(Z_STRVAL_P(member), "queryString") == 0) { - ZVAL_OBJ(&zobj, &stmt->std); //zval_ptr_dtor(rv); - return zend_std_read_property(&zobj, member, type, cache_slot, rv); + return zend_std_read_property(&stmt->std, Z_STR_P(member), type, NULL, rv); } } } @@ -2495,25 +2523,52 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl return rv; } -static zval *row_dim_read(zval *object, zval *member, int type, zval *rv) +static zval *row_prop_write(zend_object *object, zend_string *name, zval *value, void **cache_slot) { - return row_prop_read(object, member, type, NULL, rv); + php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set"); + return value; } -static zval *row_prop_write(zval *object, zval *member, zval *value, void **cache_slot) +static void row_dim_write(zend_object *object, zval *member, zval *value) { php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set"); - return value; } -static void row_dim_write(zval *object, zval *member, zval *value) +static int row_prop_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot) { - php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set"); + pdo_row_t *row = (pdo_row_t *)object; + pdo_stmt_t *stmt = row->stmt; + int colno = -1; + zend_long lval; + + if (stmt) { + if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) { + return lval >=0 && lval < stmt->column_count; + } + + /* TODO: replace this with a hash of available column names to column + * numbers */ + for (colno = 0; colno < stmt->column_count; colno++) { + if (ZSTR_LEN(stmt->columns[colno].name) == ZSTR_LEN(name) && + strncmp(ZSTR_VAL(stmt->columns[colno].name), ZSTR_VAL(name), ZSTR_LEN(name)) == 0) { + int res; + zval val; + + fetch_value(stmt, &val, colno, NULL); + res = check_empty ? i_zend_is_true(&val) : Z_TYPE(val) != IS_NULL; + zval_ptr_dtor_nogc(&val); + + return res; + } + } + } + + return 0; } -static int row_prop_exists(zval *object, zval *member, int check_empty, void **cache_slot) +static int row_dim_exists(zend_object *object, zval *member, int check_empty) { - pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object); + pdo_row_t *row = (pdo_row_t *)object; pdo_stmt_t *stmt = row->stmt; int colno = -1; zend_long lval; @@ -2549,24 +2604,19 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c return 0; } -static int row_dim_exists(zval *object, zval *member, int check_empty) -{ - return row_prop_exists(object, member, check_empty, NULL); -} - -static void row_prop_delete(zval *object, zval *offset, void **cache_slot) +static void row_prop_delete(zend_object *object, zend_string *offset, void **cache_slot) { php_error_docref(NULL, E_WARNING, "Cannot delete properties from a PDORow"); } -static void row_dim_delete(zval *object, zval *offset) +static void row_dim_delete(zend_object *object, zval *offset) { php_error_docref(NULL, E_WARNING, "Cannot delete properties from a PDORow"); } -static HashTable *row_get_properties_for(zval *object, zend_prop_purpose purpose) +static HashTable *row_get_properties_for(zend_object *object, zend_prop_purpose purpose) { - pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object); + pdo_row_t *row = (pdo_row_t *)object; pdo_stmt_t *stmt = row->stmt; HashTable *props; int i; @@ -2607,11 +2657,6 @@ static zend_function *row_method_get( return fbc; } -static int row_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS) -{ - return FAILURE; -} - static zend_function *row_get_ctor(zend_object *object) { zend_throw_exception_ex(php_pdo_get_exception(), 0, "You may not create a PDORow manually"); @@ -2690,7 +2735,6 @@ void pdo_stmt_init(void) pdo_row_object_handlers.unset_dimension = row_dim_delete; pdo_row_object_handlers.get_properties_for = row_get_properties_for; pdo_row_object_handlers.get_method = row_method_get; - pdo_row_object_handlers.call_method = row_call_method; pdo_row_object_handlers.get_constructor = row_get_ctor; pdo_row_object_handlers.get_class_name = row_get_classname; pdo_row_object_handlers.compare_objects = row_compare; diff --git a/ext/pdo/tests/bug_44173.phpt b/ext/pdo/tests/bug_44173.phpt index aab73d87a6..7d4111144f 100644 --- a/ext/pdo/tests/bug_44173.phpt +++ b/ext/pdo/tests/bug_44173.phpt @@ -18,11 +18,6 @@ $db->exec("CREATE TABLE test (x int)"); $db->exec("INSERT INTO test VALUES (1)"); -// Bug entry [1] -$stmt = $db->query(); -var_dump($stmt); - - // Bug entry [2] -- 1 is PDO::FETCH_LAZY $stmt = $db->query("SELECT * FROM test", PDO::FETCH_LAZY, 0, 0); var_dump($stmt); @@ -55,9 +50,6 @@ var_dump($stmt); ?> --EXPECTF-- -Warning: PDO::query() expects at least 1 parameter, 0 given in %s -bool(false) - Warning: PDO::query(): SQLSTATE[HY000]: General error: fetch mode doesn't allow any extra arguments in %s bool(false) diff --git a/ext/pdo/tests/pdo_drivers_error.phpt b/ext/pdo/tests/pdo_drivers_error.phpt deleted file mode 100644 index 5a371f02bc..0000000000 --- a/ext/pdo/tests/pdo_drivers_error.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Test that PDO::getAvailableDrivers / pdo_drivers does not accept any parameters ---CREDITS-- -Amo Chohan <amo.chohan@gmail.com> ---SKIPIF-- -<?php -if (!extension_loaded('pdo')) die('skip'); ---FILE-- -<?php -PDO::getAvailableDrivers('fail'); -pdo_drivers('fail'); ---EXPECTF-- -Warning: PDO::getAvailableDrivers() expects exactly 0 parameters, 1 given in %s on line %d - -Warning: pdo_drivers() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt index e280ded294..d733a2b544 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt @@ -16,9 +16,6 @@ $db = MySQLPDOTest::factory(); $default = $db->getAttribute(PDO::ATTR_STATEMENT_CLASS); var_dump($default); - if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS))) - printf("[001] Expecting boolean/false got %s\n", var_export($tmp, true)); - if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, 'foo'))) printf("[002] Expecting boolean/false got %s\n", var_export($tmp, true)); diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt index 10ccba2291..07ad3d9d33 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt @@ -30,22 +30,11 @@ try { printf("[002] Expecting false got %s\n", var_export($tmp, true)); $stmt->execute(); - // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 0 given in - if (false !== ($tmp = @$stmt->getColumnMeta())) - printf("[003] Expecting false got %s\n", var_export($tmp, true)); // invalid offset if (false !== ($tmp = @$stmt->getColumnMeta(-1))) printf("[004] Expecting false got %s\n", var_export($tmp, true)); - // Warning: PDOStatement::getColumnMeta() expects parameter 1 to be int, array given in - if (false !== ($tmp = @$stmt->getColumnMeta(array()))) - printf("[005] Expecting false got %s\n", var_export($tmp, true)); - - // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 2 given in - if (false !== ($tmp = @$stmt->getColumnMeta(1, 1))) - printf("[006] Expecting false got %s\n", var_export($tmp, true)); - $emulated = $stmt->getColumnMeta(0); printf("Testing native PS...\n"); diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c index 5f0eb26df3..762629fe01 100644 --- a/ext/pdo_odbc/pdo_odbc.c +++ b/ext/pdo_odbc/pdo_odbc.c @@ -66,13 +66,6 @@ zend_ulong pdo_odbc_pool_on = SQL_CP_OFF; zend_ulong pdo_odbc_pool_mode = SQL_CP_ONE_PER_HENV; #endif -#if defined(DB2CLI_VER) && !defined(PHP_WIN32) -PHP_INI_BEGIN() - PHP_INI_ENTRY("pdo_odbc.db2_instance_name", NULL, PHP_INI_SYSTEM, NULL) -PHP_INI_END() - -#endif - /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(pdo_odbc) { @@ -84,26 +77,6 @@ PHP_MINIT_FUNCTION(pdo_odbc) return FAILURE; } -#if defined(DB2CLI_VER) && !defined(PHP_WIN32) - REGISTER_INI_ENTRIES(); - { - char *instance = INI_STR("pdo_odbc.db2_instance_name"); - if (instance) { - char *env = malloc(sizeof("DB2INSTANCE=") + strlen(instance)); - - php_error_docref(NULL, E_DEPRECATED, "The pdo_odbc.db2_instance_name ini directive is deprecated and will be removed in the future"); - - if (!env) { - return FAILURE; - } - strcpy(env, "DB2INSTANCE="); - strcat(env, instance); - putenv(env); - /* after this point, we can't free env without breaking the environment */ - } - } -#endif - #ifdef SQL_ATTR_CONNECTION_POOLING /* ugh, we don't really like .ini stuff in PDO, but since ODBC connection * pooling is process wide, we can't set it from within the scope of a @@ -145,9 +118,6 @@ PHP_MINIT_FUNCTION(pdo_odbc) */ PHP_MSHUTDOWN_FUNCTION(pdo_odbc) { -#if defined(DB2CLI_VER) && !defined(PHP_WIN32) - UNREGISTER_INI_ENTRIES(); -#endif php_pdo_unregister_driver(&pdo_odbc_driver); return SUCCESS; } @@ -166,9 +136,5 @@ PHP_MINFO_FUNCTION(pdo_odbc) php_info_print_table_row(2, "ODBC Connection Pooling", "Not supported in this build"); #endif php_info_print_table_end(); - -#if defined(DB2CLI_VER) && !defined(PHP_WIN32) - DISPLAY_INI_ENTRIES(); -#endif } /* }}} */ diff --git a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt index c452d4c34f..c788b4ee90 100644 --- a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt +++ b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt @@ -117,14 +117,11 @@ array(2) { string(4) "2---" } -Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: cannot access private method bar::test2() in %s on line %d +Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: non-static method bar::test2() cannot be called statically in %s on line %d +bool(false) + +Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: non-static method bar::test3() cannot be called statically in %s on line %d bool(false) -array(2) { - [0]=> - string(7) "1===php" - [1]=> - string(4) "2===" -} Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: class 'bar' does not have a method 'inexistent' in %s on line %d bool(false) diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt index aa2e43748f..45062c3b49 100644 --- a/ext/pgsql/tests/01createdb.phpt +++ b/ext/pgsql/tests/01createdb.phpt @@ -9,7 +9,7 @@ PostgreSQL create db include('config.inc'); $db = pg_connect($conn_str); -if (!@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name))) +if (!($q = @pg_query($db, "SELECT * FROM ".$table_name)) || !@pg_num_rows($q)) { pg_query($db,$table_def); // Create table here for ($i=0; $i < $num_test_record; $i++) { @@ -21,7 +21,7 @@ else { } $v = pg_version(); -if (version_compare($v['server'], '9.2', '>=') && !@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name_92))) +if (version_compare($v['server'], '9.2', '>=') && (!($q = @pg_query($db, "SELECT * FROM ".$table_name_92)) || !@pg_num_rows($q))) { pg_query($db,$table_def_92); // Create table here } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index f2d1341047..87483417eb 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1224,7 +1224,7 @@ PHP_METHOD(Phar, __construct) ZVAL_STRINGL(&arg1, fname, fname_len); ZVAL_LONG(&arg2, flags); - zend_call_method_with_2_params(zobj, Z_OBJCE_P(zobj), + zend_call_method_with_2_params(Z_OBJ_P(zobj), Z_OBJCE_P(zobj), &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2); zval_ptr_dtor(&arg1); @@ -1733,7 +1733,7 @@ PHP_METHOD(Phar, buildFromDirectory) ZVAL_STRINGL(&arg, dir, dir_len); ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS); - zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator, + zend_call_method_with_2_params(Z_OBJ(iter), spl_ce_RecursiveDirectoryIterator, &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2); zval_ptr_dtor(&arg); @@ -1749,7 +1749,7 @@ PHP_METHOD(Phar, buildFromDirectory) RETURN_FALSE; } - zend_call_method_with_1_params(&iteriter, spl_ce_RecursiveIteratorIterator, + zend_call_method_with_1_params(Z_OBJ(iteriter), spl_ce_RecursiveIteratorIterator, &spl_ce_RecursiveIteratorIterator->constructor, "__construct", NULL, &iter); if (EG(exception)) { @@ -1772,7 +1772,7 @@ PHP_METHOD(Phar, buildFromDirectory) ZVAL_STRINGL(&arg2, regex, regex_len); - zend_call_method_with_2_params(®exiter, spl_ce_RegexIterator, + zend_call_method_with_2_params(Z_OBJ(regexiter), spl_ce_RegexIterator, &spl_ce_RegexIterator->constructor, "__construct", NULL, &iteriter, &arg2); zval_ptr_dtor(&arg2); } @@ -2223,7 +2223,7 @@ its_ok: ZVAL_STRINGL(&arg1, phar->fname, phar->fname_len); - zend_call_method_with_1_params(&ret, ce, &ce->constructor, "__construct", NULL, &arg1); + zend_call_method_with_1_params(Z_OBJ(ret), ce, &ce->constructor, "__construct", NULL, &arg1); zval_ptr_dtor(&arg1); return Z_OBJ(ret); } @@ -4480,7 +4480,7 @@ PHP_METHOD(PharFileInfo, __construct) ZVAL_STRINGL(&arg1, fname, fname_len); - zend_call_method_with_1_params(zobj, Z_OBJCE_P(zobj), + zend_call_method_with_1_params(Z_OBJ_P(zobj), Z_OBJCE_P(zobj), &spl_ce_SplFileInfo->constructor, "__construct", NULL, &arg1); zval_ptr_dtor(&arg1); diff --git a/ext/phar/tests/002.phpt b/ext/phar/tests/002.phpt index 41cb9be716..cfd8cc5e66 100644 --- a/ext/phar/tests/002.phpt +++ b/ext/phar/tests/002.phpt @@ -5,13 +5,17 @@ Phar::mapPhar truncated manifest/improper params --FILE-- <?php try { -Phar::mapPhar(5, 'hio', 'hi'); + Phar::mapPhar(5, 'hio', 'hi'); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -Phar::mapPhar(); +try { + Phar::mapPhar(); } catch (Exception $e) { - echo $e->getMessage(); + echo $e->getMessage(), "\n"; } __HALT_COMPILER(); ?> --EXPECTF-- -Warning: Phar::mapPhar() expects at most 2 parameters, 3 given in %s002.php on line %d +Phar::mapPhar() expects at most 2 parameters, 3 given internal corruption of phar "%s002.php" (truncated manifest at manifest length) diff --git a/ext/phar/tests/badparameters.phpt b/ext/phar/tests/badparameters.phpt index e8ddb1f62a..bf9c5d5696 100644 --- a/ext/phar/tests/badparameters.phpt +++ b/ext/phar/tests/badparameters.phpt @@ -8,200 +8,263 @@ phar.readonly=0 <?php ini_set('phar.readonly', 1); -function print_exception($e) { - echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; +try { + Phar::mungServer('hi'); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + Phar::createDefaultStub(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + Phar::loadPhar(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + Phar::canCompress('hi'); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } - -Phar::mungServer('hi'); -Phar::createDefaultStub(array()); -Phar::loadPhar(array()); -Phar::canCompress('hi'); try { $a = new Phar(array()); } catch (TypeError $e) { - print_exception($e); + echo $e->getMessage(), "\n"; } try { $a = new Phar(dirname(__FILE__) . '/files/frontcontroller10.phar'); } catch (PharException $e) { - print_exception($e); + echo $e->getMessage(), "\n"; +} +try { + $a->convertToExecutable(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $a->convertToData(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } -$a->convertToExecutable(array()); -$a->convertToData(array()); try { $b = new PharData(dirname(__FILE__) . '/whatever.tar'); } catch (PharException $e) { - print_exception($e); + echo $e->getMessage(), "\n"; } try { $c = new PharData(dirname(__FILE__) . '/whatever.zip'); } catch (PharException $e) { - print_exception($e); + echo $e->getMessage(), "\n"; } -$b->delete(array()); try { -$a->delete('oops'); + $b->delete(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $a->delete('oops'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { -$b->delete('oops'); + $b->delete('oops'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; +} +try { + echo $a->getPath() . "\n"; +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } -echo $a->getPath() . "\n"; try { -$a->setAlias('oops'); + $a->setAlias('oops'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { -$b->setAlias('oops'); + $b->setAlias('oops'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ini_set('phar.readonly', 0); -$a->setAlias(array()); +try { + $a->setAlias(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ini_set('phar.readonly', 1); try { -$b->stopBuffering(); + $b->stopBuffering(); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { -$a->setStub('oops'); + $a->setStub('oops'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { -$b->setStub('oops'); + $b->setStub('oops'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ini_set('phar.readonly', 0); -$a->setStub(array()); +try { + $a->setStub(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ini_set('phar.readonly', 1); try { -$b->setDefaultStub('oops'); + $b->setDefaultStub('oops'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; +} +try { + $a->setDefaultStub(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } -$a->setDefaultStub(array()); try { -$a->setDefaultStub('oops'); + $a->setDefaultStub('oops'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { -$a->setSignatureAlgorithm(Phar::MD5); + $a->setSignatureAlgorithm(Phar::MD5); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } -$a->compress(array()); try { -$a->compress(1); + $a->compress(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $a->compress(1); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; +} +try { + $a->compressFiles(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } -$a->compressFiles(array()); try { -$a->decompressFiles(); + $a->decompressFiles(); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } -$a->copy(array()); try { -$a->copy('a', 'b'); + $a->copy(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $a->copy('a', 'b'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; +} +try { + $a->offsetExists(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $a->offsetGet(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } -$a->offsetExists(array()); -$a->offsetGet(array()); ini_set('phar.readonly', 0); -$a->offsetSet(array()); +try { + $a->offsetSet(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ini_set('phar.readonly', 1); -$b->offsetUnset(array()); try { -$a->offsetUnset('a'); + $b->offsetUnset(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $a->offsetUnset('a'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; +} +try { + $a->addEmptyDir(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $a->addFile(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } -$a->addEmptyDir(array()); -$a->addFile(array()); -$a->addFromString(array()); try { -$a->setMetadata('a'); + $a->addFromString(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $a->setMetadata('a'); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ini_set('phar.readonly', 0); -$a->setMetadata(1,2); +try { + $a->setMetadata(1,2); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ini_set('phar.readonly', 1); try { -$a->delMetadata(); + $a->delMetadata(); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> ===DONE=== --EXPECTF-- -Warning: Phar::mungServer() expects parameter 1 to be array, string given in %sbadparameters.php on line %d - -Warning: Phar::createDefaultStub() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d - -Warning: Phar::loadPhar() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d - -Warning: Phar::canCompress() expects parameter 1 to be int, string given in %sbadparameters.php on line %d - -Exception: Phar::__construct() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d - -Warning: Phar::convertToExecutable() expects parameter 1 to be int, array given in %sbadparameters.php on line %d - -Warning: Phar::convertToData() expects parameter 1 to be int, array given in %sbadparameters.php on line %d - -Warning: PharData::delete() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d +Phar::mungServer() expects parameter 1 to be array, string given +Phar::createDefaultStub() expects parameter 1 to be a valid path, array given +Phar::loadPhar() expects parameter 1 to be a valid path, array given +Phar::canCompress() expects parameter 1 to be int, string given +Phar::__construct() expects parameter 1 to be a valid path, array given +Phar::convertToExecutable() expects parameter 1 to be int, array given +Phar::convertToData() expects parameter 1 to be int, array given +PharData::delete() expects parameter 1 to be a valid path, array given Cannot write out phar archive, phar is read-only Entry oops does not exist and cannot be deleted -%sfiles/frontcontroller10.phar +%sfrontcontroller10.phar Cannot write out phar archive, phar is read-only A Phar alias cannot be set in a plain tar archive - -Warning: Phar::setAlias() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d +Phar::setAlias() expects parameter 1 to be string, array given Cannot change stub, phar is read-only A Phar stub cannot be set in a plain tar archive - -Warning: Phar::setStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d +Phar::setStub() expects parameter 1 to be string, array given A Phar stub cannot be set in a plain tar archive - -Warning: Phar::setDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d +Phar::setDefaultStub() expects parameter 1 to be string, array given Cannot change stub: phar.readonly=1 Cannot set signature algorithm, phar is read-only - -Warning: Phar::compress() expects parameter 1 to be int, array given in %sbadparameters.php on line %d +Phar::compress() expects parameter 1 to be int, array given Cannot compress phar archive, phar is read-only - -Warning: Phar::compressFiles() expects parameter 1 to be int, array given in %sbadparameters.php on line %d +Phar::compressFiles() expects parameter 1 to be int, array given Phar is readonly, cannot change compression - -Warning: Phar::copy() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d +Phar::copy() expects exactly 2 parameters, 1 given Cannot copy "a" to "b", phar is read-only - -Warning: Phar::offsetExists() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d - -Warning: Phar::offsetGet() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d - -Warning: Phar::offsetSet() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d - -Warning: PharData::offsetUnset() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d +Phar::offsetExists() expects parameter 1 to be a valid path, array given +Phar::offsetGet() expects parameter 1 to be a valid path, array given +Phar::offsetSet() expects exactly 2 parameters, 1 given +PharData::offsetUnset() expects parameter 1 to be a valid path, array given Write operations disabled by the php.ini setting phar.readonly - -Warning: Phar::addEmptyDir() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d - -Warning: Phar::addFile() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d - -Warning: Phar::addFromString() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d +Phar::addEmptyDir() expects parameter 1 to be a valid path, array given +Phar::addFile() expects parameter 1 to be a valid path, array given +Phar::addFromString() expects exactly 2 parameters, 1 given Write operations disabled by the php.ini setting phar.readonly - -Warning: Phar::setMetadata() expects exactly 1 parameter, 2 given in %sbadparameters.php on line %d +Phar::setMetadata() expects exactly 1 parameter, 2 given Write operations disabled by the php.ini setting phar.readonly ===DONE=== diff --git a/ext/phar/tests/bug64931/bug64931.phpt b/ext/phar/tests/bug64931/bug64931.phpt index 4439fcf792..aa2d17182c 100644 --- a/ext/phar/tests/bug64931/bug64931.phpt +++ b/ext/phar/tests/bug64931/bug64931.phpt @@ -38,7 +38,7 @@ try { try { $phar->addFromString(".phar\0", "gotcha"); -} catch (Exception $e) { +} catch (TypeError $e) { echo "CAUGHT: ". $e->getMessage() ."\n"; } @@ -54,6 +54,5 @@ CAUGHT: Cannot create any files in magic ".phar" directory CAUGHT: Cannot create any files in magic ".phar" directory CAUGHT: Cannot create any files in magic ".phar" directory CAUGHT: Cannot create any files in magic ".phar" directory - -Warning: Phar::addFromString() expects parameter 1 to be a valid path, string given in %s%ebug64931.php on line %d +CAUGHT: Phar::addFromString() expects parameter 1 to be a valid path, string given ===DONE=== diff --git a/ext/phar/tests/create_path_error.phpt b/ext/phar/tests/create_path_error.phpt index fd200d8613..c10d19c711 100644 --- a/ext/phar/tests/create_path_error.phpt +++ b/ext/phar/tests/create_path_error.phpt @@ -53,7 +53,7 @@ foreach($checks as $check) { $phar[$check] = 'error'; } - catch(Exception $e) + catch (TypeError $e) { echo 'Exception: ' . $e->getMessage() . "\n"; } @@ -79,4 +79,5 @@ string(5) "query" 11:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character 12:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character 13:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character -Error: Phar::offsetSet() expects parameter 1 to be a valid path, string given===DONE=== +Exception: Phar::offsetSet() expects parameter 1 to be a valid path, string given +===DONE=== diff --git a/ext/phar/tests/fatal_error_webphar.phpt b/ext/phar/tests/fatal_error_webphar.phpt index ce3e8980ad..21df0775b0 100644 --- a/ext/phar/tests/fatal_error_webphar.phpt +++ b/ext/phar/tests/fatal_error_webphar.phpt @@ -1,5 +1,7 @@ --TEST-- Phar web-based phar with fatal error +--XFAIL-- +Uses no longer supported __autoload() function, new phar needed --INI-- default_charset=UTF-8 --SKIPIF-- diff --git a/ext/phar/tests/fgc_edgecases.phpt b/ext/phar/tests/fgc_edgecases.phpt index b75601a07b..d061cf3c91 100644 --- a/ext/phar/tests/fgc_edgecases.phpt +++ b/ext/phar/tests/fgc_edgecases.phpt @@ -14,7 +14,11 @@ Phar::interceptFileFuncs(); $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $pname = 'phar://' . $fname; -file_get_contents(array()); +try { + file_get_contents(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} chdir(dirname(__FILE__)); file_put_contents($fname, "blah\n"); file_put_contents("foob", "test\n"); @@ -46,7 +50,7 @@ include $pname . '/foo/hi'; <?php rmdir(dirname(__FILE__) . '/poo'); ?> <?php unlink(dirname(__FILE__) . '/foob'); ?> --EXPECTF-- -Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %sfgc_edgecases.php on line %d +file_get_contents() expects parameter 1 to be a valid path, array given blah <?php echo file_get_contents("foo/" . basename(__FILE__)); diff --git a/ext/phar/tests/fopen.phpt b/ext/phar/tests/fopen.phpt index b55bc59c84..9f9022cc8d 100644 --- a/ext/phar/tests/fopen.phpt +++ b/ext/phar/tests/fopen.phpt @@ -10,7 +10,6 @@ phar.readonly=0 Phar::interceptFileFuncs(); $a = fopen(__FILE__, 'rb'); // this satisfies 1 line of code coverage fclose($a); -$a = fopen(); // this satisfies another line of code coverage $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $a = new Phar($fname); @@ -36,7 +35,6 @@ include $fname; --CLEAN-- <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> --EXPECTF-- -Warning: fopen() expects at least 2 parameters, 0 given in %sfopen.php on line %d hihi Warning: fopen(notfound.txt): failed to open stream: No such file or directory in phar://%sfopen.phar.php/index.php on line %d ===DONE=== diff --git a/ext/phar/tests/fopen_edgecases2.phpt b/ext/phar/tests/fopen_edgecases2.phpt index 4ac529a4e0..2c70e17352 100644 --- a/ext/phar/tests/fopen_edgecases2.phpt +++ b/ext/phar/tests/fopen_edgecases2.phpt @@ -10,7 +10,11 @@ Phar::interceptFileFuncs(); $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $pname = 'phar://' . $fname; -fopen(array(), 'r'); +try { + fopen(array(), 'r'); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} chdir(dirname(__FILE__)); file_put_contents($fname, "blah\n"); file_put_contents("foob", "test\n"); @@ -35,7 +39,7 @@ include $pname . '/foo/hi'; <?php rmdir(dirname(__FILE__) . '/poo'); ?> <?php unlink(dirname(__FILE__) . '/foob'); ?> --EXPECTF-- -Warning: fopen() expects parameter 1 to be a valid path, array given in %sfopen_edgecases2.php on line %d +fopen() expects parameter 1 to be a valid path, array given blah test diff --git a/ext/phar/tests/open_for_write_existing_b.phpt b/ext/phar/tests/open_for_write_existing_b.phpt index ce59d9824f..edd5a65048 100644 --- a/ext/phar/tests/open_for_write_existing_b.phpt +++ b/ext/phar/tests/open_for_write_existing_b.phpt @@ -19,9 +19,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; include 'files/phar_test.inc'; -$fp = fopen($pname . '/b/c.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($pname . '/b/c.php', 'wb')); include $pname . '/b/c.php'; ?> ===DONE=== @@ -29,9 +27,6 @@ include $pname . '/b/c.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_existing_b.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d +bool(false) This is b/c ===DONE=== diff --git a/ext/phar/tests/open_for_write_existing_c.phpt b/ext/phar/tests/open_for_write_existing_c.phpt index eb0c27bf64..5c389956fa 100644 --- a/ext/phar/tests/open_for_write_existing_c.phpt +++ b/ext/phar/tests/open_for_write_existing_c.phpt @@ -19,9 +19,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; include 'files/phar_test.inc'; -$fp = fopen($pname . '/b/c.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($pname . '/b/c.php', 'wb')); include $pname . '/b/c.php'; ?> ===DONE=== @@ -29,9 +27,6 @@ include $pname . '/b/c.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_existing_c.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d +bool(false) This is b/c ===DONE=== diff --git a/ext/phar/tests/open_for_write_newfile_b.phpt b/ext/phar/tests/open_for_write_newfile_b.phpt index 53b31e03d5..775b90b1bb 100644 --- a/ext/phar/tests/open_for_write_newfile_b.phpt +++ b/ext/phar/tests/open_for_write_newfile_b.phpt @@ -19,9 +19,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; include 'files/phar_test.inc'; -$fp = fopen($pname . '/b/new.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($pname . '/b/new.php', 'wb')); include $pname . '/b/c.php'; include $pname . '/b/new.php'; ?> @@ -31,10 +29,7 @@ include $pname . '/b/new.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d +bool(false) This is b/c Warning: include(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.php" in %sopen_for_write_newfile_b.php on line %d diff --git a/ext/phar/tests/open_for_write_newfile_c.phpt b/ext/phar/tests/open_for_write_newfile_c.phpt index 8275c02baa..2b313ebf90 100644 --- a/ext/phar/tests/open_for_write_newfile_c.phpt +++ b/ext/phar/tests/open_for_write_newfile_c.phpt @@ -19,9 +19,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>'; $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; include 'files/phar_test.inc'; -$fp = fopen($pname . '/b/new.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($pname . '/b/new.php', 'wb')); include $pname . '/b/c.php'; include $pname . '/b/new.php'; ?> @@ -31,10 +29,7 @@ include $pname . '/b/new.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d +bool(false) This is b/c Warning: include(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.php" in %sopen_for_write_newfile_c.php on line %d diff --git a/ext/phar/tests/opendir_edgecases.phpt b/ext/phar/tests/opendir_edgecases.phpt index be899df81b..68ea62d3c3 100644 --- a/ext/phar/tests/opendir_edgecases.phpt +++ b/ext/phar/tests/opendir_edgecases.phpt @@ -12,7 +12,11 @@ Phar::interceptFileFuncs(); $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $pname = 'phar://' . $fname; -opendir(array()); +try { + opendir(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} mkdir(dirname(__FILE__) . '/poo'); chdir(dirname(__FILE__)); @@ -52,7 +56,7 @@ include $pname . '/foo'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php rmdir(dirname(__FILE__) . '/poo'); --EXPECTF-- -Warning: opendir() expects parameter 1 to be a valid path, array given in %sopendir_edgecases.php on line %d +opendir() expects parameter 1 to be a valid path, array given . .. foo diff --git a/ext/phar/tests/phar_bz2.phpt b/ext/phar/tests/phar_bz2.phpt index c269a8b34f..7da4c97493 100644 --- a/ext/phar/tests/phar_bz2.phpt +++ b/ext/phar/tests/phar_bz2.phpt @@ -40,7 +40,6 @@ $b = new Phar($fname2); var_dump($b->isFileFormat(Phar::PHAR)); var_dump($b->isCompressed() == Phar::BZ2); // additional code coverage -$b->isFileFormat(array()); try { $b->isFileFormat(25); } catch (Exception $e) { @@ -58,7 +57,5 @@ string(9) "it worked" string(%d) "phar://%sphar_bz2.phar/tar_004.php" bool(true) bool(true) - -Warning: Phar::isFileFormat() expects parameter 1 to be int, array given in %sphar_bz2.php on line %d Unknown file format specified ===DONE=== diff --git a/ext/phar/tests/phar_commitwrite.phpt b/ext/phar/tests/phar_commitwrite.phpt index 9671737272..7a3b5e7b93 100644 --- a/ext/phar/tests/phar_commitwrite.phpt +++ b/ext/phar/tests/phar_commitwrite.phpt @@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi'; $p->stopBuffering(); var_dump(strlen($p->getStub())); $p->setStub("<?php -function __autoload(\$class) -{ +spl_autoload_register(function(\$class) { include 'phar://' . str_replace('_', '/', \$class); -} +}); Phar::mapPhar('phar_commitwrite.phar'); include 'phar://phar_commitwrite.phar/startup.php'; __HALT_COMPILER(); @@ -31,10 +30,9 @@ __HALT_COMPILER(); --EXPECTF-- int(6641) string(%d) "<?php -function __autoload($class) -{ +spl_autoload_register(function($class) { include 'phar://' . str_replace('_', '/', $class); -} +}); Phar::mapPhar('phar_commitwrite.phar'); include 'phar://phar_commitwrite.phar/startup.php'; __HALT_COMPILER(); ?> diff --git a/ext/phar/tests/phar_create_in_cwd.phpt b/ext/phar/tests/phar_create_in_cwd.phpt index 52120fa7f9..4a9bd23a73 100644 --- a/ext/phar/tests/phar_create_in_cwd.phpt +++ b/ext/phar/tests/phar_create_in_cwd.phpt @@ -13,10 +13,9 @@ try { $p['file1.txt'] = 'hi'; var_dump(strlen($p->getStub())); $p->setStub("<?php -function __autoload(\$class) -{ +spl_autoload_register(function(\$class) { include 'phar://' . str_replace('_', '/', \$class); -} +}); Phar::mapPhar('phar_create_in_cwd.phar'); include 'phar://phar_create_in_cwd.phar/startup.php'; __HALT_COMPILER(); @@ -34,10 +33,9 @@ unlink(dirname(__FILE__) . '/phar_create_in_cwd.phar'); --EXPECTF-- int(6641) string(%d) "<?php -function __autoload($class) -{ +spl_autoload_register(function($class) { include 'phar://' . str_replace('_', '/', $class); -} +}); Phar::mapPhar('phar_create_in_cwd.phar'); include 'phar://phar_create_in_cwd.phar/startup.php'; __HALT_COMPILER(); ?> diff --git a/ext/phar/tests/phar_decompress.phpt b/ext/phar/tests/phar_decompress.phpt index 3344d9bbbd..3a76fb12e8 100644 --- a/ext/phar/tests/phar_decompress.phpt +++ b/ext/phar/tests/phar_decompress.phpt @@ -32,18 +32,17 @@ $unc2 = $gz->decompress(); echo $unc2->getPath() . "\n"; $unc3 = $gz->decompress('hooba.phar'); echo $unc3->getPath() . "\n"; -$gz->decompress(array()); $zip = $phar->convertToData(Phar::ZIP); ini_set('phar.readonly', 1); try { -$gz->decompress(); + $gz->decompress(); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } try { -$zip->decompress(); + $zip->decompress(); } catch (Exception $e) { -echo $e->getMessage() . "\n"; + echo $e->getMessage() . "\n"; } ?> ===DONE=== @@ -62,8 +61,6 @@ int(4096) %sphar_decompress2.phar %sphar_decompress.phar %sphar_decompress.hooba.phar - -Warning: Phar::decompress() expects parameter 1 to be %string, array given in %sphar_decompress.php on line %d Cannot decompress phar archive, phar is read-only Cannot decompress zip-based archives with whole-archive compression ===DONE=== diff --git a/ext/phar/tests/phar_extract.phpt b/ext/phar/tests/phar_extract.phpt index f7d1403d59..2d1091dbac 100644 --- a/ext/phar/tests/phar_extract.phpt +++ b/ext/phar/tests/phar_extract.phpt @@ -48,7 +48,11 @@ try { echo $e->getMessage(), "\n"; } -$a->extractTo(array()); +try { + $a->extractTo(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} try { $a->extractTo(''); @@ -137,8 +141,7 @@ string(3) "hi3" string(3) "hi2" bool(false) Invalid argument, expected a filename (string) or array of filenames - -Warning: Phar::extractTo() expects parameter 1 to be a valid path, array given in %sphar_extract.php on line %d +Phar::extractTo() expects parameter 1 to be a valid path, array given Invalid argument, extraction path must be non-zero length Unable to use path "%soops" for extraction, it is a file, must be a directory Invalid argument, array of filenames to extract contains non-string value diff --git a/ext/phar/tests/phar_isvalidpharfilename.phpt b/ext/phar/tests/phar_isvalidpharfilename.phpt index a59f498b95..84d2e757e9 100644 --- a/ext/phar/tests/phar_isvalidpharfilename.phpt +++ b/ext/phar/tests/phar_isvalidpharfilename.phpt @@ -7,8 +7,6 @@ phar.readonly=1 --FILE-- <?php chdir(dirname(__FILE__)); -Phar::isValidPharFilename(array()); -echo "*\n"; var_dump(Phar::isValidPharFilename('*')); var_dump(Phar::isValidPharFilename('*', true)); var_dump(Phar::isValidPharFilename('*', false)); @@ -76,8 +74,6 @@ var_dump(Phar::isValidPharFilename('dir.phar.php', false)); <?php rmdir(dirname(__FILE__) . '/.phar'); --EXPECTF-- -Warning: Phar::isValidPharFilename() expects parameter 1 to be a valid path, array given in %sphar_isvalidpharfilename.php on line %d -* bool(false) bool(false) bool(false) diff --git a/ext/phar/tests/phar_oo_006.phpt b/ext/phar/tests/phar_oo_006.phpt index de9b499a83..b71ecda23d 100644 --- a/ext/phar/tests/phar_oo_006.phpt +++ b/ext/phar/tests/phar_oo_006.phpt @@ -23,7 +23,7 @@ try { $phar->setFileClass('SplFileInfo'); } -catch (UnexpectedValueException $e) +catch (TypeError $e) { echo $e->getMessage() . "\n"; } diff --git a/ext/phar/tests/phar_running.phpt b/ext/phar/tests/phar_running.phpt index 25acf82285..194946b498 100644 --- a/ext/phar/tests/phar_running.phpt +++ b/ext/phar/tests/phar_running.phpt @@ -11,7 +11,6 @@ $pname = 'phar://' . $fname; $phar = new Phar($fname); $phar['index.php'] = '<?php -Phar::running(array()); var_dump(Phar::running()); var_dump(Phar::running(false)); ?>'; @@ -22,7 +21,6 @@ var_dump(Phar::running()); --CLEAN-- <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> --EXPECTF-- -Warning: Phar::running() expects parameter 1 to be bool, array given in phar://%sphar_running.phar.php/index.php on line 2 string(%d) "phar://%sphar_running.phar.php" string(%d) "%sphar_running.phar.php" string(0) "" diff --git a/ext/phar/tests/phar_unlinkarchive.phpt b/ext/phar/tests/phar_unlinkarchive.phpt index 98001fcbf0..9e7d0f2383 100644 --- a/ext/phar/tests/phar_unlinkarchive.phpt +++ b/ext/phar/tests/phar_unlinkarchive.phpt @@ -28,7 +28,11 @@ Phar::unlinkArchive($pdname); } catch (Exception $e) { echo $e->getMessage(),"\n"; } -Phar::unlinkArchive(array()); +try { + Phar::unlinkArchive(array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} $pname = 'phar://' . $fname; $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip'; @@ -89,8 +93,7 @@ __HALT_COMPILER(); Unknown phar archive "" Unknown phar archive "%sphar_unlinkarchive.phar" Unknown phar archive "%sphar_unlinkarchive.phar.tar": internal corruption of phar "%sphar_unlinkarchive.phar.tar" (truncated entry) - -Warning: Phar::unlinkArchive() expects parameter 1 to be a valid path, array given in %sphar_unlinkarchive.php on line %d +Phar::unlinkArchive() expects parameter 1 to be a valid path, array given bool(false) string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>" phar archive "%sphar_unlinkarchive.phar" has open file handles or objects. fclose() all file handles, and unset() all objects prior to calling unlinkArchive() diff --git a/ext/phar/tests/pharfileinfo_chmod.phpt b/ext/phar/tests/pharfileinfo_chmod.phpt index 23ce5c914a..6a6b07b4d1 100644 --- a/ext/phar/tests/pharfileinfo_chmod.phpt +++ b/ext/phar/tests/pharfileinfo_chmod.phpt @@ -19,7 +19,6 @@ $phar['a']->chmod(066); } catch (Exception $e) { echo $e->getMessage(), "\n"; } -$b->chmod(array()); lstat($pname . '/a/b'); // sets BG(CurrentLStatFile) $b->chmod(0666); ?> @@ -28,6 +27,4 @@ $b->chmod(0666); <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?> --EXPECTF-- Phar entry "a" is a temporary directory (not an actual entry in the archive), cannot chmod - -Warning: PharFileInfo::chmod() expects parameter 1 to be int, array given in %spharfileinfo_chmod.php on line %d ===DONE=== diff --git a/ext/phar/tests/pharfileinfo_compression.phpt b/ext/phar/tests/pharfileinfo_compression.phpt index 9f5480be4f..dbf9e8fa38 100644 --- a/ext/phar/tests/pharfileinfo_compression.phpt +++ b/ext/phar/tests/pharfileinfo_compression.phpt @@ -17,7 +17,6 @@ $phar['a/b'] = 'hi there'; $b = $phar['a/b']; -$b->isCompressed(array()); try { $b->isCompressed(25); } catch (Exception $e) { @@ -76,7 +75,6 @@ var_dump($b->decompress()); <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?> <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.tar'); ?> --EXPECTF-- -Warning: PharFileInfo::isCompressed() expects parameter 1 to be int, array given in %spharfileinfo_compression.php on line 11 Unknown compression type specified Unknown compression type specified Cannot compress with Gzip compression, not possible with tar-based phar archives diff --git a/ext/phar/tests/pharfileinfo_setmetadata.phpt b/ext/phar/tests/pharfileinfo_setmetadata.phpt index 8fb6935f26..1dc3ab9118 100644 --- a/ext/phar/tests/pharfileinfo_setmetadata.phpt +++ b/ext/phar/tests/pharfileinfo_setmetadata.phpt @@ -36,8 +36,6 @@ $b->delMetadata(); } catch (Exception $e) { echo $e->getMessage(), "\n"; } -ini_set('phar.readonly', 0); -$b->setMetadata(1,2,3); ?> ===DONE=== --CLEAN-- @@ -48,6 +46,4 @@ Phar entry is a temporary directory (not an actual entry in the archive), cannot Phar entry is a temporary directory (not an actual entry in the archive), cannot delete metadata Write operations disabled by the php.ini setting phar.readonly Write operations disabled by the php.ini setting phar.readonly - -Warning: PharFileInfo::setMetadata() expects exactly 1 parameter, 3 given in %spharfileinfo_setmetadata.php on line %d ===DONE=== diff --git a/ext/phar/tests/readfile_edgecases.phpt b/ext/phar/tests/readfile_edgecases.phpt index f6a0dc65b9..20617c6b28 100644 --- a/ext/phar/tests/readfile_edgecases.phpt +++ b/ext/phar/tests/readfile_edgecases.phpt @@ -10,7 +10,6 @@ Phar::interceptFileFuncs(); $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $pname = 'phar://' . $fname; -readfile(array()); chdir(dirname(__FILE__)); file_put_contents($fname, "blah\n"); file_put_contents("foob", "test\n"); @@ -35,7 +34,6 @@ include $pname . '/foo/hi'; <?php rmdir(dirname(__FILE__) . '/poo'); ?> <?php unlink(dirname(__FILE__) . '/foob'); ?> --EXPECTF-- -Warning: readfile() expects parameter 1 to be a valid path, array given in %sreadfile_edgecases.php on line %d blah <?php readfile("foo/" . basename(__FILE__)); diff --git a/ext/phar/tests/stat2_5.3.phpt b/ext/phar/tests/stat2_5.3.phpt index 99f658fa78..de21dd5c08 100644 --- a/ext/phar/tests/stat2_5.3.phpt +++ b/ext/phar/tests/stat2_5.3.phpt @@ -8,8 +8,6 @@ phar.require_hash=0 --FILE-- <?php Phar::interceptFileFuncs(); -is_file(); -is_link(); var_dump(is_file(__FILE__)); $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.tar'; @@ -39,9 +37,6 @@ include $fname3; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?> <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.tar'); ?> --EXPECTF-- -Warning: is_file() expects exactly 1 parameter, 0 given in %sstat2_5.3.php on line %d - -Warning: is_link() expects exactly 1 parameter, 0 given in %sstat2_5.3.php on line %d bool(true) is_link bool(false) diff --git a/ext/phar/tests/tar/open_for_write_existing_b.phpt b/ext/phar/tests/tar/open_for_write_existing_b.phpt index 4c67def631..0bd97d55ba 100644 --- a/ext/phar/tests/tar/open_for_write_existing_b.phpt +++ b/ext/phar/tests/tar/open_for_write_existing_b.phpt @@ -29,9 +29,7 @@ foreach ($files as $n => $file) { $phar->stopBuffering(); ini_set('phar.readonly', 1); -$fp = fopen($alias . '/b/c.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($alias . '/b/c.php', 'wb')); include $alias . '/b/c.php'; @@ -42,10 +40,7 @@ include $alias . '/b/c.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_existing_b.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d +bool(false) This is b/c ===DONE=== diff --git a/ext/phar/tests/tar/open_for_write_existing_c.phpt b/ext/phar/tests/tar/open_for_write_existing_c.phpt index 9e73f1e899..d3c12b8e05 100644 --- a/ext/phar/tests/tar/open_for_write_existing_c.phpt +++ b/ext/phar/tests/tar/open_for_write_existing_c.phpt @@ -29,9 +29,7 @@ foreach ($files as $n => $file) { $phar->stopBuffering(); ini_set('phar.readonly', 1); -$fp = fopen($alias . '/b/c.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($alias . '/b/c.php', 'wb')); include $alias . '/b/c.php'; @@ -42,10 +40,7 @@ include $alias . '/b/c.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_existing_c.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d +bool(false) This is b/c ===DONE=== diff --git a/ext/phar/tests/tar/open_for_write_newfile_b.phpt b/ext/phar/tests/tar/open_for_write_newfile_b.phpt index 5c57587234..657782fb38 100644 --- a/ext/phar/tests/tar/open_for_write_newfile_b.phpt +++ b/ext/phar/tests/tar/open_for_write_newfile_b.phpt @@ -29,9 +29,7 @@ foreach ($files as $n => $file) { $phar->stopBuffering(); ini_set('phar.readonly', 1); -$fp = fopen($alias . '/b/new.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($alias . '/b/new.php', 'wb')); include $alias . '/b/c.php'; include $alias . '/b/new.php'; @@ -43,10 +41,7 @@ include $alias . '/b/new.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d +bool(false) This is b/c Warning: include(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.tar" in %sopen_for_write_newfile_b.php on line %d diff --git a/ext/phar/tests/tar/open_for_write_newfile_c.phpt b/ext/phar/tests/tar/open_for_write_newfile_c.phpt index b5078426fe..0a65086cc7 100644 --- a/ext/phar/tests/tar/open_for_write_newfile_c.phpt +++ b/ext/phar/tests/tar/open_for_write_newfile_c.phpt @@ -29,9 +29,7 @@ foreach ($files as $n => $file) { $phar->stopBuffering(); ini_set('phar.readonly', 1); -$fp = fopen($alias . '/b/new.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($alias . '/b/new.php', 'wb')); include $alias . '/b/c.php'; include $alias . '/b/new.php'; @@ -42,10 +40,7 @@ include $alias . '/b/new.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d +bool(false) This is b/c Warning: include(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.tar" in %sopen_for_write_newfile_c.php on line %d diff --git a/ext/phar/tests/tar/phar_commitwrite.phpt b/ext/phar/tests/tar/phar_commitwrite.phpt index 1f6d744917..23d6800598 100644 --- a/ext/phar/tests/tar/phar_commitwrite.phpt +++ b/ext/phar/tests/tar/phar_commitwrite.phpt @@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi'; $p->stopBuffering(); var_dump($p->getStub()); $p->setStub("<?php -function __autoload(\$class) -{ +spl_autoload_register(function(\$class) { include 'phar://' . str_replace('_', '/', \$class); -} +}); Phar::mapPhar('phar_commitwrite.phar'); include 'phar://phar_commitwrite.phar/startup.php'; __HALT_COMPILER(); @@ -32,10 +31,9 @@ unlink(dirname(__FILE__) . '/phar_commitwrite.phar.tar'); string(60) "<?php // tar-based phar archive stub file __HALT_COMPILER();" string(%d) "<?php -function __autoload($class) -{ +spl_autoload_register(function($class) { include 'phar://' . str_replace('_', '/', $class); -} +}); Phar::mapPhar('phar_commitwrite.phar'); include 'phar://phar_commitwrite.phar/startup.php'; __HALT_COMPILER(); ?> diff --git a/ext/phar/tests/zip/open_for_write_existing_b.phpt b/ext/phar/tests/zip/open_for_write_existing_b.phpt index 789067eb29..9527583b19 100644 --- a/ext/phar/tests/zip/open_for_write_existing_b.phpt +++ b/ext/phar/tests/zip/open_for_write_existing_b.phpt @@ -29,9 +29,7 @@ $phar->stopBuffering(); ini_set('phar.readonly', 1); -$fp = fopen($alias . '/b/c.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($alias . '/b/c.php', 'wb')); include $alias . '/b/c.php'; ?> ===DONE=== @@ -39,9 +37,6 @@ include $alias . '/b/c.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_existing_b.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_b.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_b.php on line %d +bool(false) This is b/c ===DONE=== diff --git a/ext/phar/tests/zip/open_for_write_existing_c.phpt b/ext/phar/tests/zip/open_for_write_existing_c.phpt index adcb50ff93..a115985ca3 100644 --- a/ext/phar/tests/zip/open_for_write_existing_c.phpt +++ b/ext/phar/tests/zip/open_for_write_existing_c.phpt @@ -29,9 +29,7 @@ $phar->stopBuffering(); ini_set('phar.readonly', 1); -$fp = fopen($alias . '/b/c.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($alias . '/b/c.php', 'wb')); include $alias . '/b/c.php'; ?> ===DONE=== @@ -39,9 +37,6 @@ include $alias . '/b/c.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_existing_c.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d +bool(false) This is b/c ===DONE=== diff --git a/ext/phar/tests/zip/open_for_write_newfile_b.phpt b/ext/phar/tests/zip/open_for_write_newfile_b.phpt index 134bb4f0dd..30e33293af 100644 --- a/ext/phar/tests/zip/open_for_write_newfile_b.phpt +++ b/ext/phar/tests/zip/open_for_write_newfile_b.phpt @@ -29,9 +29,7 @@ $phar->stopBuffering(); ini_set('phar.readonly', 1); -$fp = fopen($alias . '/b/new.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($alias . '/b/new.php', 'wb')); include $alias . '/b/c.php'; include $alias . '/b/new.php'; @@ -42,10 +40,7 @@ include $alias . '/b/new.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d +bool(false) This is b/c Warning: include(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.zip" in %sopen_for_write_newfile_b.php on line %d diff --git a/ext/phar/tests/zip/open_for_write_newfile_c.phpt b/ext/phar/tests/zip/open_for_write_newfile_c.phpt index 86e33da7c9..415547d5a1 100644 --- a/ext/phar/tests/zip/open_for_write_newfile_c.phpt +++ b/ext/phar/tests/zip/open_for_write_newfile_c.phpt @@ -29,9 +29,7 @@ $phar->stopBuffering(); ini_set('phar.readonly', 1); -$fp = fopen($alias . '/b/new.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); +var_dump(fopen($alias . '/b/new.php', 'wb')); include $alias . '/b/c.php'; include $alias . '/b/new.php'; @@ -42,10 +40,7 @@ include $alias . '/b/new.php'; <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?> --EXPECTF-- Warning: fopen(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d - -Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d - -Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d +bool(false) This is b/c Warning: include(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.zip" in %sopen_for_write_newfile_c.php on line %d diff --git a/ext/phar/tests/zip/phar_commitwrite.phpt b/ext/phar/tests/zip/phar_commitwrite.phpt index fa9efc7bd2..163622e4dd 100644 --- a/ext/phar/tests/zip/phar_commitwrite.phpt +++ b/ext/phar/tests/zip/phar_commitwrite.phpt @@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi'; $p->stopBuffering(); var_dump($p->getStub()); $p->setStub("<?php -function __autoload(\$class) -{ +spl_autoload_register(function(\$class) { include 'phar://' . str_replace('_', '/', \$class); -} +}); Phar::mapPhar('phar_commitwrite.phar'); include 'phar://phar_commitwrite.phar/startup.php'; __HALT_COMPILER(); @@ -32,10 +31,9 @@ unlink(dirname(__FILE__) . '/phar_commitwrite.phar.zip'); string(60) "<?php // zip-based phar archive stub file __HALT_COMPILER();" string(%d) "<?php -function __autoload($class) -{ +spl_autoload_register(function($class) { include 'phar://' . str_replace('_', '/', $class); -} +}); Phar::mapPhar('phar_commitwrite.phar'); include 'phar://phar_commitwrite.phar/startup.php'; __HALT_COMPILER(); ?> diff --git a/ext/posix/tests/posix_errno_error.phpt b/ext/posix/tests/posix_errno_error.phpt deleted file mode 100644 index 0a77fb0009..0000000000 --- a/ext/posix/tests/posix_errno_error.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Test function posix_errno() by calling it with its expected arguments ---SKIPIF-- -<?php - if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; -?> ---CREDITS-- -Morten Amundsen mor10am@gmail.com -Francesco Fullone ff@ideato.it -#PHPTestFest Cesena Italia on 2009-06-20 ---FILE-- -<?php - -echo "*** Test by calling method or function with more than expected arguments ***\n"; - -// test without any error -var_dump(posix_errno('bar')); - -?> ---EXPECTF-- -*** Test by calling method or function with more than expected arguments *** - -Warning: posix_errno() expects exactly 0 parameters, 1 given in %s on line %d -NULL diff --git a/ext/posix/tests/posix_getcwd.phpt b/ext/posix/tests/posix_getcwd.phpt index 20f7b0372e..f6f180925a 100644 --- a/ext/posix/tests/posix_getcwd.phpt +++ b/ext/posix/tests/posix_getcwd.phpt @@ -9,11 +9,7 @@ if (!function_exists('posix_getcwd')) die('skip posix_getcwd() not found'); <?php var_dump(posix_getcwd()); -var_dump(posix_getcwd(1)); ?> --EXPECTF-- string(%d) "%s" - -Warning: posix_getcwd() expects exactly 0 parameters, 1 given in %s on line %d -NULL diff --git a/ext/posix/tests/posix_getgrgid_error.phpt b/ext/posix/tests/posix_getgrgid_error.phpt index ef7fa57a9d..e9dbe2a6ce 100644 --- a/ext/posix/tests/posix_getgrgid_error.phpt +++ b/ext/posix/tests/posix_getgrgid_error.phpt @@ -14,17 +14,6 @@ Test posix_getgrgid() function : error conditions echo "*** Testing posix_getgrgid() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing posix_getgrgid() function with Zero arguments --\n"; -var_dump( posix_getgrgid() ); - -//Test posix_getgrgid with one more than the expected number of arguments -echo "\n-- Testing posix_getgrgid() function with more than expected no. of arguments --\n"; - -$extra_arg = 10; -$gid = 0; -var_dump( posix_getgrgid($gid, $extra_arg) ); - echo "\n-- Testing posix_getgrgid() function with a negative group id --\n"; $gid = -999; var_dump( posix_getgrgid($gid)); @@ -34,16 +23,6 @@ echo "Done"; --EXPECTF-- *** Testing posix_getgrgid() : error conditions *** --- Testing posix_getgrgid() function with Zero arguments -- - -Warning: posix_getgrgid() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing posix_getgrgid() function with more than expected no. of arguments -- - -Warning: posix_getgrgid() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing posix_getgrgid() function with a negative group id -- bool(false) Done diff --git a/ext/posix/tests/posix_getpgid_error.phpt b/ext/posix/tests/posix_getpgid_error.phpt index 88d68554ee..19e306b2ee 100644 --- a/ext/posix/tests/posix_getpgid_error.phpt +++ b/ext/posix/tests/posix_getpgid_error.phpt @@ -16,14 +16,6 @@ if((!extension_loaded("posix")) || (!function_exists("posix_getpgid"))) { echo "*** Testing posix_getpgid() : error conditions ***\n"; -echo "\n-- Testing posix_getpgid() function no arguments --\n"; -var_dump( posix_getpgid() ); - -echo "\n-- Testing posix_getpgid() with one extra argument --\n"; -$pid = 10; -$extra_arg = 20; -var_dump( posix_getpgid($pid, $extra_arg) ); - echo "\n-- Testing posix_getpgid() with negative pid --\n"; $pid = -99; var_dump( posix_getpgid($pid) ); @@ -33,16 +25,6 @@ echo "Done"; --EXPECTF-- *** Testing posix_getpgid() : error conditions *** --- Testing posix_getpgid() function no arguments -- - -Warning: posix_getpgid() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing posix_getpgid() with one extra argument -- - -Warning: posix_getpgid() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing posix_getpgid() with negative pid -- bool(false) Done diff --git a/ext/posix/tests/posix_getpwuid_error.phpt b/ext/posix/tests/posix_getpwuid_error.phpt index 440edf6a76..365033b689 100644 --- a/ext/posix/tests/posix_getpwuid_error.phpt +++ b/ext/posix/tests/posix_getpwuid_error.phpt @@ -14,14 +14,6 @@ Test posix_getpwuid() function : error conditions echo "*** Testing posix_getpwuid() : error conditions ***\n"; -echo "\n-- Testing posix_getpwuid() function with Zero arguments --\n"; -var_dump( posix_getpwuid() ); - -echo "\n-- Testing posix_getpwuid() function with more than expected no. of arguments --\n"; -$uid = posix_getuid(); -$extra_arg = 10; -var_dump( posix_getpwuid($uid, $extra_arg) ); - echo "\n-- Testing posix_getpwuid() function negative uid --\n"; $uid = -99; var_dump( posix_getpwuid($uid) ); @@ -31,16 +23,6 @@ echo "Done"; --EXPECTF-- *** Testing posix_getpwuid() : error conditions *** --- Testing posix_getpwuid() function with Zero arguments -- - -Warning: posix_getpwuid() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing posix_getpwuid() function with more than expected no. of arguments -- - -Warning: posix_getpwuid() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing posix_getpwuid() function negative uid -- bool(false) Done diff --git a/ext/posix/tests/posix_getsid_error.phpt b/ext/posix/tests/posix_getsid_error.phpt index 6013a40b96..833ae9a0db 100644 --- a/ext/posix/tests/posix_getsid_error.phpt +++ b/ext/posix/tests/posix_getsid_error.phpt @@ -13,16 +13,9 @@ PHP Testfest Berlin 2009-05-10 ?> --FILE-- <?php -var_dump( posix_getsid() ); -var_dump( posix_getsid(array()) ); var_dump( posix_getsid(-1) ); ?> ===DONE=== --EXPECTF-- -Warning: posix_getsid() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: posix_getsid() expects parameter 1 to be int, array given in %s on line %d -bool(false) bool(false) ===DONE=== diff --git a/ext/posix/tests/posix_initgroups.phpt b/ext/posix/tests/posix_initgroups.phpt index 5b0ec8adad..20cf8cef8b 100644 --- a/ext/posix/tests/posix_initgroups.phpt +++ b/ext/posix/tests/posix_initgroups.phpt @@ -8,11 +8,8 @@ if (!function_exists('posix_initgroups')) die('skip posix_initgroups() not found --FILE-- <?php -var_dump(posix_initgroups('foo', 'bar')); var_dump(posix_initgroups(NULL, NULL)); ?> --EXPECTF-- -Warning: posix_initgroups() expects parameter 2 to be int, string given in %s on line %d -bool(false) bool(false) diff --git a/ext/posix/tests/posix_kill_error.phpt b/ext/posix/tests/posix_kill_error.phpt index 0c8f6ef642..89474c4994 100644 --- a/ext/posix/tests/posix_kill_error.phpt +++ b/ext/posix/tests/posix_kill_error.phpt @@ -16,16 +16,6 @@ Test posix_kill() function : error conditions echo "*** Testing posix_kill() : error conditions ***\n"; -echo "\n-- Testing posix_kill() function with more than expected no. of arguments --\n"; -$pid = posix_getpid(); -$sig = 9; -$extra_arg = 10; -var_dump( posix_kill($pid, $sig, $extra_arg) ); - -echo "\n-- Testing posix_kill() function with less than expected no. of arguments --\n"; -$pid = posix_getpid(); -var_dump( posix_kill($pid) ); - echo "\n-- Testing posix_kill() function with invalid signal --\n"; $pid = posix_getpid(); $sig = 999; @@ -41,16 +31,6 @@ echo "Done"; --EXPECTF-- *** Testing posix_kill() : error conditions *** --- Testing posix_kill() function with more than expected no. of arguments -- - -Warning: posix_kill() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - --- Testing posix_kill() function with less than expected no. of arguments -- - -Warning: posix_kill() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - -- Testing posix_kill() function with invalid signal -- bool(false) diff --git a/ext/posix/tests/posix_seteuid_variation4.phpt b/ext/posix/tests/posix_seteuid_variation4.phpt deleted file mode 100644 index 4224bafa82..0000000000 --- a/ext/posix/tests/posix_seteuid_variation4.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test function posix_seteuid() by substituting argument 1 with float values. ---SKIPIF-- -<?php - PHP_INT_SIZE == 4 or die("skip - 32-bit only"); - if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; - if(posix_geteuid() == 0) print "skip - Cannot run test as root."; -?> ---CREDITS-- -Marco Fabbri mrfabbri@gmail.com -Francesco Fullone ff@ideato.it -#PHPTestFest Cesena Italia on 2009-06-20 ---FILE-- -<?php - - -echo "*** Test substituting argument 1 with float values ***\n"; - -$myUid = posix_getuid(); - -$myUid = $myUid - 1.1; - -$variation_array = array( - 'float '.$myUid => $myUid, - 'float -'.$myUid => -$myUid, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - ); - - -foreach ( $variation_array as $var ) { - var_dump(posix_seteuid( $var ) ); -} -?> ---EXPECTF-- -*** Test substituting argument 1 with float values *** -bool(false) -bool(false) - -Warning: posix_seteuid() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: posix_seteuid() expects parameter 1 to be int, float given in %s on line %d -bool(false) -bool(false) diff --git a/ext/posix/tests/posix_setgid_variation4.phpt b/ext/posix/tests/posix_setgid_variation4.phpt deleted file mode 100644 index d85b5a900a..0000000000 --- a/ext/posix/tests/posix_setgid_variation4.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test function posix_setgid() by substituting argument 1 with float values. ---SKIPIF-- -<?php - PHP_INT_SIZE == 4 or die("skip - 32-bit only"); - if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; - if(posix_geteuid() == 0) print "skip - Cannot run test as root."; -?> ---CREDITS-- -Marco Fabbri mrfabbri@gmail.com -Francesco Fullone ff@ideato.it -#PHPTestFest Cesena Italia on 2009-06-20 ---FILE-- -<?php - - -echo "*** Test substituting argument 1 with float values ***\n"; - - - -$variation_array = array( - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - ); - - -foreach ( $variation_array as $var ) { - var_dump(posix_setgid( $var ) ); -} -?> -===DONE=== ---EXPECTF-- -*** Test substituting argument 1 with float values *** -bool(false) -bool(false) - -Warning: posix_setgid() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: posix_setgid() expects parameter 1 to be int, float given in %s on line %d -bool(false) -bool(false) -===DONE=== diff --git a/ext/posix/tests/posix_setuid_variation4.phpt b/ext/posix/tests/posix_setuid_variation4.phpt deleted file mode 100644 index 7423ba324e..0000000000 --- a/ext/posix/tests/posix_setuid_variation4.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test function posix_setuid() by substituting argument 1 with float values. ---SKIPIF-- -<?php - PHP_INT_SIZE == 4 or die("skip - 32-bit only"); - if(!extension_loaded("posix")) print "skip - POSIX extension not loaded"; - if(posix_geteuid() == 0) print "skip - Cannot run test as root."; -?> ---CREDITS-- -Marco Fabbri mrfabbri@gmail.com -Francesco Fullone ff@ideato.it -#PHPTestFest Cesena Italia on 2009-06-20 ---FILE-- -<?php - - -echo "*** Test substituting argument 1 with float values ***\n"; - -$myUid = posix_getuid(); - -$myUid = $myUid - 1.1; - -$variation_array = array( - 'float '.$myUid => $myUid, - 'float -'.$myUid => -$myUid, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - ); - - -foreach ( $variation_array as $var ) { - var_dump(posix_setuid( $var ) ); -} -?> ---EXPECTF-- -*** Test substituting argument 1 with float values *** -bool(false) -bool(false) - -Warning: posix_setuid() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: posix_setuid() expects parameter 1 to be int, float given in %s on line %d -bool(false) -bool(false) diff --git a/ext/posix/tests/posix_strerror_error.phpt b/ext/posix/tests/posix_strerror_error.phpt index 3007f976c6..60b096656a 100644 --- a/ext/posix/tests/posix_strerror_error.phpt +++ b/ext/posix/tests/posix_strerror_error.phpt @@ -14,14 +14,6 @@ Test posix_strerror() function : error conditions echo "*** Testing posix_strerror() : error conditions ***\n"; -echo "\n-- Testing posix_strerror() function with Zero arguments --\n"; -var_dump( posix_strerror() ); - -echo "\n-- Testing posix_strerror() function with more than expected no. of arguments --\n"; -$errno = posix_get_last_error(); -$extra_arg = 10; -var_dump( posix_strerror($errno, $extra_arg) ); - echo "\n-- Testing posix_strerror() function with invalid error number --\n"; $errno = -999; echo gettype( posix_strerror($errno) )."\n"; @@ -31,16 +23,6 @@ echo "Done"; --EXPECTF-- *** Testing posix_strerror() : error conditions *** --- Testing posix_strerror() function with Zero arguments -- - -Warning: posix_strerror() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing posix_strerror() function with more than expected no. of arguments -- - -Warning: posix_strerror() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing posix_strerror() function with invalid error number -- string Done diff --git a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt index 158a2d0ca7..ba340db300 100644 --- a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt +++ b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt @@ -20,14 +20,11 @@ PHP Testfest Berlin 2009-05-10 ?> --FILE-- <?php - var_dump(posix_ttyname()); // param missing var_dump(posix_ttyname(0)); // param not a ressource var_dump(posix_ttyname(imagecreate(1, 1))); // wrong resource type ?> ===DONE=== --EXPECTF-- -Warning: posix_ttyname() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) bool(false) Warning: posix_ttyname(): supplied resource is not a valid stream resource in %s on line %d diff --git a/ext/posix/tests/posix_ttyname_variation6.phpt b/ext/posix/tests/posix_ttyname_variation6.phpt index eecae6769e..691c5eea7e 100644 --- a/ext/posix/tests/posix_ttyname_variation6.phpt +++ b/ext/posix/tests/posix_ttyname_variation6.phpt @@ -18,7 +18,7 @@ echo "*** Test substituting argument 1 with object values ***\n"; -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { if (error_reporting() != 0) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; diff --git a/ext/pspell/tests/002.phpt b/ext/pspell/tests/002.phpt index 1b0dc2cdfa..538775d013 100644 --- a/ext/pspell/tests/002.phpt +++ b/ext/pspell/tests/002.phpt @@ -10,15 +10,12 @@ if (!@pspell_new('en')) die('skip English dictionary is not available'); $p = pspell_new('en'); -var_dump(pspell_check('a')); var_dump(pspell_check($p, 'somebogusword')); var_dump(pspell_add_to_session($p, '')); var_dump(pspell_add_to_session($p, 'somebogusword')); var_dump(pspell_check($p, 'somebogusword')); -var_dump(pspell_clear_session(new stdclass)); - $res = @pspell_clear_session($p); if ($res) { var_dump($res); @@ -29,14 +26,9 @@ if ($res) { } ?> --EXPECTF-- -Warning: pspell_check() expects exactly 2 parameters, 1 given in %s on line %d -NULL bool(false) bool(false) bool(true) bool(true) - -Warning: pspell_clear_session() expects parameter 1 to be int, object given in %s on line %d -NULL bool(true) bool(false) diff --git a/ext/readline/tests/libedit_callback_handler_install_001.phpt b/ext/readline/tests/libedit_callback_handler_install_001.phpt index b5d921e279..fb69ba5cb0 100644 --- a/ext/readline/tests/libedit_callback_handler_install_001.phpt +++ b/ext/readline/tests/libedit_callback_handler_install_001.phpt @@ -13,7 +13,6 @@ function foo() { var_dump(readline_callback_handler_install('testing: ', 'foo')); var_dump(readline_callback_handler_install('testing: ', 'foobar!')); -var_dump(readline_callback_handler_install('testing: ')); ?> --EXPECTF-- @@ -21,6 +20,3 @@ bool(true) Warning: readline_callback_handler_install(): foobar! is not callable in %s on line %d bool(false) - -Warning: readline_callback_handler_install() expects exactly 2 parameters, 1 given in %s on line %d -NULL diff --git a/ext/readline/tests/readline_add_history_001.phpt b/ext/readline/tests/readline_add_history_001.phpt index a4bd524736..fe7c8c406e 100644 --- a/ext/readline/tests/readline_add_history_001.phpt +++ b/ext/readline/tests/readline_add_history_001.phpt @@ -10,7 +10,6 @@ var_dump(readline_list_history()); var_dump(readline_add_history(NULL)); var_dump(readline_list_history()); var_dump(readline_clear_history()); -var_dump(readline_add_history()); ?> --EXPECTF-- @@ -27,6 +26,3 @@ array(2) { string(0) "" } bool(true) - -Warning: readline_add_history() expects exactly 1 parameter, 0 given in %s on line %d -NULL diff --git a/ext/readline/tests/readline_callback_handler_install_001.phpt b/ext/readline/tests/readline_callback_handler_install_001.phpt index cc054b0aa6..9dd13b4de1 100644 --- a/ext/readline/tests/readline_callback_handler_install_001.phpt +++ b/ext/readline/tests/readline_callback_handler_install_001.phpt @@ -13,7 +13,6 @@ function foo() { var_dump(readline_callback_handler_install('testing: ', 'foo')); var_dump(readline_callback_handler_install('testing: ', 'foobar!')); -var_dump(readline_callback_handler_install('testing: ')); ?> --EXPECTF-- @@ -21,6 +20,3 @@ var_dump(readline_callback_handler_install('testing: ')); Warning: readline_callback_handler_install(): foobar! is not callable in %s on line %d bool(false) - -Warning: readline_callback_handler_install() expects exactly 2 parameters, 1 given in %s on line %d -NULL diff --git a/ext/readline/tests/readline_clear_history_001.phpt b/ext/readline/tests/readline_clear_history_001.phpt index 5df1ae77a0..8dea376ccf 100644 --- a/ext/readline/tests/readline_clear_history_001.phpt +++ b/ext/readline/tests/readline_clear_history_001.phpt @@ -6,11 +6,7 @@ readline_clear_history(): Basic test <?php var_dump(readline_clear_history()); -var_dump(readline_clear_history(1)); ?> --EXPECTF-- bool(true) - -Warning: readline_clear_history() expects exactly 0 parameters, 1 given in %s on line %d -NULL diff --git a/ext/readline/tests/readline_list_history_001.phpt b/ext/readline/tests/readline_list_history_001.phpt index 2f6f9525d2..37e1b0af17 100644 --- a/ext/readline/tests/readline_list_history_001.phpt +++ b/ext/readline/tests/readline_list_history_001.phpt @@ -6,12 +6,8 @@ readline_list_history(): Basic test <?php var_dump(readline_list_history()); -var_dump(readline_list_history(1)); ?> --EXPECTF-- array(0) { } - -Warning: readline_list_history() expects exactly 0 parameters, 1 given in %s on line %d -NULL diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 4c6f6f9aa4..0510994b89 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -55,11 +55,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) #define REFLECTION_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(reflection, v) #define reflection_update_property(object, name, value) do { \ - zval member; \ - ZVAL_STR(&member, name); \ - zend_std_write_property(object, &member, value, NULL); \ + zend_std_write_property(Z_OBJ_P(object), name, value, NULL); \ Z_TRY_DELREF_P(value); \ - zval_ptr_dtor(&member); \ } while (0) #define reflection_update_property_name(object, value) \ @@ -248,9 +245,9 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */ } /* }}} */ -static HashTable *reflection_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */ +static HashTable *reflection_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */ { - reflection_object *intern = Z_REFLECTION_P(obj); + reflection_object *intern = reflection_object_from_obj(obj); *gc_data = &intern->obj; *gc_data_count = 1; return zend_std_get_properties(obj); @@ -447,7 +444,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char smart_str_append_printf(str, "%s }\n", indent); if (obj && Z_TYPE_P(obj) == IS_OBJECT) { - HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(obj); + HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(Z_OBJ_P(obj)); zend_string *prop_name; smart_str prop_str = {0}; @@ -1848,7 +1845,7 @@ ZEND_METHOD(reflection_function, invoke) if (!Z_ISUNDEF(intern->obj)) { Z_OBJ_HT(intern->obj)->get_closure( - &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object); + Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object); } result = zend_call_function(&fci, &fcc); @@ -1911,7 +1908,7 @@ ZEND_METHOD(reflection_function, invokeArgs) if (!Z_ISUNDEF(intern->obj)) { Z_OBJ_HT(intern->obj)->get_closure( - &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object); + Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object); } result = zend_call_function(&fci, &fcc); @@ -2349,9 +2346,7 @@ ZEND_METHOD(reflection_parameter, __construct) position= (int)Z_LVAL_P(parameter); if (position < 0 || (uint32_t)position >= num_args) { if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) { - if (fptr->type != ZEND_OVERLOADED_FUNCTION) { - zend_string_release_ex(fptr->common.function_name, 0); - } + zend_string_release_ex(fptr->common.function_name, 0); zend_free_trampoline(fptr); } if (is_closure) { @@ -2388,9 +2383,7 @@ ZEND_METHOD(reflection_parameter, __construct) } if (position == -1) { if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) { - if (fptr->type != ZEND_OVERLOADED_FUNCTION) { - zend_string_release_ex(fptr->common.function_name, 0); - } + zend_string_release_ex(fptr->common.function_name, 0); zend_free_trampoline(fptr); } if (is_closure) { @@ -3186,7 +3179,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic) } /* }}} */ -/* {{{ proto public mixed ReflectionMethod::invoke(mixed object, mixed* args) +/* {{{ proto public mixed ReflectionMethod::invoke(mixed object, [mixed* args]) Invokes the method. */ ZEND_METHOD(reflection_method, invoke) { @@ -4185,7 +4178,6 @@ ZEND_METHOD(reflection_class, hasProperty) zend_property_info *property_info; zend_class_entry *ce; zend_string *name; - zval property; if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) { return; @@ -4199,12 +4191,9 @@ ZEND_METHOD(reflection_class, hasProperty) RETURN_TRUE; } else { if (Z_TYPE(intern->obj) != IS_UNDEF) { - ZVAL_STR_COPY(&property, name); - if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, NULL)) { - zval_ptr_dtor(&property); + if (Z_OBJ_HANDLER(intern->obj, has_property)(Z_OBJ(intern->obj), name, 2, NULL)) { RETURN_TRUE; } - zval_ptr_dtor(&property); } RETURN_FALSE; } @@ -4234,7 +4223,7 @@ ZEND_METHOD(reflection_class, getProperty) } } else if (Z_TYPE(intern->obj) != IS_UNDEF) { /* Check for dynamic properties */ - if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(&intern->obj), name)) { + if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj)), name)) { zend_property_info property_info_tmp; property_info_tmp.flags = ZEND_ACC_PUBLIC; property_info_tmp.name = name; @@ -4348,7 +4337,7 @@ ZEND_METHOD(reflection_class, getProperties) } ZEND_HASH_FOREACH_END(); if (Z_TYPE(intern->obj) != IS_UNDEF && (filter & ZEND_ACC_PUBLIC) != 0) { - HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(&intern->obj); + HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj)); zval *prop; ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) { _adddynproperty(prop, key, ce, return_value); @@ -4613,7 +4602,7 @@ ZEND_METHOD(reflection_class, isInstance) } /* }}} */ -/* {{{ proto public stdclass ReflectionClass::newInstance(mixed* args, ...) +/* {{{ proto public stdclass ReflectionClass::newInstance([mixed* args], ...) Returns an instance of this class */ ZEND_METHOD(reflection_class, newInstance) { @@ -5253,7 +5242,7 @@ ZEND_METHOD(reflection_property, __construct) && property_info->ce != ce)) { /* Check for dynamic properties */ if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT) { - if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(classname), name)) { + if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(Z_OBJ_P(classname)), name)) { dynam_prop = 1; } } @@ -5519,7 +5508,6 @@ ZEND_METHOD(reflection_property, isInitialized) } RETURN_FALSE; } else { - zval name_zv; zend_class_entry *old_scope; int retval; @@ -5534,8 +5522,7 @@ ZEND_METHOD(reflection_property, isInitialized) old_scope = EG(fake_scope); EG(fake_scope) = intern->ce; - ZVAL_STR(&name_zv, ref->unmangled_name); - retval = Z_OBJ_HT_P(object)->has_property(object, &name_zv, ZEND_PROPERTY_EXISTS, NULL); + retval = Z_OBJ_HT_P(object)->has_property(Z_OBJ_P(object), ref->unmangled_name, ZEND_PROPERTY_EXISTS, NULL); EG(fake_scope) = old_scope; RETVAL_BOOL(retval); @@ -6284,7 +6271,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_function___construct, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_invoke, 0, 0, 0) - ZEND_ARG_INFO(0, args) + ZEND_ARG_VARIADIC_INFO(0, args) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_reflection_function_invokeArgs, 0) @@ -6362,9 +6349,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method___construct, 0, 0, 1) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invoke, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method_invoke, 0, 0, 1) ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, args) + ZEND_ARG_VARIADIC_INFO(0, args) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invokeArgs, 0) @@ -6458,8 +6445,8 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isInstance, 0) ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstance, 0) - ZEND_ARG_INFO(0, args) +ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_newInstance, 0, 0, 0) + ZEND_ARG_VARIADIC_INFO(0, args) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstanceWithoutConstructor, 0) @@ -6749,20 +6736,19 @@ static const zend_function_entry reflection_ext_functions[] = { /* {{{ */ }; /* }}} */ /* {{{ _reflection_write_property */ -static zval *_reflection_write_property(zval *object, zval *member, zval *value, void **cache_slot) +static zval *_reflection_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) { - if ((Z_TYPE_P(member) == IS_STRING) - && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member)) - && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) - || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) + if (zend_hash_exists(&object->ce->properties_info, name) + && ((ZSTR_LEN(name) == sizeof("name") - 1 && !memcmp(ZSTR_VAL(name), "name", sizeof("name"))) + || (ZSTR_LEN(name) == sizeof("class") - 1 && !memcmp(ZSTR_VAL(name), "class", sizeof("class"))))) { zend_throw_exception_ex(reflection_exception_ptr, 0, - "Cannot set read-only property %s::$%s", ZSTR_VAL(Z_OBJCE_P(object)->name), Z_STRVAL_P(member)); + "Cannot set read-only property %s::$%s", ZSTR_VAL(object->ce->name), ZSTR_VAL(name)); return &EG(uninitialized_zval); } else { - return zend_std_write_property(object, member, value, cache_slot); + return zend_std_write_property(object, name, value, cache_slot); } } /* }}} */ diff --git a/ext/reflection/tests/004.phpt b/ext/reflection/tests/004.phpt index 36ae406b43..924c3fe283 100644 --- a/ext/reflection/tests/004.phpt +++ b/ext/reflection/tests/004.phpt @@ -4,7 +4,7 @@ ReflectionMethod::invoke() with non object or null value <?php class a { - function a(){ + function __construct(){ } } class b { @@ -13,7 +13,7 @@ class b { $b = new b(); $a=new ReflectionClass("a"); -$m=$a->getMethod("a"); +$m=$a->getMethod("__construct"); try { $m->invoke(null); @@ -35,9 +35,7 @@ try { echo $E->getMessage()."\n"; } -echo "===DONE===\n";?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; a has a deprecated constructor in %s on line %d -Trying to invoke non static method a::a() without an object +?> +--EXPECT-- +Trying to invoke non static method a::__construct() without an object Given object is not an instance of the class this method was declared in -===DONE=== diff --git a/ext/reflection/tests/ReflectionClass_constructor_002.phpt b/ext/reflection/tests/ReflectionClass_constructor_002.phpt index c463bb72c1..05825ba97e 100644 --- a/ext/reflection/tests/ReflectionClass_constructor_002.phpt +++ b/ext/reflection/tests/ReflectionClass_constructor_002.phpt @@ -4,7 +4,7 @@ ReflectionClass::__constructor() - bad arguments <?php try { var_dump(new ReflectionClass()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } @@ -34,7 +34,7 @@ try { try { var_dump(new ReflectionClass("stdClass", 1)); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } @@ -46,21 +46,12 @@ try { ?> --EXPECTF-- -Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3 -object(ReflectionClass)#%d (1) { - ["name"]=> - string(0) "" -} +ReflectionClass::__construct() expects exactly 1 parameter, 0 given Class does not exist Class 1 does not exist Class 1 does not exist Notice: Array to string conversion in %s on line 27 Class Array does not exist - -Warning: ReflectionClass::__construct() expects exactly 1 parameter, 2 given in %s on line 33 -object(ReflectionClass)#%d (1) { - ["name"]=> - string(0) "" -} +ReflectionClass::__construct() expects exactly 1 parameter, 2 given Class X does not exist diff --git a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt index 5260e719a3..020ac6f7f5 100644 --- a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt @@ -8,30 +8,14 @@ class C { $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; -var_dump($rc->getConstant()); -var_dump($rc->getConstant("myConst", "myConst")); var_dump($rc->getConstant(null)); var_dump($rc->getConstant(1)); var_dump($rc->getConstant(1.5)); var_dump($rc->getConstant(true)); -var_dump($rc->getConstant(array(1,2,3))); -var_dump($rc->getConstant(new C)); ?> ---EXPECTF-- +--EXPECT-- Check invalid params: - -Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 0 given in %s on line 8 -NULL - -Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 2 given in %s on line 9 -NULL bool(false) bool(false) bool(false) bool(false) - -Warning: ReflectionClass::getConstant() expects parameter 1 to be string, array given in %s on line 14 -NULL - -Warning: ReflectionClass::getConstant() expects parameter 1 to be string, object given in %s on line 15 -NULL diff --git a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt index 5db9d8f3d3..df6880aedb 100644 --- a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt @@ -9,48 +9,7 @@ class NewCtor { class ExtendsNewCtor extends NewCtor { } -class OldCtor { - function OldCtor() {} -} - -class ExtendsOldCtor extends OldCtor { -} - - -class X { - function Y() {} -} - -class Y extends X { -} - -class OldAndNewCtor { - function OldAndNewCtor() {} - function __construct() {} -} - -class NewAndOldCtor { - function __construct() {} - function NewAndOldCtor() {} -} -class B { - function B() {} -} - -class C extends B { - function C() {} -} - -class D1 extends C { - function __construct() {} -} - -class D2 extends C { -} - -$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor', - 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y'); - +$classes = array('NewCtor', 'ExtendsNewCtor'); foreach ($classes as $class) { $rc = new ReflectionClass($class); $rm = $rc->getConstructor(); @@ -63,21 +22,6 @@ foreach ($classes as $class) { } ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d +--EXPECT-- Constructor of NewCtor: __construct Constructor of ExtendsNewCtor: __construct -Constructor of OldCtor: OldCtor -Constructor of ExtendsOldCtor: OldCtor -Constructor of OldAndNewCtor: __construct -Constructor of NewAndOldCtor: __construct -Constructor of B: B -Constructor of C: C -Constructor of D1: __construct -Constructor of D2: C -No constructor for X -No constructor for Y diff --git a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt index 1eb084214b..424550f67a 100644 --- a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt @@ -13,12 +13,12 @@ $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; try { var_dump($rc->getMethod()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->getMethod("f", "f")); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -43,32 +43,24 @@ try { } try { var_dump($rc->getMethod(array(1,2,3))); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->getMethod(new C)); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- +--EXPECT-- Check invalid params: - -Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 0 given in %s on line 9 -NULL - -Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 2 given in %s on line 14 -NULL +ReflectionClass::getMethod() expects exactly 1 parameter, 0 given +ReflectionClass::getMethod() expects exactly 1 parameter, 2 given Method does not exist Method 1 does not exist Method 1.5 does not exist Method 1 does not exist - -Warning: ReflectionClass::getMethod() expects parameter 1 to be string, array given in %s on line 39 -NULL - -Warning: ReflectionClass::getMethod() expects parameter 1 to be string, object given in %s on line 44 -NULL +ReflectionClass::getMethod() expects parameter 1 to be string, array given +ReflectionClass::getMethod() expects parameter 1 to be string, object given diff --git a/ext/reflection/tests/ReflectionClass_getParentClass.phpt b/ext/reflection/tests/ReflectionClass_getParentClass.phpt index 382948d3d3..ef64de5ecb 100644 --- a/ext/reflection/tests/ReflectionClass_getParentClass.phpt +++ b/ext/reflection/tests/ReflectionClass_getParentClass.phpt @@ -10,11 +10,14 @@ class Foo {} class Bar extends Foo {} -$rc1 = new ReflectionClass("Bar"); -var_dump($rc1->getParentClass()); +$rc = new ReflectionClass("Bar"); +$parent = $rc->getParentClass(); +$grandParent = $parent->getParentClass(); +var_dump($parent, $grandParent); ?> --EXPECTF-- object(ReflectionClass)#%d (1) { ["name"]=> string(3) "Foo" } +bool(false) diff --git a/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt b/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt deleted file mode 100644 index be50dbb730..0000000000 --- a/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -ReflectionClass::getParentClass() ---CREDITS-- -Robin Fernandes <robinf@php.net> -Steve Seear <stevseea@php.net> ---FILE-- -<?php -class A {} -class B extends A {} - -$rc = new ReflectionClass('B'); -$parent = $rc->getParentClass(); -$grandParent = $parent->getParentClass(); -var_dump($parent, $grandParent); - -echo "\nTest bad params:\n"; -var_dump($rc->getParentClass(null)); -var_dump($rc->getParentClass('x')); -var_dump($rc->getParentClass('x', 123)); - -?> ---EXPECTF-- -object(ReflectionClass)#%d (1) { - ["name"]=> - string(1) "A" -} -bool(false) - -Test bad params: - -Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 2 given in %s on line %d -NULL diff --git a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt index 68522e097a..d9a2ebcd71 100644 --- a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt @@ -13,12 +13,12 @@ $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; try { var_dump($rc->getProperty()); -} catch (exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->getProperty("a", "a")); -} catch (exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -43,30 +43,22 @@ try { } try { var_dump($rc->getProperty(array(1,2,3))); -} catch (exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->getProperty(new C)); -} catch (exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- +--EXPECT-- Check invalid params: - -Warning: ReflectionClass::getProperty() expects exactly 1 parameter, 0 given in %s on line 9 -NULL - -Warning: ReflectionClass::getProperty() expects exactly 1 parameter, 2 given in %s on line 14 -NULL +ReflectionClass::getProperty() expects exactly 1 parameter, 0 given +ReflectionClass::getProperty() expects exactly 1 parameter, 2 given Property does not exist Property 1 does not exist Property 1.5 does not exist Property 1 does not exist - -Warning: ReflectionClass::getProperty() expects parameter 1 to be string, array given in %s on line 39 -NULL - -Warning: ReflectionClass::getProperty() expects parameter 1 to be string, object given in %s on line 44 -NULL +ReflectionClass::getProperty() expects parameter 1 to be string, array given +ReflectionClass::getProperty() expects parameter 1 to be string, object given diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt index 52fa378eb6..7c071e5ba0 100644 --- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt +++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt @@ -12,12 +12,12 @@ class C { $rc = new ReflectionClass('C'); try { var_dump($rc->getStaticPropertyValue("x", "default value", 'blah')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->getStaticPropertyValue()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -32,20 +32,15 @@ try { } try { var_dump($rc->getStaticPropertyValue(array(1,2,3))); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- -Warning: ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given in %s on line 8 -NULL - -Warning: ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given in %s on line 13 -NULL +--EXPECT-- +ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given +ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given Class C does not have a property named string(3) "def" - -Warning: ReflectionClass::getStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 28 -NULL +ReflectionClass::getStaticPropertyValue() expects parameter 1 to be string, array given diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt index 14c847401d..257d9aa9da 100644 --- a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt +++ b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt @@ -11,30 +11,14 @@ class C { $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; -var_dump($rc->hasConstant()); -var_dump($rc->hasConstant("myConst", "myConst")); var_dump($rc->hasConstant(null)); var_dump($rc->hasConstant(1)); var_dump($rc->hasConstant(1.5)); var_dump($rc->hasConstant(true)); -var_dump($rc->hasConstant(array(1,2,3))); -var_dump($rc->hasConstant(new C)); ?> ---EXPECTF-- +--EXPECT-- Check invalid params: - -Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 0 given in %s on line 8 -NULL - -Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 2 given in %s on line 9 -NULL bool(false) bool(false) bool(false) bool(false) - -Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, array given in %s on line 14 -NULL - -Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, object given in %s on line 15 -NULL diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt index 63fe8791fc..77f2865a31 100644 --- a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt +++ b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt @@ -11,30 +11,14 @@ class C { $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; -var_dump($rc->hasMethod()); -var_dump($rc->hasMethod("f", "f")); var_dump($rc->hasMethod(null)); var_dump($rc->hasMethod(1)); var_dump($rc->hasMethod(1.5)); var_dump($rc->hasMethod(true)); -var_dump($rc->hasMethod(array(1,2,3))); -var_dump($rc->hasMethod(new C)); ?> ---EXPECTF-- +--EXPECT-- Check invalid params: - -Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 0 given in %s on line 8 -NULL - -Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 2 given in %s on line 9 -NULL bool(false) bool(false) bool(false) bool(false) - -Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, array given in %s on line 14 -NULL - -Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, object given in %s on line 15 -NULL diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt index 753890394f..a1bbb9e73c 100644 --- a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt +++ b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt @@ -11,30 +11,14 @@ class C { $rc = new ReflectionClass("C"); echo "Check invalid params:\n"; -var_dump($rc->hasProperty()); -var_dump($rc->hasProperty("a", "a")); var_dump($rc->hasProperty(null)); var_dump($rc->hasProperty(1)); var_dump($rc->hasProperty(1.5)); var_dump($rc->hasProperty(true)); -var_dump($rc->hasProperty(array(1,2,3))); -var_dump($rc->hasProperty(new C)); ?> --EXPECTF-- Check invalid params: - -Warning: ReflectionClass::hasProperty() expects exactly 1 parameter, 0 given in %s on line 8 -NULL - -Warning: ReflectionClass::hasProperty() expects exactly 1 parameter, 2 given in %s on line 9 -NULL bool(false) bool(false) bool(false) bool(false) - -Warning: ReflectionClass::hasProperty() expects parameter 1 to be string, array given in %s on line 14 -NULL - -Warning: ReflectionClass::hasProperty() expects parameter 1 to be string, object given in %s on line 15 -NULL diff --git a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt index 91398867ec..b0deab33da 100644 --- a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt +++ b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt @@ -41,12 +41,12 @@ foreach ($rcs as $childName => $child) { echo "\n\nTest bad arguments:\n"; try { var_dump($rcs['A']->implementsInterface()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rcs['A']->implementsInterface('C', 'C')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -144,12 +144,8 @@ Does I2 implement I2? Test bad arguments: - -Warning: ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given in %s on line 37 -NULL - -Warning: ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given in %s on line 42 -NULL +ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given +ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given Parameter one must either be a string or a ReflectionClass object Interface ThisClassDoesNotExist does not exist Parameter one must either be a string or a ReflectionClass object diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt index 1378edd3d2..e688b40f46 100644 --- a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt +++ b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt @@ -17,39 +17,16 @@ class privateCtorNew { private function __construct() {} } -class publicCtorOld { - public function publicCtorOld() {} -} - -class protectedCtorOld { - protected function protectedCtorOld() {} -} - -class privateCtorOld { - private function privateCtorOld() {} -} - - -$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew", - "publicCtorOld", "protectedCtorOld", "privateCtorOld"); - -foreach($classes as $class ) { +$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew"); +foreach ($classes as $class) { $reflectionClass = new ReflectionClass($class); echo "Is $class instantiable? "; var_dump($reflectionClass->IsInstantiable()); } ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; protectedCtorOld has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d +--EXPECT-- Is noCtor instantiable? bool(true) Is publicCtorNew instantiable? bool(true) Is protectedCtorNew instantiable? bool(false) Is privateCtorNew instantiable? bool(false) -Is publicCtorOld instantiable? bool(true) -Is protectedCtorOld instantiable? bool(false) -Is privateCtorOld instantiable? bool(false) diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt index 10a86d9136..af4ce9d2f4 100644 --- a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt +++ b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt @@ -35,16 +35,6 @@ foreach($classes as $class) { var_dump($rc->isIterateable()); } -echo "\nTest invalid params:\n"; -$rc = new ReflectionClass('IteratorImpl'); -var_dump($rc->isIterateable(null)); -var_dump($rc->isIterateable(null, null)); -var_dump($rc->isIterateable(1)); -var_dump($rc->isIterateable(1.5)); -var_dump($rc->isIterateable(true)); -var_dump($rc->isIterateable('X')); -var_dump($rc->isIterateable(null)); - echo "\nTest static invocation:\n"; ReflectionClass::isIterateable(); @@ -61,32 +51,9 @@ Is ExtendsIteratorImpl iterable? bool(true) Is ExtendsIteratorAggregateImpl iterable? bool(true) Is A iterable? bool(false) -Test invalid params: - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 34 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 2 given in %s on line 35 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 36 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 37 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 38 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 39 -NULL - -Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 40 -NULL - Test static invocation: -Fatal error: Uncaught Error: Non-static method ReflectionClass::isIterateable() cannot be called statically in %s:43 +Fatal error: Uncaught Error: Non-static method ReflectionClass::isIterateable() cannot be called statically in %s:%d Stack trace: #0 {main} - thrown in %s on line 43 + thrown in %s on line %d diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt index 368ea7d7ec..03d17e223e 100644 --- a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt +++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt @@ -11,12 +11,12 @@ $rc = new ReflectionClass('A'); echo "\n\nTest bad arguments:\n"; try { var_dump($rc->isSubclassOf()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->isSubclassOf('C', 'C')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -35,14 +35,10 @@ try { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- +--EXPECT-- Test bad arguments: - -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 7 -NULL - -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 12 -NULL +ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given +ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given Parameter one must either be a string or a ReflectionClass object Class ThisClassDoesNotExist does not exist Parameter one must either be a string or a ReflectionClass object diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt index 068710311d..11bd44077f 100644 --- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt @@ -5,11 +5,6 @@ Robin Fernandes <robinf@php.net> Steve Seear <stevseea@php.net> --FILE-- <?php -class A { - public function A() { - echo "In constructor of class A\n"; - } -} class B { public function __construct($a, $b) { @@ -32,28 +27,17 @@ class E { } -$rcA = new ReflectionClass('A'); $rcB = new ReflectionClass('B'); $rcC = new ReflectionClass('C'); $rcD = new ReflectionClass('D'); $rcE = new ReflectionClass('E'); try { - var_dump($rcA->newInstanceArgs()); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; -} -try { - var_dump($rcA->newInstanceArgs(array('x'))); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; -} - -try { var_dump($rcB->newInstanceArgs()); } catch (Throwable $e) { echo "Exception: " . $e->getMessage() . "\n"; } + try { var_dump($rcB->newInstanceArgs(array('x', 123))); } catch (Throwable $e) { @@ -85,13 +69,6 @@ try { } ?> --EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d -In constructor of class A -object(A)#%d (0) { -} -In constructor of class A -object(A)#%d (0) { -} Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected In constructor of class B with args x, 123 object(B)#%d (0) { diff --git a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt index c91d2ee958..bf68098a7d 100644 --- a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt @@ -5,11 +5,6 @@ Robin Fernandes <robinf@php.net> Steve Seear <stevseea@php.net> --FILE-- <?php -class A { - public function A() { - echo "In constructor of class A\n"; - } -} class B { public function __construct($a, $b) { @@ -28,20 +23,15 @@ class D { echo "In constructor of class D\n"; } } + class E { } - -$rcA = new ReflectionClass('A'); $rcB = new ReflectionClass('B'); $rcC = new ReflectionClass('C'); $rcD = new ReflectionClass('D'); $rcE = new ReflectionClass('E'); -$a1 = $rcA->newInstance(); -$a2 = $rcA->newInstance('x'); -var_dump($a1, $a2); - try { var_dump($rcB->newInstance()); } catch (Throwable $e) { @@ -78,13 +68,6 @@ try { } ?> --EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d -In constructor of class A -In constructor of class A -object(A)#%d (0) { -} -object(A)#%d (0) { -} Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected In constructor of class B with args x, 123 object(B)#%d (0) { diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt index fb472681ca..6d3cf3a44f 100644 --- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt +++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt @@ -12,17 +12,17 @@ class C { $rc = new ReflectionClass('C'); try { var_dump($rc->setStaticPropertyValue("x", "default value", 'blah')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->setStaticPropertyValue()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($rc->setStaticPropertyValue(null)); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -37,23 +37,16 @@ try { } try { var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- -Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given in %s on line 8 -NULL - -Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given in %s on line 13 -NULL - -Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given in %s on line 18 -NULL +--EXPECT-- +ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given +ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given +ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given Class C does not have a property named Class C does not have a property named 1.5 - -Warning: ReflectionClass::setStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 33 -NULL +ReflectionClass::setStaticPropertyValue() expects parameter 1 to be string, array given diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt b/ext/reflection/tests/ReflectionClass_toString_001.phpt index e97af14110..6875ff300a 100644 --- a/ext/reflection/tests/ReflectionClass_toString_001.phpt +++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt @@ -265,7 +265,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] { Method [ <internal:Reflection> public method newInstance ] { - Parameters [1] { - Parameter #0 [ <required> $args ] + Parameter #0 [ <optional> ...$args ] } } diff --git a/ext/reflection/tests/ReflectionExtension_bug66218.phpt b/ext/reflection/tests/ReflectionExtension_bug66218.phpt index 77f3d230b3..f42967c089 100644 --- a/ext/reflection/tests/ReflectionExtension_bug66218.phpt +++ b/ext/reflection/tests/ReflectionExtension_bug66218.phpt @@ -2,7 +2,6 @@ ReflectionExtension::getFunctions() ##6218 zend_register_functions breaks reflection --SKIPIF-- <?php -if (PHP_SAPI != "cli") die("skip CLI only test"); if (!function_exists("dl")) die("skip need dl"); ?> --FILE-- diff --git a/ext/reflection/tests/ReflectionMethod_006.phpt b/ext/reflection/tests/ReflectionMethod_006.phpt index 627dc96f32..81f8116d77 100644 --- a/ext/reflection/tests/ReflectionMethod_006.phpt +++ b/ext/reflection/tests/ReflectionMethod_006.phpt @@ -17,79 +17,7 @@ try { echo "Ok - ".$re->getMessage().PHP_EOL; } -class C { - public function f() {} -} - -$rm = new ReflectionMethod('C', 'f'); - -var_dump($rm->isFinal(1)); -var_dump($rm->isAbstract(1)); -var_dump($rm->isPrivate(1)); -var_dump($rm->isProtected(1)); -var_dump($rm->isPublic(1)); -var_dump($rm->isStatic(1)); -var_dump($rm->isConstructor(1)); -var_dump($rm->isDestructor(1)); -var_dump($rm->getModifiers(1)); -var_dump($rm->isInternal(1)); -var_dump($rm->isUserDefined(1)); -var_dump($rm->getFileName(1)); -var_dump($rm->getStartLine(1)); -var_dump($rm->getEndLine(1)); -var_dump($rm->getStaticVariables(1)); -var_dump($rm->getName(1)); - - ?> ---EXPECTF-- +--EXPECT-- Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 0 given Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given - -Warning: ReflectionMethod::isFinal() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isAbstract() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isProtected() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isPublic() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isStatic() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isConstructor() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::isDestructor() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::isInternal() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::isUserDefined() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::getFileName() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::getStartLine() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::getEndLine() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::getStaticVariables() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionFunctionAbstract::getName() expects exactly 0 parameters, 1 given in %s on line %d -NULL diff --git a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt index 243c59504b..da108d258d 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt @@ -19,21 +19,6 @@ echo "\nInherited new-style constructor\n"; $methodInfo = new ReflectionMethod("ExtendsNewCtor::__construct"); var_dump($methodInfo->isConstructor()); -class OldCtor { - function OldCtor() { - echo "In " . __METHOD__ . "\n"; - } -} -echo "\nOld-style constructor:\n"; -$methodInfo = new ReflectionMethod("OldCtor::OldCtor"); -var_dump($methodInfo->isConstructor()); - -class ExtendsOldCtor extends OldCtor { -} -echo "\nInherited old-style constructor:\n"; -$methodInfo = new ReflectionMethod("ExtendsOldCtor::OldCtor"); -var_dump($methodInfo->isConstructor()); - class X { function Y() { echo "In " . __METHOD__ . "\n"; @@ -49,69 +34,16 @@ echo "\nInherited method of the same name as the class:\n"; $methodInfo = new ReflectionMethod("Y::Y"); var_dump($methodInfo->isConstructor()); -class OldAndNewCtor { - function OldAndNewCtor() { - echo "In " . __METHOD__ . "\n"; - } - - function __construct() { - echo "In " . __METHOD__ . "\n"; - } -} -echo "\nOld-style constructor:\n"; -$methodInfo = new ReflectionMethod("OldAndNewCtor::OldAndNewCtor"); -var_dump($methodInfo->isConstructor()); - -echo "\nRedefined constructor:\n"; -$methodInfo = new ReflectionMethod("OldAndNewCtor::__construct"); -var_dump($methodInfo->isConstructor()); - -class NewAndOldCtor { - function __construct() { - echo "In " . __METHOD__ . "\n"; - } - - function NewAndOldCtor() { - echo "In " . __METHOD__ . "\n"; - } -} -echo "\nNew-style constructor:\n"; -$methodInfo = new ReflectionMethod("NewAndOldCtor::__construct"); -var_dump($methodInfo->isConstructor()); - -echo "\nRedefined old-style constructor:\n"; -$methodInfo = new ReflectionMethod("NewAndOldCtor::NewAndOldCtor"); -var_dump($methodInfo->isConstructor()); - ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d +--EXPECT-- New-style constructor: bool(true) Inherited new-style constructor bool(true) -Old-style constructor: -bool(true) - -Inherited old-style constructor: -bool(true) - Not a constructor: bool(false) Inherited method of the same name as the class: bool(false) - -Old-style constructor: -bool(false) - -Redefined constructor: -bool(true) - -New-style constructor: -bool(true) - -Redefined old-style constructor: -bool(false) diff --git a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt index d3b9ca3c81..d1e7ee68fb 100644 --- a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt +++ b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt @@ -35,15 +35,7 @@ $staticmethod = $staticclass->getMethod( 'foo' ); $object = new Example(); $fakeobj = new StdClass(); -echo "\n-- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments --\n"; -var_dump( $staticmethod->getClosure( 'foobar' ) ); -var_dump( $staticmethod->getClosure( 'foo', 'bar' ) ); -var_dump( $method->getClosure( $object, 'foobar' ) ); - -echo "\n-- Testing ReflectionMethod::getClosure() function with Zero arguments --\n"; -$closure = $method->getClosure(); - -echo "\n-- Testing ReflectionMethod::getClosure() function with Zero arguments --\n"; +echo "\n-- Testing ReflectionMethod::getClosure() function with invalid object --\n"; try { var_dump( $method->getClosure( $fakeobj ) ); } catch( Exception $e ) { @@ -55,19 +47,6 @@ try { --EXPECTF-- *** Testing ReflectionMethod::getClosure() : error conditions *** --- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments -- -object(Closure)#%d (0) { -} -object(Closure)#%d (0) { -} - -Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing ReflectionMethod::getClosure() function with Zero arguments -- - -Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 0 given in %s on line %d - --- Testing ReflectionMethod::getClosure() function with Zero arguments -- +-- Testing ReflectionMethod::getClosure() function with invalid object -- string(72) "Given object is not an instance of the class this method was declared in" ===DONE=== diff --git a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt index d1a19c7116..d867993599 100644 --- a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt @@ -75,13 +75,9 @@ reflectMethodModifiers("DerivedClass"); reflectMethodModifiers("TestInterface"); reflectMethodModifiers("AbstractClass"); -echo "Wrong number of params:\n"; -$a = new ReflectionMethod('TestClass::foo'); -$a->getModifiers(1); - $a = new ReflectionMethod('ReflectionMethod::getModifiers'); -echo "\nReflectionMethod::getModifiers() modifiers:\n"; +echo "ReflectionMethod::getModifiers() modifiers:\n"; printf("0x%08x\n", $a->getModifiers()); ?> @@ -234,9 +230,5 @@ Modifiers for method AbstractClass::foo(): 0x00000041 -Wrong number of params: - -Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d - ReflectionMethod::getModifiers() modifiers: 0x00000001 diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt index 0c87a66153..156cc9db52 100644 --- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt +++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt @@ -37,10 +37,6 @@ $foo = new ReflectionMethod($testClassInstance, 'foo'); $staticMethod = new ReflectionMethod('TestClass::staticMethod'); $privateMethod = new ReflectionMethod("TestClass::privateMethod"); -echo "Wrong number of parameters:\n"; -var_dump($foo->invokeArgs()); -var_dump($foo->invokeArgs(true)); - echo "\nNon-instance:\n"; try { var_dump($foo->invokeArgs(new stdClass(), array())); @@ -48,14 +44,8 @@ try { var_dump($e->getMessage()); } -echo "\nNon-object:\n"; -var_dump($foo->invokeArgs(true, array())); - echo "\nStatic method:\n"; -var_dump($staticMethod->invokeArgs()); -var_dump($staticMethod->invokeArgs(true)); -var_dump($staticMethod->invokeArgs(true, array())); var_dump($staticMethod->invokeArgs(null, array())); echo "\nPrivate method:\n"; @@ -80,32 +70,10 @@ try { ?> --EXPECTF-- -Wrong number of parameters: - -Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Non-instance: string(72) "Given object is not an instance of the class this method was declared in" -Non-object: - -Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, bool given in %s on line %d -NULL - Static method: - -Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, bool given in %s on line %d -NULL Called staticMethod() Exception: Using $this when not in object context NULL diff --git a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt index 0a2b15fb83..6711feb4ac 100644 --- a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt @@ -60,8 +60,16 @@ var_dump($methodWithArgs->invoke($testClassInstance, 1, "arg2", 3)); echo "\nStatic method:\n"; -var_dump($staticMethod->invoke()); -var_dump($staticMethod->invoke(true)); +try { + var_dump($staticMethod->invoke()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($staticMethod->invoke(true)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($staticMethod->invoke(new stdClass())); echo "\nMethod that throws an exception:\n"; @@ -94,12 +102,8 @@ Called methodWithArgs(1, arg2) NULL Static method: - -Warning: ReflectionMethod::invoke() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: ReflectionMethod::invoke() expects parameter 1 to be object, bool given in %s on line %d -NULL +ReflectionMethod::invoke() expects at least 1 parameter, 0 given +ReflectionMethod::invoke() expects parameter 1 to be object, bool given Called staticMethod() Exception: Using $this when not in object context NULL diff --git a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt index 411299f0c7..4fa86eb363 100644 --- a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt +++ b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt @@ -30,7 +30,7 @@ $testClassInstance->prop = "Hello"; echo "invoke() on a non-object:\n"; try { var_dump($foo->invoke(true)); -} catch (ReflectionException $e) { +} catch (TypeError $e) { var_dump($e->getMessage()); } @@ -59,9 +59,7 @@ try { ?> --EXPECTF-- invoke() on a non-object: - -Warning: ReflectionMethod::invoke() expects parameter 1 to be object, bool given in %s%eReflectionMethod_invoke_error1.php on line %d -NULL +string(71) "ReflectionMethod::invoke() expects parameter 1 to be object, bool given" invoke() on a non-instance: string(72) "Given object is not an instance of the class this method was declared in" diff --git a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt index aecc9b97d2..fee873fe01 100644 --- a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt @@ -9,14 +9,6 @@ class NewCtor { class ExtendsNewCtor extends NewCtor { } -class OldCtor { - function OldCtor() {} -} - -class ExtendsOldCtor extends OldCtor { -} - - class X { function Y() {} } @@ -24,15 +16,6 @@ class X { class Y extends X { } -class OldAndNewCtor { - function OldAndNewCtor() {} - function __construct() {} -} - -class NewAndOldCtor { - function __construct() {} - function NewAndOldCtor() {} -} class B { function B() {} } @@ -48,8 +31,8 @@ class D1 extends C { class D2 extends C { } -$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor', - 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y'); +$classes = array('NewCtor', 'ExtendsNewCtor', + 'B', 'C', 'D1', 'D2', 'X', 'Y'); foreach ($classes as $class) { $rc = new ReflectionObject(new $class); @@ -63,21 +46,12 @@ foreach ($classes as $class) { } ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d +--EXPECT-- Constructor of NewCtor: __construct Constructor of ExtendsNewCtor: __construct -Constructor of OldCtor: OldCtor -Constructor of ExtendsOldCtor: OldCtor -Constructor of OldAndNewCtor: __construct -Constructor of NewAndOldCtor: __construct -Constructor of B: B -Constructor of C: C +No constructor for B +No constructor for C Constructor of D1: __construct -Constructor of D2: C +No constructor for D2 No constructor for X No constructor for Y diff --git a/ext/reflection/tests/ReflectionObject_getName_basic.phpt b/ext/reflection/tests/ReflectionObject_getName_basic.phpt index 68cea6a1cd..1885695cb1 100644 --- a/ext/reflection/tests/ReflectionObject_getName_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_getName_basic.phpt @@ -2,8 +2,6 @@ ReflectionObject::getName() - basic function test --FILE-- <?php -$r0 = new ReflectionObject(); -var_dump($r0->getName()); $r1 = new ReflectionObject(new stdClass); var_dump($r1->getName()); @@ -18,8 +16,6 @@ var_dump($r3->getName()); ?> --EXPECTF-- -Warning: ReflectionObject::__construct() expects exactly 1 parameter, 0 given in %s on line 2 -string(0) "" string(8) "stdClass" string(1) "C" string(16) "ReflectionObject" diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt index 675bbdde8d..3baa8a0950 100644 --- a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt +++ b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt @@ -30,54 +30,21 @@ class privateCtorNew { } } -class publicCtorOld { - public function publicCtorOld() {} - public static function reflectionObjectFactory() { - return new ReflectionObject(new self); - } -} - -class protectedCtorOld { - protected function protectedCtorOld() {} - public static function reflectionObjectFactory() { - return new ReflectionObject(new self); - } -} - -class privateCtorOld { - private function privateCtorOld() {} - public static function reflectionObjectFactory() { - return new ReflectionObject(new self); - } -} - - $reflectionObjects = array( noCtor::reflectionObjectFactory(), publicCtorNew::reflectionObjectFactory(), protectedCtorNew::reflectionObjectFactory(), privateCtorNew::reflectionObjectFactory(), - publicCtorOld::reflectionObjectFactory(), - protectedCtorOld::reflectionObjectFactory(), - privateCtorOld::reflectionObjectFactory() ); -foreach($reflectionObjects as $reflectionObject ) { +foreach ($reflectionObjects as $reflectionObject) { $name = $reflectionObject->getName(); echo "Is $name instantiable? "; var_dump($reflectionObject->IsInstantiable()); } ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; protectedCtorOld has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d +--EXPECT-- Is noCtor instantiable? bool(true) Is publicCtorNew instantiable? bool(true) Is protectedCtorNew instantiable? bool(false) Is privateCtorNew instantiable? bool(false) -Is publicCtorOld instantiable? bool(true) -Is protectedCtorOld instantiable? bool(false) -Is privateCtorOld instantiable? bool(false) diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt index f05197ebaf..a2484f9dc2 100644 --- a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt +++ b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt @@ -11,12 +11,12 @@ $ro = new ReflectionObject(new C); echo "\n\nTest bad arguments:\n"; try { var_dump($ro->isSubclassOf()); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { var_dump($ro->isSubclassOf('C', 'C')); -} catch (Exception $e) { +} catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { @@ -35,14 +35,10 @@ try { echo $e->getMessage() . "\n"; } ?> ---EXPECTF-- +--EXPECT-- Test bad arguments: - -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 7 -NULL - -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 12 -NULL +ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given +ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given Parameter one must either be a string or a ReflectionClass object Class ThisClassDoesNotExist does not exist Parameter one must either be a string or a ReflectionClass object diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt index 11994ed705..582bcffe65 100644 --- a/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt +++ b/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt @@ -5,20 +5,12 @@ ReflectionObject::isSubclassOf() - invalid params class A {} $ro = new ReflectionObject(new A); -var_dump($ro->isSubclassOf()); -var_dump($ro->isSubclassOf('A',5)); var_dump($ro->isSubclassOf('X')); ?> --EXPECTF-- -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 5 -NULL - -Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 6 -NULL - -Fatal error: Uncaught ReflectionException: Class X does not exist in %s:7 +Fatal error: Uncaught ReflectionException: Class X does not exist in %s:%d Stack trace: -#0 %s(7): ReflectionClass->isSubclassOf('X') +#0 %s(%d): ReflectionClass->isSubclassOf('X') #1 {main} - thrown in %s on line 7 + thrown in %s on line %d diff --git a/ext/reflection/tests/ReflectionProperty_error.phpt b/ext/reflection/tests/ReflectionProperty_error.phpt index c8a2f11ee1..a7fdff5000 100644 --- a/ext/reflection/tests/ReflectionProperty_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_error.phpt @@ -24,39 +24,8 @@ try { echo "Ok - ".$re->getMessage().PHP_EOL; } - -$rp = new ReflectionProperty('C', 'p'); -var_dump($rp->getName(1)); -var_dump($rp->isPrivate(1)); -var_dump($rp->isProtected(1)); -var_dump($rp->isPublic(1)); -var_dump($rp->isStatic(1)); -var_dump($rp->getModifiers(1)); -var_dump($rp->isDefault(1)); - ?> ---EXPECTF-- +--EXPECT-- Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 0 given Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 1 given Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 3 given - -Warning: ReflectionProperty::getName() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::isProtected() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::isPublic() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::isStatic() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d -NULL diff --git a/ext/reflection/tests/ReflectionProperty_export_error.phpt b/ext/reflection/tests/ReflectionProperty_export_error.phpt index ab09ed01f0..5acf9de6c3 100644 --- a/ext/reflection/tests/ReflectionProperty_export_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_export_error.phpt @@ -32,10 +32,6 @@ catch(Exception $e) { echo $e->getMessage(); } -echo "\n\nIncorrect number of args:\n"; -ReflectionProperty::export(); -ReflectionProperty::export('TestClass', "nonExistentProperty", true, false); - ?> --EXPECTF-- Non-existent class: @@ -46,9 +42,3 @@ The parameter class is expected to be either a string or an object Non-existent property: Property TestClass::$nonExistentProperty does not exist - -Incorrect number of args: - -Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given in %s on line %d - -Warning: ReflectionProperty::export() expects at most 3 parameters, 4 given in %s on line %d diff --git a/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt b/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt index c7c9366471..7ee787a348 100644 --- a/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt +++ b/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt @@ -13,15 +13,9 @@ class B extends A { $propInfo = new ReflectionProperty('B', 'prop'); var_dump($propInfo->getDeclaringClass()); -echo "Wrong number of params:\n"; -$propInfo->getDeclaringClass(1); - ?> --EXPECTF-- object(ReflectionClass)#%d (1) { ["name"]=> string(1) "A" } -Wrong number of params: - -Warning: ReflectionProperty::getDeclaringClass() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt index 3bca85e4b6..52e9d1d2ef 100644 --- a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt @@ -18,15 +18,6 @@ $instance = new TestClass(); $invalidInstance = new AnotherClass(); $propInfo = new ReflectionProperty('TestClass', 'pub2'); -echo "Too few args:\n"; -var_dump($propInfo->getValue()); - -echo "\nToo many args:\n"; -var_dump($propInfo->getValue($instance, true)); - -echo "\nWrong type of arg:\n"; -var_dump($propInfo->getValue(true)); - echo "\nInstance without property:\n"; $propInfo = new ReflectionProperty('TestClass', 'stat'); @@ -51,21 +42,6 @@ var_dump($propInfo->getValue($invalidInstance)); ?> --EXPECTF-- -Too few args: - -Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Too many args: - -Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Wrong type of arg: - -Warning: ReflectionProperty::getValue() expects parameter 1 to be object, bool given in %s on line %d -NULL - Instance without property: Static property / too many args: @@ -79,8 +55,8 @@ Cannot access non-public member TestClass::$prot Invalid instance: -Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in %s:47 +Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in %s:%d Stack trace: -#0 %s(47): ReflectionProperty->getValue(Object(AnotherClass)) +#0 %s(%d): ReflectionProperty->getValue(Object(AnotherClass)) #1 {main} - thrown in %s on line 47 + thrown in %s on line %d diff --git a/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt b/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt index 2aa630d9d0..1472615178 100644 --- a/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt +++ b/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt @@ -24,10 +24,6 @@ reflectProperty("TestClass", "stat"); reflectProperty("TestClass", "prot"); reflectProperty("TestClass", "priv"); -echo "Wrong number of params:\n"; -$propInfo = new ReflectionProperty('TestClass', 'pub'); -$propInfo->isDefault(1); - ?> --EXPECTF-- ********************************** @@ -58,6 +54,3 @@ isDefault(): bool(true) ********************************** -Wrong number of params: - -Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/reflection/tests/ReflectionProperty_setValue_error.phpt b/ext/reflection/tests/ReflectionProperty_setValue_error.phpt index 0bf223daa7..f58590b3ea 100644 --- a/ext/reflection/tests/ReflectionProperty_setValue_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_setValue_error.phpt @@ -18,30 +18,6 @@ $instance = new TestClass(); $instanceWithNoProperties = new AnotherClass(); $propInfo = new ReflectionProperty('TestClass', 'pub2'); -echo "Too few args:\n"; -var_dump($propInfo->setValue()); -var_dump($propInfo->setValue($instance)); - -echo "\nToo many args:\n"; -var_dump($propInfo->setValue($instance, "NewValue", true)); - -echo "\nWrong type of arg:\n"; -var_dump($propInfo->setValue(true, "NewValue")); -$propInfo = new ReflectionProperty('TestClass', 'stat'); - -echo "\nStatic property / too many args:\n"; -var_dump($propInfo->setValue($instance, "NewValue", true)); - -echo "\nStatic property / too few args:\n"; -var_dump($propInfo->setValue("A new value")); -var_dump(TestClass::$stat); -var_dump($propInfo->setValue()); -var_dump(TestClass::$stat); - -echo "\nStatic property / wrong type of arg:\n"; -var_dump($propInfo->setValue(true, "Another new value")); -var_dump(TestClass::$stat); - echo "\nProtected property:\n"; try { $propInfo = new ReflectionProperty('TestClass', 'prot'); @@ -57,41 +33,6 @@ var_dump($propInfo->setValue($instanceWithNoProperties, "NewValue")); var_dump($instanceWithNoProperties->pub2); ?> --EXPECTF-- -Too few args: - -Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Too many args: - -Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Wrong type of arg: - -Warning: ReflectionProperty::setValue() expects parameter 1 to be object, bool given in %s on line %d -NULL - -Static property / too many args: - -Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Static property / too few args: -NULL -string(11) "A new value" - -Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d -NULL -string(11) "A new value" - -Static property / wrong type of arg: -NULL -string(17) "Another new value" - Protected property: Cannot access non-public member TestClass::$prot diff --git a/ext/reflection/tests/bug30148.phpt b/ext/reflection/tests/bug30148.phpt deleted file mode 100644 index 27c31ca6ae..0000000000 --- a/ext/reflection/tests/bug30148.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes) ---FILE-- -<?php - -class Root -{ - function Root() {} -} -class Base extends Root -{ - function __construct() {} -} -class Derived extends Base -{ -} -$a = new ReflectionMethod('Root','Root'); -$b = new ReflectionMethod('Base','Root'); -$c = new ReflectionMethod('Base','__construct'); -$d = new ReflectionMethod('Derived','Root'); -$e = new ReflectionMethod('Derived','__construct'); -var_dump($a->isConstructor()); -var_dump($b->isConstructor()); -var_dump($c->isConstructor()); -var_dump($d->isConstructor()); -var_dump($e->isConstructor()); -?> -===DONE=== ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Root has a deprecated constructor in %s on line %d -bool(true) -bool(false) -bool(true) -bool(false) -bool(true) -===DONE=== diff --git a/ext/reflection/tests/bug38942.phpt b/ext/reflection/tests/bug38942.phpt deleted file mode 100644 index 59666607cb..0000000000 --- a/ext/reflection/tests/bug38942.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Bug #38942 (Double old-style-ctor inheritance) ---FILE-- -<?php -class foo { - public function foo() {} -} - -class bar extends foo { -} -ReflectionClass::export("bar"); -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d -Class [ <user> class bar extends foo ] { - @@ %sbug38942.php 6-7 - - - Constants [0] { - } - - - Static properties [0] { - } - - - Static methods [0] { - } - - - Properties [0] { - } - - - Methods [1] { - Method [ <user, inherits foo, ctor> public method foo ] { - @@ %sbug38942.php 3 - 3 - } - } -} diff --git a/ext/reflection/tests/bug47254.phpt b/ext/reflection/tests/bug47254.phpt index e3ce114c9c..b6f33fcfc6 100644 --- a/ext/reflection/tests/bug47254.phpt +++ b/ext/reflection/tests/bug47254.phpt @@ -23,10 +23,7 @@ $m = $R->getMethods(); print_r($m); ?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d +--EXPECT-- Array ( [0] => ReflectionMethod Object diff --git a/ext/reflection/tests/bug74673.phpt b/ext/reflection/tests/bug74673.phpt index 8e4e8e3a18..07db9a169a 100644 --- a/ext/reflection/tests/bug74673.phpt +++ b/ext/reflection/tests/bug74673.phpt @@ -3,10 +3,6 @@ Bug #74673 (Segfault when cast Reflection object to string with undefined consta --FILE-- <?php -set_error_handler(function() { - throw new Exception(); -}); - class A { public function method($test = PHP_SELF + 1) @@ -19,4 +15,4 @@ $class = new ReflectionClass('A'); echo $class; ?> --EXPECTF-- -Fatal error: Method ReflectionClass::__toString() must not throw an exception, caught Exception: in %sbug74673.php on line %d +Fatal error: Method ReflectionClass::__toString() must not throw an exception, caught Error: Undefined constant 'PHP_SELF' in %s on line %d diff --git a/ext/reflection/tests/bug76536.phpt b/ext/reflection/tests/bug76536.phpt index 9f3b3fdb31..aa32781e16 100644 --- a/ext/reflection/tests/bug76536.phpt +++ b/ext/reflection/tests/bug76536.phpt @@ -2,7 +2,7 @@ Bug #76536 (PHP crashes with core dump when throwing exception in error handler) --FILE-- <?php -class SomeConstants {const SOME_CONSTANT = SOME_NONSENSE;} +class SomeConstants {const SOME_CONSTANT = "foo" % 5; } function handleError() {throw new ErrorException();} diff --git a/ext/reflection/tests/request38992.phpt b/ext/reflection/tests/request38992.phpt index 8c0052fd85..e6eab83415 100644 --- a/ext/reflection/tests/request38992.phpt +++ b/ext/reflection/tests/request38992.phpt @@ -11,12 +11,17 @@ class MyClass } $r = new ReflectionMethod('MyClass', 'doSomething'); -$r->invoke('WTF?'); -$r->invokeArgs('WTF?', array()); +try { + $r->invoke('WTF?'); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $r->invokeArgs('WTF?', array()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> -===DONE=== ---EXPECTF-- -Warning: ReflectionMethod::invoke() expects parameter 1 to be object, string given in %s%erequest38992.php on line %d - -Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given in %s%erequest38992.php on line %d -===DONE=== +--EXPECT-- +ReflectionMethod::invoke() expects parameter 1 to be object, string given +ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given diff --git a/ext/session/session.c b/ext/session/session.c index f8f375d888..124b470205 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -2344,30 +2344,31 @@ static PHP_FUNCTION(session_cache_limiter) Return the current cache expire. If new_cache_expire is given, the current cache_expire is replaced with new_cache_expire */ static PHP_FUNCTION(session_cache_expire) { - zval *expires = NULL; - zend_string *ini_name; + zend_long expires; + zend_bool expires_is_null = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &expires) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &expires, &expires_is_null) == FAILURE) { return; } - if (expires && PS(session_status) == php_session_active) { + if (!expires_is_null && PS(session_status) == php_session_active) { php_error_docref(NULL, E_WARNING, "Cannot change cache expire when session is active"); RETURN_LONG(PS(cache_expire)); } - if (expires && SG(headers_sent)) { + if (!expires_is_null && SG(headers_sent)) { php_error_docref(NULL, E_WARNING, "Cannot change cache expire when headers already sent"); RETURN_FALSE; } RETVAL_LONG(PS(cache_expire)); - if (expires) { - convert_to_string_ex(expires); - ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0); - zend_alter_ini_entry(ini_name, Z_STR_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + if (!expires_is_null) { + zend_string *ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0); + zend_string *ini_value = zend_long_to_str(expires); + zend_alter_ini_entry(ini_name, ini_value, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); zend_string_release_ex(ini_name, 0); + zend_string_release_ex(ini_value, 0); } } /* }}} */ diff --git a/ext/session/tests/session_cache_expire_error.phpt b/ext/session/tests/session_cache_expire_error.phpt deleted file mode 100644 index 5ae5d95637..0000000000 --- a/ext/session/tests/session_cache_expire_error.phpt +++ /dev/null @@ -1,169 +0,0 @@ ---TEST-- -Test session_cache_expire() function : error functionality ---SKIPIF-- -<?php include('skipif.inc'); ?> ---FILE-- -<?php - -ob_start(); - -/* - * Prototype : int session_cache_expire([int $new_cache_expire]) - * Description : Return current cache expire - * Source code : ext/session/session.c - */ - -echo "*** Testing session_cache_expire() : error functionality ***\n"; - -// Get an unset variable -$unset_var = 10; -unset($unset_var); - -class classA -{ - public function __toString() { - return "Hello World!"; - } -} - -$heredoc = <<<EOT -Hello World! -EOT; - -$fp = fopen(__FILE__, "r"); - -// Unexpected values to be passed as arguments -$inputs = array( - - // Integer data -/*1*/ 0, - 1, - 12345, - -2345, - - // Float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // Null data -/*10*/ NULL, - null, - - // Boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // Empty strings -/*16*/ "", - '', - - // Invalid string data -/*18*/ "Nothing", - 'Nothing', - $heredoc, - - // Object data -/*21*/ new classA(), - - // Undefined data -/*22*/ @$undefined_var, - - // Unset data -/*23*/ @$unset_var, - - // Resource variable -/*24*/ $fp -); - - -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(session_cache_expire($input)); - $iterator++; -}; - -fclose($fp); -echo "Done"; -ob_end_flush(); -?> ---EXPECTF-- -*** Testing session_cache_expire() : error functionality *** - --- Iteration 1 -- -int(180) - --- Iteration 2 -- -int(0) - --- Iteration 3 -- -int(1) - --- Iteration 4 -- -int(12345) - --- Iteration 5 -- -int(-2345) - --- Iteration 6 -- -int(10) - --- Iteration 7 -- -int(-10) - --- Iteration 8 -- -int(%s) - --- Iteration 9 -- -int(1) - --- Iteration 10 -- -int(0) - --- Iteration 11 -- -int(0) - --- Iteration 12 -- -int(0) - --- Iteration 13 -- -int(1) - --- Iteration 14 -- -int(0) - --- Iteration 15 -- -int(1) - --- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(0) - --- Iteration 18 -- -int(0) - --- Iteration 19 -- -int(0) - --- Iteration 20 -- -int(0) - --- Iteration 21 -- -int(0) - --- Iteration 22 -- -int(0) - --- Iteration 23 -- -int(0) - --- Iteration 24 -- -int(0) -Done diff --git a/ext/session/tests/session_cache_limiter_error.phpt b/ext/session/tests/session_cache_limiter_error.phpt index 42b2cb0694..284649e277 100644 --- a/ext/session/tests/session_cache_limiter_error.phpt +++ b/ext/session/tests/session_cache_limiter_error.phpt @@ -75,9 +75,6 @@ $inputs = array( // Unset data /*23*/ @$unset_var, - - // Resource variable -/*24*/ $fp ); @@ -163,9 +160,4 @@ string(12) "Hello World!" -- Iteration 23 -- string(0) "" - --- Iteration 24 -- - -Warning: session_cache_limiter() expects parameter 1 to be string, resource given in %s on line %d -NULL Done diff --git a/ext/session/tests/session_regenerate_id_cookie.phpt b/ext/session/tests/session_regenerate_id_cookie.phpt index 9558beb814..880a41e6d8 100644 --- a/ext/session/tests/session_regenerate_id_cookie.phpt +++ b/ext/session/tests/session_regenerate_id_cookie.phpt @@ -64,7 +64,7 @@ echo "Done"; ?> --EXPECTF-- *** Testing session_regenerate_id() : basic functionality for cookie *** -string(%d) "X-Powered-By: PHP/7.%s +string(%d) "X-Powered-By: PHP/%d.%d.%s Expires: %s Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache diff --git a/ext/session/tests/session_set_save_handler_class_012.phpt b/ext/session/tests/session_set_save_handler_class_012.phpt index b7bcc3fca6..f0a9139ade 100644 --- a/ext/session/tests/session_set_save_handler_class_012.phpt +++ b/ext/session/tests/session_set_save_handler_class_012.phpt @@ -38,25 +38,23 @@ class MySession extends SessionHandler { $oldHandler = ini_get('session.save_handler'); $handler = new MySession; session_set_save_handler($handler); -var_dump(session_start()); +try { + var_dump(session_start()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION); --EXPECTF-- *** Testing session_set_save_handler() : incorrect arguments for existing handler open *** Open -Warning: SessionHandler::open() expects exactly 2 parameters, 0 given in %s on line %d -Read %s - -Warning: SessionHandler::read(): Parent session handler is not open in %s on line %d +Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d +SessionHandler::open() expects exactly 2 parameters, 0 given -Warning: SessionHandler::close(): Parent session handler is not open in %s on line %d - -Warning: session_start(): Failed to read session data: user (%s) in %s on line %d -bool(false) +Notice: Undefined variable: _SESSION in %s on line %d string(0) "" string(5) "files" string(4) "user" -int(2) -array(0) { -} +int(1) +NULL diff --git a/ext/session/tests/session_set_save_handler_class_013.phpt b/ext/session/tests/session_set_save_handler_class_013.phpt index 28e49c9f98..79c732f30c 100644 --- a/ext/session/tests/session_set_save_handler_class_013.phpt +++ b/ext/session/tests/session_set_save_handler_class_013.phpt @@ -41,6 +41,7 @@ session_set_save_handler($handler); session_start(); var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION); +?> --EXPECTF-- *** Testing session_set_save_handler() : incorrect arguments for existing handler close *** Open @@ -52,4 +53,10 @@ int(2) array(0) { } -Warning: SessionHandler::close() expects exactly 0 parameters, 1 given in %s on line %d +Fatal error: Uncaught ArgumentCountError: SessionHandler::close() expects exactly 0 parameters, 1 given in %s:%d +Stack trace: +#0 %s(%d): SessionHandler->close(false) +#1 [internal function]: MySession->close() +#2 [internal function]: session_write_close() +#3 {main} + thrown in %s on line %d diff --git a/ext/session/tests/session_set_save_handler_iface_002.phpt b/ext/session/tests/session_set_save_handler_iface_002.phpt index bc9f801a5e..cf01d8badb 100644 --- a/ext/session/tests/session_set_save_handler_iface_002.phpt +++ b/ext/session/tests/session_set_save_handler_iface_002.phpt @@ -76,14 +76,15 @@ $ret = session_set_save_handler(array($handler, 'open'), array($handler, 'close' array($handler, 'read'), 'good_write', array($handler, 'destroy'), array($handler, 'gc')); var_dump($ret); -$ret = session_set_save_handler($handler); -var_dump($ret); +try { + $ret = session_set_save_handler($handler); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} session_start(); --EXPECTF-- *** Testing session_set_save_handler() function: interface wrong *** bool(true) - -Warning: session_set_save_handler() expects parameter 1 to be SessionHandlerInterface, object given in %s -bool(false) +session_set_save_handler() expects parameter 1 to be SessionHandlerInterface, object given good handler writing diff --git a/ext/shmop/tests/002.phpt b/ext/shmop/tests/002.phpt index 3206f90776..a06f454445 100644 --- a/ext/shmop/tests/002.phpt +++ b/ext/shmop/tests/002.phpt @@ -18,9 +18,6 @@ edgarsandi - <edgar.r.sandi@gmail.com> }; echo PHP_EOL, '## shmop_open function tests ##'; - // warning outputs: 4 parameters expected - var_dump($shm_id = shmop_open()); - // warning outputs: invalid flag when the flags length != 1 var_dump(shmop_open($hex_shm_id(), '', 0644, 1024)); @@ -34,9 +31,6 @@ echo PHP_EOL, '## shmop_open function tests ##'; var_dump(shmop_open($hex_shm_id(), "c", 0666, 0)); echo PHP_EOL, '## shmop_read function tests ##'; - // warning outputs: 3 parameters expected - var_dump(shmop_read()); - // warning outputs: start is out of range $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024); var_dump(shmop_read($shm_id, -10, 0)); @@ -48,31 +42,13 @@ echo PHP_EOL, '## shmop_read function tests ##'; shmop_delete($shm_id); echo PHP_EOL, '## shmop_write function tests ##'; - // warning outputs: 3 parameters expected - var_dump(shmop_write()); - // warning outputs: offset out of range $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024); var_dump(shmop_write($shm_id, 'text to try write', -10)); shmop_delete($shm_id); - -echo PHP_EOL, '## shmop_size function tests ##'; - // warning outputs: 1 parameter expected - var_dump(shmop_size()); - -echo PHP_EOL, '## shmop_delete function tests ##'; - // warning outputs: 1 parameter expected - var_dump(shmop_delete()); - -echo PHP_EOL, '## shmop_close function tests ##'; - // warning outputs: 1 parameter expected - var_dump(shmop_close()); ?> --EXPECTF-- ## shmop_open function tests ## -Warning: shmop_open() expects exactly 4 parameters, 0 given in %s on line %d -NULL - Warning: shmop_open(): is not a valid flag in %s on line %d bool(false) @@ -86,9 +62,6 @@ Warning: shmop_open(): Shared memory segment size must be greater than zero in % bool(false) ## shmop_read function tests ## -Warning: shmop_read() expects exactly 3 parameters, 0 given in %s on line %d -NULL - Warning: shmop_read(): start is out of range in %s on line %d bool(false) @@ -96,20 +69,5 @@ Warning: shmop_read(): count is out of range in %s on line %d bool(false) ## shmop_write function tests ## -Warning: shmop_write() expects exactly 3 parameters, 0 given in %s on line %d -NULL - Warning: shmop_write(): offset out of range in %s on line %d bool(false) - -## shmop_size function tests ## -Warning: shmop_size() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -## shmop_delete function tests ## -Warning: shmop_delete() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -## shmop_close function tests ## -Warning: shmop_close() expects exactly 1 parameter, 0 given in %s on line %d -NULL diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index b7eaf90de6..cf459311b7 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -50,7 +50,7 @@ PHP_SXE_API zend_class_entry *sxe_get_element_class_entry() /* {{{ */ static php_sxe_object* php_sxe_object_new(zend_class_entry *ce, zend_function *fptr_count); static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data); static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data); -static zval *sxe_get_value(zval *z, zval *rv); +static zval *sxe_get_value(zend_object *z, zval *rv); static void php_sxe_iterator_dtor(zend_object_iterator *iter); static int php_sxe_iterator_valid(zend_object_iterator *iter); static zval *php_sxe_iterator_current_data(zend_object_iterator *iter); @@ -228,7 +228,7 @@ next_iter: /* {{{ sxe_prop_dim_read() */ -static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, zend_bool attribs, int type, zval *rv) +static zval *sxe_prop_dim_read(zend_object *object, zval *member, zend_bool elements, zend_bool attribs, int type, zval *rv) { php_sxe_object *sxe; char *name; @@ -238,7 +238,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z int nodendx = 0; int test = 0; - sxe = Z_SXEOBJ_P(object); + sxe = php_sxe_fetch_object(object); if (!member) { if (sxe->iter.type == SXE_ITER_ATTRLIST) { @@ -365,15 +365,17 @@ long_dim: /* {{{ sxe_property_read() */ -static zval *sxe_property_read(zval *object, zval *member, int type, void **cache_slot, zval *rv) +static zval *sxe_property_read(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) { - return sxe_prop_dim_read(object, member, 1, 0, type, rv); + zval member; + ZVAL_STR(&member, name); + return sxe_prop_dim_read(object, &member, 1, 0, type, rv); } /* }}} */ /* {{{ sxe_dimension_read() */ -static zval *sxe_dimension_read(zval *object, zval *offset, int type, zval *rv) +static zval *sxe_dimension_read(zend_object *object, zval *offset, int type, zval *rv) { return sxe_prop_dim_read(object, offset, 0, 1, type, rv); } @@ -415,7 +417,7 @@ static void change_node_zval(xmlNodePtr node, zval *value) /* {{{ sxe_property_write() */ -static zval *sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool elements, zend_bool attribs, xmlNodePtr *pnewnode) +static zval *sxe_prop_dim_write(zend_object *object, zval *member, zval *value, zend_bool elements, zend_bool attribs, xmlNodePtr *pnewnode) { php_sxe_object *sxe; xmlNodePtr node; @@ -432,7 +434,7 @@ static zval *sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bo zval tmp_zv, zval_copy; zend_string *trim_str; - sxe = Z_SXEOBJ_P(object); + sxe = php_sxe_fetch_object(object); if (!member) { if (sxe->iter.type == SXE_ITER_ATTRLIST) { @@ -517,7 +519,7 @@ long_dim: break; case IS_OBJECT: if (Z_OBJCE_P(value) == sxe_class_entry) { - value = sxe_get_value(value, &zval_copy); + value = sxe_get_value(Z_OBJ_P(value), &zval_copy); new_value = 1; break; } @@ -648,40 +650,42 @@ next_iter: /* {{{ sxe_property_write() */ -static zval *sxe_property_write(zval *object, zval *member, zval *value, void **cache_slot) +static zval *sxe_property_write(zend_object *object, zend_string *name, zval *value, void **cache_slot) { - zval *retval = sxe_prop_dim_write(object, member, value, 1, 0, NULL); - + zval member; + ZVAL_STR(&member, name); + zval *retval = sxe_prop_dim_write(object, &member, value, 1, 0, NULL); return retval == &EG(error_zval) ? &EG(uninitialized_zval) : retval; } /* }}} */ /* {{{ sxe_dimension_write() */ -static void sxe_dimension_write(zval *object, zval *offset, zval *value) +static void sxe_dimension_write(zend_object *object, zval *offset, zval *value) { sxe_prop_dim_write(object, offset, value, 0, 1, NULL); } /* }}} */ -static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, void **cache_slot) /* {{{ */ +static zval *sxe_property_get_adr(zend_object *object, zend_string *zname, int fetch_type, void **cache_slot) /* {{{ */ { php_sxe_object *sxe; xmlNodePtr node; zval ret; char *name; SXE_ITER type; + zval member; - sxe = Z_SXEOBJ_P(object); + sxe = php_sxe_fetch_object(object); GET_NODE(sxe, node); - convert_to_string(member); - name = Z_STRVAL_P(member); + name = ZSTR_VAL(zname); node = sxe_get_element_by_name(sxe, node, &name, &type); if (node) { return NULL; } - if (sxe_prop_dim_write(object, member, NULL, 1, 0, &node) == &EG(error_zval)) { + ZVAL_STR(&member, zname); + if (sxe_prop_dim_write(object, &member, NULL, 1, 0, &node) == &EG(error_zval)) { return NULL; } type = SXE_ITER_NONE; @@ -701,7 +705,7 @@ static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, vo /* {{{ sxe_prop_dim_exists() */ -static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend_bool elements, zend_bool attribs) +static int sxe_prop_dim_exists(zend_object *object, zval *member, int check_empty, zend_bool elements, zend_bool attribs) { php_sxe_object *sxe; xmlNodePtr node; @@ -715,7 +719,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend member = &tmp_zv; } - sxe = Z_SXEOBJ_P(object); + sxe = php_sxe_fetch_object(object); GET_NODE(sxe, node); @@ -803,15 +807,17 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend /* {{{ sxe_property_exists() */ -static int sxe_property_exists(zval *object, zval *member, int check_empty, void **cache_slot) +static int sxe_property_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot) { - return sxe_prop_dim_exists(object, member, check_empty, 1, 0); + zval member; + ZVAL_STR(&member, name); + return sxe_prop_dim_exists(object, &member, check_empty, 1, 0); } /* }}} */ /* {{{ sxe_dimension_exists() */ -static int sxe_dimension_exists(zval *object, zval *member, int check_empty) +static int sxe_dimension_exists(zend_object *object, zval *member, int check_empty) { return sxe_prop_dim_exists(object, member, check_empty, 0, 1); } @@ -819,7 +825,7 @@ static int sxe_dimension_exists(zval *object, zval *member, int check_empty) /* {{{ sxe_prop_dim_delete() */ -static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, zend_bool attribs) +static void sxe_prop_dim_delete(zend_object *object, zval *member, zend_bool elements, zend_bool attribs) { php_sxe_object *sxe; xmlNodePtr node; @@ -834,7 +840,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, member = &tmp_zv; } - sxe = Z_SXEOBJ_P(object); + sxe = php_sxe_fetch_object(object); GET_NODE(sxe, node); @@ -926,15 +932,17 @@ next_iter: /* {{{ sxe_property_delete() */ -static void sxe_property_delete(zval *object, zval *member, void **cache_slot) +static void sxe_property_delete(zend_object *object, zend_string *name, void **cache_slot) { - sxe_prop_dim_delete(object, member, 1, 0); + zval member; + ZVAL_STR(&member, name); + sxe_prop_dim_delete(object, &member, 1, 0); } /* }}} */ /* {{{ sxe_dimension_unset() */ -static void sxe_dimension_delete(zval *object, zval *offset) +static void sxe_dimension_delete(zend_object *object, zval *offset) { sxe_prop_dim_delete(object, offset, 0, 1); } @@ -1008,7 +1016,7 @@ static void sxe_properties_add(HashTable *rv, char *name, int namelen, zval *val } /* }}} */ -static int sxe_prop_is_empty(zval *object) /* {{{ */ +static int sxe_prop_is_empty(zend_object *object) /* {{{ */ { php_sxe_object *sxe; xmlNodePtr node; @@ -1017,7 +1025,7 @@ static int sxe_prop_is_empty(zval *object) /* {{{ */ int test; int is_empty; - sxe = Z_SXEOBJ_P(object); + sxe = php_sxe_fetch_object(object); GET_NODE(sxe, node); if (!node) { @@ -1099,7 +1107,7 @@ next_iter: } /* }}} */ -static HashTable *sxe_get_prop_hash(zval *object, int is_debug) /* {{{ */ +static HashTable *sxe_get_prop_hash(zend_object *object, int is_debug) /* {{{ */ { zval value; zval zattr; @@ -1115,7 +1123,7 @@ static HashTable *sxe_get_prop_hash(zval *object, int is_debug) /* {{{ */ use_iter = 0; - sxe = Z_SXEOBJ_P(object); + sxe = php_sxe_fetch_object(object); if (is_debug) { rv = zend_new_array(0); @@ -1229,9 +1237,9 @@ next_iter: } /* }}} */ -static HashTable *sxe_get_gc(zval *object, zval **table, int *n) /* {{{ */ { +static HashTable *sxe_get_gc(zend_object *object, zval **table, int *n) /* {{{ */ { php_sxe_object *sxe; - sxe = Z_SXEOBJ_P(object); + sxe = php_sxe_fetch_object(object); *table = NULL; *n = 0; @@ -1239,13 +1247,13 @@ static HashTable *sxe_get_gc(zval *object, zval **table, int *n) /* {{{ */ { } /* }}} */ -static HashTable *sxe_get_properties(zval *object) /* {{{ */ +static HashTable *sxe_get_properties(zend_object *object) /* {{{ */ { return sxe_get_prop_hash(object, 0); } /* }}} */ -static HashTable * sxe_get_debug_info(zval *object, int *is_temp) /* {{{ */ +static HashTable * sxe_get_debug_info(zend_object *object, int *is_temp) /* {{{ */ { *is_temp = 1; return sxe_get_prop_hash(object, 1); @@ -1855,14 +1863,14 @@ static int cast_object(zval *object, int type, char *contents) /* {{{ sxe_object_cast() */ -static int sxe_object_cast_ex(zval *readobj, zval *writeobj, int type) +static int sxe_object_cast_ex(zend_object *readobj, zval *writeobj, int type) { php_sxe_object *sxe; xmlChar *contents = NULL; xmlNodePtr node; int rv; - sxe = Z_SXEOBJ_P(readobj); + sxe = php_sxe_fetch_object(readobj); if (type == _IS_BOOL) { node = php_sxe_get_first_node(sxe, NULL); @@ -1904,7 +1912,7 @@ static int sxe_object_cast_ex(zval *readobj, zval *writeobj, int type) /* }}} */ /* {{{ Variant of sxe_object_cast_ex that handles overwritten __toString() method */ -static int sxe_object_cast(zval *readobj, zval *writeobj, int type) +static int sxe_object_cast(zend_object *readobj, zval *writeobj, int type) { if (type == IS_STRING && zend_std_cast_object_tostring(readobj, writeobj, IS_STRING) == SUCCESS @@ -1920,7 +1928,7 @@ static int sxe_object_cast(zval *readobj, zval *writeobj, int type) Returns the string content */ SXE_METHOD(__toString) { - if (sxe_object_cast_ex(ZEND_THIS, return_value, IS_STRING) != SUCCESS) { + if (sxe_object_cast_ex(Z_OBJ_P(ZEND_THIS), return_value, IS_STRING) != SUCCESS) { zval_ptr_dtor(return_value); RETURN_EMPTY_STRING(); } @@ -1954,10 +1962,10 @@ static int php_sxe_count_elements_helper(php_sxe_object *sxe, zend_long *count) } /* }}} */ -static int sxe_count_elements(zval *object, zend_long *count) /* {{{ */ +static int sxe_count_elements(zend_object *object, zend_long *count) /* {{{ */ { php_sxe_object *intern; - intern = Z_SXEOBJ_P(object); + intern = php_sxe_fetch_object(object); if (intern->fptr_count) { zval rv; zend_call_method_with_0_params(object, intern->zo.ce, &intern->fptr_count, "count", &rv); @@ -1989,9 +1997,9 @@ SXE_METHOD(count) } /* }}} */ -static zval *sxe_get_value(zval *z, zval *rv) /* {{{ */ +static zval *sxe_get_value(zend_object *zobj, zval *rv) /* {{{ */ { - if (sxe_object_cast_ex(z, rv, IS_STRING) == FAILURE) { + if (sxe_object_cast_ex(zobj, rv, IS_STRING) == FAILURE) { zend_error(E_ERROR, "Unable to cast node to string"); /* FIXME: Should not be fatal */ } @@ -2005,9 +2013,9 @@ static zend_object_handlers sxe_object_handlers; /* {{{ sxe_object_clone() */ static zend_object * -sxe_object_clone(zval *object) +sxe_object_clone(zend_object *object) { - php_sxe_object *sxe = Z_SXEOBJ_P(object); + php_sxe_object *sxe = php_sxe_fetch_object(object); php_sxe_object *clone; xmlNodePtr nodep = NULL; xmlDocPtr docp = NULL; diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt deleted file mode 100644 index 8682cf818d..0000000000 --- a/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Testing xpath() with invalid XML ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only"); -?> ---FILE-- -<?php -$xml = simplexml_load_string("XXXXXXX^",$x,0x6000000000000001); -var_dump($xml->xpath("BBBB")); -?> ---EXPECTF-- -Notice: Undefined variable: x in %s on line %d - -Warning: simplexml_load_string() expects parameter 3 to be int, float given in %s on line %d - -Fatal error: Uncaught Error: Call to a member function xpath() on null in %s:%d -Stack trace: -#0 {main} - thrown in %s on line %d diff --git a/ext/simplexml/tests/bug37565.phpt b/ext/simplexml/tests/bug37565.phpt index 0af93deaf3..d20fbd5aca 100644 --- a/ext/simplexml/tests/bug37565.phpt +++ b/ext/simplexml/tests/bug37565.phpt @@ -31,7 +31,5 @@ try { ===DONE=== --EXPECT-- Error: simplexml_load_string() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given -Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given Error: simplexml_load_file() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given -Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given ===DONE=== diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 1cf4999f33..a68ea14e5c 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -1911,22 +1911,16 @@ void php_snmp_add_property(HashTable *h, const char *name, size_t name_length, p /* {{{ php_snmp_read_property(zval *object, zval *member, int type[, const zend_literal *key]) Generic object property reader */ -zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) +zval *php_snmp_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) { - zval tmp_member; zval *retval; php_snmp_object *obj; php_snmp_prop_handler *hnd; int ret; - obj = Z_SNMP_P(object); + obj = php_snmp_fetch_object(object); - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - } - - hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member)); + hnd = zend_hash_find_ptr(&php_snmp_properties, name); if (hnd && hnd->read_func) { ret = hnd->read_func(obj, rv); @@ -1936,11 +1930,7 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_ retval = &EG(uninitialized_zval); } } else { - retval = zend_std_read_property(object, member, type, cache_slot, rv); - } - - if (member == &tmp_member) { - zval_ptr_dtor(member); + retval = zend_std_read_property(object, name, type, cache_slot, rv); } return retval; @@ -1949,20 +1939,14 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_ /* {{{ php_snmp_write_property(zval *object, zval *member, zval *value[, const zend_literal *key]) Generic object property writer */ -zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **cache_slot) +zval *php_snmp_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) { - zval tmp_member; php_snmp_object *obj; php_snmp_prop_handler *hnd; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - } - - obj = Z_SNMP_P(object); + obj = php_snmp_fetch_object(object); - hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member)); + hnd = zend_hash_find_ptr(&php_snmp_properties, name); if (hnd && hnd->write_func) { hnd->write_func(obj, value); @@ -1973,11 +1957,7 @@ zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **ca } */ } else { - value = zend_std_write_property(object, member, value, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor(member); + value = zend_std_write_property(object, name, value, cache_slot); } return value; @@ -1986,19 +1966,19 @@ zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **ca /* {{{ php_snmp_has_property(zval *object, zval *member, int has_set_exists[, const zend_literal *key]) Generic object property checker */ -static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) +static int php_snmp_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot) { zval rv; php_snmp_prop_handler *hnd; int ret = 0; - if ((hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member))) != NULL) { + if ((hnd = zend_hash_find_ptr(&php_snmp_properties, name)) != NULL) { switch (has_set_exists) { case ZEND_PROPERTY_EXISTS: ret = 1; break; case ZEND_PROPERTY_ISSET: { - zval *value = php_snmp_read_property(object, member, BP_VAR_IS, cache_slot, &rv); + zval *value = php_snmp_read_property(object, name, BP_VAR_IS, cache_slot, &rv); if (value != &EG(uninitialized_zval)) { ret = Z_TYPE_P(value) != IS_NULL? 1 : 0; zval_ptr_dtor(value); @@ -2006,7 +1986,7 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, break; } default: { - zval *value = php_snmp_read_property(object, member, BP_VAR_IS, cache_slot, &rv); + zval *value = php_snmp_read_property(object, name, BP_VAR_IS, cache_slot, &rv); if (value != &EG(uninitialized_zval)) { convert_to_boolean(value); ret = Z_TYPE_P(value) == IS_TRUE? 1:0; @@ -2015,13 +1995,13 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, } } } else { - ret = zend_std_has_property(object, member, has_set_exists, cache_slot); + ret = zend_std_has_property(object, name, has_set_exists, cache_slot); } return ret; } /* }}} */ -static HashTable *php_snmp_get_gc(zval *object, zval ***gc_data, int *gc_data_count) /* {{{ */ +static HashTable *php_snmp_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) /* {{{ */ { *gc_data = NULL; *gc_data_count = 0; @@ -2031,7 +2011,7 @@ static HashTable *php_snmp_get_gc(zval *object, zval ***gc_data, int *gc_data_co /* {{{ php_snmp_get_properties(zval *object) Returns all object properties. Injects SNMP properties into object on first call */ -static HashTable *php_snmp_get_properties(zval *object) +static HashTable *php_snmp_get_properties(zend_object *object) { php_snmp_object *obj; php_snmp_prop_handler *hnd; @@ -2039,7 +2019,7 @@ static HashTable *php_snmp_get_properties(zval *object) zval rv; zend_string *key; - obj = Z_SNMP_P(object); + obj = php_snmp_fetch_object(object); props = zend_std_get_properties(object); ZEND_HASH_FOREACH_STR_KEY_PTR(&php_snmp_properties, key, hnd) { diff --git a/ext/soap/soap.c b/ext/soap/soap.c index c224d24759..1b27ec1e90 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -197,7 +197,7 @@ PHP_FUNCTION(is_soap_fault); /* Server Functions */ -PHP_METHOD(SoapServer, SoapServer); +PHP_METHOD(SoapServer, __construct); PHP_METHOD(SoapServer, setClass); PHP_METHOD(SoapServer, setObject); PHP_METHOD(SoapServer, addFunction); @@ -208,7 +208,7 @@ PHP_METHOD(SoapServer, fault); PHP_METHOD(SoapServer, addSoapHeader); /* Client Functions */ -PHP_METHOD(SoapClient, SoapClient); +PHP_METHOD(SoapClient, __construct); PHP_METHOD(SoapClient, __call); PHP_METHOD(SoapClient, __getLastRequest); PHP_METHOD(SoapClient, __getLastResponse); @@ -223,30 +223,28 @@ PHP_METHOD(SoapClient, __setLocation); PHP_METHOD(SoapClient, __setSoapHeaders); /* SoapVar Functions */ -PHP_METHOD(SoapVar, SoapVar); +PHP_METHOD(SoapVar, __construct); /* SoapFault Functions */ -PHP_METHOD(SoapFault, SoapFault); +PHP_METHOD(SoapFault, __construct); PHP_METHOD(SoapFault, __toString); /* SoapParam Functions */ -PHP_METHOD(SoapParam, SoapParam); +PHP_METHOD(SoapParam, __construct); /* SoapHeader Functions */ -PHP_METHOD(SoapHeader, SoapHeader); - -#define SOAP_CTOR(class_name, func_name, arginfo, flags) PHP_ME(class_name, func_name, arginfo, flags) +PHP_METHOD(SoapHeader, __construct); /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO(arginfo_soap__void, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapparam_soapparam, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapparam___construct, 0, 0, 2) ZEND_ARG_INFO(0, data) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader_soapheader, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader___construct, 0, 0, 2) ZEND_ARG_INFO(0, namespace) ZEND_ARG_INFO(0, name) ZEND_ARG_INFO(0, data) @@ -254,7 +252,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader_soapheader, 0, 0, 2) ZEND_ARG_INFO(0, actor) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault_soapfault, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault___construct, 0, 0, 2) ZEND_ARG_INFO(0, faultcode) ZEND_ARG_INFO(0, faultstring) ZEND_ARG_INFO(0, faultactor) @@ -263,7 +261,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault_soapfault, 0, 0, 2) ZEND_ARG_INFO(0, headerfault) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapvar_soapvar, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapvar___construct, 0, 0, 2) ZEND_ARG_INFO(0, data) ZEND_ARG_INFO(0, encoding) ZEND_ARG_INFO(0, type_name) @@ -284,7 +282,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_addsoapheader, 0, 0, 1) ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_soapserver, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver___construct, 0, 0, 1) ZEND_ARG_INFO(0, wsdl) ZEND_ARG_INFO(0, options) ZEND_END_ARG_INFO() @@ -313,7 +311,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_handle, 0, 0, 0) ZEND_ARG_INFO(0, soap_request) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient_soapclient, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___construct, 0, 0, 1) ZEND_ARG_INFO(0, wsdl) ZEND_ARG_INFO(0, options) ZEND_END_ARG_INFO() @@ -389,13 +387,13 @@ static const zend_function_entry soap_functions[] = { }; static const zend_function_entry soap_fault_functions[] = { - SOAP_CTOR(SoapFault, SoapFault, arginfo_soapfault_soapfault, 0) + PHP_ME(SoapFault, __construct, arginfo_soapfault___construct, 0) PHP_ME(SoapFault, __toString, arginfo_soap__void, 0) PHP_FE_END }; static const zend_function_entry soap_server_functions[] = { - SOAP_CTOR(SoapServer, SoapServer, arginfo_soapserver_soapserver, 0) + PHP_ME(SoapServer, __construct, arginfo_soapserver___construct, 0) PHP_ME(SoapServer, setPersistence, arginfo_soapserver_setpersistence, 0) PHP_ME(SoapServer, setClass, arginfo_soapserver_setclass, 0) PHP_ME(SoapServer, setObject, arginfo_soapserver_setobject, 0) @@ -408,7 +406,7 @@ static const zend_function_entry soap_server_functions[] = { }; static const zend_function_entry soap_client_functions[] = { - SOAP_CTOR(SoapClient, SoapClient, arginfo_soapclient_soapclient, 0) + PHP_ME(SoapClient, __construct, arginfo_soapclient___construct, 0) PHP_ME(SoapClient, __call, arginfo_soapclient___call, 0) ZEND_NAMED_ME(__soapCall, ZEND_MN(SoapClient___call), arginfo_soapclient___soapcall, 0) PHP_ME(SoapClient, __getLastRequest, arginfo_soapclient___getlastrequest, 0) @@ -426,17 +424,17 @@ static const zend_function_entry soap_client_functions[] = { }; static const zend_function_entry soap_var_functions[] = { - SOAP_CTOR(SoapVar, SoapVar, arginfo_soapvar_soapvar, 0) + PHP_ME(SoapVar, __construct, arginfo_soapvar___construct, 0) PHP_FE_END }; static const zend_function_entry soap_param_functions[] = { - SOAP_CTOR(SoapParam, SoapParam, arginfo_soapparam_soapparam, 0) + PHP_ME(SoapParam, __construct, arginfo_soapparam___construct, 0) PHP_FE_END }; static const zend_function_entry soap_header_functions[] = { - SOAP_CTOR(SoapHeader, SoapHeader, arginfo_soapheader_soapheader, 0) + PHP_ME(SoapHeader, __construct, arginfo_soapheader___construct, 0) PHP_FE_END }; @@ -785,9 +783,9 @@ PHP_MINFO_FUNCTION(soap) } -/* {{{ proto object SoapParam::SoapParam(mixed data, string name) +/* {{{ proto object SoapParam::__construct(mixed data, string name) SoapParam constructor */ -PHP_METHOD(SoapParam, SoapParam) +PHP_METHOD(SoapParam, __construct) { zval *data; char *name; @@ -809,9 +807,9 @@ PHP_METHOD(SoapParam, SoapParam) /* }}} */ -/* {{{ proto object SoapHeader::SoapHeader(string namespace, string name [, mixed data [, bool mustUnderstand [, mixed actor]]]) +/* {{{ proto object SoapHeader::__construct(string namespace, string name [, mixed data [, bool mustUnderstand [, mixed actor]]]) SoapHeader constructor */ -PHP_METHOD(SoapHeader, SoapHeader) +PHP_METHOD(SoapHeader, __construct) { zval *data = NULL, *actor = NULL; char *name, *ns; @@ -852,9 +850,9 @@ PHP_METHOD(SoapHeader, SoapHeader) } /* }}} */ -/* {{{ proto object SoapFault::SoapFault(string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]]) +/* {{{ proto object SoapFault::__construct(string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]]) SoapFault constructor */ -PHP_METHOD(SoapFault, SoapFault) +PHP_METHOD(SoapFault, __construct) { char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL, *name = NULL, *fault_code_ns = NULL; size_t fault_string_len, fault_actor_len = 0, name_len = 0, fault_code_len = 0; @@ -955,9 +953,9 @@ PHP_METHOD(SoapFault, __toString) } /* }}} */ -/* {{{ proto object SoapVar::SoapVar(mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]]) +/* {{{ proto object SoapVar::__construct(mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]]) SoapVar constructor */ -PHP_METHOD(SoapVar, SoapVar) +PHP_METHOD(SoapVar, __construct) { zval *data, *type, *this_ptr; char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL; @@ -1102,9 +1100,9 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht) /* {{{ */ } /* }}} */ -/* {{{ proto object SoapServer::SoapServer(mixed wsdl [, array options]) +/* {{{ proto object SoapServer::__construct(mixed wsdl [, array options]) SoapServer constructor */ -PHP_METHOD(SoapServer, SoapServer) +PHP_METHOD(SoapServer, __construct) { soapServicePtr service; zval *wsdl = NULL, *options = NULL; @@ -1113,12 +1111,12 @@ PHP_METHOD(SoapServer, SoapServer) zend_long cache_wsdl; HashTable *typemap_ht = NULL; - SOAP_SERVER_BEGIN_CODE(); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { - php_error_docref(NULL, E_ERROR, "Invalid parameters"); + return; } + SOAP_SERVER_BEGIN_CODE(); + if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) { php_error_docref(NULL, E_ERROR, "Invalid parameters"); } @@ -2256,9 +2254,9 @@ PHP_FUNCTION(is_soap_fault) /* SoapClient functions */ -/* {{{ proto object SoapClient::SoapClient(mixed wsdl [, array options]) +/* {{{ proto object SoapClient::__construct(mixed wsdl [, array options]) SoapClient constructor */ -PHP_METHOD(SoapClient, SoapClient) +PHP_METHOD(SoapClient, __construct) { zval *wsdl, *options = NULL; @@ -2269,12 +2267,12 @@ PHP_METHOD(SoapClient, SoapClient) HashTable *typemap_ht = NULL; zval *this_ptr = ZEND_THIS; - SOAP_CLIENT_BEGIN_CODE(); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { - php_error_docref(NULL, E_ERROR, "Invalid parameters"); + return; } + SOAP_CLIENT_BEGIN_CODE(); + if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) { php_error_docref(NULL, E_ERROR, "$wsdl must be string or null"); } diff --git a/ext/soap/tests/bug77088.phpt b/ext/soap/tests/bug77088.phpt index 0c1a604f2e..e6f5e7582e 100644 --- a/ext/soap/tests/bug77088.phpt +++ b/ext/soap/tests/bug77088.phpt @@ -12,18 +12,17 @@ try $options = NULL; $sClient = new SoapClient("test.wsdl", $options); } -catch(SoapFault $e) +catch(TypeError $e) { var_dump($e); } ?> --EXPECTF-- -Warning: SoapClient::SoapClient() expects parameter 2 to be array, null given in %sbug77088.php on line %d -object(SoapFault)#%d (%d) { +object(TypeError)#%d (%d) { ["message":protected]=> - string(44) "SoapClient::SoapClient(): Invalid parameters" - ["string":"Exception":private]=> + string(%d) "SoapClient::__construct() expects parameter 2 to be array, null given" + ["string":"Error":private]=> string(0) "" ["code":protected]=> int(0) @@ -31,7 +30,7 @@ object(SoapFault)#%d (%d) { string(%d) "%sbug77088.php" ["line":protected]=> int(6) - ["trace":"Exception":private]=> + ["trace":"Error":private]=> array(1) { [0]=> array(6) { @@ -40,7 +39,7 @@ object(SoapFault)#%d (%d) { ["line"]=> int(6) ["function"]=> - string(10) "SoapClient" + string(11) "__construct" ["class"]=> string(10) "SoapClient" ["type"]=> @@ -54,12 +53,6 @@ object(SoapFault)#%d (%d) { } } } - ["previous":"Exception":private]=> + ["previous":"Error":private]=> NULL - ["faultstring"]=> - string(44) "SoapClient::SoapClient(): Invalid parameters" - ["faultcode"]=> - string(6) "Client" - ["faultcodens"]=> - string(41) "http://schemas.xmlsoap.org/soap/envelope/" } diff --git a/ext/soap/tests/bugs/bug31422.phpt b/ext/soap/tests/bugs/bug31422.phpt index 4889b10d8e..152781a4ec 100644 --- a/ext/soap/tests/bugs/bug31422.phpt +++ b/ext/soap/tests/bugs/bug31422.phpt @@ -39,7 +39,6 @@ $server->handle($HTTP_RAW_POST_DATA); echo "ok\n"; ?> --EXPECTF-- -PHP Warning: fopen() expects at least 2 parameters, 0 given in %sbug31422.php on line %d -PHP Fatal error: Hello in %sbug31422.php on line %d <?xml version="1.0" encoding="UTF-8"?> -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Hello</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>fopen() expects at least 2 parameters, 0 given</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> +ok diff --git a/ext/soap/tests/bugs/bug31755.phpt b/ext/soap/tests/bugs/bug31755.phpt index 1d65b3a42b..600fd43058 100644 --- a/ext/soap/tests/bugs/bug31755.phpt +++ b/ext/soap/tests/bugs/bug31755.phpt @@ -14,6 +14,6 @@ $response= $client->__call('function', array(), null, $header); print $client->__getLastRequest(); ?> --EXPECTF-- -Warning: SoapHeader::SoapHeader(): Invalid namespace in %s on line %d +Warning: SoapHeader::__construct(): Invalid namespace in %s on line %d <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="myNS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns1:function/></SOAP-ENV:Body></SOAP-ENV:Envelope> diff --git a/ext/soap/tests/fault_warning.phpt b/ext/soap/tests/fault_warning.phpt index 98d2d269ea..2ee8bf58ee 100644 --- a/ext/soap/tests/fault_warning.phpt +++ b/ext/soap/tests/fault_warning.phpt @@ -16,13 +16,13 @@ $fault = new SoapFault(["more-ns", "Sender"], "message"); // two given echo get_class($fault); ?> --EXPECTF-- -Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d +Warning: SoapFault::__construct(): Invalid fault code in %s on line %d -Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d +Warning: SoapFault::__construct(): Invalid fault code in %s on line %d SoapFault SoapFault -Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d +Warning: SoapFault::__construct(): Invalid fault code in %s on line %d -Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d +Warning: SoapFault::__construct(): Invalid fault code in %s on line %d SoapFault diff --git a/ext/sockets/tests/socket_connect_params.phpt b/ext/sockets/tests/socket_connect_params.phpt index 94c38de1cb..f1fdf55a81 100644 --- a/ext/sockets/tests/socket_connect_params.phpt +++ b/ext/sockets/tests/socket_connect_params.phpt @@ -14,8 +14,11 @@ fa@php.net $rand = rand(1,999); $s_c = socket_create_listen(31330+$rand); // wrong parameter count - $s_w = socket_connect(); - $s_w = socket_connect($s_c); + try { + $s_w = socket_connect($s_c); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $s_w = socket_connect($s_c, '0.0.0.0'); $s_w = socket_connect($s_c, '0.0.0.0', 31330+$rand); @@ -23,9 +26,7 @@ fa@php.net ?> --EXPECTF-- -Warning: socket_connect() expects at least 2 parameters, 0 given in %s on line %d - -Warning: socket_connect() expects at least 2 parameters, 1 given in %s on line %d +socket_connect() expects at least 2 parameters, 1 given Warning: socket_connect(): Socket of type AF_INET requires 3 arguments in %s on line %d diff --git a/ext/sockets/tests/socket_create_listen_used.phpt b/ext/sockets/tests/socket_create_listen_used.phpt index b41e2caefc..2dfec4fbf7 100644 --- a/ext/sockets/tests/socket_create_listen_used.phpt +++ b/ext/sockets/tests/socket_create_listen_used.phpt @@ -18,7 +18,6 @@ fa@php.net // default invocation $s_c_l2 = socket_create_listen(31330+$rand); var_dump($s_c_l2); - socket_close($s_c_l2); socket_close($s_c_l); ?> --EXPECTF-- @@ -26,5 +25,3 @@ resource(%i) of type (Socket) Warning: socket_create_listen(): unable to bind to given address [%i]: %a in %s on line %d bool(false) - -Warning: socket_close() expects parameter 1 to be resource, bool given in %s on line %d diff --git a/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt b/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt index 554819ac99..5cf054458a 100644 --- a/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt +++ b/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt @@ -10,10 +10,6 @@ if (!extension_loaded('sockets')) { } --FILE-- <?php -var_dump(socket_create_pair(AF_INET, null, null)); - -$domain = 'unknown'; -var_dump(socket_create_pair($domain, SOCK_STREAM, 0, $sockets)); var_dump(socket_create_pair(AF_INET, null, null, $sockets)); @@ -21,11 +17,6 @@ var_dump(socket_create_pair(31337, null, null, $sockets)); var_dump(socket_create_pair(AF_INET, 31337, 0, $sockets)); --EXPECTF-- -Warning: socket_create_pair() expects exactly 4 parameters, 3 given in %s on line %d -NULL - -Warning: socket_create_pair() expects parameter 1 to be int, string given in %s on line %d -NULL bool(true) Warning: socket_create_pair(): invalid socket domain [31337] specified for argument 1, assuming AF_INET in %s on line %d diff --git a/ext/sockets/tests/socket_create_pair-wrongparams.phpt b/ext/sockets/tests/socket_create_pair-wrongparams.phpt index 856d2cdc52..41154620ad 100644 --- a/ext/sockets/tests/socket_create_pair-wrongparams.phpt +++ b/ext/sockets/tests/socket_create_pair-wrongparams.phpt @@ -10,23 +10,15 @@ if (!extension_loaded('sockets')) { } --FILE-- <?php -var_dump(socket_create_pair(AF_INET, null, null)); - -$domain = 'unknown'; -var_dump(socket_create_pair($domain, SOCK_STREAM, 0, $sockets)); var_dump(socket_create_pair(AF_INET, null, null, $sockets)); var_dump(socket_create_pair(31337, null, null, $sockets)); var_dump(socket_create_pair(AF_INET, 31337, 0, $sockets)); ---EXPECTF-- -Warning: socket_create_pair() expects exactly 4 parameters, 3 given in %s on line %d -NULL - -Warning: socket_create_pair() expects parameter 1 to be int, string given in %s on line %d -NULL +?> +--EXPECTF-- Warning: socket_create_pair(): unable to create socket pair [%d]: %s not supported in %s on line %d bool(false) diff --git a/ext/sockets/tests/socket_export_stream-2.phpt b/ext/sockets/tests/socket_export_stream-2.phpt index d3db5e36c8..fb89bd28d7 100644 --- a/ext/sockets/tests/socket_export_stream-2.phpt +++ b/ext/sockets/tests/socket_export_stream-2.phpt @@ -8,10 +8,6 @@ if (!extension_loaded('sockets')) { --FILE-- <?php -var_dump(socket_export_stream()); -var_dump(socket_export_stream(1, 2)); -var_dump(socket_export_stream(1)); -var_dump(socket_export_stream(new stdclass)); var_dump(socket_export_stream(fopen(__FILE__, "rb"))); var_dump(socket_export_stream(stream_socket_server("udp://127.0.0.1:58392", $errno, $errstr, STREAM_SERVER_BIND))); $s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); @@ -21,19 +17,8 @@ var_dump(socket_export_stream($s)); echo "Done."; +?> --EXPECTF-- -Warning: socket_export_stream() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: socket_export_stream() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: socket_export_stream() expects parameter 1 to be resource, int given in %s on line %d -NULL - -Warning: socket_export_stream() expects parameter 1 to be resource, object given in %s on line %d -NULL - Warning: socket_export_stream(): supplied resource is not a valid Socket resource in %s on line %d bool(false) diff --git a/ext/sockets/tests/socket_import_stream-2.phpt b/ext/sockets/tests/socket_import_stream-2.phpt index e1fada608e..8464b46039 100644 --- a/ext/sockets/tests/socket_import_stream-2.phpt +++ b/ext/sockets/tests/socket_import_stream-2.phpt @@ -8,10 +8,6 @@ if (!extension_loaded('sockets')) { --FILE-- <?php -var_dump(socket_import_stream()); -var_dump(socket_import_stream(1, 2)); -var_dump(socket_import_stream(1)); -var_dump(socket_import_stream(new stdclass)); var_dump(socket_import_stream(fopen(__FILE__, "rb"))); var_dump(socket_import_stream(socket_create(AF_INET, SOCK_DGRAM, SOL_UDP))); $s = stream_socket_server("udp://127.0.0.1:58392", $errno, $errstr, STREAM_SERVER_BIND); @@ -19,21 +15,9 @@ var_dump($s); var_dump(fclose($s)); var_dump(socket_import_stream($s)); - echo "Done."; +?> --EXPECTF-- -Warning: socket_import_stream() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: socket_import_stream() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: socket_import_stream() expects parameter 1 to be resource, int given in %s on line %d -NULL - -Warning: socket_import_stream() expects parameter 1 to be resource, object given in %s on line %d -NULL - Warning: socket_import_stream(): cannot represent a stream of type STDIO as a Socket Descriptor in %s on line %d bool(false) diff --git a/ext/sockets/tests/socket_listen-wrongparams.phpt b/ext/sockets/tests/socket_listen-wrongparams.phpt index 41d7ac1f10..b5715a5ff5 100644 --- a/ext/sockets/tests/socket_listen-wrongparams.phpt +++ b/ext/sockets/tests/socket_listen-wrongparams.phpt @@ -10,13 +10,9 @@ if (!extension_loaded('sockets')) { } --FILE-- <?php -var_dump(socket_listen(null)); $socket = socket_create(AF_UNIX, SOCK_STREAM, 0); var_dump(socket_listen($socket)); --EXPECTF-- -Warning: socket_listen() expects parameter 1 to be resource, null given in %s on line %d -NULL - Warning: socket_listen(): unable to listen on socket [%d]: Invalid argument in %s on line %d bool(false) --CREDITS-- diff --git a/ext/sockets/tests/socket_read_params.phpt b/ext/sockets/tests/socket_read_params.phpt index acf1d2f35d..4d462ce3a7 100644 --- a/ext/sockets/tests/socket_read_params.phpt +++ b/ext/sockets/tests/socket_read_params.phpt @@ -12,16 +12,9 @@ fa@php.net --FILE-- <?php $rand = rand(1,999); - // wrong parameter count - $s_c = socket_read(); - $s_c = socket_read(14); $s_c_l = socket_create_listen(31330+$rand); $s_c = socket_read($s_c_l, 25); socket_close($s_c_l); ?> --EXPECTF-- -Warning: socket_read() expects at least 2 parameters, 0 given in %s on line %d - -Warning: socket_read() expects at least 2 parameters, 1 given in %s on line %d - Warning: socket_read(): unable to read from socket [%i]: %a in %s on line %d diff --git a/ext/sockets/tests/socket_select-wrongparams-2.phpt b/ext/sockets/tests/socket_select-wrongparams-2.phpt index c149973e70..a7c423df1b 100644 --- a/ext/sockets/tests/socket_select-wrongparams-2.phpt +++ b/ext/sockets/tests/socket_select-wrongparams-2.phpt @@ -12,12 +12,9 @@ $write = null; $except = null; $time = 0; var_dump(socket_select($sockets, $write, $except, $time)); -socket_select($sockets, $write, $except); --EXPECTF-- Warning: socket_select(): no resource arrays were passed to select in %s on line %d bool(false) - -Warning: socket_select() expects at least 4 parameters, 3 given in %s on line %d --CREDITS-- Till Klampaeckel, till@php.net Berlin TestFest 2009 diff --git a/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt b/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt index 689421011e..0720b319b7 100644 --- a/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt +++ b/ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt @@ -16,7 +16,6 @@ if (!extension_loaded('sockets')) { } $address = '127.0.0.1'; - socket_sendto($socket, '', 1, 0, $address); // cause warning if (!socket_bind($socket, $address, 1223)) { die("Unable to bind to $address:1223"); } @@ -34,8 +33,6 @@ if (!extension_loaded('sockets')) { $from = ""; $port = 0; - socket_recvfrom($socket, $buf, 12, 0); // cause warning - socket_recvfrom($socket, $buf, 12, 0, $from); // cause warning $bytes_received = socket_recvfrom($socket, $buf, 12, 0, $from, $port); if ($bytes_received == -1) { die('An error occurred while receiving from the socket'); @@ -45,13 +42,8 @@ if (!extension_loaded('sockets')) { echo "Received $buf from remote address $from and remote port $port" . PHP_EOL; socket_close($socket); ---EXPECTF-- -Warning: Wrong parameter count for socket_sendto() in %s on line %d +--EXPECT-- bool(false) - -Warning: socket_recvfrom() expects at least 5 parameters, 4 given in %s on line %d - -Warning: Wrong parameter count for socket_recvfrom() in %s on line %d Received Ping! from remote address 127.0.0.1 and remote port 1223 --CREDITS-- Falko Menge <mail at falko-menge dot de> diff --git a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt index 8754028f84..fbc4da3861 100644 --- a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt +++ b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt @@ -20,7 +20,6 @@ require 'ipv6_skipif.inc'; } socket_recvfrom($socket, $buf, 12, 0, $from, $port); // cause warning $address = '::1'; - socket_sendto($socket, '', 1, 0, $address); // cause warning if (!socket_bind($socket, $address, 1223)) { die("Unable to bind to $address:1223"); } @@ -36,8 +35,6 @@ require 'ipv6_skipif.inc'; $from = ""; $port = 0; - socket_recvfrom($socket, $buf, 12, 0); // cause warning - socket_recvfrom($socket, $buf, 12, 0, $from); // cause warning $bytes_received = socket_recvfrom($socket, $buf, 12, 0, $from, $port); if ($bytes_received == -1) { die('An error occurred while receiving from the socket'); @@ -50,12 +47,6 @@ require 'ipv6_skipif.inc'; --EXPECTF-- Warning: socket_recvfrom(): unable to recvfrom [10022]: %s in %s on line %d - -Warning: Wrong parameter count for socket_sendto() in %s on line %d - -Warning: socket_recvfrom() expects at least 5 parameters, 4 given in %s on line %d - -Warning: Wrong parameter count for socket_recvfrom() in %s on line %d Received Ping! from remote address ::1 and remote port 1223 --CREDITS-- Falko Menge <mail at falko-menge dot de> diff --git a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt index bd07904277..ef44109b81 100644 --- a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt +++ b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp.phpt @@ -20,7 +20,6 @@ require 'ipv6_skipif.inc'; } var_dump(socket_recvfrom($socket, $buf, 12, 0, $from, $port)); // false (EAGAIN, no warning) $address = '::1'; - socket_sendto($socket, '', 1, 0, $address); // cause warning if (!socket_bind($socket, $address, 1223)) { die("Unable to bind to $address:1223"); } @@ -36,8 +35,6 @@ require 'ipv6_skipif.inc'; $from = ""; $port = 0; - socket_recvfrom($socket, $buf, 12, 0); // cause warning - socket_recvfrom($socket, $buf, 12, 0, $from); // cause warning $bytes_received = socket_recvfrom($socket, $buf, 12, 0, $from, $port); if ($bytes_received == -1) { die('An error occurred while receiving from the socket'); @@ -47,14 +44,8 @@ require 'ipv6_skipif.inc'; echo "Received $buf from remote address $from and remote port $port" . PHP_EOL; socket_close($socket); ---EXPECTF-- +--EXPECT-- bool(false) - -Warning: Wrong parameter count for socket_sendto() in %s on line %d - -Warning: socket_recvfrom() expects at least 5 parameters, 4 given in %s on line %d - -Warning: Wrong parameter count for socket_recvfrom() in %s on line %d Received Ping! from remote address ::1 and remote port 1223 --CREDITS-- Falko Menge <mail at falko-menge dot de> diff --git a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt index e25bf4df1a..600cbea595 100644 --- a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt +++ b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt @@ -26,7 +26,6 @@ if (!extension_loaded('sockets')) { $msg = "Ping!"; $len = strlen($msg); - $bytes_sent = socket_sendto($socket, $msg, $len, 0); // cause warning $bytes_sent = socket_sendto($socket, $msg, $len, 0, $address); if ($bytes_sent == -1) { @unlink($address); @@ -54,8 +53,6 @@ if (!extension_loaded('sockets')) { --EXPECTF-- Warning: socket_create(): Unable to create socket [%d]: Protocol not supported in %s on line %d bool(false) - -Warning: socket_sendto() expects at least 5 parameters, 4 given in %s on line %d bool(false) Received Ping! --CREDITS-- diff --git a/ext/sockets/tests/socket_strerror.phpt b/ext/sockets/tests/socket_strerror.phpt index aef56e5a84..4f1237e890 100644 --- a/ext/sockets/tests/socket_strerror.phpt +++ b/ext/sockets/tests/socket_strerror.phpt @@ -14,13 +14,11 @@ fa@php.net ?> --FILE-- <?php - $s_s = socket_strerror(); for ($i=0;$i<=132;$i++) { var_dump(socket_strerror($i)); } ?> --EXPECTF-- -Warning: socket_strerror() expects exactly 1 parameter, 0 given in %s on line %d string(7) "Success" string(23) "Operation not permitted" string(25) "No such file or directory" diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index e4e1774bd7..96762e65c4 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -302,7 +302,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha } /* }}} */ /* {{{ proto void spl_autoload(string class_name [, string file_extensions]) - Default implementation for __autoload() */ + Default autoloader implementation */ PHP_FUNCTION(spl_autoload) { int pos_len, pos1_len; @@ -494,7 +494,7 @@ PHP_FUNCTION(spl_autoload_call) } while (0) /* {{{ proto bool spl_autoload_register([mixed autoload_function [, bool throw [, bool prepend]]]) - Register given function as __autoload() implementation */ + Register given function as autoloader */ PHP_FUNCTION(spl_autoload_register) { zend_string *func_name; @@ -513,7 +513,7 @@ PHP_FUNCTION(spl_autoload_register) } if (ZEND_NUM_ARGS()) { - if (!zend_is_callable_ex(zcallable, NULL, IS_CALLABLE_STRICT, &func_name, &fcc, &error)) { + if (!zend_is_callable_ex(zcallable, NULL, 0, &func_name, &fcc, &error)) { alfi.ce = fcc.calling_scope; alfi.func_ptr = fcc.function_handler; obj_ptr = fcc.object; @@ -668,7 +668,7 @@ skip: } /* }}} */ /* {{{ proto bool spl_autoload_unregister(mixed autoload_function) - Unregister given function as __autoload() implementation */ + Unregister given function as autoloader */ PHP_FUNCTION(spl_autoload_unregister) { zend_string *func_name = NULL; @@ -752,7 +752,7 @@ PHP_FUNCTION(spl_autoload_unregister) } /* }}} */ /* {{{ proto false|array spl_autoload_functions() - Return all registered __autoload() functionns */ + Return all registered autoloader functions */ PHP_FUNCTION(spl_autoload_functions) { zend_function *fptr; @@ -763,14 +763,6 @@ PHP_FUNCTION(spl_autoload_functions) } if (!EG(autoload_func)) { - if ((fptr = zend_hash_find_ptr(EG(function_table), ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD)))) { - zval tmp; - - array_init(return_value); - ZVAL_STR_COPY(&tmp, ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD)); - zend_hash_next_index_insert_new(Z_ARR_P(return_value), &tmp); - return; - } RETURN_FALSE; } diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index ab488726df..c4d9245cfb 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -165,7 +165,7 @@ static void spl_array_object_free_storage(zend_object *object) zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, int by_ref); /* {{{ spl_array_object_new_ex */ -static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) +static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) { spl_array_object *intern; zend_class_entry *parent = class_type; @@ -179,7 +179,7 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval * intern->ar_flags = 0; intern->ce_get_iterator = spl_ce_ArrayIterator; if (orig) { - spl_array_object *other = Z_SPLARRAY_P(orig); + spl_array_object *other = spl_array_from_obj(orig); intern->ar_flags &= ~ SPL_ARRAY_CLONE_MASK; intern->ar_flags |= (other->ar_flags & SPL_ARRAY_CLONE_MASK); @@ -187,16 +187,18 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval * if (clone_orig) { if (other->ar_flags & SPL_ARRAY_IS_SELF) { ZVAL_UNDEF(&intern->array); - } else if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayObject) { + } else if (orig->handlers == &spl_handler_ArrayObject) { ZVAL_ARR(&intern->array, zend_array_dup(spl_array_get_hash_table(other))); } else { - ZEND_ASSERT(Z_OBJ_HT_P(orig) == &spl_handler_ArrayIterator); - ZVAL_COPY(&intern->array, orig); + ZEND_ASSERT(orig->handlers == &spl_handler_ArrayIterator); + GC_ADDREF(orig); + ZVAL_OBJ(&intern->array, orig); intern->ar_flags |= SPL_ARRAY_USE_OTHER; } } else { - ZVAL_COPY(&intern->array, orig); + GC_ADDREF(orig); + ZVAL_OBJ(&intern->array, orig); intern->ar_flags |= SPL_ARRAY_USE_OTHER; } } else { @@ -273,13 +275,11 @@ static zend_object *spl_array_object_new(zend_class_entry *class_type) /* }}} */ /* {{{ spl_array_object_clone */ -static zend_object *spl_array_object_clone(zval *zobject) +static zend_object *spl_array_object_clone(zend_object *old_object) { - zend_object *old_object; zend_object *new_object; - old_object = Z_OBJ_P(zobject); - new_object = spl_array_object_new_ex(old_object->ce, zobject, 1); + new_object = spl_array_object_new_ex(old_object->ce, old_object, 1); zend_objects_clone_members(new_object, old_object); @@ -393,11 +393,11 @@ num_index: } } /* }}} */ -static int spl_array_has_dimension(zval *object, zval *offset, int check_empty); +static int spl_array_has_dimension(zend_object *object, zval *offset, int check_empty); -static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval *offset, int type, zval *rv) /* {{{ */ +static zval *spl_array_read_dimension_ex(int check_inherited, zend_object *object, zval *offset, int type, zval *rv) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); zval *ret; if (check_inherited && @@ -416,7 +416,7 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval } else { SEPARATE_ARG_IF_REF(offset); } - zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", rv, offset); + zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_get, "offsetGet", rv, offset); zval_ptr_dtor(offset); if (!Z_ISUNDEF_P(rv)) { @@ -442,14 +442,14 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval return ret; } /* }}} */ -static zval *spl_array_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */ +static zval *spl_array_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */ { return spl_array_read_dimension_ex(1, object, offset, type, rv); } /* }}} */ -static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval *offset, zval *value) /* {{{ */ +static void spl_array_write_dimension_ex(int check_inherited, zend_object *object, zval *offset, zval *value) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); zend_long index; HashTable *ht; @@ -462,7 +462,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval } else { SEPARATE_ARG_IF_REF(offset); } - zend_call_method_with_2_params(object, Z_OBJCE_P(object), &intern->fptr_offset_set, "offsetSet", NULL, offset, value); + zend_call_method_with_2_params(object, object->ce, &intern->fptr_offset_set, "offsetSet", NULL, offset, value); zval_ptr_dtor(offset); return; } @@ -517,20 +517,20 @@ num_index: } } /* }}} */ -static void spl_array_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */ +static void spl_array_write_dimension(zend_object *object, zval *offset, zval *value) /* {{{ */ { spl_array_write_dimension_ex(1, object, offset, value); } /* }}} */ -static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset) /* {{{ */ +static void spl_array_unset_dimension_ex(int check_inherited, zend_object *object, zval *offset) /* {{{ */ { zend_long index; HashTable *ht; - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); if (check_inherited && intern->fptr_offset_del) { SEPARATE_ARG_IF_REF(offset); - zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_del, "offsetUnset", NULL, offset); + zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_del, "offsetUnset", NULL, offset); zval_ptr_dtor(offset); return; } @@ -602,20 +602,20 @@ num_index: } } /* }}} */ -static void spl_array_unset_dimension(zval *object, zval *offset) /* {{{ */ +static void spl_array_unset_dimension(zend_object *object, zval *offset) /* {{{ */ { spl_array_unset_dimension_ex(1, object, offset); } /* }}} */ -static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *offset, int check_empty) /* {{{ */ +static int spl_array_has_dimension_ex(int check_inherited, zend_object *object, zval *offset, int check_empty) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); zend_long index; zval rv, *value = NULL, *tmp; if (check_inherited && intern->fptr_offset_has) { SEPARATE_ARG_IF_REF(offset); - zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_has, "offsetExists", &rv, offset); + zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_has, "offsetExists", &rv, offset); zval_ptr_dtor(offset); if (zend_is_true(&rv)) { @@ -693,7 +693,7 @@ num_index: } } /* }}} */ -static int spl_array_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */ +static int spl_array_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */ { return spl_array_has_dimension_ex(1, object, offset, check_empty); } /* }}} */ @@ -707,7 +707,7 @@ SPL_METHOD(Array, offsetExists) if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) { return; } - RETURN_BOOL(spl_array_has_dimension_ex(0, ZEND_THIS, index, 2)); + RETURN_BOOL(spl_array_has_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, 2)); } /* }}} */ /* {{{ proto mixed ArrayObject::offsetGet(mixed $index) @@ -719,7 +719,7 @@ SPL_METHOD(Array, offsetGet) if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) { return; } - value = spl_array_read_dimension_ex(0, ZEND_THIS, index, BP_VAR_R, return_value); + value = spl_array_read_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, BP_VAR_R, return_value); if (value != return_value) { ZVAL_COPY_DEREF(return_value, value); } @@ -734,7 +734,7 @@ SPL_METHOD(Array, offsetSet) if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &index, &value) == FAILURE) { return; } - spl_array_write_dimension_ex(0, ZEND_THIS, index, value); + spl_array_write_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, value); } /* }}} */ void spl_array_iterator_append(zval *object, zval *append_value) /* {{{ */ @@ -746,7 +746,7 @@ void spl_array_iterator_append(zval *object, zval *append_value) /* {{{ */ return; } - spl_array_write_dimension(object, NULL, append_value); + spl_array_write_dimension(Z_OBJ_P(object), NULL, append_value); } /* }}} */ /* {{{ proto void ArrayObject::append(mixed $newval) @@ -771,7 +771,7 @@ SPL_METHOD(Array, offsetUnset) if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) { return; } - spl_array_unset_dimension_ex(0, ZEND_THIS, index); + spl_array_unset_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index); } /* }}} */ /* {{{ proto array ArrayObject::getArrayCopy() @@ -785,9 +785,9 @@ SPL_METHOD(Array, getArrayCopy) RETURN_ARR(zend_array_dup(spl_array_get_hash_table(intern))); } /* }}} */ -static HashTable *spl_array_get_properties_for(zval *object, zend_prop_purpose purpose) /* {{{ */ +static HashTable *spl_array_get_properties_for(zend_object *object, zend_prop_purpose purpose) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); HashTable *ht; zend_bool dup; @@ -822,12 +822,12 @@ static HashTable *spl_array_get_properties_for(zval *object, zend_prop_purpose p return ht; } /* }}} */ -static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */ +static HashTable* spl_array_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */ { zval *storage; zend_string *zname; zend_class_entry *base; - spl_array_object *intern = Z_SPLARRAY_P(obj); + spl_array_object *intern = spl_array_from_obj(obj); if (!intern->std.properties) { rebuild_object_properties(&intern->std); @@ -846,7 +846,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */ storage = &intern->array; Z_TRY_ADDREF_P(storage); - base = Z_OBJ_HT_P(obj) == &spl_handler_ArrayIterator + base = obj->handlers == &spl_handler_ArrayIterator ? spl_ce_ArrayIterator : spl_ce_ArrayObject; zname = spl_gen_private_prop_name(base, "storage", sizeof("storage")-1); zend_symtable_update(debug_info, zname, storage); @@ -857,75 +857,85 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */ } /* }}} */ -static HashTable *spl_array_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */ +static HashTable *spl_array_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(obj); + spl_array_object *intern = spl_array_from_obj(obj); *gc_data = &intern->array; *gc_data_count = 1; return zend_std_get_properties(obj); } /* }}} */ -static zval *spl_array_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */ +static zval *spl_array_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0 - && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) { - return spl_array_read_dimension(object, member, type, rv); + && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) { + zval member; + ZVAL_STR(&member, name); + return spl_array_read_dimension(object, &member, type, rv); } - return zend_std_read_property(object, member, type, cache_slot, rv); + return zend_std_read_property(object, name, type, cache_slot, rv); } /* }}} */ -static zval *spl_array_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */ +static zval *spl_array_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0 - && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) { - spl_array_write_dimension(object, member, value); + && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) { + zval member; + ZVAL_STR(&member, name); + spl_array_write_dimension(object, &member, value); return value; } - return zend_std_write_property(object, member, value, cache_slot); + return zend_std_write_property(object, name, value, cache_slot); } /* }}} */ -static zval *spl_array_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static zval *spl_array_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0 - && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) { + && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) { /* If object has offsetGet() overridden, then fallback to read_property, * which will call offsetGet(). */ + zval member; if (intern->fptr_offset_get) { return NULL; } - return spl_array_get_dimension_ptr(1, intern, member, type); + ZVAL_STR(&member, name); + return spl_array_get_dimension_ptr(1, intern, &member, type); } - return zend_std_get_property_ptr_ptr(object, member, type, cache_slot); + return zend_std_get_property_ptr_ptr(object, name, type, cache_slot); } /* }}} */ -static int spl_array_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */ +static int spl_array_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0 - && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) { - return spl_array_has_dimension(object, member, has_set_exists); + && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) { + zval member; + ZVAL_STR(&member, name); + return spl_array_has_dimension(object, &member, has_set_exists); } - return zend_std_has_property(object, member, has_set_exists, cache_slot); + return zend_std_has_property(object, name, has_set_exists, cache_slot); } /* }}} */ -static void spl_array_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */ +static void spl_array_unset_property(zend_object *object, zend_string *name, void **cache_slot) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0 - && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) { - spl_array_unset_dimension(object, member); + && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) { + zval member; + ZVAL_STR(&member, name); + spl_array_unset_dimension(object, &member); return; } - zend_std_unset_property(object, member, cache_slot); + zend_std_unset_property(object, name, cache_slot); } /* }}} */ static int spl_array_compare_objects(zval *o1, zval *o2) /* {{{ */ @@ -1322,7 +1332,7 @@ SPL_METHOD(Array, getIterator) return; } - ZVAL_OBJ(return_value, spl_array_object_new_ex(intern->ce_get_iterator, object, 0)); + ZVAL_OBJ(return_value, spl_array_object_new_ex(intern->ce_get_iterator, Z_OBJ_P(object), 0)); } /* }}} */ @@ -1391,9 +1401,9 @@ static zend_long spl_array_object_count_elements_helper(spl_array_object *intern } } /* }}} */ -int spl_array_object_count_elements(zval *object, zend_long *count) /* {{{ */ +int spl_array_object_count_elements(zend_object *object, zend_long *count) /* {{{ */ { - spl_array_object *intern = Z_SPLARRAY_P(object); + spl_array_object *intern = spl_array_from_obj(object); if (intern->fptr_count) { zval rv; diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index da9887b501..416cbd014e 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -346,15 +346,13 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu Open the directory Clone other members (properties) */ -static zend_object *spl_filesystem_object_clone(zval *zobject) +static zend_object *spl_filesystem_object_clone(zend_object *old_object) { - zend_object *old_object; zend_object *new_object; spl_filesystem_object *intern; spl_filesystem_object *source; int index, skip_dots; - old_object = Z_OBJ_P(zobject); source = spl_filesystem_from_obj(old_object); new_object = spl_filesystem_object_new_ex(old_object->ce); intern = spl_filesystem_from_obj(new_object); @@ -466,7 +464,7 @@ static spl_filesystem_object *spl_filesystem_object_create_info(spl_filesystem_o if (ce->constructor->common.scope != spl_ce_SplFileInfo) { ZVAL_STRINGL(&arg1, file_path, file_path_len); - zend_call_method_with_1_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1); + zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1); zval_ptr_dtor(&arg1); } else { spl_filesystem_info_set_filename(intern, file_path, file_path_len, use_copy); @@ -511,7 +509,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file spl_filesystem_object_get_file_name(source); if (ce->constructor->common.scope != spl_ce_SplFileInfo) { ZVAL_STRINGL(&arg1, source->file_name, source->file_name_len); - zend_call_method_with_1_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1); + zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1); zval_ptr_dtor(&arg1); } else { intern->file_name = estrndup(source->file_name, source->file_name_len); @@ -536,7 +534,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file if (ce->constructor->common.scope != spl_ce_SplFileObject) { ZVAL_STRINGL(&arg1, source->file_name, source->file_name_len); ZVAL_STRINGL(&arg2, "r", 1); - zend_call_method_with_2_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1, &arg2); + zend_call_method_with_2_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1, &arg2); zval_ptr_dtor(&arg1); zval_ptr_dtor(&arg2); } else { @@ -600,9 +598,9 @@ static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, s } /* }}} */ -static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_temp) /* {{{ */ +static HashTable *spl_filesystem_object_get_debug_info(zend_object *object, int *is_temp) /* {{{ */ { - spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(object); + spl_filesystem_object *intern = spl_filesystem_from_obj(object); zval tmp; HashTable *rv; zend_string *pnstr; @@ -849,19 +847,19 @@ SPL_METHOD(DirectoryIterator, seek) if (intern->u.dir.index > pos) { /* we first rewind */ - zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewind, "rewind", NULL); + zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewind, "rewind", NULL); } while (intern->u.dir.index < pos) { int valid = 0; - zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid, "valid", &retval); + zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid, "valid", &retval); valid = zend_is_true(&retval); zval_ptr_dtor(&retval); if (!valid) { zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Seek position " ZEND_LONG_FMT " is out of range", pos); return; } - zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, "next", NULL); + zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, "next", NULL); } } /* }}} */ @@ -1346,15 +1344,12 @@ SPL_METHOD(SplFileInfo, setFileClass) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS); zend_class_entry *ce = spl_ce_SplFileObject; - zend_error_handling error_handling; - - zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) { - intern->file_class = ce; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) { + return; } - zend_restore_error_handling(&error_handling); + intern->file_class = ce; } /* }}} */ @@ -1364,15 +1359,12 @@ SPL_METHOD(SplFileInfo, setInfoClass) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS); zend_class_entry *ce = spl_ce_SplFileInfo; - zend_error_handling error_handling; - - zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling ); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) { - intern->info_class = ce; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) { + return; } - zend_restore_error_handling(&error_handling); + intern->info_class = ce; } /* }}} */ @@ -1382,15 +1374,12 @@ SPL_METHOD(SplFileInfo, getFileInfo) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS); zend_class_entry *ce = intern->info_class; - zend_error_handling error_handling; - zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling); - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) { - spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value); + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) { + return; } - zend_restore_error_handling(&error_handling); + spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value); } /* }}} */ @@ -1400,22 +1389,20 @@ SPL_METHOD(SplFileInfo, getPathInfo) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS); zend_class_entry *ce = intern->info_class; - zend_error_handling error_handling; - - zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling); + size_t path_len; + char *path; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) { - size_t path_len; - char *path = spl_filesystem_object_get_pathname(intern, &path_len); - if (path) { - char *dpath = estrndup(path, path_len); - path_len = php_dirname(dpath, path_len); - spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value); - efree(dpath); - } + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) { + return; } - zend_restore_error_handling(&error_handling); + path = spl_filesystem_object_get_pathname(intern, &path_len); + if (path) { + char *dpath = estrndup(path, path_len); + path_len = php_dirname(dpath, path_len); + spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value); + efree(dpath); + } } /* }}} */ @@ -1860,12 +1847,12 @@ zend_object_iterator *spl_filesystem_tree_get_iterator(zend_class_entry *ce, zva /* }}} */ /* {{{ spl_filesystem_object_cast */ -static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type) +static int spl_filesystem_object_cast(zend_object *readobj, zval *writeobj, int type) { - spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(readobj); + spl_filesystem_object *intern = spl_filesystem_from_obj(readobj); if (type == IS_STRING) { - if (Z_OBJCE_P(readobj)->__tostring) { + if (readobj->ce->__tostring) { return zend_std_cast_object_tostring(readobj, writeobj, type); } @@ -2162,7 +2149,7 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje return spl_filesystem_file_read_csv(intern, intern->u.file.delimiter, intern->u.file.enclosure, intern->u.file.escape, NULL); } else { zend_execute_data *execute_data = EG(current_execute_data); - zend_call_method_with_0_params(this_ptr, Z_OBJCE_P(ZEND_THIS), &intern->u.file.func_getCurr, "getCurrentLine", &retval); + zend_call_method_with_0_params(Z_OBJ_P(this_ptr), Z_OBJCE_P(ZEND_THIS), &intern->u.file.func_getCurr, "getCurrentLine", &retval); } if (!Z_ISUNDEF(retval)) { if (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) { @@ -2835,30 +2822,6 @@ SPL_METHOD(SplFileObject, fgetc) } } /* }}} */ -/* {{{ proto string SplFileObject::fgetss([string allowable_tags]) - Get a line from file pointer and strip HTML tags */ -SPL_METHOD(SplFileObject, fgetss) -{ - spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS); - zval arg2; - - if(!intern->u.file.stream) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized"); - return; - } - - if (intern->u.file.max_line_len > 0) { - ZVAL_LONG(&arg2, intern->u.file.max_line_len); - } else { - ZVAL_LONG(&arg2, 1024); - } - - spl_filesystem_file_free_line(intern); - intern->u.file.current_line_num++; - - FileFunctionCall(fgetss, ZEND_NUM_ARGS(), &arg2); -} /* }}} */ - /* {{{ proto int SplFileObject::fpassthru() Output all remaining data from a file pointer */ SPL_METHOD(SplFileObject, fpassthru) @@ -3047,10 +3010,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fseek, 0, 0, 1) ZEND_ARG_INFO(0, whence) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetss, 0, 0, 0) - ZEND_ARG_INFO(0, allowable_tags) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1) ZEND_ARG_INFO(0, format) ZEND_ARG_VARIADIC_INFO(1, vars) @@ -3089,7 +3048,6 @@ static const zend_function_entry spl_SplFileObject_functions[] = { SPL_ME(SplFileObject, fseek, arginfo_file_object_fseek, ZEND_ACC_PUBLIC) SPL_ME(SplFileObject, fgetc, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC) SPL_ME(SplFileObject, fpassthru, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC) - SPL_ME(SplFileObject, fgetss, arginfo_file_object_fgetss, ZEND_ACC_PUBLIC) SPL_ME(SplFileObject, fscanf, arginfo_file_object_fscanf, ZEND_ACC_PUBLIC) SPL_ME(SplFileObject, fwrite, arginfo_file_object_fwrite, ZEND_ACC_PUBLIC) SPL_ME(SplFileObject, fread, arginfo_file_object_fread, ZEND_ACC_PUBLIC) diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 2a274595f3..fd59724b5a 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -365,7 +365,7 @@ static void spl_dllist_object_free_storage(zend_object *object) /* {{{ */ zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval *object, int by_ref); -static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */ +static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */ { spl_dllist_object *intern; zend_class_entry *parent = class_type; @@ -380,7 +380,7 @@ static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zval intern->traverse_position = 0; if (orig) { - spl_dllist_object *other = Z_SPLDLLIST_P(orig); + spl_dllist_object *other = spl_dllist_from_obj(orig); intern->ce_get_iterator = other->ce_get_iterator; if (clone_orig) { @@ -455,13 +455,9 @@ static zend_object *spl_dllist_object_new(zend_class_entry *class_type) /* {{{ * } /* }}} */ -static zend_object *spl_dllist_object_clone(zval *zobject) /* {{{ */ +static zend_object *spl_dllist_object_clone(zend_object *old_object) /* {{{ */ { - zend_object *old_object; - zend_object *new_object; - - old_object = Z_OBJ_P(zobject); - new_object = spl_dllist_object_new_ex(old_object->ce, zobject, 1); + zend_object *new_object = spl_dllist_object_new_ex(old_object->ce, old_object, 1); zend_objects_clone_members(new_object, old_object); @@ -469,9 +465,9 @@ static zend_object *spl_dllist_object_clone(zval *zobject) /* {{{ */ } /* }}} */ -static int spl_dllist_object_count_elements(zval *object, zend_long *count) /* {{{ */ +static int spl_dllist_object_count_elements(zend_object *object, zend_long *count) /* {{{ */ { - spl_dllist_object *intern = Z_SPLDLLIST_P(object); + spl_dllist_object *intern = spl_dllist_from_obj(object); if (intern->fptr_count) { zval rv; @@ -490,9 +486,9 @@ static int spl_dllist_object_count_elements(zval *object, zend_long *count) /* { } /* }}} */ -static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* {{{{ */ +static HashTable* spl_dllist_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{{ */ { - spl_dllist_object *intern = Z_SPLDLLIST_P(obj); + spl_dllist_object *intern = spl_dllist_from_obj(obj); spl_ptr_llist_element *current = intern->llist->head, *next; zval tmp, dllist_array; zend_string *pnstr; @@ -534,9 +530,9 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* { } /* }}}} */ -static HashTable *spl_dllist_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */ +static HashTable *spl_dllist_object_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */ { - spl_dllist_object *intern = Z_SPLDLLIST_P(obj); + spl_dllist_object *intern = spl_dllist_from_obj(obj); spl_ptr_llist_element *current = intern->llist->head; int i = 0; @@ -704,7 +700,7 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty) return; } - spl_dllist_object_count_elements(ZEND_THIS, &count); + spl_dllist_object_count_elements(Z_OBJ_P(ZEND_THIS), &count); RETURN_BOOL(count == 0); } /* }}} */ diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h index c5614a691d..bf14c78b11 100644 --- a/ext/spl/spl_engine.h +++ b/ext/spl/spl_engine.h @@ -33,7 +33,7 @@ static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, z zend_function *func = pce->constructor; spl_instantiate(pce, retval); - zend_call_method(retval, pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL); + zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL); return 0; } /* }}} */ @@ -44,7 +44,7 @@ static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval *retval, z zend_function *func = pce->constructor; spl_instantiate(pce, retval); - zend_call_method(retval, pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2); + zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2); return 0; } /* }}} */ diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index ce93f2aef5..1236593479 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -141,9 +141,9 @@ static void spl_fixedarray_copy(spl_fixedarray *to, spl_fixedarray *from) /* {{{ } /* }}} */ -static HashTable* spl_fixedarray_object_get_gc(zval *obj, zval **table, int *n) /* {{{{ */ +static HashTable* spl_fixedarray_object_get_gc(zend_object *obj, zval **table, int *n) /* {{{{ */ { - spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(obj); + spl_fixedarray_object *intern = spl_fixed_array_from_obj(obj); HashTable *ht = zend_std_get_properties(obj); *table = intern->array.elements; @@ -153,9 +153,9 @@ static HashTable* spl_fixedarray_object_get_gc(zval *obj, zval **table, int *n) } /* }}}} */ -static HashTable* spl_fixedarray_object_get_properties(zval *obj) /* {{{{ */ +static HashTable* spl_fixedarray_object_get_properties(zend_object *obj) /* {{{{ */ { - spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(obj); + spl_fixedarray_object *intern = spl_fixed_array_from_obj(obj); HashTable *ht = zend_std_get_properties(obj); zend_long i = 0; @@ -202,7 +202,7 @@ static void spl_fixedarray_object_free_storage(zend_object *object) /* {{{ */ zend_object_iterator *spl_fixedarray_get_iterator(zend_class_entry *ce, zval *object, int by_ref); -static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */ +static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */ { spl_fixedarray_object *intern; zend_class_entry *parent = class_type; @@ -218,7 +218,7 @@ static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, z intern->flags = 0; if (orig && clone_orig) { - spl_fixedarray_object *other = Z_SPLFIXEDARRAY_P(orig); + spl_fixedarray_object *other = spl_fixed_array_from_obj(orig); intern->ce_get_iterator = other->ce_get_iterator; spl_fixedarray_init(&intern->array, other->array.size); spl_fixedarray_copy(&intern->array, &other->array); @@ -295,13 +295,9 @@ static zend_object *spl_fixedarray_new(zend_class_entry *class_type) /* {{{ */ } /* }}} */ -static zend_object *spl_fixedarray_object_clone(zval *zobject) /* {{{ */ +static zend_object *spl_fixedarray_object_clone(zend_object *old_object) /* {{{ */ { - zend_object *old_object; - zend_object *new_object; - - old_object = Z_OBJ_P(zobject); - new_object = spl_fixedarray_object_new_ex(old_object->ce, zobject, 1); + zend_object *new_object = spl_fixedarray_object_new_ex(old_object->ce, old_object, 1); zend_objects_clone_members(new_object, old_object); @@ -337,11 +333,11 @@ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_o } /* }}} */ -static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */ +static zval *spl_fixedarray_object_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */ { spl_fixedarray_object *intern; - intern = Z_SPLFIXEDARRAY_P(object); + intern = spl_fixed_array_from_obj(object); if (type == BP_VAR_IS && intern->fptr_offset_has) { SEPARATE_ARG_IF_REF(offset); @@ -406,12 +402,12 @@ static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_o } /* }}} */ -static void spl_fixedarray_object_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */ +static void spl_fixedarray_object_write_dimension(zend_object *object, zval *offset, zval *value) /* {{{ */ { spl_fixedarray_object *intern; zval tmp; - intern = Z_SPLFIXEDARRAY_P(object); + intern = spl_fixed_array_from_obj(object); if (intern->fptr_offset_set) { if (!offset) { @@ -451,11 +447,11 @@ static inline void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_o } /* }}} */ -static void spl_fixedarray_object_unset_dimension(zval *object, zval *offset) /* {{{ */ +static void spl_fixedarray_object_unset_dimension(zend_object *object, zval *offset) /* {{{ */ { spl_fixedarray_object *intern; - intern = Z_SPLFIXEDARRAY_P(object); + intern = spl_fixed_array_from_obj(object); if (intern->fptr_offset_del) { SEPARATE_ARG_IF_REF(offset); @@ -500,11 +496,11 @@ static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_obje } /* }}} */ -static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */ +static int spl_fixedarray_object_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */ { spl_fixedarray_object *intern; - intern = Z_SPLFIXEDARRAY_P(object); + intern = spl_fixed_array_from_obj(object); if (intern->fptr_offset_has) { zval rv; @@ -522,11 +518,11 @@ static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int c } /* }}} */ -static int spl_fixedarray_object_count_elements(zval *object, zend_long *count) /* {{{ */ +static int spl_fixedarray_object_count_elements(zend_object *object, zend_long *count) /* {{{ */ { spl_fixedarray_object *intern; - intern = Z_SPLFIXEDARRAY_P(object); + intern = spl_fixed_array_from_obj(object); if (intern->fptr_count) { zval rv; zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv); @@ -576,7 +572,7 @@ SPL_METHOD(SplFixedArray, __construct) SPL_METHOD(SplFixedArray, __wakeup) { spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(ZEND_THIS); - HashTable *intern_ht = zend_std_get_properties(ZEND_THIS); + HashTable *intern_ht = zend_std_get_properties(Z_OBJ_P(ZEND_THIS)); zval *data; if (zend_parse_parameters_none() == FAILURE) { diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index aad9ed4f36..41ad7826ae 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -126,7 +126,7 @@ static void spl_ptr_heap_pqueue_elem_ctor(zval *zv) { /* {{{ */ static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, zend_long *result) { /* {{{ */ zval zresult; - zend_call_method_with_2_params(object, heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b); + zend_call_method_with_2_params(Z_OBJ_P(object), heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b); if (EG(exception)) { return FAILURE; @@ -378,7 +378,7 @@ static void spl_heap_object_free_storage(zend_object *object) /* {{{ */ } /* }}} */ -static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */ +static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */ { spl_heap_object *intern; zend_class_entry *parent = class_type; @@ -393,7 +393,7 @@ static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zval *o intern->fptr_cmp = NULL; if (orig) { - spl_heap_object *other = Z_SPLHEAP_P(orig); + spl_heap_object *other = spl_heap_from_obj(orig); intern->ce_get_iterator = other->ce_get_iterator; if (clone_orig) { @@ -462,13 +462,9 @@ static zend_object *spl_heap_object_new(zend_class_entry *class_type) /* {{{ */ } /* }}} */ -static zend_object *spl_heap_object_clone(zval *zobject) /* {{{ */ +static zend_object *spl_heap_object_clone(zend_object *old_object) /* {{{ */ { - zend_object *old_object; - zend_object *new_object; - - old_object = Z_OBJ_P(zobject); - new_object = spl_heap_object_new_ex(old_object->ce, zobject, 1); + zend_object *new_object = spl_heap_object_new_ex(old_object->ce, old_object, 1); zend_objects_clone_members(new_object, old_object); @@ -476,9 +472,9 @@ static zend_object *spl_heap_object_clone(zval *zobject) /* {{{ */ } /* }}} */ -static int spl_heap_object_count_elements(zval *object, zend_long *count) /* {{{ */ +static int spl_heap_object_count_elements(zend_object *object, zend_long *count) /* {{{ */ { - spl_heap_object *intern = Z_SPLHEAP_P(object); + spl_heap_object *intern = spl_heap_from_obj(object); if (intern->fptr_count) { zval rv; @@ -498,8 +494,8 @@ static int spl_heap_object_count_elements(zval *object, zend_long *count) /* {{{ } /* }}} */ -static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zval *obj, int *is_temp) { /* {{{ */ - spl_heap_object *intern = Z_SPLHEAP_P(obj); +static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zend_object *obj, int *is_temp) { /* {{{ */ + spl_heap_object *intern = spl_heap_from_obj(obj); zval tmp, heap_array; zend_string *pnstr; HashTable *debug_info; @@ -545,9 +541,9 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv } /* }}} */ -static HashTable *spl_heap_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */ +static HashTable *spl_heap_object_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */ { - spl_heap_object *intern = Z_SPLHEAP_P(obj); + spl_heap_object *intern = spl_heap_from_obj(obj); *gc_data = intern->heap->elements; *gc_data_count = intern->heap->count; @@ -555,13 +551,13 @@ static HashTable *spl_heap_object_get_gc(zval *obj, zval **gc_data, int *gc_data } /* }}} */ -static HashTable* spl_heap_object_get_debug_info(zval *obj, int *is_temp) /* {{{ */ +static HashTable* spl_heap_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */ { return spl_heap_object_get_debug_info_helper(spl_ce_SplHeap, obj, is_temp); } /* }}} */ -static HashTable* spl_pqueue_object_get_debug_info(zval *obj, int *is_temp) /* {{{ */ +static HashTable* spl_pqueue_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */ { return spl_heap_object_get_debug_info_helper(spl_ce_SplPriorityQueue, obj, is_temp); } @@ -1192,7 +1188,7 @@ static const zend_function_entry spl_funcs_SplHeap[] = { SPL_ME(SplHeap, valid, arginfo_splheap_void, ZEND_ACC_PUBLIC) SPL_ME(SplHeap, recoverFromCorruption, arginfo_splheap_void, ZEND_ACC_PUBLIC) SPL_ME(SplHeap, isCorrupted, arginfo_splheap_void, ZEND_ACC_PUBLIC) - ZEND_FENTRY(compare, NULL, NULL, ZEND_ACC_PROTECTED|ZEND_ACC_ABSTRACT) + ZEND_FENTRY(compare, NULL, arginfo_heap_compare, ZEND_ACC_PROTECTED|ZEND_ACC_ABSTRACT) PHP_FE_END }; /* }}} */ diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 5cddf4d460..ecefa1c2c0 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -201,7 +201,7 @@ static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthi level--; } if (object->endIteration && object->in_iteration) { - zend_call_method_with_0_params(zthis, object->ce, &object->endIteration, "endIteration", NULL); + zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endIteration, "endIteration", NULL); } object->in_iteration = 0; return FAILURE; @@ -267,9 +267,9 @@ next_step: ce = object->iterators[object->level].ce; zobject = &object->iterators[object->level].zobject; if (object->callHasChildren) { - zend_call_method_with_0_params(zthis, object->ce, &object->callHasChildren, "callHasChildren", &retval); + zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callHasChildren, "callHasChildren", &retval); } else { - zend_call_method_with_0_params(zobject, ce, NULL, "haschildren", &retval); + zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "haschildren", &retval); } if (EG(exception)) { if (!(object->flags & RIT_CATCH_GET_CHILD)) { @@ -304,7 +304,7 @@ next_step: } } if (object->nextElement) { - zend_call_method_with_0_params(zthis, object->ce, &object->nextElement, "nextelement", NULL); + zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL); } object->iterators[object->level].state = RS_NEXT; if (EG(exception)) { @@ -317,7 +317,7 @@ next_step: return /* self */; case RS_SELF: if (object->nextElement && (object->mode == RIT_SELF_FIRST || object->mode == RIT_CHILD_FIRST)) { - zend_call_method_with_0_params(zthis, object->ce, &object->nextElement, "nextelement", NULL); + zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL); } if (object->mode == RIT_SELF_FIRST) { object->iterators[object->level].state = RS_CHILD; @@ -329,9 +329,9 @@ next_step: ce = object->iterators[object->level].ce; zobject = &object->iterators[object->level].zobject; if (object->callGetChildren) { - zend_call_method_with_0_params(zthis, object->ce, &object->callGetChildren, "callGetChildren", &child); + zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callGetChildren, "callGetChildren", &child); } else { - zend_call_method_with_0_params(zobject, ce, NULL, "getchildren", &child); + zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "getchildren", &child); } if (EG(exception)) { @@ -367,7 +367,7 @@ next_step: sub_iter->funcs->rewind(sub_iter); } if (object->beginChildren) { - zend_call_method_with_0_params(zthis, object->ce, &object->beginChildren, "beginchildren", NULL); + zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginChildren, "beginchildren", NULL); if (EG(exception)) { if (!(object->flags & RIT_CATCH_GET_CHILD)) { return; @@ -381,7 +381,7 @@ next_step: /* no more elements */ if (object->level > 0) { if (object->endChildren) { - zend_call_method_with_0_params(zthis, object->ce, &object->endChildren, "endchildren", NULL); + zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL); if (EG(exception)) { if (!(object->flags & RIT_CATCH_GET_CHILD)) { return; @@ -415,7 +415,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt zend_iterator_dtor(sub_iter); zval_ptr_dtor(&object->iterators[object->level--].zobject); if (!EG(exception) && (!object->endChildren || object->endChildren->common.scope != spl_ce_RecursiveIteratorIterator)) { - zend_call_method_with_0_params(zthis, object->ce, &object->endChildren, "endchildren", NULL); + zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL); } } object->iterators = erealloc(object->iterators, sizeof(spl_sub_iterator)); @@ -425,7 +425,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt sub_iter->funcs->rewind(sub_iter); } if (!EG(exception) && object->beginIteration && !object->in_iteration) { - zend_call_method_with_0_params(zthis, object->ce, &object->beginIteration, "beginIteration", NULL); + zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginIteration, "beginIteration", NULL); } object->in_iteration = 1; spl_recursive_it_move_forward_ex(object, zthis); @@ -494,7 +494,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "o|lzl", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) { if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) { - zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval); + zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval); iterator = &aggregate_retval; } else { Z_ADDREF_P(iterator); @@ -522,7 +522,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "o|ll", &iterator, &mode, &flags) == SUCCESS) { if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) { - zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval); + zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval); iterator = &aggregate_retval; } else { Z_ADDREF_P(iterator); @@ -783,7 +783,7 @@ SPL_METHOD(RecursiveIteratorIterator, callHasChildren) if (Z_TYPE_P(zobject) == IS_UNDEF) { RETURN_FALSE; } else { - zend_call_method_with_0_params(zobject, ce, NULL, "haschildren", return_value); + zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "haschildren", return_value); if (Z_TYPE_P(return_value) == IS_UNDEF) { RETURN_FALSE; } @@ -808,7 +808,7 @@ SPL_METHOD(RecursiveIteratorIterator, callGetChildren) if (Z_TYPE_P(zobject) == IS_UNDEF) { return; } else { - zend_call_method_with_0_params(zobject, ce, NULL, "getchildren", return_value); + zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "getchildren", return_value); if (Z_TYPE_P(return_value) == IS_UNDEF) { RETURN_NULL(); } @@ -1035,7 +1035,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje smart_str_appendl(&str, ZSTR_VAL(object->prefix[0].s), ZSTR_LEN(object->prefix[0].s)); for (level = 0; level < object->level; ++level) { - zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next); + zend_call_method_with_0_params(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, "hasnext", &has_next); if (Z_TYPE(has_next) != IS_UNDEF) { if (Z_TYPE(has_next) == IS_TRUE) { smart_str_appendl(&str, ZSTR_VAL(object->prefix[1].s), ZSTR_LEN(object->prefix[1].s)); @@ -1045,7 +1045,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje zval_ptr_dtor(&has_next); } } - zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next); + zend_call_method_with_0_params(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, "hasnext", &has_next); if (Z_TYPE(has_next) != IS_UNDEF) { if (Z_TYPE(has_next) == IS_TRUE) { smart_str_appendl(&str, ZSTR_VAL(object->prefix[3].s), ZSTR_LEN(object->prefix[3].s)); @@ -1367,47 +1367,6 @@ static zend_function *spl_dual_it_get_method(zend_object **object, zend_string * return function_handler; } -#if MBO_0 -int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS) -{ - zval ***func_params, func; - zval retval; - int arg_count; - int current = 0; - int success; - void **p; - spl_dual_it_object *intern; - - intern = Z_SPLDUAL_IT_P(ZEND_THIS); - - ZVAL_STRING(&func, method, 0); - - p = EG(argument_stack).top_element-2; - arg_count = (zend_ulong) *p; - - func_params = safe_emalloc(sizeof(zval **), arg_count, 0); - - current = 0; - while (arg_count-- > 0) { - func_params[current] = (zval **) p - (arg_count-current); - current++; - } - arg_count = current; /* restore */ - - if (call_user_function_ex(EG(function_table), NULL, &func, &retval, arg_count, func_params, 0, NULL) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - RETURN_ZVAL(&retval, 0, 0); - - success = SUCCESS; - } else { - zend_throw_error(NULL, "Unable to call %s::%s()", intern->inner.ce->name, method); - success = FAILURE; - } - - efree(func_params); - return success; -} -#endif - #define SPL_CHECK_CTOR(intern, classname) \ if (intern->dit_type == DIT_Unknown) { \ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Classes derived from %s must call %s::__construct()", \ @@ -1498,7 +1457,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z ce = ce_cast; } if (instanceof_function(ce, zend_ce_aggregate)) { - zend_call_method_with_0_params(zobject, ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", &retval); + zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", &retval); if (EG(exception)) { zval_ptr_dtor(&retval); return NULL; @@ -1517,7 +1476,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z case DIT_AppendIterator: zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling); spl_instantiate(spl_ce_ArrayIterator, &intern->u.append.zarrayit); - zend_call_method_with_0_params(&intern->u.append.zarrayit, spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL); + zend_call_method_with_0_params(Z_OBJ(intern->u.append.zarrayit), spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL); intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 0); zend_restore_error_handling(&error_handling); return intern; @@ -1815,7 +1774,7 @@ static inline void spl_filter_it_fetch(zval *zthis, spl_dual_it_object *intern) zval retval; while (spl_dual_it_fetch(intern, 1) == SUCCESS) { - zend_call_method_with_0_params(zthis, intern->std.ce, NULL, "accept", &retval); + zend_call_method_with_0_params(Z_OBJ_P(zthis), intern->std.ce, NULL, "accept", &retval); if (Z_TYPE(retval) != IS_UNDEF) { if (zend_is_true(&retval)) { zval_ptr_dtor(&retval); @@ -1899,7 +1858,7 @@ SPL_METHOD(RecursiveFilterIterator, hasChildren) SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS); - zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval); + zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "haschildren", &retval); if (Z_TYPE(retval) != IS_UNDEF) { RETURN_ZVAL(&retval, 0, 1); } else { @@ -1920,7 +1879,7 @@ SPL_METHOD(RecursiveFilterIterator, getChildren) SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS); - zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval); + zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval); if (!EG(exception) && Z_TYPE(retval) != IS_UNDEF) { spl_instantiate_arg_ex1(Z_OBJCE_P(ZEND_THIS), return_value, &retval); } @@ -1940,7 +1899,7 @@ SPL_METHOD(RecursiveCallbackFilterIterator, getChildren) SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS); - zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval); + zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval); if (!EG(exception) && Z_TYPE(retval) != IS_UNDEF) { spl_instantiate_arg_ex2(Z_OBJCE_P(ZEND_THIS), return_value, &retval, &intern->u.cbfilter->fci.function_name); } @@ -2228,7 +2187,7 @@ SPL_METHOD(RecursiveRegexIterator, getChildren) SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS); - zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval); + zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval); if (!EG(exception)) { zval args[5]; @@ -2262,7 +2221,7 @@ SPL_METHOD(RecursiveRegexIterator, accept) RETURN_BOOL(zend_hash_num_elements(Z_ARRVAL(intern->current.data)) > 0); } - zend_call_method_with_0_params(ZEND_THIS, spl_ce_RegexIterator, NULL, "accept", return_value); + zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), spl_ce_RegexIterator, NULL, "accept", return_value); } #endif @@ -2480,7 +2439,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos) if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator)) { ZVAL_LONG(&zpos, pos); spl_dual_it_free(intern); - zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, &zpos); + zend_call_method_with_1_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "seek", NULL, &zpos); if (!EG(exception)) { intern->current.pos = pos; if (spl_limit_it_valid(intern) == SUCCESS) { @@ -2630,7 +2589,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern) /* Recursion ? */ if (intern->dit_type == DIT_RecursiveCachingIterator) { zval retval, zchildren, zflags; - zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval); + zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "haschildren", &retval); if (EG(exception)) { zval_ptr_dtor(&retval); if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) { @@ -2640,7 +2599,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern) } } else { if (zend_is_true(&retval)) { - zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &zchildren); + zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &zchildren); if (EG(exception)) { zval_ptr_dtor(&zchildren); if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) { @@ -3682,7 +3641,6 @@ PHP_MINIT_FUNCTION(spl_iterators) memcpy(&spl_handlers_dual_it, &std_object_handlers, sizeof(zend_object_handlers)); spl_handlers_dual_it.offset = XtOffsetOf(spl_dual_it_object, std); spl_handlers_dual_it.get_method = spl_dual_it_get_method; - /*spl_handlers_dual_it.call_method = spl_dual_it_call_method;*/ spl_handlers_dual_it.clone_obj = NULL; spl_handlers_dual_it.dtor_obj = spl_dual_it_dtor; spl_handlers_dual_it.free_obj = spl_dual_it_free_storage; diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 8b170afaee..12b9ac48e8 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -115,7 +115,7 @@ void spl_SplObjectStorage_free_storage(zend_object *object) /* {{{ */ } /* }}} */ -static int spl_object_storage_get_hash(zend_hash_key *key, spl_SplObjectStorage *intern, zval *this, zval *obj) { +static int spl_object_storage_get_hash(zend_hash_key *key, spl_SplObjectStorage *intern, zend_object *this, zval *obj) { if (intern->fptr_get_hash) { zval rv; zend_call_method_with_1_params(this, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj); @@ -162,7 +162,7 @@ static spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage } } /* }}} */ -spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *obj, zval *inf) /* {{{ */ +spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *intern, zend_object *this, zval *obj, zval *inf) /* {{{ */ { spl_SplObjectStorageElement *pelement, element; zend_hash_key key; @@ -202,7 +202,7 @@ static int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, z { int ret = FAILURE; zend_hash_key key; - if (spl_object_storage_get_hash(&key, intern, this, obj) == FAILURE) { + if (spl_object_storage_get_hash(&key, intern, Z_OBJ_P(this), obj) == FAILURE) { return ret; } if (key.key) { @@ -215,7 +215,7 @@ static int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, z return ret; } /* }}}*/ -void spl_object_storage_addall(spl_SplObjectStorage *intern, zval *this, spl_SplObjectStorage *other) { /* {{{ */ +void spl_object_storage_addall(spl_SplObjectStorage *intern, zend_object *this, spl_SplObjectStorage *other) { /* {{{ */ spl_SplObjectStorageElement *element; ZEND_HASH_FOREACH_PTR(&other->storage, element) { @@ -225,7 +225,7 @@ void spl_object_storage_addall(spl_SplObjectStorage *intern, zval *this, spl_Spl intern->index = 0; } /* }}} */ -static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval *orig) /* {{{ */ +static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zend_object *orig) /* {{{ */ { spl_SplObjectStorage *intern; zend_class_entry *parent = class_type; @@ -256,7 +256,7 @@ static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval } if (orig) { - spl_SplObjectStorage *other = Z_SPLOBJSTORAGE_P(orig); + spl_SplObjectStorage *other = spl_object_storage_from_obj(orig); spl_object_storage_addall(intern, orig, other); } @@ -265,13 +265,11 @@ static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval /* }}} */ /* {{{ spl_object_storage_clone */ -static zend_object *spl_object_storage_clone(zval *zobject) +static zend_object *spl_object_storage_clone(zend_object *old_object) { - zend_object *old_object; zend_object *new_object; - old_object = Z_OBJ_P(zobject); - new_object = spl_object_storage_new_ex(old_object->ce, zobject); + new_object = spl_object_storage_new_ex(old_object->ce, old_object); zend_objects_clone_members(new_object, old_object); @@ -279,9 +277,9 @@ static zend_object *spl_object_storage_clone(zval *zobject) } /* }}} */ -static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{ */ +static HashTable* spl_object_storage_debug_info(zend_object *obj, int *is_temp) /* {{{ */ { - spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(obj); + spl_SplObjectStorage *intern = spl_object_storage_from_obj(obj); spl_SplObjectStorageElement *element; HashTable *props; zval tmp, storage; @@ -291,7 +289,7 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{ *is_temp = 1; - props = Z_OBJPROP_P(obj); + props = obj->handlers->get_properties(obj); debug_info = zend_new_array(zend_hash_num_elements(props) + 1); zend_hash_copy(debug_info, props, (copy_ctor_func_t)zval_add_ref); @@ -319,10 +317,10 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{ /* }}} */ /* overridden for garbage collection */ -static HashTable *spl_object_storage_get_gc(zval *obj, zval **table, int *n) /* {{{ */ +static HashTable *spl_object_storage_get_gc(zend_object *obj, zval **table, int *n) /* {{{ */ { int i = 0; - spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(obj); + spl_SplObjectStorage *intern = spl_object_storage_from_obj(obj); spl_SplObjectStorageElement *element; if (intern->storage.nNumOfElements * 2 > intern->gcdata_num) { @@ -380,7 +378,7 @@ int spl_object_storage_contains(spl_SplObjectStorage *intern, zval *this, zval * { int found; zend_hash_key key; - if (spl_object_storage_get_hash(&key, intern, this, obj) == FAILURE) { + if (spl_object_storage_get_hash(&key, intern, Z_OBJ_P(this), obj) == FAILURE) { return 0; } @@ -404,7 +402,7 @@ SPL_METHOD(SplObjectStorage, attach) if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|z!", &obj, &inf) == FAILURE) { return; } - spl_object_storage_attach(intern, ZEND_THIS, obj, inf); + spl_object_storage_attach(intern, Z_OBJ_P(ZEND_THIS), obj, inf); } /* }}} */ /* {{{ proto void SplObjectStorage::detach(object obj) @@ -450,7 +448,7 @@ SPL_METHOD(SplObjectStorage, offsetGet) return; } - if (spl_object_storage_get_hash(&key, intern, ZEND_THIS, obj) == FAILURE) { + if (spl_object_storage_get_hash(&key, intern, Z_OBJ_P(ZEND_THIS), obj) == FAILURE) { return; } @@ -480,7 +478,7 @@ SPL_METHOD(SplObjectStorage, addAll) other = Z_SPLOBJSTORAGE_P(obj); - spl_object_storage_addall(intern, ZEND_THIS, other); + spl_object_storage_addall(intern, Z_OBJ_P(ZEND_THIS), other); RETURN_LONG(zend_hash_num_elements(&intern->storage)); } /* }}} */ @@ -729,7 +727,7 @@ SPL_METHOD(SplObjectStorage, serialize) /* members */ smart_str_appendl(&buf, "m:", 2); - ZVAL_ARR(&members, zend_array_dup(zend_std_get_properties(ZEND_THIS))); + ZVAL_ARR(&members, zend_array_dup(zend_std_get_properties(Z_OBJ_P(ZEND_THIS)))); php_var_serialize(&buf, &members, &var_hash); /* finishes the string */ zval_ptr_dtor(&members); @@ -815,7 +813,7 @@ SPL_METHOD(SplObjectStorage, unserialize) goto outexcept; } - if (spl_object_storage_get_hash(&key, intern, ZEND_THIS, &entry) == FAILURE) { + if (spl_object_storage_get_hash(&key, intern, Z_OBJ_P(ZEND_THIS), &entry) == FAILURE) { zval_ptr_dtor(&entry); zval_ptr_dtor(&inf); goto outexcept; @@ -830,7 +828,7 @@ SPL_METHOD(SplObjectStorage, unserialize) var_push_dtor(&var_hash, &pelement->obj); } } - element = spl_object_storage_attach(intern, ZEND_THIS, &entry, Z_ISUNDEF(inf)?NULL:&inf); + element = spl_object_storage_attach(intern, Z_OBJ_P(ZEND_THIS), &entry, Z_ISUNDEF(inf)?NULL:&inf); var_replace(&var_hash, &entry, &element->obj); var_replace(&var_hash, &inf, &element->inf); zval_ptr_dtor(&entry); @@ -1008,7 +1006,7 @@ SPL_METHOD(MultipleIterator, attachIterator) } } - spl_object_storage_attach(intern, ZEND_THIS, iterator, info); + spl_object_storage_attach(intern, Z_OBJ_P(ZEND_THIS), iterator, info); } /* }}} */ @@ -1029,7 +1027,7 @@ SPL_METHOD(MultipleIterator, rewind) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) { it = &element->obj; - zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_rewind, "rewind", NULL); + zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_rewind, "rewind", NULL); zend_hash_move_forward_ex(&intern->storage, &intern->pos); } } @@ -1052,7 +1050,7 @@ SPL_METHOD(MultipleIterator, next) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) { it = &element->obj; - zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_next, "next", NULL); + zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_next, "next", NULL); zend_hash_move_forward_ex(&intern->storage, &intern->pos); } } @@ -1082,7 +1080,7 @@ SPL_METHOD(MultipleIterator, valid) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) { it = &element->obj; - zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval); + zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval); if (!Z_ISUNDEF(retval)) { valid = (Z_TYPE(retval) == IS_TRUE); @@ -1118,7 +1116,7 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_ zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) { it = &element->obj; - zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval); + zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval); if (!Z_ISUNDEF(retval)) { valid = Z_TYPE(retval) == IS_TRUE; @@ -1129,9 +1127,9 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_ if (valid) { if (SPL_MULTIPLE_ITERATOR_GET_ALL_CURRENT == get_type) { - zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_current, "current", &retval); + zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_current, "current", &retval); } else { - zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_key, "key", &retval); + zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_key, "key", &retval); } if (Z_ISUNDEF(retval)) { zend_throw_exception(spl_ce_RuntimeException, "Failed to call sub iterator method", 0); @@ -1217,8 +1215,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_MultipleIterator_setflags, 0, 0, 1) ZEND_ARG_INFO(0, flags) ZEND_END_ARG_INFO(); +ZEND_BEGIN_ARG_INFO_EX(arginfo_MultipleIterator_construct, 0, 0, 0) + ZEND_ARG_INFO(0, flags) +ZEND_END_ARG_INFO(); + static const zend_function_entry spl_funcs_MultipleIterator[] = { - SPL_ME(MultipleIterator, __construct, arginfo_MultipleIterator_setflags, 0) + SPL_ME(MultipleIterator, __construct, arginfo_MultipleIterator_construct, 0) SPL_ME(MultipleIterator, getFlags, arginfo_splobject_void, 0) SPL_ME(MultipleIterator, setFlags, arginfo_MultipleIterator_setflags, 0) SPL_ME(MultipleIterator, attachIterator, arginfo_MultipleIterator_attachIterator, 0) diff --git a/ext/spl/tests/SplFileInfo_setFileClass_error.phpt b/ext/spl/tests/SplFileInfo_setFileClass_error.phpt index 7443998013..db0186f218 100644 --- a/ext/spl/tests/SplFileInfo_setFileClass_error.phpt +++ b/ext/spl/tests/SplFileInfo_setFileClass_error.phpt @@ -7,7 +7,7 @@ $info = new SplFileInfo(__FILE__); try { $info->setFileClass('stdClass'); -} catch (UnexpectedValueException $e) { +} catch (TypeError $e) { echo $e->getMessage(), "\n"; } diff --git a/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt b/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt index a280a6e147..9a2e71defe 100644 --- a/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt +++ b/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt @@ -7,7 +7,7 @@ $info = new SplFileInfo(__FILE__); try { $info->setInfoClass('stdClass'); -} catch (UnexpectedValueException $e) { +} catch (TypeError $e) { echo $e->getMessage(), "\n"; } diff --git a/ext/spl/tests/SplFileObject_seek_error_001.phpt b/ext/spl/tests/SplFileObject_seek_error_001.phpt index 4de5bcdd4d..8741e3b788 100644 --- a/ext/spl/tests/SplFileObject_seek_error_001.phpt +++ b/ext/spl/tests/SplFileObject_seek_error_001.phpt @@ -2,9 +2,7 @@ SplFileObject::seek function - test parameters --FILE-- <?php -$obj = New SplFileObject(__FILE__); -$obj->seek(1,2); -$obj->seek(); +$obj = new SplFileObject(__FILE__); try { $obj->seek(-1); } catch (LogicException $e) { @@ -12,7 +10,4 @@ try { } ?> --EXPECTF-- -Warning: SplFileObject::seek() expects exactly 1 parameter, 2 given in %s - -Warning: SplFileObject::seek() expects exactly 1 parameter, 0 given in %s -Can't seek file %s to negative line %s +Can't seek file %s to negative line -1 diff --git a/ext/spl/tests/arrayObject_asort_basic1.phpt b/ext/spl/tests/arrayObject_asort_basic1.phpt index 6c6fd2949f..094d825bb6 100644 --- a/ext/spl/tests/arrayObject_asort_basic1.phpt +++ b/ext/spl/tests/arrayObject_asort_basic1.phpt @@ -15,7 +15,11 @@ $ao1 = new ArrayObject(array(4,2,3)); $ao2 = new ArrayObject(array('a'=>4,'b'=>2,'c'=>3)); var_dump($ao1->asort()); var_dump($ao1); -var_dump($ao2->asort('blah')); +try { + var_dump($ao2->asort('blah')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($ao2); var_dump($ao2->asort(SORT_NUMERIC)); var_dump($ao2); @@ -35,9 +39,7 @@ object(ArrayObject)#%d (1) { int(4) } } - -Warning: asort() expects parameter 2 to be int, string given in %sarrayObject_asort_basic1.php on line %d -bool(false) +asort() expects parameter 2 to be int, string given object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(3) { diff --git a/ext/spl/tests/arrayObject_count_basic1.phpt b/ext/spl/tests/arrayObject_count_basic1.phpt index 41e1527f93..3271090d08 100644 --- a/ext/spl/tests/arrayObject_count_basic1.phpt +++ b/ext/spl/tests/arrayObject_count_basic1.phpt @@ -25,9 +25,6 @@ var_dump(count($c), count($ao)); unset($c[0]); unset($ao[0]); var_dump($c->count(), $ao->count()); - -//Extra args are ignored. -var_dump($ao->count('blah')); ?> ==ArrayIterator== <?php @@ -53,11 +50,8 @@ var_dump(count($c), count($ao)); unset($c[0]); unset($ao[0]); var_dump($c->count(), $ao->count()); - -//Extra args are ignored. -var_dump($ao->count('blah')); ?> ---EXPECTF-- +--EXPECT-- ==ArrayObject== int(99) int(0) @@ -67,9 +61,6 @@ int(99) int(2) int(99) int(1) - -Warning: ArrayObject::count() expects exactly 0 parameters, 1 given in %s on line %d -NULL ==ArrayIterator== int(99) int(0) @@ -79,6 +70,3 @@ int(99) int(2) int(99) int(1) - -Warning: ArrayIterator::count() expects exactly 0 parameters, 1 given in %s on line %d -NULL diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt index 823256edbc..c6759a31cf 100644 --- a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt +++ b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt @@ -29,8 +29,8 @@ $ao = new ArrayObject($original); try { $copy = $ao->exchangeArray(); $copy['addedToCopy'] = 'added To Copy'; -} catch (Exception $e) { - echo "Exception:" . $e->getMessage() . "\n"; +} catch (TypeError $e) { + echo "Exception: " . $e->getMessage() . "\n"; } $original->addedToOriginal = 'added To Original'; var_dump($ao, $original, $copy); @@ -81,8 +81,9 @@ array(2) { --> exchangeArray() with no arg: +Exception: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given -Warning: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given in %s on line 27 +Notice: Undefined variable: copy in %s on line %d object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> object(C)#3 (2) { @@ -98,10 +99,7 @@ object(C)#3 (2) { ["addedToOriginal"]=> string(17) "added To Original" } -array(1) { - ["addedToCopy"]=> - string(13) "added To Copy" -} +NULL --> exchangeArray() with bad arg type: diff --git a/ext/spl/tests/arrayObject_ksort_basic1.phpt b/ext/spl/tests/arrayObject_ksort_basic1.phpt index 1692a02ef1..aa1abbf239 100644 --- a/ext/spl/tests/arrayObject_ksort_basic1.phpt +++ b/ext/spl/tests/arrayObject_ksort_basic1.phpt @@ -14,7 +14,11 @@ $ao1 = new ArrayObject(array(4,2,3)); $ao2 = new ArrayObject(array('b'=>4,'a'=>2,'q'=>3, 99=>'x')); var_dump($ao1->ksort()); var_dump($ao1); -var_dump($ao2->ksort('blah')); +try { + var_dump($ao2->ksort('blah')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($ao2); var_dump($ao2->ksort(SORT_STRING)); var_dump($ao2); @@ -34,9 +38,7 @@ object(ArrayObject)#%d (1) { int(3) } } - -Warning: ksort() expects parameter 2 to be int, string given in %sarrayObject_ksort_basic1.php on line %d -bool(false) +ksort() expects parameter 2 to be int, string given object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(4) { diff --git a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt index 89efdb6a9f..d0910b3a0a 100644 --- a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt +++ b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt @@ -8,7 +8,7 @@ try { foreach($ao as $key=>$value) { echo " $key=>$value\n"; } -} catch (Exception $e) { +} catch (TypeError $e) { var_dump($e->getMessage()); } @@ -18,7 +18,7 @@ try { foreach($ao as $key=>$value) { echo " $key=>$value\n"; } -} catch (Exception $e) { +} catch (TypeError $e) { var_dump($e->getMessage()); } @@ -43,14 +43,7 @@ try { ?> --EXPECTF-- -Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given in %s on line 4 - a=>1 - b=>2 - c=>3 - -Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given in %s on line 14 - a=>1 - b=>2 - c=>3 +string(118) "ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given" +string(110) "ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given" string(113) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'nonExistentClass' given" string(105) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'stdClass' given" diff --git a/ext/spl/tests/bug45216.phpt b/ext/spl/tests/bug45216.phpt deleted file mode 100644 index 31e6d62352..0000000000 --- a/ext/spl/tests/bug45216.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -SPL: SplFileObject::fgetss (bug 45216) ---CREDITS-- -Perrick Penet <perrick@noparking.net> -#testfest phpcampparis 2008-06-07 ---FILE-- -<?php -$file = dirname(__FILE__) . '/foo.html'; -file_put_contents($file, 'text 0<div class="tested">text 1</div>'); -$handle = fopen($file, 'r'); - -$object = new SplFileObject($file); -var_dump($object->fgetss()); -var_dump(fgetss($handle)); -?> ---CLEAN-- -<?php -unlink(dirname(__FILE__) . '/foo.html'); -?> ---EXPECTF-- -Deprecated: Function fgetss() is deprecated in %s on line %d -string(12) "text 0text 1" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(12) "text 0text 1" diff --git a/ext/spl/tests/bug46051.phpt b/ext/spl/tests/bug46051.phpt index e993951ffa..d53f87bc47 100644 --- a/ext/spl/tests/bug46051.phpt +++ b/ext/spl/tests/bug46051.phpt @@ -6,8 +6,8 @@ Bug #46051 (SplFileInfo::openFile - memory overlap) $x = new splfileinfo(__FILE__); try { -$x->openFile(NULL, NULL, NULL); -} catch (Exception $e) { } + $x->openFile(NULL, NULL, NULL); +} catch (TypeError $e) { } var_dump($x->getPathName()); --EXPECTF-- diff --git a/ext/spl/tests/bug65545.phpt b/ext/spl/tests/bug65545.phpt index 76c29cbf48..bd5a7f06db 100644 --- a/ext/spl/tests/bug65545.phpt +++ b/ext/spl/tests/bug65545.phpt @@ -6,9 +6,6 @@ $obj = new SplFileObject(__FILE__, 'r'); $data = $obj->fread(5); var_dump($data); -$data = $obj->fread(); -var_dump($data); - $data = $obj->fread(0); var_dump($data); @@ -20,9 +17,6 @@ var_dump(strlen($data) === filesize(__FILE__) - 5); --EXPECTF-- string(5) "<?php" -Warning: SplFileObject::fread() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: SplFileObject::fread(): Length parameter must be greater than 0 in %s on line %d bool(false) bool(true) diff --git a/ext/spl/tests/class_implements_variation1.phpt b/ext/spl/tests/class_implements_variation1.phpt index 9d876d3a36..4c70f2b412 100644 --- a/ext/spl/tests/class_implements_variation1.phpt +++ b/ext/spl/tests/class_implements_variation1.phpt @@ -12,8 +12,8 @@ echo "*** Testing class_implements() : variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/spl/tests/class_uses_variation1.phpt b/ext/spl/tests/class_uses_variation1.phpt index be6aa9ac7f..538c9257e7 100644 --- a/ext/spl/tests/class_uses_variation1.phpt +++ b/ext/spl/tests/class_uses_variation1.phpt @@ -12,8 +12,8 @@ echo "*** Testing class_uses() : variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/spl/tests/fileobject_005.phpt b/ext/spl/tests/fileobject_005.phpt index 7b012e7710..672c806538 100644 --- a/ext/spl/tests/fileobject_005.phpt +++ b/ext/spl/tests/fileobject_005.phpt @@ -16,14 +16,11 @@ $fo->fwrite("blahlubba"); var_dump($fo->ftruncate(4)); $fo->rewind(); -var_dump($fo->fgets(8)); +var_dump($fo->fgets()); $fo->rewind(); $fo->fwrite("blahlubba"); -// This should throw a warning and return NULL since an argument is missing -var_dump($fo->ftruncate()); - ?> ==DONE== --CLEAN-- @@ -33,10 +30,5 @@ unlink($path); ?> --EXPECTF-- bool(true) - -Warning: SplFileObject::fgets() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s on line %d -NULL +string(4) "blah" ==DONE== diff --git a/ext/spl/tests/iterator_044.phpt b/ext/spl/tests/iterator_044.phpt index 1271ccaa64..66d03dc359 100644 --- a/ext/spl/tests/iterator_044.phpt +++ b/ext/spl/tests/iterator_044.phpt @@ -24,8 +24,16 @@ class MyCachingIterator extends CachingIterator { echo "===$k===\n"; var_dump($v); - var_dump($this->offsetExists($v)); - var_dump($this->offsetGet($v)); + try { + var_dump($this->offsetExists($v)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump($this->offsetGet($v)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } } @@ -52,9 +60,6 @@ catch(Exception $e) $it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)), CachingIterator::FULL_CACHE); -var_dump($it->offsetExists()); -var_dump($it->offsetGet()); - $checks = array(0, new stdClass, new MyFoo, NULL, 2, 'foo', 3); $it->test($checks); @@ -71,12 +76,6 @@ $it->test($checks); --EXPECTF-- Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) - -Warning: CachingIterator::offsetExists() expects exactly 1 parameter, 0 given in %siterator_044.php on line %d -NULL - -Warning: CachingIterator::offsetGet() expects exactly 1 parameter, 0 given in %siterator_044.php on line %d -NULL ===0=== int(0) bool(false) @@ -86,12 +85,8 @@ NULL ===1=== object(stdClass)#%d (0) { } - -Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL - -Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL +CachingIterator::offsetExists() expects parameter 1 to be string, object given +CachingIterator::offsetGet() expects parameter 1 to be string, object given ===2=== object(MyFoo)#%d (0) { } @@ -131,12 +126,8 @@ int(0) ===1=== object(stdClass)#1 (0) { } - -Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL - -Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL +CachingIterator::offsetExists() expects parameter 1 to be string, object given +CachingIterator::offsetGet() expects parameter 1 to be string, object given ===2=== object(MyFoo)#2 (0) { } diff --git a/ext/spl/tests/iterator_045.phpt b/ext/spl/tests/iterator_045.phpt index c8ffae77a5..fce7ab3655 100644 --- a/ext/spl/tests/iterator_045.phpt +++ b/ext/spl/tests/iterator_045.phpt @@ -73,10 +73,6 @@ catch(Exception $e) $it = new MyCachingIterator(new ArrayIterator(array(0, 1, 2, 3)), CachingIterator::FULL_CACHE); -var_dump($it->offsetSet()); -var_dump($it->offsetSet(0)); -var_dump($it->offsetUnset()); - $checks = array(0 => 25, 1 => 42, 3 => 'FooBar'); $unsets = array(0, 2); @@ -97,15 +93,6 @@ $it->show(); --EXPECTF-- Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) - -Warning: CachingIterator::offsetSet() expects exactly 2 parameters, 0 given in %siterator_045.php on line %d -NULL - -Warning: CachingIterator::offsetSet() expects exactly 2 parameters, 1 given in %siterator_045.php on line %d -NULL - -Warning: CachingIterator::offsetUnset() expects exactly 1 parameter, 0 given in %siterator_045.php on line %d -NULL MyCachingIterator::testSet() set(0,25) set(1,42) diff --git a/ext/spl/tests/iterator_count.phpt b/ext/spl/tests/iterator_count.phpt index c0dad0f422..944b40dd96 100644 --- a/ext/spl/tests/iterator_count.phpt +++ b/ext/spl/tests/iterator_count.phpt @@ -9,20 +9,10 @@ $array=array('a','b'); $iterator = new ArrayIterator($array); -iterator_count(); - - -iterator_count($iterator,'1'); - iterator_count('1'); - ?> --EXPECTF-- -Warning: iterator_count() expects exactly 1 parameter, 0 given in %s - -Warning: iterator_count() expects exactly 1 parameter, 2 given in %s - Fatal error: Uncaught TypeError: Argument 1 passed to iterator_count() must implement interface Traversable, string given in %s:%d Stack trace: #0 %s(%d): iterator_count('1') diff --git a/ext/spl/tests/iterator_to_array.phpt b/ext/spl/tests/iterator_to_array.phpt index f36b99db23..a5a8e5a9b7 100644 --- a/ext/spl/tests/iterator_to_array.phpt +++ b/ext/spl/tests/iterator_to_array.phpt @@ -9,19 +9,10 @@ $array=array('a','b'); $iterator = new ArrayIterator($array); -iterator_to_array(); - - -iterator_to_array($iterator,'test','test'); - iterator_to_array('test','test'); ?> --EXPECTF-- -Warning: iterator_to_array() expects at least 1 parameter, 0 given in %s - -Warning: iterator_to_array() expects at most 2 parameters, 3 given in %s - Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, string given in %s:%d Stack trace: #0 %s(%d): iterator_to_array('test', 'test') diff --git a/ext/spl/tests/regexIterator_setMode_error.phpt b/ext/spl/tests/regexIterator_setMode_error.phpt index 77732b058c..046086102b 100644 --- a/ext/spl/tests/regexIterator_setMode_error.phpt +++ b/ext/spl/tests/regexIterator_setMode_error.phpt @@ -17,12 +17,8 @@ try { var_dump($e->getCode()); } -$regexIterator->setMode('foo'); - ?> --EXPECTF-- int(0) string(14) "Illegal mode 7" int(0) - -Warning: RegexIterator::setMode() expects parameter 1 to be int, string given in %s on line %d diff --git a/ext/spl/tests/spl_004.phpt b/ext/spl/tests/spl_004.phpt index 60de68b82a..72458446e1 100644 --- a/ext/spl/tests/spl_004.phpt +++ b/ext/spl/tests/spl_004.phpt @@ -44,11 +44,19 @@ var_dump(iterator_apply($it, 'test')); echo "===ERRORS===\n"; try { var_dump(iterator_apply($it, 'test', 1)); -} catch (Error $e) { - my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(iterator_apply($it, 'non_existing_function')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(iterator_apply($it, 'non_existing_function', NULL, 2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } -var_dump(iterator_apply($it, 'non_existing_function')); -var_dump(iterator_apply($it, 'non_existing_function', NULL, 2)); ?> ===DONE=== @@ -78,9 +86,7 @@ int(5) int(6) int(4) ===ERRORS=== -Error: Argument 3 passed to iterator_apply() must be of the type array or null, int given -Error: iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name -NULL -Error: iterator_apply() expects at most 3 parameters, 4 given -NULL +Argument 3 passed to iterator_apply() must be of the type array or null, int given +iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name +iterator_apply() expects at most 3 parameters, 4 given ===DONE=== diff --git a/ext/spl/tests/spl_autoload_005.phpt b/ext/spl/tests/spl_autoload_005.phpt index ccebf91f04..58198c2ff1 100644 --- a/ext/spl/tests/spl_autoload_005.phpt +++ b/ext/spl/tests/spl_autoload_005.phpt @@ -48,7 +48,7 @@ catch(Exception $e) ===DONE=== <?php exit(0); ?> --EXPECT-- -Exception: Passed array specifies a non static method but no object (non-static method MyAutoLoader::autoLoad() should not be called statically) +Exception: Passed array specifies a non static method but no object (non-static method MyAutoLoader::autoLoad() cannot be called statically) MyAutoLoader::autoLoad(TestClass) MyAutoLoader::autoThrow(TestClass) Exception: Unavailable diff --git a/ext/spl/tests/spl_autoload_007.phpt b/ext/spl/tests/spl_autoload_007.phpt index 1a81f191c7..1cddac4234 100644 --- a/ext/spl/tests/spl_autoload_007.phpt +++ b/ext/spl/tests/spl_autoload_007.phpt @@ -66,7 +66,7 @@ string(22) "MyAutoLoader::autoLoad" ok string(22) "MyAutoLoader::dynaLoad" -Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() should not be called statically) +Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() cannot be called statically) array(2) { [0]=> @@ -98,7 +98,7 @@ array(2) { [1]=> string(8) "dynaLoad" } -Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() should not be called statically) +Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() cannot be called statically) array(2) { [0]=> diff --git a/ext/spl/tests/spl_autoload_008.phpt b/ext/spl/tests/spl_autoload_008.phpt index df795d02b6..51fbdd2e9f 100644 --- a/ext/spl/tests/spl_autoload_008.phpt +++ b/ext/spl/tests/spl_autoload_008.phpt @@ -80,7 +80,7 @@ Exception: Bla int(0) ====2==== string(22) "MyAutoLoader::dynaLoad" -LogicException: Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() should not be called statically) +LogicException: Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() cannot be called statically) int(0) ====3==== array(2) { @@ -100,7 +100,7 @@ array(2) { [1]=> string(8) "dynaLoad" } -LogicException: Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() should not be called statically) +LogicException: Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() cannot be called statically) int(0) ====5==== array(2) { diff --git a/ext/spl/tests/spl_heap_is_empty_basic.phpt b/ext/spl/tests/spl_heap_is_empty_basic.phpt index 47d7ccce9a..4a90734ad4 100644 --- a/ext/spl/tests/spl_heap_is_empty_basic.phpt +++ b/ext/spl/tests/spl_heap_is_empty_basic.phpt @@ -21,11 +21,8 @@ $heap->insert(1); var_dump($heap->isEmpty()); $heap->extract(); var_dump($heap->isEmpty()); -$heap->isEmpty('var'); ?> --EXPECTF-- bool(true) bool(false) bool(true) - -Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s diff --git a/ext/spl/tests/spl_object_id.phpt b/ext/spl/tests/spl_object_id.phpt index ca13b03fee..a4e8518eaf 100644 --- a/ext/spl/tests/spl_object_id.phpt +++ b/ext/spl/tests/spl_object_id.phpt @@ -4,18 +4,10 @@ SPL: spl_object_id() <?php var_dump(spl_object_id(new stdClass)); -var_dump(spl_object_id(42)); -var_dump(spl_object_id()); $a = new stdClass(); var_dump(spl_object_id(new stdClass) === spl_object_id($a)); ?> --EXPECTF-- int(%d) - -Warning: spl_object_id() expects parameter 1 to be object, int given in %sspl_object_id.php on line %d -NULL - -Warning: spl_object_id() expects exactly 1 parameter, 0 given in %sspl_object_id.php on line %d -NULL bool(false) diff --git a/ext/sqlite3/tests/sqlite3_33_reset.phpt b/ext/sqlite3/tests/sqlite3_33_reset.phpt index 531874ceb6..48abc829c7 100644 --- a/ext/sqlite3/tests/sqlite3_33_reset.phpt +++ b/ext/sqlite3/tests/sqlite3_33_reset.phpt @@ -15,13 +15,11 @@ $db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')"); $stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id'); $stmt->bindValue(':id', 1, SQLITE3_INTEGER); -$stmt->reset("dummy"); $stmt->reset(); //var_dump($db); //var_dump($db->close()); echo "Done\n"; ?> ---EXPECTF-- -Warning: SQLite3Stmt::reset() expects exactly 0 parameters, 1 given in %s on line %d +--EXPECT-- Done diff --git a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt index 767f9d0065..d921b99dd7 100644 --- a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt +++ b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt @@ -17,7 +17,6 @@ try{ } var_dump($db->enableExceptions(false)); $db->query("SELECT * FROM non_existent_table"); -var_dump($db->enableExceptions("wrong_type","wrong_type")); echo "Closing database\n"; var_dump($db->close()); echo "Done\n"; @@ -28,9 +27,6 @@ no such table: non_existent_table bool(true) Warning: SQLite3::query(): no such table: non_existent_table in %s on line %d - -Warning: SQLite3::enableExceptions() expects at most 1 parameter, 2 given in %s on line %d -NULL Closing database bool(true) Done diff --git a/ext/standard/array.c b/ext/standard/array.c index 297b0c0f38..c1cae18f58 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -799,13 +799,13 @@ PHP_FUNCTION(count) /* first, we check if the handler is defined */ if (Z_OBJ_HT_P(array)->count_elements) { RETVAL_LONG(1); - if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value))) { + if (SUCCESS == Z_OBJ_HT(*array)->count_elements(Z_OBJ_P(array), &Z_LVAL_P(return_value))) { return; } } /* if not and the object implements Countable we call its count() method */ if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) { - zend_call_method_with_0_params(array, NULL, NULL, "count", &retval); + zend_call_method_with_0_params(Z_OBJ_P(array), NULL, NULL, "count", &retval); if (Z_TYPE(retval) != IS_UNDEF) { RETVAL_LONG(zval_get_long(&retval)); zval_ptr_dtor(&retval); @@ -1700,16 +1700,16 @@ static zend_always_inline int php_valid_var_name(const char *var_name, size_t va } /* }}} */ -PHPAPI int php_prefix_varname(zval *result, const zval *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore) /* {{{ */ +PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore) /* {{{ */ { - ZVAL_NEW_STR(result, zend_string_alloc(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); - memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); + ZVAL_NEW_STR(result, zend_string_alloc(ZSTR_LEN(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); + memcpy(Z_STRVAL_P(result), ZSTR_VAL(prefix), ZSTR_LEN(prefix)); if (add_underscore) { - Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; + Z_STRVAL_P(result)[ZSTR_LEN(prefix)] = '_'; } - memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); + memcpy(Z_STRVAL_P(result) + ZSTR_LEN(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); return SUCCESS; } @@ -1888,7 +1888,7 @@ static zend_long php_extract_overwrite(zend_array *arr, zend_array *symbol_table } /* }}} */ -static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -1944,7 +1944,7 @@ static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *s } /* }}} */ -static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -1995,7 +1995,7 @@ static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbo } /* }}} */ -static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2069,7 +2069,7 @@ static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol } /* }}} */ -static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2135,7 +2135,7 @@ static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_tab } /* }}} */ -static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2182,7 +2182,7 @@ static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_ } /* }}} */ -static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2229,7 +2229,7 @@ static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_tabl } /* }}} */ -static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2283,7 +2283,7 @@ static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *sym } /* }}} */ -static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2425,9 +2425,10 @@ static zend_long php_extract_skip(zend_array *arr, zend_array *symbol_table) /* Imports variables into symbol table from an array */ PHP_FUNCTION(extract) { - zval *var_array_param, *prefix = NULL; + zval *var_array_param; zend_long extract_refs; zend_long extract_type = EXTR_OVERWRITE; + zend_string *prefix = NULL; zend_long count; zend_array *symbol_table; @@ -2435,7 +2436,7 @@ PHP_FUNCTION(extract) Z_PARAM_ARRAY_EX2(var_array_param, 0, 1, 0) Z_PARAM_OPTIONAL Z_PARAM_LONG(extract_type) - Z_PARAM_ZVAL(prefix) + Z_PARAM_STR(prefix) ZEND_PARSE_PARAMETERS_END(); extract_refs = (extract_type & EXTR_REFS); @@ -2455,8 +2456,7 @@ PHP_FUNCTION(extract) } if (prefix) { - convert_to_string(prefix); - if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) { + if (ZSTR_LEN(prefix) && !php_valid_var_name(ZSTR_VAL(prefix), ZSTR_LEN(prefix))) { php_error_docref(NULL, E_WARNING, "prefix is not a valid identifier"); return; } @@ -3226,7 +3226,7 @@ PHP_FUNCTION(array_pop) } ZVAL_COPY_DEREF(return_value, val); - if (!p->key && Z_ARRVAL_P(stack)->nNextFreeElement > 0 && p->h >= (zend_ulong)(Z_ARRVAL_P(stack)->nNextFreeElement - 1)) { + if (!p->key && (zend_long)p->h == (Z_ARRVAL_P(stack)->nNextFreeElement - 1)) { Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1; } @@ -3468,14 +3468,14 @@ PHP_FUNCTION(array_splice) Returns elements specified by offset and length */ PHP_FUNCTION(array_slice) { - zval *input, /* Input array */ - *z_length = NULL, /* How many elements to get */ - *entry; /* An array entry */ - zend_long offset, /* Offset to get elements from */ - length = 0; - zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */ - int num_in, /* Number of elements in the input array */ - pos; /* Current position in the array */ + zval *input; /* Input array */ + zval *entry; /* An array entry */ + zend_long offset; /* Offset to get elements from */ + zend_long length = 0; /* How many elements to get */ + zend_bool length_is_null = 1; /* Whether an explicit length has been omitted */ + zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array */ + uint32_t num_in; /* Number of elements in the input array */ + uint32_t pos; /* Current position in the array */ zend_string *string_key; zend_ulong num_key; @@ -3483,7 +3483,7 @@ PHP_FUNCTION(array_slice) Z_PARAM_ARRAY(input) Z_PARAM_LONG(offset) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL(z_length) + Z_PARAM_LONG_EX(length, length_is_null, 1, 0) Z_PARAM_BOOL(preserve_keys) ZEND_PARSE_PARAMETERS_END(); @@ -3491,14 +3491,12 @@ PHP_FUNCTION(array_slice) num_in = zend_hash_num_elements(Z_ARRVAL_P(input)); /* We want all entries from offset to the end if length is not passed or is null */ - if (ZEND_NUM_ARGS() < 3 || Z_TYPE_P(z_length) == IS_NULL) { + if (length_is_null) { length = num_in; - } else { - length = zval_get_long(z_length); } /* Clamp the offset.. */ - if (offset > num_in) { + if (offset > (zend_long) num_in) { ZVAL_EMPTY_ARRAY(return_value); return; } else if (offset < 0 && (offset = (num_in + offset)) < 0) { @@ -4150,9 +4148,12 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /* /* The has_property check is first performed in "exists" mode (which returns true for * properties that are null but exist) and then in "has" mode to handle objects that * implement __isset (which is not called in "exists" mode). */ - if (Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_EXISTS, NULL) - || Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_ISSET, NULL)) { - prop = Z_OBJ_HANDLER_P(data, read_property)(data, name, BP_VAR_R, NULL, rv); + zend_string *str, *tmp_str; + + str = zval_get_tmp_string(name, &tmp_str); + if (Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_EXISTS, NULL) + || Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_ISSET, NULL)) { + prop = Z_OBJ_HANDLER_P(data, read_property)(Z_OBJ_P(data), str, BP_VAR_R, NULL, rv); if (prop) { ZVAL_DEREF(prop); if (prop != rv) { @@ -4160,6 +4161,7 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /* } } } + zend_tmp_string_release(tmp_str); } else if (Z_TYPE_P(data) == IS_ARRAY) { if (Z_TYPE_P(name) == IS_STRING) { prop = zend_symtable_find(Z_ARRVAL_P(data), Z_STR_P(name)); diff --git a/ext/standard/assert.c b/ext/standard/assert.c index eb1b59db74..28decb5033 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -29,7 +29,6 @@ ZEND_BEGIN_MODULE_GLOBALS(assert) zend_bool active; zend_bool bail; zend_bool warning; - zend_bool quiet_eval; zend_bool exception; ZEND_END_MODULE_GLOBALS(assert) @@ -46,7 +45,6 @@ enum { ASSERT_CALLBACK, ASSERT_BAIL, ASSERT_WARNING, - ASSERT_QUIET_EVAL, ASSERT_EXCEPTION }; @@ -81,7 +79,6 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateBool, bail, zend_assert_globals, assert_globals) STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateBool, warning, zend_assert_globals, assert_globals) PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback) - STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateBool, quiet_eval, zend_assert_globals, assert_globals) STD_PHP_INI_ENTRY("assert.exception", "0", PHP_INI_ALL, OnUpdateBool, exception, zend_assert_globals, assert_globals) PHP_INI_END() @@ -104,7 +101,6 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */ REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT); INIT_CLASS_ENTRY(ce, "AssertionError", NULL); @@ -147,9 +143,6 @@ PHP_FUNCTION(assert) { zval *assertion; zval *description = NULL; - int val; - char *myeval = NULL; - char *compiled_string_description; if (! ASSERTG(active)) { RETURN_TRUE; @@ -161,51 +154,7 @@ PHP_FUNCTION(assert) Z_PARAM_ZVAL(description) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(assertion) == IS_STRING) { - zval retval; - int old_error_reporting = 0; /* shut up gcc! */ - - if (zend_forbid_dynamic_call("assert() with string argument") == FAILURE) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling assert() with a string argument is deprecated"); - - myeval = Z_STRVAL_P(assertion); - - if (ASSERTG(quiet_eval)) { - old_error_reporting = EG(error_reporting); - EG(error_reporting) = 0; - } - - compiled_string_description = zend_make_compiled_string_description("assert code"); - if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description) == FAILURE) { - efree(compiled_string_description); - if (!description) { - zend_throw_error(NULL, "Failure evaluating code: %s%s", PHP_EOL, myeval); - } else { - zend_string *str = zval_get_string(description); - zend_throw_error(NULL, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval); - zend_string_release_ex(str, 0); - } - if (ASSERTG(bail)) { - zend_bailout(); - } - RETURN_FALSE; - } - efree(compiled_string_description); - - if (ASSERTG(quiet_eval)) { - EG(error_reporting) = old_error_reporting; - } - - convert_to_boolean(&retval); - val = Z_TYPE(retval) == IS_TRUE; - } else { - val = zend_is_true(assertion); - } - - if (val) { + if (zend_is_true(assertion)) { RETURN_TRUE; } @@ -220,8 +169,8 @@ PHP_FUNCTION(assert) const char *filename = zend_get_executed_filename(); ZVAL_STRING(&args[0], SAFE_STRING(filename)); - ZVAL_LONG (&args[1], lineno); - ZVAL_STRING(&args[2], SAFE_STRING(myeval)); + ZVAL_LONG(&args[1], lineno); + ZVAL_NULL(&args[2]); ZVAL_FALSE(&retval); @@ -255,18 +204,10 @@ PHP_FUNCTION(assert) } } else if (ASSERTG(warning)) { if (!description) { - if (myeval) { - php_error_docref(NULL, E_WARNING, "Assertion \"%s\" failed", myeval); - } else { - php_error_docref(NULL, E_WARNING, "Assertion failed"); - } + php_error_docref(NULL, E_WARNING, "Assertion failed"); } else { zend_string *str = zval_get_string(description); - if (myeval) { - php_error_docref(NULL, E_WARNING, "%s: \"%s\" failed", ZSTR_VAL(str), myeval); - } else { - php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str)); - } + php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str)); zend_string_release_ex(str, 0); } } @@ -320,18 +261,6 @@ PHP_FUNCTION(assert_options) RETURN_LONG(oldint); break; - case ASSERT_QUIET_EVAL: - oldint = ASSERTG(quiet_eval); - if (ac == 2) { - zend_string *value_str = zval_get_string(value); - key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0); - zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); - zend_string_release_ex(key, 0); - zend_string_release_ex(value_str, 0); - } - RETURN_LONG(oldint); - break; - case ASSERT_WARNING: oldint = ASSERTG(warning); if (ac == 2) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index d281730afa..ccd14de59b 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1099,12 +1099,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_fgetc, 0) ZEND_ARG_INFO(0, fp) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetss, 0, 0, 1) - ZEND_ARG_INFO(0, fp) - ZEND_ARG_INFO(0, length) - ZEND_ARG_INFO(0, allowable_tags) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_fscanf, 0, 0, 2) ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, format) @@ -2392,7 +2386,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setlocale, 0, 0, 2) ZEND_ARG_VARIADIC_INFO(0, locales) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 2) ZEND_ARG_INFO(0, encoded_string) ZEND_ARG_INFO(1, result) ZEND_END_ARG_INFO() @@ -3140,7 +3134,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(feof, arginfo_feof) PHP_FE(fgetc, arginfo_fgetc) PHP_FE(fgets, arginfo_fgets) - PHP_DEP_FE(fgetss, arginfo_fgetss) PHP_FE(fread, arginfo_fread) PHP_NAMED_FE(fopen, php_if_fopen, arginfo_fopen) PHP_FE(fpassthru, arginfo_fpassthru) diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 2fff4e736e..9c949e166c 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -156,7 +156,7 @@ PHP_RSHUTDOWN_FUNCTION(browscap); /* Left for BC (not binary safe!) */ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers); PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers); -PHPAPI int php_prefix_varname(zval *result, const zval *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore); +PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore); #define MT_N (624) diff --git a/ext/standard/file.c b/ext/standard/file.c index cc3d4d2699..df4c50545b 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -691,7 +691,7 @@ PHP_FUNCTION(file_put_contents) if (Z_OBJ_HT_P(data) != NULL) { zval out; - if (zend_std_cast_object_tostring(data, &out, IS_STRING) == SUCCESS) { + if (zend_std_cast_object_tostring(Z_OBJ_P(data), &out, IS_STRING) == SUCCESS) { numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out)); if (numbytes != Z_STRLEN(out)) { php_error_docref(NULL, E_WARNING, "Only "ZEND_LONG_FMT" of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); @@ -1090,55 +1090,6 @@ PHPAPI PHP_FUNCTION(fgetc) } /* }}} */ -/* {{{ proto string fgetss(resource fp [, int length [, string allowable_tags]]) - Get a line from file pointer and strip HTML tags */ -PHPAPI PHP_FUNCTION(fgetss) -{ - zval *fd; - zend_long bytes = 0; - size_t len = 0; - size_t actual_len, retval_len; - char *buf = NULL, *retval; - php_stream *stream; - char *allowed_tags=NULL; - size_t allowed_tags_len=0; - - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_RESOURCE(fd) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(bytes) - Z_PARAM_STRING(allowed_tags, allowed_tags_len) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - - PHP_STREAM_TO_ZVAL(stream, fd); - - if (ZEND_NUM_ARGS() >= 2) { - if (bytes <= 0) { - php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0"); - RETURN_FALSE; - } - - len = (size_t) bytes; - buf = safe_emalloc(sizeof(char), (len + 1), 0); - /*needed because recv doesn't set null char at end*/ - memset(buf, 0, len + 1); - } - - if ((retval = php_stream_get_line(stream, buf, len, &actual_len)) == NULL) { - if (buf != NULL) { - efree(buf); - } - RETURN_FALSE; - } - - retval_len = php_strip_tags(retval, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len); - - // TODO: avoid reallocation ??? - RETVAL_STRINGL(retval, retval_len); - efree(retval); -} -/* }}} */ - /* {{{ proto mixed fscanf(resource stream, string format [, string ...]) Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) @@ -1986,8 +1937,6 @@ PHP_FUNCTION(fgetcsv) char enclosure = '"'; /* allow this to be set as parameter */ int escape = (unsigned char) '\\'; - /* first section exactly as php_fgetss */ - zend_long len = 0; size_t buf_len; char *buf; diff --git a/ext/standard/file.h b/ext/standard/file.h index 3a059b5c83..f479989ea2 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -35,7 +35,6 @@ PHPAPI PHP_FUNCTION(fread); PHPAPI PHP_FUNCTION(fgetc); PHPAPI PHP_FUNCTION(fgets); PHP_FUNCTION(fscanf); -PHPAPI PHP_FUNCTION(fgetss); PHP_FUNCTION(fgetcsv); PHP_FUNCTION(fputcsv); PHPAPI PHP_FUNCTION(fwrite); diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 9d90558f59..5df7c623fd 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -166,129 +166,6 @@ static const php_stream_filter_factory strfilter_tolower_factory = { }; /* }}} */ -/* {{{ strip_tags filter implementation */ -typedef struct _php_strip_tags_filter { - const char *allowed_tags; - int allowed_tags_len; - uint8_t state; - uint8_t persistent; -} php_strip_tags_filter; - -static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, zend_string *allowed_tags, int persistent) -{ - if (allowed_tags != NULL) { - if (NULL == (inst->allowed_tags = pemalloc(ZSTR_LEN(allowed_tags) + 1, persistent))) { - return FAILURE; - } - memcpy((char *)inst->allowed_tags, ZSTR_VAL(allowed_tags), ZSTR_LEN(allowed_tags) + 1); - inst->allowed_tags_len = (int)ZSTR_LEN(allowed_tags); - } else { - inst->allowed_tags = NULL; - } - inst->state = 0; - inst->persistent = persistent; - - return SUCCESS; -} - -static void php_strip_tags_filter_dtor(php_strip_tags_filter *inst) -{ - if (inst->allowed_tags != NULL) { - pefree((void *)inst->allowed_tags, inst->persistent); - } -} - -static php_stream_filter_status_t strfilter_strip_tags_filter( - php_stream *stream, - php_stream_filter *thisfilter, - php_stream_bucket_brigade *buckets_in, - php_stream_bucket_brigade *buckets_out, - size_t *bytes_consumed, - int flags - ) -{ - php_stream_bucket *bucket; - size_t consumed = 0; - php_strip_tags_filter *inst = (php_strip_tags_filter *) Z_PTR(thisfilter->abstract); - - while (buckets_in->head) { - bucket = php_stream_bucket_make_writeable(buckets_in->head); - consumed = bucket->buflen; - - bucket->buflen = php_strip_tags(bucket->buf, bucket->buflen, &(inst->state), inst->allowed_tags, inst->allowed_tags_len); - - php_stream_bucket_append(buckets_out, bucket); - } - - if (bytes_consumed) { - *bytes_consumed = consumed; - } - - return PSFS_PASS_ON; -} - -static void strfilter_strip_tags_dtor(php_stream_filter *thisfilter) -{ - assert(Z_PTR(thisfilter->abstract) != NULL); - - php_strip_tags_filter_dtor((php_strip_tags_filter *)Z_PTR(thisfilter->abstract)); - - pefree(Z_PTR(thisfilter->abstract), ((php_strip_tags_filter *)Z_PTR(thisfilter->abstract))->persistent); -} - -static const php_stream_filter_ops strfilter_strip_tags_ops = { - strfilter_strip_tags_filter, - strfilter_strip_tags_dtor, - "string.strip_tags" -}; - -static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, uint8_t persistent) -{ - php_strip_tags_filter *inst; - php_stream_filter *filter = NULL; - zend_string *allowed_tags = NULL; - - php_error_docref(NULL, E_DEPRECATED, "The string.strip_tags filter is deprecated"); - - inst = pemalloc(sizeof(php_strip_tags_filter), persistent); - - if (filterparams != NULL) { - if (Z_TYPE_P(filterparams) == IS_ARRAY) { - smart_str tags_ss = {0}; - zval *tmp; - - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) { - convert_to_string_ex(tmp); - smart_str_appendc(&tags_ss, '<'); - smart_str_append(&tags_ss, Z_STR_P(tmp)); - smart_str_appendc(&tags_ss, '>'); - } ZEND_HASH_FOREACH_END(); - smart_str_0(&tags_ss); - allowed_tags = tags_ss.s; - } else { - allowed_tags = zval_get_string(filterparams); - } - } - - if (php_strip_tags_filter_ctor(inst, allowed_tags, persistent) == SUCCESS) { - filter = php_stream_filter_alloc(&strfilter_strip_tags_ops, inst, persistent); - } else { - pefree(inst, persistent); - } - - if (allowed_tags) { - zend_string_release(allowed_tags); - } - - return filter; -} - -static const php_stream_filter_factory strfilter_strip_tags_factory = { - strfilter_strip_tags_create -}; - -/* }}} */ - /* {{{ base64 / quoted_printable stream filter implementation */ typedef enum _php_conv_err_t { @@ -2037,7 +1914,6 @@ static const struct { { &strfilter_rot13_ops, &strfilter_rot13_factory }, { &strfilter_toupper_ops, &strfilter_toupper_factory }, { &strfilter_tolower_ops, &strfilter_tolower_factory }, - { &strfilter_strip_tags_ops, &strfilter_strip_tags_factory }, { &strfilter_convert_ops, &strfilter_convert_factory }, { &consumed_filter_ops, &consumed_filter_factory }, { &chunked_filter_ops, &chunked_filter_factory }, diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index f38fae5f53..0df21e37d7 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -32,7 +32,7 @@ static zend_object_handlers php_incomplete_object_handlers; /* {{{ incomplete_class_message */ -static void incomplete_class_message(zval *object, int error_type) +static void incomplete_class_message(zend_object *object, int error_type) { zend_string *class_name; @@ -47,7 +47,7 @@ static void incomplete_class_message(zval *object, int error_type) } /* }}} */ -static zval *incomplete_class_get_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */ +static zval *incomplete_class_get_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */ { incomplete_class_message(object, E_NOTICE); @@ -60,27 +60,27 @@ static zval *incomplete_class_get_property(zval *object, zval *member, int type, } /* }}} */ -static zval *incomplete_class_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */ +static zval *incomplete_class_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); return value; } /* }}} */ -static zval *incomplete_class_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static zval *incomplete_class_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); return &EG(error_zval); } /* }}} */ -static void incomplete_class_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */ +static void incomplete_class_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); } /* }}} */ -static int incomplete_class_has_property(zval *object, zval *member, int check_empty, void **cache_slot) /* {{{ */ +static int incomplete_class_has_property(zend_object *object, zend_string *member, int check_empty, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); return 0; @@ -89,10 +89,7 @@ static int incomplete_class_has_property(zval *object, zval *member, int check_e static zend_function *incomplete_class_get_method(zend_object **object, zend_string *method, const zval *key) /* {{{ */ { - zval zobject; - - ZVAL_OBJ(&zobject, *object); - incomplete_class_message(&zobject, E_ERROR); + incomplete_class_message(*object, E_ERROR); return NULL; } /* }}} */ @@ -132,15 +129,14 @@ PHPAPI zend_class_entry *php_create_incomplete_class(void) /* {{{ php_lookup_class_name */ -PHPAPI zend_string *php_lookup_class_name(zval *object) +PHPAPI zend_string *php_lookup_class_name(zend_object *object) { - zval *val; - HashTable *object_properties; - - object_properties = Z_OBJPROP_P(object); + if (object->properties) { + zval *val = zend_hash_str_find(object->properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1); - if ((val = zend_hash_str_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1)) != NULL && Z_TYPE_P(val) == IS_STRING) { - return zend_string_copy(Z_STR_P(val)); + if (val != NULL && Z_TYPE_P(val) == IS_STRING) { + return zend_string_copy(Z_STR_P(val)); + } } return NULL; diff --git a/ext/standard/password.c b/ext/standard/password.c index 3f1ff6dd55..4a4d99dc6e 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -52,19 +52,6 @@ void php_password_algo_unregister(const char *ident) { zend_hash_str_del(&php_password_algos, ident, strlen(ident)); } -static int php_password_salt_is_alphabet(const char *str, const size_t len) /* {{{ */ -{ - size_t i = 0; - - for (i = 0; i < len; i++) { - if (!((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= '0' && str[i] <= '9') || str[i] == '.' || str[i] == '/')) { - return FAILURE; - } - } - return SUCCESS; -} -/* }}} */ - static int php_password_salt_to64(const char *str, const size_t str_len, const size_t out_len, char *ret) /* {{{ */ { size_t pos = 0; @@ -123,65 +110,11 @@ static zend_string* php_password_make_salt(size_t length) /* {{{ */ /* }}} */ static zend_string* php_password_get_salt(zval *unused_, size_t required_salt_len, HashTable *options) { - zend_string *buffer; - zval *option_buffer; - - if (!options || !(option_buffer = zend_hash_str_find(options, "salt", sizeof("salt") - 1))) { - return php_password_make_salt(required_salt_len); - } - - php_error_docref(NULL, E_DEPRECATED, "Use of the 'salt' option to password_hash is deprecated"); - - switch (Z_TYPE_P(option_buffer)) { - case IS_STRING: - buffer = zend_string_copy(Z_STR_P(option_buffer)); - break; - case IS_LONG: - case IS_DOUBLE: - case IS_OBJECT: - buffer = zval_get_string(option_buffer); - break; - case IS_FALSE: - case IS_TRUE: - case IS_NULL: - case IS_RESOURCE: - case IS_ARRAY: - default: - php_error_docref(NULL, E_WARNING, "Non-string salt parameter supplied"); - return NULL; - } - - /* XXX all the crypt related APIs work with int for string length. - That should be revised for size_t and then we maybe don't require - the > INT_MAX check. */ - if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(buffer))) { - php_error_docref(NULL, E_WARNING, "Supplied salt is too long"); - zend_string_release_ex(buffer, 0); - return NULL; - } - - if (ZSTR_LEN(buffer) < required_salt_len) { - php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd expecting %zd", ZSTR_LEN(buffer), required_salt_len); - zend_string_release_ex(buffer, 0); - return NULL; + if (options && zend_hash_str_exists(options, "salt", sizeof("salt") - 1)) { + php_error_docref(NULL, E_WARNING, "The 'salt' option is no longer supported. The provided salt has been been ignored"); } - if (php_password_salt_is_alphabet(ZSTR_VAL(buffer), ZSTR_LEN(buffer)) == FAILURE) { - zend_string *salt = zend_string_alloc(required_salt_len, 0); - if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), required_salt_len, ZSTR_VAL(salt)) == FAILURE) { - php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd", ZSTR_LEN(buffer)); - zend_string_release_ex(salt, 0); - zend_string_release_ex(buffer, 0); - return NULL; - } - zend_string_release_ex(buffer, 0); - return salt; - } else { - zend_string *salt = zend_string_alloc(required_salt_len, 0); - memcpy(ZSTR_VAL(salt), ZSTR_VAL(buffer), required_salt_len); - zend_string_release_ex(buffer, 0); - return salt; - } + return php_password_make_salt(required_salt_len); } /* bcrypt implementation */ diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index d768f25bdb..eeb4461965 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -27,7 +27,7 @@ #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); \ + class_name = php_lookup_class_name(Z_OBJ_P(struc)); \ if (!class_name) { \ class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \ } \ @@ -51,7 +51,7 @@ extern "C" { #endif PHPAPI zend_class_entry *php_create_incomplete_class(void); -PHPAPI zend_string *php_lookup_class_name(zval *object); +PHPAPI zend_string *php_lookup_class_name(zend_object *object); PHPAPI void php_store_class_name(zval *object, const char *name, size_t len); #ifdef __cplusplus diff --git a/ext/standard/random.c b/ext/standard/random.c index f6568a658f..01d99a5eef 100644 --- a/ext/standard/random.c +++ b/ext/standard/random.c @@ -194,7 +194,7 @@ PHP_FUNCTION(random_bytes) zend_long size; zend_string *bytes; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(size) ZEND_PARSE_PARAMETERS_END(); @@ -268,7 +268,7 @@ PHP_FUNCTION(random_int) zend_long max; zend_long result; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 2, 2) + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(min) Z_PARAM_LONG(max) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 9b6e05de65..8fe7b2d225 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -1671,8 +1671,7 @@ PHP_FUNCTION(sapi_windows_vt100_support) php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)&fileno, 0); } else { - zend_internal_type_error( - ZEND_ARG_USES_STRICT_TYPES(), + zend_type_error( "%s() was not able to analyze the specified stream", get_active_function_name() ); diff --git a/ext/standard/string.c b/ext/standard/string.c index 91cb14da4b..1f18bb23d8 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1813,79 +1813,34 @@ PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) } /* }}} */ -/* {{{ php_needle_char - */ -static int php_needle_char(zval *needle, char *target) -{ - switch (Z_TYPE_P(needle)) { - case IS_LONG: - *target = (char)Z_LVAL_P(needle); - return SUCCESS; - case IS_NULL: - case IS_FALSE: - *target = '\0'; - return SUCCESS; - case IS_TRUE: - *target = '\1'; - return SUCCESS; - case IS_DOUBLE: - *target = (char)(int)Z_DVAL_P(needle); - return SUCCESS; - case IS_OBJECT: - *target = (char) zval_get_long(needle); - return SUCCESS; - default: - php_error_docref(NULL, E_WARNING, "needle is not a string or an integer"); - return FAILURE; - } -} -/* }}} */ - /* {{{ proto string stristr(string haystack, string needle[, bool part]) Finds first occurrence of a string within another, case insensitive */ PHP_FUNCTION(stristr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; size_t found_offset; char *haystack_dup; - char needle_char[2]; + char *orig_needle; zend_bool part = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_BOOL(part) ZEND_PARSE_PARAMETERS_END(); - haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack)); - - if (Z_TYPE_P(needle) == IS_STRING) { - char *orig_needle; - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - efree(haystack_dup); - RETURN_FALSE; - } - orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); - found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), Z_STRLEN_P(needle)); - efree(orig_needle); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - efree(haystack_dup); - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = php_stristr(haystack_dup, needle_char, ZSTR_LEN(haystack), 1); + if (!ZSTR_LEN(needle)) { + php_error_docref(NULL, E_WARNING, "Empty needle"); + RETURN_FALSE; } + haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack)); + orig_needle = estrndup(ZSTR_VAL(needle), ZSTR_LEN(needle)); + found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), ZSTR_LEN(needle)); + efree(orig_needle); + if (found) { found_offset = found - haystack_dup; if (part) { @@ -1905,40 +1860,25 @@ PHP_FUNCTION(stristr) Finds first occurrence of a string within another */ PHP_FUNCTION(strstr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; - char needle_char[2]; zend_long found_offset; zend_bool part = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_BOOL(part) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - RETURN_FALSE; - } - - found = php_memnstr(ZSTR_VAL(haystack), Z_STRVAL_P(needle), Z_STRLEN_P(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = php_memnstr(ZSTR_VAL(haystack), needle_char, 1, ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (!ZSTR_LEN(needle)) { + php_error_docref(NULL, E_WARNING, "Empty needle"); + RETURN_FALSE; } + found = php_memnstr(ZSTR_VAL(haystack), ZSTR_VAL(needle), ZSTR_LEN(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (found) { found_offset = found - ZSTR_VAL(haystack); if (part) { @@ -1959,15 +1899,13 @@ PHP_FUNCTION(strstr) Finds position of first occurrence of a string within another */ PHP_FUNCTION(strpos) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; - char needle_char[2]; - zend_long offset = 0; + zend_long offset = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); @@ -1980,32 +1918,15 @@ PHP_FUNCTION(strpos) RETURN_FALSE; } - if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - RETURN_FALSE; - } - - found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, - Z_STRVAL_P(needle), - Z_STRLEN_P(needle), - ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, - needle_char, - 1, - ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (!ZSTR_LEN(needle)) { + php_error_docref(NULL, E_WARNING, "Empty needle"); + RETURN_FALSE; } + found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, + ZSTR_VAL(needle), ZSTR_LEN(needle), + ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (found) { RETURN_LONG(found - ZSTR_VAL(haystack)); } else { @@ -2019,15 +1940,13 @@ PHP_FUNCTION(strpos) PHP_FUNCTION(stripos) { const char *found = NULL; - zend_string *haystack; + zend_string *haystack, *needle; zend_long offset = 0; - char needle_char[2]; - zval *needle; zend_string *needle_dup = NULL, *haystack_dup; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); @@ -2044,33 +1963,14 @@ PHP_FUNCTION(stripos) RETURN_FALSE; } - if (Z_TYPE_P(needle) == IS_STRING) { - if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > ZSTR_LEN(haystack)) { - RETURN_FALSE; - } - - haystack_dup = php_string_tolower(haystack); - needle_dup = php_string_tolower(Z_STR_P(needle)); - found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, - ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - haystack_dup = php_string_tolower(haystack); - needle_char[0] = tolower(needle_char[0]); - needle_char[1] = '\0'; - found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, - needle_char, - sizeof(needle_char) - 1, - ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); + if (ZSTR_LEN(needle) == 0 || ZSTR_LEN(needle) > ZSTR_LEN(haystack)) { + RETURN_FALSE; } + haystack_dup = php_string_tolower(haystack); + needle_dup = php_string_tolower(needle); + found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, + ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); if (found) { RETVAL_LONG(found - ZSTR_VAL(haystack_dup)); @@ -2089,38 +1989,20 @@ PHP_FUNCTION(stripos) Finds position of last occurrence of a string within another string */ PHP_FUNCTION(strrpos) { - zval *zneedle; zend_string *haystack; + char *needle; size_t needle_len; zend_long offset = 0; - char ord_needle[2]; - const char *p, *e, *found, *needle; + const char *p, *e, *found; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(zneedle) + Z_PARAM_STRING(needle, needle_len) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - if (Z_TYPE_P(zneedle) == IS_STRING) { - needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRLEN_P(zneedle); - } else { - if (php_needle_char(zneedle, ord_needle) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - ord_needle[1] = '\0'; - needle = ord_needle; - needle_len = 1; - } - - if ((ZSTR_LEN(haystack) == 0) || (needle_len == 0)) { + if (ZSTR_LEN(haystack) == 0 || needle_len == 0) { RETURN_FALSE; } @@ -2156,49 +2038,29 @@ PHP_FUNCTION(strrpos) Finds position of last occurrence of a string within another string */ PHP_FUNCTION(strripos) { - zval *zneedle; zend_string *needle; zend_string *haystack; zend_long offset = 0; const char *p, *e, *found; - zend_string *needle_dup, *haystack_dup, *ord_needle = NULL; - ALLOCA_FLAG(use_heap); + zend_string *needle_dup, *haystack_dup; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(zneedle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - ZSTR_ALLOCA_ALLOC(ord_needle, 1, use_heap); - if (Z_TYPE_P(zneedle) == IS_STRING) { - needle = Z_STR_P(zneedle); - } else { - if (php_needle_char(zneedle, ZSTR_VAL(ord_needle)) != SUCCESS) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - ZSTR_VAL(ord_needle)[1] = '\0'; - needle = ord_needle; - } - - if ((ZSTR_LEN(haystack) == 0) || (ZSTR_LEN(needle) == 0)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); + if (ZSTR_LEN(haystack) == 0 || ZSTR_LEN(needle) == 0) { RETURN_FALSE; } if (ZSTR_LEN(needle) == 1) { /* Single character search can shortcut memcmps Can also avoid tolower emallocs */ + char lowered; if (offset >= 0) { if ((size_t)offset > ZSTR_LEN(haystack)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2207,22 +2069,19 @@ PHP_FUNCTION(strripos) } else { p = ZSTR_VAL(haystack); if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + (size_t)offset; } /* Borrow that ord_needle buffer to avoid repeatedly tolower()ing needle */ - *ZSTR_VAL(ord_needle) = tolower(*ZSTR_VAL(needle)); + lowered = tolower(*ZSTR_VAL(needle)); while (e >= p) { - if (tolower(*e) == *ZSTR_VAL(ord_needle)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); + if (tolower(*e) == lowered) { RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; } - ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } @@ -2230,7 +2089,6 @@ PHP_FUNCTION(strripos) if (offset >= 0) { if ((size_t)offset > ZSTR_LEN(haystack)) { zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2239,7 +2097,6 @@ PHP_FUNCTION(strripos) } else { if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) { zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2256,11 +2113,9 @@ PHP_FUNCTION(strripos) RETVAL_LONG(found - ZSTR_VAL(haystack_dup)); zend_string_release_ex(needle_dup, 0); zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); } else { zend_string_release_ex(needle_dup, 0); zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } } @@ -2270,31 +2125,16 @@ PHP_FUNCTION(strripos) Finds the last occurrence of a character in a string within another */ PHP_FUNCTION(strrchr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; zend_long found_offset; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(needle) == IS_STRING) { - found = zend_memrchr(ZSTR_VAL(haystack), *Z_STRVAL_P(needle), ZSTR_LEN(haystack)); - } else { - char needle_chr; - if (php_needle_char(needle, &needle_chr) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = zend_memrchr(ZSTR_VAL(haystack), needle_chr, ZSTR_LEN(haystack)); - } - + found = zend_memrchr(ZSTR_VAL(haystack), *ZSTR_VAL(needle), ZSTR_LEN(haystack)); if (found) { found_offset = found - ZSTR_VAL(haystack); RETURN_STRINGL(found, ZSTR_LEN(haystack) - found_offset); @@ -2752,8 +2592,8 @@ PHP_FUNCTION(quotemeta) old_end = ZSTR_VAL(old) + ZSTR_LEN(old); - if (ZSTR_VAL(old) == old_end) { - RETURN_FALSE; + if (ZSTR_LEN(old) == 0) { + RETURN_EMPTY_STRING(); } str = zend_string_safe_alloc(2, ZSTR_LEN(old), 0, 0); @@ -4918,7 +4758,7 @@ PHP_FUNCTION(setlocale) } /* }}} */ -/* {{{ proto void parse_str(string encoded_string [, array &result]) +/* {{{ proto void parse_str(string encoded_string, array &result) Parses GET/POST/COOKIE data and sets global variables */ PHP_FUNCTION(parse_str) { @@ -4927,38 +4767,18 @@ PHP_FUNCTION(parse_str) char *res = NULL; size_t arglen; - ZEND_PARSE_PARAMETERS_START(1, 2) + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STRING(arg, arglen) - Z_PARAM_OPTIONAL Z_PARAM_ZVAL(arrayArg) ZEND_PARSE_PARAMETERS_END(); - res = estrndup(arg, arglen); - - if (arrayArg == NULL) { - zval tmp; - zend_array *symbol_table; - if (zend_forbid_dynamic_call("parse_str() with a single argument") == FAILURE) { - efree(res); - return; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling parse_str() without the result argument is deprecated"); - - symbol_table = zend_rebuild_symbol_table(); - ZVAL_ARR(&tmp, symbol_table); - sapi_module.treat_data(PARSE_STRING, res, &tmp); - if (UNEXPECTED(zend_hash_del(symbol_table, ZSTR_KNOWN(ZEND_STR_THIS)) == SUCCESS)) { - zend_throw_error(NULL, "Cannot re-assign $this"); - } - } else { - arrayArg = zend_try_array_init(arrayArg); - if (!arrayArg) { - return; - } - - sapi_module.treat_data(PARSE_STRING, res, arrayArg); + arrayArg = zend_try_array_init(arrayArg); + if (!arrayArg) { + return; } + + res = estrndup(arg, arglen); + sapi_module.treat_data(PARSE_STRING, res, arrayArg); } /* }}} */ diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt index c82f5f7fd0..c51e98a67b 100644 --- a/ext/standard/tests/array/005.phpt +++ b/ext/standard/tests/array/005.phpt @@ -33,18 +33,6 @@ $mixed_array = array( /* Testing Error Conditions */ echo "\n*** Testing Error Conditions ***\n"; -/* Zero argument */ -var_dump( array_shift() ); - -/* Scalar argument */ -var_dump( array_shift($number) ); - -/* String argument */ -var_dump( array_shift($str) ); - -/* Invalid Number of arguments */ -var_dump( array_shift($mixed_array[1],$mixed_array[2]) ); - /* Empty Array as argument */ var_dump( array_shift($empty_array) ); @@ -83,18 +71,6 @@ echo"Done"; ?> --EXPECTF-- *** Testing Error Conditions *** - -Warning: array_shift() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_shift() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_shift() expects exactly 1 parameter, 2 given in %s on line %d -NULL NULL *** Testing with various array inputs *** diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt index 017456917e..c62be0d27c 100644 --- a/ext/standard/tests/array/009.phpt +++ b/ext/standard/tests/array/009.phpt @@ -69,51 +69,6 @@ foreach ($varient_arrays as $sub_array ) { echo "\n"; } -/*test these functions on array which is already unset */ -echo "\n-- Testing variation: when array is unset --\n"; -$unset_array = array (1); -unset($unset_array); - -var_dump( current($unset_array) ); -var_dump( key($unset_array) ); -var_dump( next($unset_array) ); -var_dump( reset($unset_array) ); - - -echo "\n*** Testing error conditions ***\n"; -//Zero argument, expected 1 argument -var_dump( key() ); -var_dump( current() ); -var_dump( reset() ); -var_dump( next() ); - -// args more than expected, expected 1 argument -$temp_array = array(1); -var_dump( key($temp_array, $temp_array) ); -var_dump( current($temp_array, $temp_array) ); -var_dump( reset($temp_array, $temp_array) ); -var_dump( next($temp_array, $temp_array) ); - -// invalid args type, valid argument: array -$int_var = 1; -$float_var = 1.5; -$string = "string"; -var_dump( key($int_var) ); -var_dump( key($float_var) ); -var_dump( key($string) ); - -var_dump( current($int_var) ); -var_dump( current($float_var) ); -var_dump( current($string) ); - -var_dump( next($int_var) ); -var_dump( next($float_var) ); -var_dump( next($string) ); - -var_dump( reset($int_var) ); -var_dump( reset($float_var) ); -var_dump( reset($string) ); - echo "Done\n"; ?> --EXPECTF-- @@ -456,84 +411,4 @@ array(5) { string(4) "zero" } - --- Testing variation: when array is unset -- - -Notice: Undefined variable: unset_array in %s on line %d - -Warning: current() expects parameter 1 to be array, null given in %s on line %d -NULL - -Notice: Undefined variable: unset_array in %s on line %d - -Warning: key() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, null given in %s on line %d -NULL - -*** Testing error conditions *** - -Warning: key() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: current() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: reset() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: next() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: key() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: current() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: reset() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: next() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, string given in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/array_change_key_case_variation.phpt b/ext/standard/tests/array/array_change_key_case_variation.phpt index 3f8d502ffe..f2b185523f 100644 --- a/ext/standard/tests/array/array_change_key_case_variation.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation.phpt @@ -6,13 +6,16 @@ Test array_change_key_case() function - 2 $item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four"); /* use 'case' argument other than CASE_LOWER & CASE_UPPER */ -var_dump(array_change_key_case($item, "CASE_UPPER")); +try { + var_dump(array_change_key_case($item, "CASE_UPPER")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(array_change_key_case($item, 5)); /* when keys are different in terms of only case */ /* should return one value key pair with key being in lowercase */ var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) ); -var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) ); /* should return one value key pair with key being in uppercase */ var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) ); @@ -21,8 +24,7 @@ var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) echo "end\n"; ?> --EXPECTF-- -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL +array_change_key_case() expects parameter 2 to be int, string given array(4) { ["ONE"]=> int(1) @@ -37,9 +39,6 @@ array(1) { ["one"]=> int(4) } - -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL array(1) { ["ONE"]=> int(3) diff --git a/ext/standard/tests/array/array_column_error.phpt b/ext/standard/tests/array/array_column_error.phpt index 26a09aff24..9223248520 100644 --- a/ext/standard/tests/array/array_column_error.phpt +++ b/ext/standard/tests/array/array_column_error.phpt @@ -11,18 +11,6 @@ Test array_column() function: error conditions echo "*** Testing array_column() : error conditions ***\n"; -echo "\n-- Testing array_column() function with Zero arguments --\n"; -var_dump(array_column()); - -echo "\n-- Testing array_column() function with One argument --\n"; -var_dump(array_column(array())); - -echo "\n-- Testing array_column() function with string as first parameter --\n"; -var_dump(array_column('foo', 0)); - -echo "\n-- Testing array_column() function with int as first parameter --\n"; -var_dump(array_column(1, 'foo')); - echo "\n-- Testing array_column() column key parameter should be a string or an integer (testing bool) --\n"; var_dump(array_column(array(), true)); @@ -40,26 +28,6 @@ echo "Done\n"; --EXPECTF-- *** Testing array_column() : error conditions *** --- Testing array_column() function with Zero arguments -- - -Warning: array_column() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing array_column() function with One argument -- - -Warning: array_column() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing array_column() function with string as first parameter -- - -Warning: array_column() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Testing array_column() function with int as first parameter -- - -Warning: array_column() expects parameter 1 to be array, int given in %s on line %d -NULL - -- Testing array_column() column key parameter should be a string or an integer (testing bool) -- Warning: array_column(): The column key should be either a string or an integer in %s on line %d diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt index d90c80f20b..f6c6905780 100644 --- a/ext/standard/tests/array/array_diff_uassoc_error.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt @@ -27,36 +27,32 @@ function key_compare_func($a, $b) //Test array_diff_uassoc with one more than the expected number of arguments echo "\n-- Testing array_diff_uassoc() function with more than expected no. of arguments --\n"; -var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) ); -var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) ); +try { + var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_diff_uassoc with one less than the expected number of arguments echo "\n-- Testing array_diff_uassoc() function with less than expected no. of arguments --\n"; var_dump( array_diff_uassoc($array1, $array2) ); -// Testing array_diff_uassoc with no arguments -echo "\n-- Testing array_diff_uassoc() function with no arguments --\n"; -var_dump( array_diff_uassoc() ); ?> ===DONE=== --EXPECTF-- *** Testing array_diff_uassoc() : error conditions *** -- Testing array_diff_uassoc() function with more than expected no. of arguments -- - -Warning: array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members +array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members -- Testing array_diff_uassoc() function with less than expected no. of arguments -- Warning: array_diff_uassoc(): at least 3 parameters are required, 2 given in %s on line %d NULL - --- Testing array_diff_uassoc() function with no arguments -- - -Warning: array_diff_uassoc(): at least 3 parameters are required, 0 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt index 09b4a70237..e80f02629e 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation10.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt @@ -14,27 +14,23 @@ $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "green", "yellow", "red"); //function name within double quotes -var_dump( array_diff_ukey($array1, $array1, "unknown_function") ); +try { + var_dump( array_diff_ukey($array1, $array1, "unknown_function") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //function name within single quotes -var_dump( array_diff_ukey($array1, $array1, 'unknown_function') ); - -//function name without quotes -var_dump( array_diff_ukey($array1, $array1, unknown_function) ); +try { + var_dump( array_diff_ukey($array1, $array1, 'unknown_function') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_ukey() : usage variation *** - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL +array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name +array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name ===DONE=== diff --git a/ext/standard/tests/array/array_fill_error.phpt b/ext/standard/tests/array/array_fill_error.phpt index 2fbdb850c3..386404a336 100644 --- a/ext/standard/tests/array/array_fill_error.phpt +++ b/ext/standard/tests/array/array_fill_error.phpt @@ -10,44 +10,16 @@ Test array_fill() function : error conditions echo "*** Testing array_fill() : error conditions ***\n"; -// Zero arguments -echo "-- Testing array_fill() function with Zero arguments --\n"; -var_dump( array_fill() ); - -// More than expected number of arguments -echo "-- Testing array_fill() function with more than expected no. of arguments --\n"; +// calling array_fill with negative values for 'num' parameter $start_key = 0; -$num = 2; -$val = 1; -$extra_arg = 10; -var_dump( array_fill($start_key,$num,$val, $extra_arg) ); - -// Less than the expected number of arguments -echo "-- Testing array_fill() function with less than expected no. of arguments --\n"; -$start_key = 0; -$num = 2; -var_dump( array_fill($start_key,$num) ); - -//calling array_fill with negative values for 'num' parameter $num = -1; +$val = 1; var_dump( array_fill($start_key,$num,$val) ); echo "Done"; ?> --EXPECTF-- *** Testing array_fill() : error conditions *** --- Testing array_fill() function with Zero arguments -- - -Warning: array_fill() expects exactly 3 parameters, 0 given in %s on line %d -NULL --- Testing array_fill() function with more than expected no. of arguments -- - -Warning: array_fill() expects exactly 3 parameters, 4 given in %s on line %d -NULL --- Testing array_fill() function with less than expected no. of arguments -- - -Warning: array_fill() expects exactly 3 parameters, 2 given in %s on line %d -NULL Warning: array_fill(): Number of elements can't be negative in %s on line %d bool(false) diff --git a/ext/standard/tests/array/array_fill_keys.phpt b/ext/standard/tests/array/array_fill_keys.phpt index 12adde72e7..fb222a414b 100644 --- a/ext/standard/tests/array/array_fill_keys.phpt +++ b/ext/standard/tests/array/array_fill_keys.phpt @@ -4,15 +4,12 @@ basic array_fill_keys test precision=14 --FILE-- <?php - var_dump(array_fill_keys('test', 1)); var_dump(array_fill_keys(array(), 1)); var_dump(array_fill_keys(array('foo', 'bar'), NULL)); var_dump(array_fill_keys(array('5', 'foo', 10, 1.23), 123)); var_dump(array_fill_keys(array('test', TRUE, 10, 100), '')); ?> ---EXPECTF-- -Warning: array_fill_keys() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- array(0) { } array(2) { diff --git a/ext/standard/tests/array/array_fill_keys_variation3.phpt b/ext/standard/tests/array/array_fill_keys_variation3.phpt index 84cc928cbc..b1abbcfe1b 100644 --- a/ext/standard/tests/array/array_fill_keys_variation3.phpt +++ b/ext/standard/tests/array/array_fill_keys_variation3.phpt @@ -12,33 +12,18 @@ Test array_fill_keys() function : variation of parameter echo "*** Testing array_fill_keys() : parameter variations ***\n"; -$simpleStr = "simple"; $fp = fopen(__FILE__, "r"); -$bool = false; -$float = 2.4; $array = array("one", "two"); -$nullVal = null; - -echo "\n-- Testing array_fill_keys() function with both wrong arguments --\n"; -var_dump( array_fill_keys($bool, $float) ); echo "\n-- Testing array_fill_keys() function with unusual second arguments --\n"; var_dump( array_fill_keys($array, $fp) ); -echo "\n-- Testing array_fill_keys() function with mixed array --\n"; -var_dump( array_fill_keys($nullVal, $simpleStr) ); - fclose($fp); echo "Done"; ?> --EXPECTF-- *** Testing array_fill_keys() : parameter variations *** --- Testing array_fill_keys() function with both wrong arguments -- - -Warning: array_fill_keys() expects parameter 1 to be array, bool given in %sarray_fill_keys_variation3.php on line %d -NULL - -- Testing array_fill_keys() function with unusual second arguments -- array(2) { ["one"]=> @@ -46,9 +31,4 @@ array(2) { ["two"]=> resource(%d) of type (stream) } - --- Testing array_fill_keys() function with mixed array -- - -Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d -NULL Done diff --git a/ext/standard/tests/array/array_filter.phpt b/ext/standard/tests/array/array_filter.phpt index ba27a59c96..1488aedd09 100644 --- a/ext/standard/tests/array/array_filter.phpt +++ b/ext/standard/tests/array/array_filter.phpt @@ -26,9 +26,6 @@ var_dump(array_filter($array2, "even")); var_dump(array_filter($array3, "even")); var_dump(array_filter(array())); -var_dump(array_filter(array(), array())); -var_dump(array_filter("", null)); -var_dump(array_filter($array1, 1)); echo '== DONE =='; ?> @@ -81,13 +78,4 @@ array(2) { } array(0) { } - -Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL == DONE == diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt index 4749fe8e45..a32fdadc05 100644 --- a/ext/standard/tests/array/array_filter_variation10.phpt +++ b/ext/standard/tests/array/array_filter_variation10.phpt @@ -48,7 +48,11 @@ var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_KEY)); var_dump(array_filter($mixed, 'is_numeric', 0)); -var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH)); +try { + var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -88,14 +92,5 @@ array(2) { ["b"]=> int(2) } - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 -array(0) { -} +is_numeric() expects exactly 1 parameter, 2 given Done diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt index ed89d13d35..1755a322b0 100644 --- a/ext/standard/tests/array/array_filter_variation9.phpt +++ b/ext/standard/tests/array/array_filter_variation9.phpt @@ -22,10 +22,18 @@ var_dump( array_filter($input, 'is_int') ); var_dump( array_filter($input, 'chr') ); // using language construct 'echo' as 'callback' -var_dump( array_filter($input, 'echo') ); +try { + var_dump( array_filter($input, 'echo') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // using language construct 'exit' as 'callback' -var_dump( array_filter($input, 'exit') ); +try { + var_dump( array_filter($input, 'exit') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -63,10 +71,6 @@ array(8) { [7]=> NULL } - -Warning: array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL - -Warning: array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL +array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name +array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt index 122d1e4767..f4b91503bc 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt @@ -14,26 +14,23 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); //function name within double quotes -var_dump( array_intersect_ukey($array1, $array2, "unknown_function") ); +try { + var_dump( array_intersect_ukey($array1, $array2, "unknown_function") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //function name within single quotes -var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') ); +try { + var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -//function name without quotes -var_dump( array_intersect_ukey($array1, $array2, unknown_function) ); ?> ===DONE=== --EXPECTF-- *** Testing array_intersect_ukey() : usage variation *** - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL +array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name +array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name ===DONE=== diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt index 61faf0158d..e917815337 100644 --- a/ext/standard/tests/array/array_key_exists.phpt +++ b/ext/standard/tests/array/array_key_exists.phpt @@ -69,24 +69,8 @@ foreach ($search_arrays_v as $search_array) { } echo "\n*** Testing error conditions ***\n"; -//Zeor args -var_dump( array_key_exists() ); // first args as array var_dump( array_key_exists(array(), array()) ); -// second args as string -var_dump( array_key_exists("", "") ); -// second args a integer -var_dump( array_key_exists(1, 1) ); -// second args as NULL -var_dump( array_key_exists(1, NULL) ); -// second args as boolean -var_dump( array_key_exists(1, true) ); -// first args as boolean -var_dump( array_key_exists(false, true) ); -// second args as float -var_dump( array_key_exists(false, 17.5) ); -// args more than expected -var_dump( array_key_exists(1, array(), array()) ); // first argument as floating point value var_dump( array_key_exists(17.5, array(1,23) ) ) ; @@ -249,33 +233,9 @@ bool(true) *** Testing error conditions *** -Warning: array_key_exists() expects exactly 2 parameters, 0 given in %s on line %d -NULL - Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d bool(false) -Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, int given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d -NULL - -Warning: array_key_exists() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d bool(false) diff --git a/ext/standard/tests/array/array_keys_error.phpt b/ext/standard/tests/array/array_keys_error.phpt index 46a989b839..0febae29c7 100644 --- a/ext/standard/tests/array/array_keys_error.phpt +++ b/ext/standard/tests/array/array_keys_error.phpt @@ -3,32 +3,19 @@ Test array_keys() function (error conditions) --FILE-- <?php -echo "\n*** Testing error conditions ***"; -var_dump(array_keys(100)); -var_dump(array_keys("string")); -var_dump(array_keys(new stdclass)); // object -var_dump(array_keys()); // Zero arguments -var_dump(array_keys(array(), "", TRUE, 100)); // args > expected +echo "\n*** Testing error conditions ***\n"; +try { + var_dump(array_keys(new stdclass)); // object +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(array_keys(array(1,2,3, new stdClass => array()))); // (W)illegal offset echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** -Warning: array_keys() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_keys() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_keys() expects parameter 1 to be array, object given in %s on line %d -NULL - -Warning: array_keys() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_keys() expects at most 3 parameters, 4 given in %s on line %d -NULL +array_keys() expects parameter 1 to be array, object given Warning: Illegal offset type in %s on line %d array(3) { diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt index 56dd033521..d15f28425e 100644 --- a/ext/standard/tests/array/array_map_error.phpt +++ b/ext/standard/tests/array/array_map_error.phpt @@ -9,10 +9,6 @@ Test array_map() function : error conditions echo "*** Testing array_map() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing array_map() function with Zero arguments --\n"; -var_dump( array_map() ); - // Testing array_map with one less than the expected number of arguments echo "\n-- Testing array_map() function with one less than expected no. of arguments --\n"; function callback1() { @@ -45,15 +41,8 @@ echo "Done"; --EXPECTF-- *** Testing array_map() : error conditions *** --- Testing array_map() function with Zero arguments -- - -Warning: array_map() expects at least 2 parameters, 0 given in %s on line %d%d -NULL - -- Testing array_map() function with one less than expected no. of arguments -- - -Warning: array_map() expects at least 2 parameters, 1 given in %s on line %d%d -NULL +Exception: array_map() expects at least 2 parameters, 1 given -- Testing array_map() function with less no. of arrays than callback function arguments -- Exception: Too few arguments to function callback2(), 1 passed and exactly 2 expected diff --git a/ext/standard/tests/array/array_map_object1.phpt b/ext/standard/tests/array/array_map_object1.phpt index b808381048..43cc4484e6 100644 --- a/ext/standard/tests/array/array_map_object1.phpt +++ b/ext/standard/tests/array/array_map_object1.phpt @@ -22,13 +22,17 @@ echo "-- simple class with public variable and method --\n"; class SimpleClass { public $var1 = 1; - public function square($n) { + public static function square($n) { return $n * $n; } } function test($cb, $args) { echo join('::', $cb) . "\n"; - var_dump(array_map($cb, $args)); + try { + var_dump(array_map($cb, $args)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } test(array('SimpleClass', 'square'), array(1, 2)); @@ -36,7 +40,7 @@ echo "\n-- simple class with private variable and method --\n"; class SimpleClassPri { private $var1 = 10; - private function add($n) { + private static function add($n) { return $var + $n; } } @@ -46,7 +50,7 @@ echo "\n-- simple class with protected variable and method --\n"; class SimpleClassPro { protected $var1 = 5; - protected function mul($n) { + protected static function mul($n) { return $var1 * $n; } } @@ -62,14 +66,14 @@ echo "\n-- abstract class --\n"; abstract class AbstractClass { protected $var2 = 5; - abstract function emptyFunction(); + abstract static function emptyFunction(); } // class deriving the above abstract class class ChildClass extends AbstractClass { private $var3; - public function emptyFunction() { + public static function emptyFunction() { echo "defined in child\n"; } } @@ -79,7 +83,7 @@ echo "\n-- class with final method --\n"; class FinalClass { private $var4; - final function finalMethod() { + final static function finalMethod() { echo "This function can't be overloaded\n"; } } @@ -126,8 +130,6 @@ test(array('InterClass', 'square'), array(1, 2)); *** Testing array_map() : object functionality *** -- simple class with public variable and method -- SimpleClass::square - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d array(2) { [0]=> int(1) @@ -137,26 +139,18 @@ array(2) { -- simple class with private variable and method -- SimpleClassPri::add - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() -- simple class with protected variable and method -- SimpleClassPro::mul - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() -- class without members -- EmptyClass - -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members -- abstract class -- ChildClass::emptyFunction - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d defined in child defined in child array(2) { @@ -168,8 +162,6 @@ array(2) { -- class with final method -- FinalClass::finalMethod - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d This function can't be overloaded This function can't be overloaded array(2) { @@ -188,13 +180,9 @@ array(2) { int(4) } StaticClass::cube - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() StaticClass::retVal - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() -- class implementing an interface -- InterClass::square array(2) { diff --git a/ext/standard/tests/array/array_map_object2.phpt b/ext/standard/tests/array/array_map_object2.phpt index 7cfb528bf2..e5218ccbe4 100644 --- a/ext/standard/tests/array/array_map_object2.phpt +++ b/ext/standard/tests/array/array_map_object2.phpt @@ -26,21 +26,25 @@ class SimpleClass } echo "-- with non-existent class --\n"; -var_dump( array_map(array('non-existent', 'square'), array(1, 2)) ); +try { + var_dump( array_map(array('non-existent', 'square'), array(1, 2)) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with existent class and non-existent method --\n"; -var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) ); +try { + var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> --EXPECTF-- *** Testing array_map() : with non-existent class and method *** -- with non-existent class -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found -- with existent class and non-existent method -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' Done diff --git a/ext/standard/tests/array/array_map_object3.phpt b/ext/standard/tests/array/array_map_object3.phpt index 114d1d3134..2f1536df5c 100644 --- a/ext/standard/tests/array/array_map_object3.phpt +++ b/ext/standard/tests/array/array_map_object3.phpt @@ -51,13 +51,21 @@ echo "-- accessing parent method from child class --\n"; var_dump( array_map(array('ChildClass', 'staticParent1'), $arr1) ); echo "-- accessing child method from parent class --\n"; -var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) ); +try { + var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- accessing parent method using child class object --\n"; var_dump( array_map(array($childobj, 'staticParent1'), $arr1) ); echo "-- accessing child method using parent class object --\n"; -var_dump( array_map(array($parentobj, 'staticChild'), $arr1) ); +try { + var_dump( array_map(array($parentobj, 'staticChild'), $arr1) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -73,9 +81,7 @@ array(3) { int(7) } -- accessing child method from parent class -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' -- accessing parent method using child class object -- array(3) { [0]=> @@ -86,7 +92,5 @@ array(3) { int(7) } -- accessing child method using parent class object -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' Done diff --git a/ext/standard/tests/array/array_map_variation12.phpt b/ext/standard/tests/array/array_map_variation12.phpt index b258c2d31b..67abde0108 100644 --- a/ext/standard/tests/array/array_map_variation12.phpt +++ b/ext/standard/tests/array/array_map_variation12.phpt @@ -20,10 +20,18 @@ echo "-- with built-in function 'pow' and two parameters --\n"; var_dump( array_map('pow', $array1, $array2)); echo "-- with built-in function 'pow' and one parameter --\n"; -var_dump( array_map('pow', $array1)); +try { + var_dump( array_map('pow', $array1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with language construct --\n"; -var_dump( array_map('echo', $array1)); +try { + var_dump( array_map('echo', $array1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -39,22 +47,7 @@ array(3) { int(243) } -- with built-in function 'pow' and one parameter -- - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d -array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL -} +pow() expects exactly 2 parameters, 1 given -- with language construct -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation14.phpt b/ext/standard/tests/array/array_map_variation14.phpt index 771d3f949e..2764cb7374 100644 --- a/ext/standard/tests/array/array_map_variation14.phpt +++ b/ext/standard/tests/array/array_map_variation14.phpt @@ -36,10 +36,18 @@ echo "-- with undefined variable --\n"; var_dump( array_map(@$undefined_var, $arr1) ); echo "-- with empty string --\n"; -var_dump( array_map("", $arr1, $arr2) ); +try { + var_dump( array_map("", $arr1, $arr2) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with empty array --\n"; -var_dump( array_map(array(), $arr1, $arr2) ); +try { + var_dump( array_map(array(), $arr1, $arr2) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -115,11 +123,7 @@ array(2) { int(2) } -- with empty string -- - -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- with empty array -- - -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members Done diff --git a/ext/standard/tests/array/array_map_variation15.phpt b/ext/standard/tests/array/array_map_variation15.phpt index b29af47713..f36d55bd5f 100644 --- a/ext/standard/tests/array/array_map_variation15.phpt +++ b/ext/standard/tests/array/array_map_variation15.phpt @@ -18,13 +18,15 @@ $arr1 = array(1, 2); $arr2 = array("one", "two"); $arr3 = array(1.1, 2.2); -var_dump( array_map('non_existent', $arr1, $arr2, $arr3) ); +try { + var_dump( array_map('non_existent', $arr1, $arr2, $arr3) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_map() : non existent 'callback' function *** - -Warning: array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation16.phpt b/ext/standard/tests/array/array_map_variation16.phpt index c4987cb385..0c80337c76 100644 --- a/ext/standard/tests/array/array_map_variation16.phpt +++ b/ext/standard/tests/array/array_map_variation16.phpt @@ -30,8 +30,12 @@ $callback_names = array( ); for($count = 0; $count < count($callback_names); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_map($callback_names[$count], $arr1) ); + echo "-- Iteration ".($count + 1)." --\n"; + try { + var_dump( array_map($callback_names[$count], $arr1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "Done"; @@ -39,35 +43,19 @@ echo "Done"; --EXPECTF-- *** Testing array_map() : non-permmited built-in functions *** -- Iteration 1 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name -- Iteration 2 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name -- Iteration 3 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name -- Iteration 4 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name -- Iteration 5 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name -- Iteration 6 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name -- Iteration 7 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name -- Iteration 8 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation17.phpt b/ext/standard/tests/array/array_map_variation17.phpt index 1cfbdd7beb..4558dc999f 100644 --- a/ext/standard/tests/array/array_map_variation17.phpt +++ b/ext/standard/tests/array/array_map_variation17.phpt @@ -66,93 +66,77 @@ $unexpected_callbacks = array( // loop through each element of $inputs to check the behavior of array_map for($count = 0; $count < count($unexpected_callbacks); $count++) { - echo "\n-- Iteration ".($count + 1)." --"; - var_dump( array_map($unexpected_callbacks[$count], $arr1)); + echo "\n-- Iteration ".($count + 1)." --\n"; + try { + var_dump( array_map($unexpected_callbacks[$count], $arr1)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_map() : unexpected values for 'callback' argument *** -- Iteration 1 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 2 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 3 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 4 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 5 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 6 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 7 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 8 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 9 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 10 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 11 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 12 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 13 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 14 -- -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- Iteration 15 -- -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- Iteration 16 -- -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members -- Iteration 17 -- -Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object -- Iteration 18 -- -Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object -- Iteration 19 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 20 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given Done diff --git a/ext/standard/tests/array/array_merge.phpt b/ext/standard/tests/array/array_merge.phpt index e6a8096282..98cb3a318f 100644 --- a/ext/standard/tests/array/array_merge.phpt +++ b/ext/standard/tests/array/array_merge.phpt @@ -78,12 +78,13 @@ var_dump(array_merge($begin_array[6])); echo "\n*** Testing array_merge() with typecasting non-array to array ***\n"; var_dump(array_merge($begin_array[4], (array)"type1", (array)10, (array)12.34)); -echo "\n*** Testing error conditions ***"; +echo "\n*** Testing error conditions ***\n"; /* Invalid arguments */ -var_dump(array_merge()); -var_dump(array_merge(100, 200)); -var_dump(array_merge($begin_array[0], $begin_array[1], 100)); -var_dump(array_merge($begin_array[0], $begin_array[1], $arr4)); +try { + var_dump(array_merge()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -746,17 +747,5 @@ array(7) { } *** Testing error conditions *** -Warning: array_merge() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_merge(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Notice: Undefined variable: arr4 in %s on line %d - -Warning: array_merge(): Expected parameter 3 to be an array, null given in %s on line %d -NULL +array_merge() expects at least 1 parameter, 0 given Done diff --git a/ext/standard/tests/array/array_merge_recursive_error.phpt b/ext/standard/tests/array/array_merge_recursive_error.phpt index ffa9cc998e..f741220837 100644 --- a/ext/standard/tests/array/array_merge_recursive_error.phpt +++ b/ext/standard/tests/array/array_merge_recursive_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing array_merge_recursive() : error conditions ***\n"; // Zero arguments echo "\n-- Testing array_merge_recursive() function with Zero arguments --\n"; -var_dump( array_merge_recursive() ); +try { + var_dump( array_merge_recursive() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -19,7 +23,5 @@ echo "Done"; *** Testing array_merge_recursive() : error conditions *** -- Testing array_merge_recursive() function with Zero arguments -- - -Warning: array_merge_recursive() expects at least 1 parameter, 0 given in %s on line %d -NULL +array_merge_recursive() expects at least 1 parameter, 0 given Done diff --git a/ext/standard/tests/array/array_multisort_error.phpt b/ext/standard/tests/array/array_multisort_error.phpt index 3e78b78ac0..105662be07 100644 --- a/ext/standard/tests/array/array_multisort_error.phpt +++ b/ext/standard/tests/array/array_multisort_error.phpt @@ -10,10 +10,6 @@ Test array_multisort() function : error conditions echo "*** Testing array_multisort() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing array_multisort() function with Zero arguments --\n"; -var_dump( array_multisort() ); - echo "\n-- Testing array_multisort() function with repeated flags --\n"; $ar1 = array(1); var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) ); @@ -27,11 +23,6 @@ var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) ); --EXPECTF-- *** Testing array_multisort() : error conditions *** --- Testing array_multisort() function with Zero arguments -- - -Warning: array_multisort() expects at least 1 parameter, 0 given in %sarray_multisort_error.php on line %d -NULL - -- Testing array_multisort() function with repeated flags -- Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d diff --git a/ext/standard/tests/array/array_multisort_variation1.phpt b/ext/standard/tests/array/array_multisort_variation1.phpt index 9a33a270f1..677a87103f 100644 --- a/ext/standard/tests/array/array_multisort_variation1.phpt +++ b/ext/standard/tests/array/array_multisort_variation1.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/array/array_multisort_variation2.phpt b/ext/standard/tests/array/array_multisort_variation2.phpt index 8c26a8347b..f9a00e9701 100644 --- a/ext/standard/tests/array/array_multisort_variation2.phpt +++ b/ext/standard/tests/array/array_multisort_variation2.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/array/array_multisort_variation3.phpt b/ext/standard/tests/array/array_multisort_variation3.phpt index 28130e31fd..c625d2a566 100644 --- a/ext/standard/tests/array/array_multisort_variation3.phpt +++ b/ext/standard/tests/array/array_multisort_variation3.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt index 6d89dd0c6c..e6ff858b16 100644 --- a/ext/standard/tests/array/array_multisort_variation8.phpt +++ b/ext/standard/tests/array/array_multisort_variation8.phpt @@ -11,7 +11,7 @@ Test array_multisort() function : usage variation - test sort order of all types echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { // We're testing sort order not errors so ignore. } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt index c267516730..fd5fa520b6 100644 --- a/ext/standard/tests/array/array_pad.phpt +++ b/ext/standard/tests/array/array_pad.phpt @@ -3,9 +3,6 @@ array_pad() tests --FILE-- <?php -var_dump(array_pad()); -var_dump(array_pad(array())); -var_dump(array_pad(array(), 1)); var_dump(array_pad(array(), 1, 0)); var_dump(array_pad(array(), 0, 0)); @@ -16,19 +13,10 @@ var_dump(array_pad(array("", -1, 2.0), 2, array())); var_dump(array_pad(array("", -1, 2.0), -3, array())); var_dump(array_pad(array("", -1, 2.0), -4, array())); var_dump(array_pad(array("", -1, 2.0), 2000000, 0)); -var_dump(array_pad("", 2000000, 0)); echo "Done\n"; ?> --EXPECTF-- -Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d -NULL array(1) { [0]=> int(0) @@ -95,7 +83,4 @@ array(4) { Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d bool(false) - -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/array_push.phpt b/ext/standard/tests/array/array_push.phpt index 52e754f94d..227a520ac1 100644 --- a/ext/standard/tests/array/array_push.phpt +++ b/ext/standard/tests/array/array_push.phpt @@ -31,16 +31,7 @@ $mixed_array = array( ); /* Error Conditions */ -echo "\n*** Testing Error Conditions ***\n"; - -/* Zero argument */ -var_dump( array_push() ); - -/* Scalar argument */ -var_dump( array_push($number, 22) ); - -/* String argument */ -var_dump( array_push($str, 22) ); +echo "\n*** Testing Edge Conditions ***\n"; /* Invalid Number of arguments */ var_dump( array_push($mixed_array[1],1,2) ); @@ -70,16 +61,7 @@ var_dump( $mixed_array[2] ); echo"\nDone"; ?> --EXPECTF-- -*** Testing Error Conditions *** - -Warning: array_push() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_push() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_push() expects parameter 1 to be array, string given in %s on line %d -NULL +*** Testing Edge Conditions *** int(11) int(1) diff --git a/ext/standard/tests/array/array_rand.phpt b/ext/standard/tests/array/array_rand.phpt index db432dc9b4..72999eda5f 100644 --- a/ext/standard/tests/array/array_rand.phpt +++ b/ext/standard/tests/array/array_rand.phpt @@ -3,10 +3,8 @@ array_rand() tests --FILE-- <?php -var_dump(array_rand()); var_dump(array_rand(array())); var_dump(array_rand(array(), 0)); -var_dump(array_rand(0, 0)); var_dump(array_rand(array(1,2,3), 0)); var_dump(array_rand(array(1,2,3), -1)); var_dump(array_rand(array(1,2,3), 10)); @@ -16,18 +14,12 @@ var_dump(array_rand(array(1,2,3), 2)); echo "Done\n"; ?> --EXPECTF-- -Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: array_rand(): Array is empty in %s on line %d NULL Warning: array_rand(): Array is empty in %s on line %d NULL -Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d -NULL - Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d NULL diff --git a/ext/standard/tests/array/array_search1.phpt b/ext/standard/tests/array/array_search1.phpt index 49563f9712..10c1672e54 100644 --- a/ext/standard/tests/array/array_search1.phpt +++ b/ext/standard/tests/array/array_search1.phpt @@ -5,8 +5,6 @@ array_search() tests $a = array(1=>0, 2=>1, 4=>3, "a"=>"b", "c"=>"d"); -var_dump(array_search(1)); -var_dump(array_search(1,1)); var_dump(array_search("a",$a)); var_dump(array_search("0",$a, true)); var_dump(array_search("0",$a)); @@ -18,12 +16,7 @@ var_dump(array_search(-1,$a, true)); echo "Done\n"; ?> ---EXPECTF-- -Warning: array_search() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: array_search() expects parameter 2 to be array, int given in %s on line %d -NULL +--EXPECT-- int(1) bool(false) int(1) diff --git a/ext/standard/tests/array/array_search_variation3.phpt b/ext/standard/tests/array/array_search_variation3.phpt index 41b0b5bb20..596c36f805 100644 --- a/ext/standard/tests/array/array_search_variation3.phpt +++ b/ext/standard/tests/array/array_search_variation3.phpt @@ -33,9 +33,17 @@ class array_search_check { $array_search_obj = new array_search_check(); //creating new object //error: as wrong datatype for second argument -var_dump( array_search("array_var", $array_search_obj) ); +try { + var_dump( array_search("array_var", $array_search_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //error: as wrong datatype for second argument -var_dump( array_search("foo", $array_search_obj) ); +try { + var_dump( array_search("foo", $array_search_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //element found as "one" exists in array $array_var var_dump( array_search("one", $array_search_obj->array_var) ); @@ -48,11 +56,7 @@ string(5) "three" int(5) *** Testing objects with array_search() *** - -Warning: array_search() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: array_search() expects parameter 2 to be array, object given in %s on line %d -NULL +array_search() expects parameter 2 to be array, object given +array_search() expects parameter 2 to be array, object given int(1) Done diff --git a/ext/standard/tests/array/array_slice.phpt b/ext/standard/tests/array/array_slice.phpt index 59d804350b..d19f5195d6 100644 --- a/ext/standard/tests/array/array_slice.phpt +++ b/ext/standard/tests/array/array_slice.phpt @@ -20,26 +20,6 @@ $var_array = array( $num = 4; $str = "john"; -/* Zero args */ -echo"\n*** Output for Zero Argument ***\n"; -array_slice(); - -/* Single args */ -echo"\n*** Output for Single array Argument ***\n"; -array_slice($var_array); - -/* More than valid no. of args (ie. >4 ) */ -echo"\n*** Output for invalid number of Arguments ***\n"; -array_slice($var_array, 2, 4, true, 3); - -/* Scalar arg */ -echo"\n*** Output for scalar Argument ***\n"; -array_slice($num, 2); - -/* String arg */ -echo"\n*** Output for string Argument ***\n"; -array_slice($str, 2); - $counter = 1; foreach ($var_array as $sub_array) { @@ -89,26 +69,6 @@ foreach ($var_array as $sub_array) ?> --EXPECTF-- -*** Output for Zero Argument *** - -Warning: array_slice() expects at least 2 parameters, 0 given in %s on line %d - -*** Output for Single array Argument *** - -Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d - -*** Output for invalid number of Arguments *** - -Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d - -*** Output for scalar Argument *** - -Warning: array_slice() expects parameter 1 to be array, int given in %s on line %d - -*** Output for string Argument *** - -Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d - *** Iteration 1 *** *** Variation with first two Arguments *** diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt index 7b6d712a1f..46f33b9503 100644 --- a/ext/standard/tests/array/array_slice_variation1.phpt +++ b/ext/standard/tests/array/array_slice_variation1.phpt @@ -15,12 +15,20 @@ var_dump(array_slice(range(1, 3), -1, NULL, 1)); $a = 'foo'; -var_dump(array_slice(range(1, 3), 0, $a)); -var_dump(array_slice(range(1, 3), 0, $a)); +try { + var_dump(array_slice(range(1, 3), 0, $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(array_slice(range(1, 3), 0, $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($a); ?> ---EXPECT-- +--EXPECTF-- array(3) { [0]=> int(1) @@ -53,8 +61,6 @@ array(1) { [2]=> int(3) } -array(0) { -} -array(0) { -} +array_slice() expects parameter 3 to be int, string given +array_slice() expects parameter 3 to be int, string given string(3) "foo" diff --git a/ext/standard/tests/array/array_slice_variation2.phpt b/ext/standard/tests/array/array_slice_variation2.phpt deleted file mode 100644 index a76d68e6e0..0000000000 --- a/ext/standard/tests/array/array_slice_variation2.phpt +++ /dev/null @@ -1,303 +0,0 @@ ---TEST-- -Test array_slice() function : usage variations - Pass different data types as $offset arg ---SKIPIF-- -<?php if (PHP_INT_SIZE > 4) die("skip this test is for 32bit platform only"); ?> ---FILE-- -<?php -/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]]) - * Description: Returns elements specified by offset and length - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $offset argument to array_slice() to test behaviour - */ - -echo "*** Testing array_slice() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$input_array = array('one' => 1, 2, 'three' => 3, 4); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $offset argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of array_slice() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_slice($input_array, $input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_slice() : usage variations *** - --- Iteration 1 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 2 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 3 -- -array(0) { -} - --- Iteration 4 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 5 -- -array(0) { -} - --- Iteration 6 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 7 -- - -Warning: array_slice() expects parameter 2 to be int, float given in %s on line %d -NULL - --- Iteration 8 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 9 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 10 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 11 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 12 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 13 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 14 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 15 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 16 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: array_slice() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 23 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} -Done diff --git a/ext/standard/tests/array/array_unshift.phpt b/ext/standard/tests/array/array_unshift.phpt index 9b474277a9..9ebe83391e 100644 --- a/ext/standard/tests/array/array_unshift.phpt +++ b/ext/standard/tests/array/array_unshift.phpt @@ -7,8 +7,6 @@ $a = array(); $s = ""; var_dump(array_unshift($a, $s)); var_dump($a); -var_dump(array_unshift($s, $a)); -var_dump($a); var_dump(array_unshift($a, $a)); var_dump($a); @@ -20,13 +18,6 @@ array(1) { [0]=> string(0) "" } - -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -array(1) { - [0]=> - string(0) "" -} int(2) array(2) { [0]=> diff --git a/ext/standard/tests/array/array_walk.phpt b/ext/standard/tests/array/array_walk.phpt index 7cd8a8cf7a..cf792bfa19 100644 --- a/ext/standard/tests/array/array_walk.phpt +++ b/ext/standard/tests/array/array_walk.phpt @@ -3,12 +3,6 @@ array_walk() tests --FILE-- <?php -var_dump(array_walk()); -$var = 1; -var_dump(array_walk($var,1)); -$var = array(); -var_dump(array_walk($var,"")); - function foo($v1, $v2, $v3) { var_dump($v1); var_dump($v2); @@ -31,14 +25,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL int(1) int(0) string(4) "data" diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt index 0a5d854582..7ac62d7484 100644 --- a/ext/standard/tests/array/array_walk_closure.phpt +++ b/ext/standard/tests/array/array_walk_closure.phpt @@ -3,14 +3,6 @@ array_walk() closure tests --FILE-- <?php -var_dump(array_walk()); - -$ar = false; -var_dump(array_walk($ar, $ar)); - -$ar = NULL; -var_dump(array_walk($ar, $ar)); - $ar = ["one" => 1, "two"=>2, "three" => 3]; var_dump(array_walk($ar, function(){ var_dump(func_get_args());})); @@ -94,14 +86,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL array(2) { [0]=> int(1) diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt index a4026180fb..73445892a6 100644 --- a/ext/standard/tests/array/array_walk_error2.phpt +++ b/ext/standard/tests/array/array_walk_error2.phpt @@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk() function with too many callback parameters -- - -Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d -NULL +Exception: array_walk() expects at most 3 parameters, 4 given Done diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt index fc04304fc5..9f3ac8c1cd 100644 --- a/ext/standard/tests/array/array_walk_objects.phpt +++ b/ext/standard/tests/array/array_walk_objects.phpt @@ -24,7 +24,11 @@ array_walk($t, "walk"); $var = array(); array_walk($var, "walk"); $var = ""; -array_walk($var, "walk"); +try { + array_walk($var, "walk"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro" string(14) "test_protected" string(7) "var_pub" string(11) "test_public" - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +array_walk() expects parameter 1 to be array, string given Done diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt index a83c227a3b..097143e8ec 100644 --- a/ext/standard/tests/array/array_walk_rec_objects.phpt +++ b/ext/standard/tests/array/array_walk_rec_objects.phpt @@ -24,7 +24,11 @@ array_walk_recursive($t, "walk"); $var = array(); array_walk_recursive($var, "walk"); $var = ""; -array_walk_recursive($var, "walk"); +try { + array_walk_recursive($var, "walk"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro" string(14) "test_protected" string(7) "var_pub" string(11) "test_public" - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +array_walk_recursive() expects parameter 1 to be array, string given Done diff --git a/ext/standard/tests/array/array_walk_recursive1.phpt b/ext/standard/tests/array/array_walk_recursive1.phpt index 962f133e4c..f952b4410b 100644 --- a/ext/standard/tests/array/array_walk_recursive1.phpt +++ b/ext/standard/tests/array/array_walk_recursive1.phpt @@ -3,12 +3,6 @@ array_walk_recursive() tests --FILE-- <?php -var_dump(array_walk_recursive()); -$var = 1; -var_dump(array_walk_recursive($var,1)); -$var = array(); -var_dump(array_walk_recursive($var,"")); - function foo($v1, $v2, $v3) { var_dump($v1); var_dump($v2); @@ -31,14 +25,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL int(1) int(0) string(4) "data" diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt index b162a1c9dc..e9bd7ea175 100644 --- a/ext/standard/tests/array/array_walk_recursive_error2.phpt +++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt @@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk_recursive() function with too many callback parameters -- - -Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d -NULL +Exception: array_walk_recursive() expects at most 3 parameters, 4 given Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation7.phpt b/ext/standard/tests/array/array_walk_recursive_variation7.phpt index 06dc1aaa09..a0c159d71d 100644 --- a/ext/standard/tests/array/array_walk_recursive_variation7.phpt +++ b/ext/standard/tests/array/array_walk_recursive_variation7.phpt @@ -29,9 +29,6 @@ var_dump( array_walk_recursive($input, function($value, $key) { var_dump($key); echo "-- Anonymous function with three arguments --\n"; var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10)); -echo "-- Anonymous function with one more argument --\n"; -var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30)); - echo "-- Anonymous function with null argument --\n"; var_dump( array_walk_recursive( $input, function() { echo "1\n"; })); echo "Done" @@ -80,10 +77,6 @@ int(0) int(10) bool(true) --- Anonymous function with one more argument -- - -Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d -NULL -- Anonymous function with null argument -- 1 1 diff --git a/ext/standard/tests/array/array_walk_recursive_variation8.phpt b/ext/standard/tests/array/array_walk_recursive_variation8.phpt index 2db8067fe0..51eba1e0e0 100644 --- a/ext/standard/tests/array/array_walk_recursive_variation8.phpt +++ b/ext/standard/tests/array/array_walk_recursive_variation8.phpt @@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n"; var_dump( array_walk_recursive($input, "min")); echo "-- With 'echo' language construct --\n"; -var_dump( array_walk_recursive($input, "echo")); +try { + var_dump( array_walk_recursive($input, "echo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -36,7 +40,5 @@ bool(true) -- With 'min' built-in function -- bool(true) -- With 'echo' language construct -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt index 671ad44309..0354782eda 100644 --- a/ext/standard/tests/array/array_walk_variation7.phpt +++ b/ext/standard/tests/array/array_walk_variation7.phpt @@ -29,9 +29,6 @@ var_dump( array_walk($input, function($value, $key) { var_dump($key); var_dump($ echo "-- Anonymous function with three arguments --\n"; var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10)); -echo "-- Anonymous function with one more argument --\n"; -var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30)); - echo "-- Anonymous function with null argument --\n"; var_dump( array_walk( $input, function() { echo "1\n"; })); echo "Done" @@ -80,10 +77,6 @@ int(0) int(10) bool(true) --- Anonymous function with one more argument -- - -Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d -NULL -- Anonymous function with null argument -- 1 1 diff --git a/ext/standard/tests/array/array_walk_variation8.phpt b/ext/standard/tests/array/array_walk_variation8.phpt index 829baf1add..baa5f3914b 100644 --- a/ext/standard/tests/array/array_walk_variation8.phpt +++ b/ext/standard/tests/array/array_walk_variation8.phpt @@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n"; var_dump( array_walk($input, "min")); echo "-- With 'echo' language construct --\n"; -var_dump( array_walk($input, "echo")); +try { + var_dump( array_walk($input, "echo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -36,7 +40,5 @@ bool(true) -- With 'min' built-in function -- bool(true) -- With 'echo' language construct -- - -Warning: array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/bug35014.phpt b/ext/standard/tests/array/bug35014.phpt index f858bf107b..b674590fd6 100644 --- a/ext/standard/tests/array/bug35014.phpt +++ b/ext/standard/tests/array/bug35014.phpt @@ -7,7 +7,6 @@ precision=14 --FILE-- <?php $tests = array( - 'foo', array(), array(0), array(3), @@ -22,9 +21,7 @@ foreach ($tests as $v) { var_dump(array_product($v)); } ?> ---EXPECTF-- -Warning: array_product() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- int(1) int(0) int(3) diff --git a/ext/standard/tests/array/bug35014_64bit.phpt b/ext/standard/tests/array/bug35014_64bit.phpt index 5caf48c6ee..3b3d29b5be 100644 --- a/ext/standard/tests/array/bug35014_64bit.phpt +++ b/ext/standard/tests/array/bug35014_64bit.phpt @@ -7,7 +7,6 @@ precision=14 --FILE-- <?php $tests = array( - 'foo', array(), array(0), array(3), @@ -22,9 +21,7 @@ foreach ($tests as $v) { var_dump(array_product($v)); } ?> ---EXPECTF-- -Warning: array_product() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- int(1) int(0) int(3) diff --git a/ext/standard/tests/array/bug40191.phpt b/ext/standard/tests/array/bug40191.phpt index f5e439821d..b94e709364 100644 --- a/ext/standard/tests/array/bug40191.phpt +++ b/ext/standard/tests/array/bug40191.phpt @@ -8,12 +8,14 @@ $arrObj->append('foo'); $arrObj->append('bar'); $arrObj->append('foo'); -$arr = array_unique($arrObj); -var_dump($arr); +try { + $arr = array_unique($arrObj); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- -Warning: array_unique() expects parameter 1 to be array, object given in %s on line %d -NULL +--EXPECT-- +array_unique() expects parameter 1 to be array, object given Done diff --git a/ext/standard/tests/array/bug67693.phpt b/ext/standard/tests/array/bug67693.phpt index 516436c511..c9aa2d86fa 100644 --- a/ext/standard/tests/array/bug67693.phpt +++ b/ext/standard/tests/array/bug67693.phpt @@ -16,9 +16,9 @@ echo"\nDone"; ?> --EXPECT-- array(2) { - [0]=> + [-1]=> int(0) - [1]=> + [0]=> int(0) } diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt index 175cfe7118..1fd2e8e6ca 100644 --- a/ext/standard/tests/array/count_recursive.phpt +++ b/ext/standard/tests/array/count_recursive.phpt @@ -111,16 +111,6 @@ for( $i =0; $i < count( $mode_arr ); $i++) { var_dump(count($arr, $mode_arr[$i])); } - -echo "\n-- Testing error conditions --"; -var_dump( count() ); // No. of args = 0 -var_dump( count(array(), COUNT_NORMAL, 100) ); // No. of args > expected - -/* Testing Invalid type arguments */ -var_dump( count("string", ABCD) ); -var_dump( count(100, "string") ); -var_dump( count(array(), "") ); - echo "\nDone"; /* closing the resource handles */ @@ -230,22 +220,4 @@ For mode '1' count is => int(9) For mode '' count is => int(3) For mode '' count is => int(3) --- Testing error conditions -- -Warning: count() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: count() expects at most 2 parameters, 3 given in %s on line %d -NULL - -Warning: Use of undefined constant ABCD - assumed 'ABCD' (this will throw an Error in a future version of PHP) in %s on line %d - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt Binary files differdeleted file mode 100644 index 4af2097a7d..0000000000 --- a/ext/standard/tests/array/each.phpt +++ /dev/null diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt deleted file mode 100644 index cd38682dc7..0000000000 --- a/ext/standard/tests/array/each_basic.phpt +++ /dev/null @@ -1,76 +0,0 @@ ---TEST-- -Test each() function : basic functionality ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test basic functionality of each() - */ - -echo "*** Testing each() : basic functionality ***\n"; - -$arr = array ('one' => 1, 'zero', 'two' => 'deux', 20 => 'twenty'); -echo "\n-- Passed array: --\n"; -var_dump($arr); - -echo "\n-- Initial position: --\n"; -var_dump(each($arr)); - -echo "\n-- End position: --\n"; -end($arr); -var_dump(each($arr)); - -echo "\n-- Passed the end of array: --\n"; -var_dump(each($arr)); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : basic functionality *** - --- Passed array: -- -array(4) { - ["one"]=> - int(1) - [0]=> - string(4) "zero" - ["two"]=> - string(4) "deux" - [20]=> - string(6) "twenty" -} - --- Initial position: -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} - --- End position: -- -array(4) { - [1]=> - string(6) "twenty" - ["value"]=> - string(6) "twenty" - [0]=> - int(20) - ["key"]=> - int(20) -} - --- Passed the end of array: -- -bool(false) -Done diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt deleted file mode 100644 index e7ee4976ed..0000000000 --- a/ext/standard/tests/array/each_error.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test each() function : error conditions - pass incorrect number of args ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass an incorrect number of arguments to each() to test behaviour - */ - -echo "*** Testing each() : error conditions ***\n"; - -// Zero arguments -echo "\n-- Testing each() function with Zero arguments --\n"; -var_dump( each() ); - -//Test each with one more than the expected number of arguments -echo "\n-- Testing each() function with more than expected no. of arguments --\n"; -$arr = array(1, 2); -$extra_arg = 10; -var_dump( each($arr, $extra_arg) ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : error conditions *** - --- Testing each() function with Zero arguments -- - -Warning: each() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing each() function with more than expected no. of arguments -- - -Warning: each() expects exactly 1 parameter, 2 given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt deleted file mode 100644 index 6b75d5e15c..0000000000 --- a/ext/standard/tests/array/each_variation1.phpt +++ /dev/null @@ -1,223 +0,0 @@ ---TEST-- -Test each() function : usage variations - Pass different data types as $arr arg ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass different data types as $arr arg to each() to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $arr argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( each($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1 -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 2 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 3 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 4 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 5 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 6 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 7 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 8 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 9 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 10 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 11 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 12 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 13 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 14 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 15 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 16 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 17 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 20 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 21 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 24 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 25 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt deleted file mode 100644 index 34eeedc9a8..0000000000 --- a/ext/standard/tests/array/each_variation2.phpt +++ /dev/null @@ -1,249 +0,0 @@ ---TEST-- -Test each() function : usage variations - arrays of different data types ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass arrays of different data types as $arr argument to each() to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// arrays of different data types to be passed as $arr -$inputs = array( - - // int data -/*1*/ 'int' => array( - 0, - 1, - 12345, - -2345, - ), - - // float data -/*2*/ 'float' => array( - 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - ), - - // null data -/*3*/ 'null' => array( - NULL, - null, - ), - - // boolean data -/*4*/ 'bool' => array( - true, - false, - TRUE, - FALSE, - ), - - // empty data -/*5*/ 'empty string' => array( - "", - '', - ), - -/*6*/ 'empty array' => array( - ), - - // string data -/*7*/ 'string' => array( - "string", - 'string', - $heredoc, - ), - - // object data -/*8*/ 'object' => array( - new classA(), - ), - - // undefined data -/*9*/ 'undefined' => array( - @$undefined_var, - ), - - // unset data -/*10*/ 'unset' => array( - @$unset_var, - ), - - // resource variable -/*11*/ 'resource' => array( - $fp - ), -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; - var_dump( each($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1: int data -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - int(0) - ["value"]=> - int(0) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 2: float data -- -array(4) { - [1]=> - float(10.5) - ["value"]=> - float(10.5) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 3: null data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 4: bool data -- -array(4) { - [1]=> - bool(true) - ["value"]=> - bool(true) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 5: empty string data -- -array(4) { - [1]=> - string(0) "" - ["value"]=> - string(0) "" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 6: empty array data -- -bool(false) - --- Iteration 7: string data -- -array(4) { - [1]=> - string(6) "string" - ["value"]=> - string(6) "string" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 8: object data -- -array(4) { - [1]=> - object(classA)#%d (0) { - } - ["value"]=> - object(classA)#%d (0) { - } - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 9: undefined data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 10: unset data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 11: resource data -- -array(4) { - [1]=> - resource(%d) of type (stream) - ["value"]=> - resource(%d) of type (stream) - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt deleted file mode 100644 index 32342d6d78..0000000000 --- a/ext/standard/tests/array/each_variation3.phpt +++ /dev/null @@ -1,254 +0,0 @@ ---TEST-- -Test each() function : usage variations - keys of different data types ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass each() arrays where the keys are different data types to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// unexpected values to be passed as $arr -$inputs = array( - - // int data -/*1*/ 'int' => array( - 0 => 'zero', - 1 => 'one', - 12345 => 'positive', - -2345 => 'negative', - ), - - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - -/*3*/ 'extreme floats' => array( - 12.3456789000e6 => 'large', - 12.3456789000E-10 => 'small', - ), - - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - - // boolean data -/*6*/ 'bool lowercase' => array( - true => 'lowert', - false => 'lowerf', - ), - -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - -/*9*/ 'empty single quotes' => array( - '' => 'emptys', - ), - - // string data -/*10*/ 'string' => array( - "stringd" => 'stringd', - 'strings' => 'strings', - $heredoc => 'stringh', - ), - - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; - var_dump( each($input) ); - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1: int data -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 2: float data -- -array(4) { - [1]=> - string(8) "positive" - ["value"]=> - string(8) "positive" - [0]=> - int(10) - ["key"]=> - int(10) -} - --- Iteration 3: extreme floats data -- -array(4) { - [1]=> - string(5) "large" - ["value"]=> - string(5) "large" - [0]=> - int(12345678) - ["key"]=> - int(12345678) -} - --- Iteration 4: null uppercase data -- -array(4) { - [1]=> - string(6) "null 1" - ["value"]=> - string(6) "null 1" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 5: null lowercase data -- -array(4) { - [1]=> - string(6) "null 2" - ["value"]=> - string(6) "null 2" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 6: bool lowercase data -- -array(4) { - [1]=> - string(6) "lowert" - ["value"]=> - string(6) "lowert" - [0]=> - int(1) - ["key"]=> - int(1) -} - --- Iteration 7: bool uppercase data -- -array(4) { - [1]=> - string(6) "uppert" - ["value"]=> - string(6) "uppert" - [0]=> - int(1) - ["key"]=> - int(1) -} - --- Iteration 8: empty double quotes data -- -array(4) { - [1]=> - string(6) "emptyd" - ["value"]=> - string(6) "emptyd" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 9: empty single quotes data -- -array(4) { - [1]=> - string(6) "emptys" - ["value"]=> - string(6) "emptys" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 10: string data -- -array(4) { - [1]=> - string(7) "stringd" - ["value"]=> - string(7) "stringd" - [0]=> - string(7) "stringd" - ["key"]=> - string(7) "stringd" -} - --- Iteration 11: undefined data -- -array(4) { - [1]=> - string(9) "undefined" - ["value"]=> - string(9) "undefined" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 12: unset data -- -array(4) { - [1]=> - string(5) "unset" - ["value"]=> - string(5) "unset" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} -Done diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt deleted file mode 100644 index 64fbb4a8d0..0000000000 --- a/ext/standard/tests/array/each_variation4.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -Test each() function : usage variations - Referenced variables ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test behaviour of each() when: - * 1. Passed an array made up of referenced variables - * 2. Passed an array as $arr argument by reference - */ - -echo "*** Testing each() : usage variations ***\n"; - -echo "\n-- Array made up of referenced variables: --\n"; -$val1 = 'foo'; -$val2 = 'bar'; - -$arr1 = array('one' => &$val1, &$val2); - -echo "-- Call each until at the end of the array: --\n"; -var_dump( each($arr1) ); -var_dump( each($arr1) ); -var_dump( each($arr1) ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Array made up of referenced variables: -- --- Call each until at the end of the array: -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(3) "foo" - ["value"]=> - string(3) "foo" - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} -array(4) { - [1]=> - string(3) "bar" - ["value"]=> - string(3) "bar" - [0]=> - int(0) - ["key"]=> - int(0) -} -bool(false) -Done diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt deleted file mode 100644 index 441882f962..0000000000 --- a/ext/standard/tests/array/each_variation5.phpt +++ /dev/null @@ -1,97 +0,0 @@ ---TEST-- -Test each() function : usage variations - Multi-dimensional arrays ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test behaviour of each() when passed: - * 1. a two-dimensional array - * 2. a sub-array - */ - -echo "*** Testing each() : usage variations ***\n"; - -$arr = array ('zero', - array(1, 2, 3), - 'one' => 'un', - array('a', 'b', 'c') - ); - -echo "\n-- Pass each() a two-dimensional array --\n"; -for ($i = 1; $i < count($arr); $i++) { - var_dump( each($arr) ); -} - -echo "\n-- Pass each() a sub-array --\n"; -var_dump( each($arr[2])); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Pass each() a two-dimensional array -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} -array(4) { - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - ["value"]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - [0]=> - int(1) - ["key"]=> - int(1) -} -array(4) { - [1]=> - string(2) "un" - ["value"]=> - string(2) "un" - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} - --- Pass each() a sub-array -- -array(4) { - [1]=> - string(1) "a" - ["value"]=> - string(1) "a" - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt deleted file mode 100644 index de52ba5965..0000000000 --- a/ext/standard/tests/array/each_variation6.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Test each() function : usage variations - Internal array pointer ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test the position of the internal array pointer after a call to each() - */ - -echo "*** Testing each() : usage variations ***\n"; - -$arr = array('zero', 'one', 'two', 'abc', 'xyz'); - -echo "\n-- Current position: --\n"; -echo key($arr) . " => " . current($arr) . "\n"; - -echo "\n-- Call to each(): --\n"; -var_dump( each($arr) ); - -echo "\n-- New position: --\n"; -echo key($arr) . " => " . current($arr) . "\n"; - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Current position: -- -0 => zero - --- Call to each(): -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- New position: -- -1 => one -Done diff --git a/ext/standard/tests/array/end.phpt b/ext/standard/tests/array/end.phpt index dc3f2eb75e..496b6c9566 100644 --- a/ext/standard/tests/array/end.phpt +++ b/ext/standard/tests/array/end.phpt @@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle); var_dump( end($resources) ); var_dump( current($resources) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for unexpected number of arguments */ -var_dump( end() ); -var_dump( end($array[0], $array[0]) ); - -/* checking for unexpected type of arguments */ -$var=1; -$var1="string"; -var_dump( end($var) ); -var_dump( end($var1) ); - -/* checking null array */ -$null_array = array(); -var_dump( end($null_array) ); - echo "Done\n"; @@ -219,19 +204,4 @@ array(2) { *** Testing end() on resource type *** resource(%d) of type (stream) resource(%d) of type (stream) - -*** Testing error conditions *** - -Warning: end() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: end() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL -bool(false) Done diff --git a/ext/standard/tests/array/end_64bit.phpt b/ext/standard/tests/array/end_64bit.phpt index 0af5064e82..55f0d2e53b 100644 --- a/ext/standard/tests/array/end_64bit.phpt +++ b/ext/standard/tests/array/end_64bit.phpt @@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle); var_dump( end($resources) ); var_dump( current($resources) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for unexpected number of arguments */ -var_dump( end() ); -var_dump( end($array[0], $array[0]) ); - -/* checking for unexpected type of arguments */ -$var=1; -$var1="string"; -var_dump( end($var) ); -var_dump( end($var1) ); - -/* checking null array */ -$null_array = array(); -var_dump( end($null_array) ); - echo "Done\n"; ?> @@ -218,19 +203,4 @@ array(2) { *** Testing end() on resource type *** resource(%d) of type (stream) resource(%d) of type (stream) - -*** Testing error conditions *** - -Warning: end() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: end() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL -bool(false) Done diff --git a/ext/standard/tests/array/extract_error.phpt b/ext/standard/tests/array/extract_error.phpt index e8bcf8f5d8..08e1824b0f 100644 --- a/ext/standard/tests/array/extract_error.phpt +++ b/ext/standard/tests/array/extract_error.phpt @@ -6,25 +6,11 @@ Test extract() function (error conditions) /* Testing Error Conditions */ echo "*** Testing Error Conditions ***\n"; -/* Zero Arguments */ -var_dump( extract() ); - /* Invalid second argument ( only 0-6 is valid) */ $arr = array(1); var_dump( extract($arr, -1 . "wddr") ); var_dump( extract($arr, 7 , "wddr") ); -/* scalar argument */ -$val = 1; -var_dump( extract($val) ); - -/* string argument */ -$str = "test"; -var_dump( extract($str) ); - -/* More than valid number of arguments i.e. 3 args */ -var_dump( extract($arr, EXTR_SKIP, "aa", "ee") ); - /* Two Arguments, second as prefix but without prefix string as third argument */ var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) ); @@ -33,9 +19,6 @@ echo "Done\n"; --EXPECTF-- *** Testing Error Conditions *** -Warning: extract() expects at least 1 parameter, 0 given in %s on line %d -NULL - Notice: A non well formed numeric value encountered in %s on line %d Warning: extract(): Invalid extract type in %s on line %d @@ -44,15 +27,6 @@ NULL Warning: extract(): Invalid extract type in %s on line %d NULL -Warning: extract() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: extract() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: extract() expects at most 3 parameters, 4 given in %s on line %d -NULL - Warning: extract(): specified extract type requires the prefix parameter in %s on line %d NULL Done diff --git a/ext/standard/tests/array/in_array_variation3.phpt b/ext/standard/tests/array/in_array_variation3.phpt index f07d1dea89..0b58990041 100644 --- a/ext/standard/tests/array/in_array_variation3.phpt +++ b/ext/standard/tests/array/in_array_variation3.phpt @@ -36,9 +36,17 @@ class in_array_check { $in_array_obj = new in_array_check(); //creating new object //error: as wrong datatype for second argument -var_dump( in_array("array_var", $in_array_obj) ); +try { + var_dump( in_array("array_var", $in_array_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //error: as wrong datatype for second argument -var_dump( in_array("foo", $in_array_obj) ); +try { + var_dump( in_array("foo", $in_array_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //element found as "one" exists in array $array_var var_dump( in_array("one", $in_array_obj->array_var) ); @@ -51,11 +59,7 @@ bool(true) bool(true) *** Testing objects with in_array() *** - -Warning: in_array() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: in_array() expects parameter 2 to be array, object given in %s on line %d -NULL +in_array() expects parameter 2 to be array, object given +in_array() expects parameter 2 to be array, object given bool(true) Done diff --git a/ext/standard/tests/array/max.phpt b/ext/standard/tests/array/max.phpt index ae4f304eae..df471ef255 100644 --- a/ext/standard/tests/array/max.phpt +++ b/ext/standard/tests/array/max.phpt @@ -5,7 +5,6 @@ precision=14 --FILE-- <?php -var_dump(max()); var_dump(max(1)); var_dump(max(array())); var_dump(max(new stdclass)); @@ -20,16 +19,13 @@ var_dump(max(0, true, false, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: max() expects at least 1 parameter, 0 given in %s on line 3 +Warning: max(): When only one parameter is given, it must be an array in %s on line %d NULL -Warning: max(): When only one parameter is given, it must be an array in %s on line 4 -NULL - -Warning: max(): Array must contain at least one element in %s on line 5 +Warning: max(): Array must contain at least one element in %s on line %d bool(false) -Warning: max(): When only one parameter is given, it must be an array in %s on line 6 +Warning: max(): When only one parameter is given, it must be an array in %s on line %d NULL int(2) float(2.11) diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt index cb8c7cfdca..031e9b2c96 100644 --- a/ext/standard/tests/array/min.phpt +++ b/ext/standard/tests/array/min.phpt @@ -5,7 +5,6 @@ precision=14 --FILE-- <?php -var_dump(min()); var_dump(min(1)); var_dump(min(array())); var_dump(min(new stdclass)); @@ -20,16 +19,13 @@ var_dump(min(0, true, false, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: min() expects at least 1 parameter, 0 given in %s on line 3 +Warning: min(): When only one parameter is given, it must be an array in %s on line %d NULL -Warning: min(): When only one parameter is given, it must be an array in %s on line 4 -NULL - -Warning: min(): Array must contain at least one element in %s on line 5 +Warning: min(): Array must contain at least one element in %s on line %d bool(false) -Warning: min(): When only one parameter is given, it must be an array in %s on line 6 +Warning: min(): When only one parameter is given, it must be an array in %s on line %d NULL int(1) float(2.09) diff --git a/ext/standard/tests/array/negative_index.phpt b/ext/standard/tests/array/negative_index.phpt new file mode 100644 index 0000000000..a9f442acbd --- /dev/null +++ b/ext/standard/tests/array/negative_index.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test arrays starting with negative indices +--FILE-- +<?php + +$a = array_fill(-2, 3, true); +$b = [-2 => true, true, true]; +$c = ["string" => true, -2 => true, true, true]; +unset($c["string"]); +$d[-2] = true; +$d[] = true; +$d[] = true; +$e = [-2 => false]; +array_pop($e); +$e[] = true; +$e[] = true; +$e[] = true; + +var_dump($a === $b && $b === $c && $c === $d && $d == $e); +var_dump($a); +?> +--EXPECT-- +bool(true) +array(3) { + [-2]=> + bool(true) + [-1]=> + bool(true) + [0]=> + bool(true) +} diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt index b63e9874bf..3a3b2bdf60 100644 --- a/ext/standard/tests/array/range_errors.phpt +++ b/ext/standard/tests/array/range_errors.phpt @@ -21,10 +21,7 @@ var_dump( range(1.0, 7.0, 6.5) ); echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --"; var_dump( range(7.0, 1.0, 6.5) ); -echo "\n-- Testing Invalid number of arguments --"; -var_dump( range() ); // No.of args = 0 -var_dump( range(1) ); // No.of args < expected -var_dump( range(1,2,3,4) ); // No.of args > expected +echo "\n-- Testing other conditions --"; var_dump( range(-1, -2, 2) ); var_dump( range("a", "j", "z") ); var_dump( range(0, 1, "140962482048819216326.24") ); @@ -67,16 +64,7 @@ bool(false) Warning: range(): step exceeds the specified range in %s on line %d bool(false) --- Testing Invalid number of arguments -- -Warning: range() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: range() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: range() expects at most 3 parameters, 4 given in %s on line %d -bool(false) - +-- Testing other conditions -- Warning: range(): step exceeds the specified range in %s on line %d bool(false) diff --git a/ext/standard/tests/array/uasort_variation8.phpt b/ext/standard/tests/array/uasort_variation8.phpt index 2bb2b46512..d27cd569c0 100644 --- a/ext/standard/tests/array/uasort_variation8.phpt +++ b/ext/standard/tests/array/uasort_variation8.phpt @@ -10,7 +10,6 @@ Test uasort() function : usage variations - built-in function as 'cmp_function' /* * Passing different built-in library functions in place of 'cmp_function' * valid comparison functions: strcmp() & strcasecmp() -* language constructs: echo & exit */ echo "*** Testing uasort() : built in function as 'cmp_function' ***\n"; @@ -28,13 +27,6 @@ echo "-- Testing uasort() with built-in 'cmp_function': strcmp() --\n"; var_dump( uasort($array_arg, 'strcmp') ); // expecting: bool(true) var_dump($array_arg); -// Testing with language construct as comparison function -echo "-- Testing uasort() with language construct as 'cmp_function' --\n"; -var_dump( uasort($languageConstruct_fun_arg, 'echo') ); // expecting: bool(false) - -echo "-- Testing uasort() with language construct as 'cmp_function' --\n"; -var_dump( uasort($languageConstruct_fun_arg, 'exit') ); // expecting: bool(false) - echo "Done" ?> --EXPECTF-- @@ -67,12 +59,4 @@ array(5) { ["o"]=> string(6) "orange" } --- Testing uasort() with language construct as 'cmp_function' -- - -Warning: uasort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL --- Testing uasort() with language construct as 'cmp_function' -- - -Warning: uasort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/usort_variation8.phpt b/ext/standard/tests/array/usort_variation8.phpt index 3296c4a36a..98c303e083 100644 --- a/ext/standard/tests/array/usort_variation8.phpt +++ b/ext/standard/tests/array/usort_variation8.phpt @@ -30,14 +30,6 @@ $temp_array2 = $array_arg; var_dump( usort($temp_array2, 'strcmp') ); var_dump($temp_array2); -// Testing with language construct as comparison function -echo "\n-- Testing usort() with language construct as 'cmp_function' --\n"; -$temp_array3 = $array_arg; -var_dump( usort($temp_array3, 'echo') ); - -echo "\n-- Testing usort() with language construct as 'cmp_function' --\n"; -$temp_array4 = $array_arg; -var_dump( usort($temp_array4, 'exit') ); ?> ===DONE=== --EXPECTF-- @@ -72,14 +64,4 @@ array(5) { [4]=> string(6) "orange" } - --- Testing usort() with language construct as 'cmp_function' -- - -Warning: usort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL - --- Testing usort() with language construct as 'cmp_function' -- - -Warning: usort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/assert/assert.phpt b/ext/standard/tests/assert/assert.phpt index 08e1188d60..71b0649141 100644 --- a/ext/standard/tests/assert/assert.phpt +++ b/ext/standard/tests/assert/assert.phpt @@ -1,44 +1,41 @@ --TEST-- assert() --INI-- -error_reporting = 2039 assert.active = 0 assert.warning = 1 assert.callback = assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php -function a($file,$line,$myev) +function a($file, $line, $unused, $desc) { - echo "assertion failed $line,\"$myev\"\n"; + echo "assertion failed $line,\"$desc\"\n"; } class a { - function assert($file,$line,$myev) + static function assert($file, $line, $unused, $desc) { - echo "class assertion failed $line,\"$myev\"\n"; + echo "class assertion failed $line,\"$desc\"\n"; } } assert_options(ASSERT_ACTIVE,1); -assert_options(ASSERT_QUIET_EVAL,1); assert_options(ASSERT_WARNING,0); $a = 0; assert_options(ASSERT_CALLBACK,"a"); -assert('$a != 0'); +assert($a != 0); assert_options(ASSERT_CALLBACK,array("a","assert")); -assert('$a != 0'); +assert($a != 0); $obj = new a(); assert_options(ASSERT_CALLBACK,array(&$obj,"assert")); -assert('$a != 0'); +assert($a != 0); ?> --EXPECT-- -assertion failed 22,"$a != 0" -class assertion failed 25,"$a != 0" -class assertion failed 29,"$a != 0" +assertion failed 21,"assert($a != 0)" +class assertion failed 24,"assert($a != 0)" +class assertion failed 28,"assert($a != 0)" diff --git a/ext/standard/tests/assert/assert02.phpt b/ext/standard/tests/assert/assert02.phpt deleted file mode 100644 index 85b72369cb..0000000000 --- a/ext/standard/tests/assert/assert02.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -catch assert() errors ---INI-- -assert.active=1 -assert.warning=1 -assert.callback= -assert.bail=0 -assert.quiet_eval=0 ---FILE-- -<?php - -assert(1); -assert('1'); -assert('$a'); - -try { - assert('aa=sd+as+safsafasfasafsaf'); -} catch (Throwable $e) { - echo $e->getMessage(), "\n"; -} - -assert('0'); - -assert_options(ASSERT_BAIL, 1); - -try { - assert('aa=sd+as+safsafasfasafsaf'); -} catch (Throwable $e) { - echo $e->getMessage(), "\n"; -} - -echo "done\n"; - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Notice: Undefined variable: a in %sassert02.php(%d) : assert code on line 1 - -Warning: assert(): Assertion "$a" failed in %sassert02.php on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Failure evaluating code: -aa=sd+as+safsafasfasafsaf - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: assert(): Assertion "0" failed in %sassert02.php on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '=', expecting ';' in %s(%d) : assert code:1 -Stack trace: -#0 %s(%d): assert('aa=sd+as+safsaf...') -#1 {main} - -Next Error: Failure evaluating code: -aa=sd+as+safsafasfasafsaf in %s:%d -Stack trace: -#0 %s(%d): assert('aa=sd+as+safsaf...') -#1 {main} - thrown in %s on line %d diff --git a/ext/standard/tests/assert/assert03.phpt b/ext/standard/tests/assert/assert03.phpt index 80c42df473..3b231405f6 100644 --- a/ext/standard/tests/assert/assert03.phpt +++ b/ext/standard/tests/assert/assert03.phpt @@ -5,38 +5,33 @@ assert.active = 1 assert.warning = 0 assert.callback = assert.bail = 0 -assert.quiet_eval = 1 --FILE-- <?php -function a($file,$line,$myev) +function a($file, $line, $unused, $desc) { - echo "assertion failed - a - $line,\"$myev\"\n"; + echo "assertion failed - a - $line,\"$desc\"\n"; } -function b($file,$line,$myev) +function b($file, $line, $unused, $desc) { - echo "assertion failed - b - $line,\"$myev\"\n"; + echo "assertion failed - b - $line,\"$desc\"\n"; } assert_options(ASSERT_ACTIVE,1); -assert_options(ASSERT_QUIET_EVAL,1); assert_options(ASSERT_WARNING,0); $a = 0; -assert_options(ASSERT_CALLBACK,"a"); -assert('$a != 0'); +assert_options(ASSERT_CALLBACK, "a"); +assert($a != 0); /* Modify call back using ini_set() */ ini_set("assert.callback", "b"); -assert('$a != 0'); +assert($a != 0); ?> ==DONE== ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -assertion failed - a - %d,"$a != 0" - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -assertion failed - b - %d,"$a != 0" +--EXPECT-- +assertion failed - a - 18,"assert($a != 0)" +assertion failed - b - 22,"assert($a != 0)" ==DONE== diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt index 0100229958..35f7668ce1 100644 --- a/ext/standard/tests/assert/assert04.phpt +++ b/ext/standard/tests/assert/assert04.phpt @@ -5,24 +5,14 @@ assert.active = 1 assert.warning = 1 assert.callback = assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php /* Assert not active */ assert_options(ASSERT_ACTIVE, 0); assert(1); - /* Wrong parameter count in assert */ assert_options(ASSERT_ACTIVE, 1); -assert(2, "failure", 3); - -/* Wrong parameter count in assert_options */ -assert_options(ASSERT_ACTIVE, 0, 2); - -/* Wrong parameter name in assert_options */ -$test="ASSERT_FRED"; -assert_options($test, 1); /* Assert false */ assert(0); @@ -36,12 +26,6 @@ echo "not reached\n"; ?> --EXPECTF-- -Warning: assert() expects at most 2 parameters, 3 given in %s on line %d - -Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d - -Warning: assert_options() expects parameter 1 to be int, string given in %s on line %d - Warning: assert(): assert(0) failed in %s on line %d Warning: assert(): assert(0) failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_basic.phpt b/ext/standard/tests/assert/assert_basic.phpt index 73b3e73206..ce53a17a61 100644 --- a/ext/standard/tests/assert/assert_basic.phpt +++ b/ext/standard/tests/assert/assert_basic.phpt @@ -5,29 +5,16 @@ assert.active = 1 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() { echo "f1 called\n"; } -//String assert -$sa = "0 != 0"; -var_dump($r2=assert($sa)); -$sa = "0 == 0"; -var_dump($r2=assert($sa)); -//Non string assert -var_dump($r2=assert(0)); -var_dump($r2=assert(1)); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -f1 called -bool(false) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -bool(true) +var_dump($r2 = assert(0)); +var_dump($r2 = assert(1)); +--EXPECT-- f1 called bool(false) bool(true) diff --git a/ext/standard/tests/assert/assert_basic1.phpt b/ext/standard/tests/assert/assert_basic1.phpt index a5bcda3316..cd4a5601ab 100644 --- a/ext/standard/tests/assert/assert_basic1.phpt +++ b/ext/standard/tests/assert/assert_basic1.phpt @@ -5,7 +5,6 @@ assert.active = 0 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() @@ -13,17 +12,9 @@ function f1() echo "f1 called\n"; } -//String assert -$sa = "0 != 0"; -var_dump($r2=assert($sa)); -$sa = "0 == 0"; -var_dump($r2=assert($sa)); - -//Non string assert var_dump($r2=assert(0)); var_dump($r2=assert(1)); +?> --EXPECT-- bool(true) bool(true) -bool(true) -bool(true) diff --git a/ext/standard/tests/assert/assert_basic2.phpt b/ext/standard/tests/assert/assert_basic2.phpt index d6c150d0d0..052e7d4e89 100644 --- a/ext/standard/tests/assert/assert_basic2.phpt +++ b/ext/standard/tests/assert/assert_basic2.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 1 assert.callback=f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f2() diff --git a/ext/standard/tests/assert/assert_basic3.phpt b/ext/standard/tests/assert/assert_basic3.phpt index a7fd990cbe..87103cbfbb 100644 --- a/ext/standard/tests/assert/assert_basic3.phpt +++ b/ext/standard/tests/assert/assert_basic3.phpt @@ -4,7 +4,6 @@ assert() - basic - Test that bailout works assert.active = 1 assert.warning = 1 assert.callback = f1 -assert.quiet_eval = 1 assert.bail = 0 --FILE-- <?php @@ -15,13 +14,10 @@ function f1() //bail out on error var_dump($rao=assert_options(ASSERT_BAIL, 1)); -$sa = "0 != 0"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo "If this is printed BAIL hasn't worked"; --EXPECTF-- int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f1 called -Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10 +Warning: assert(): assert(0 != 0) failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_basic4.phpt b/ext/standard/tests/assert/assert_basic4.phpt index 4e78cf9ec1..289c51860e 100644 --- a/ext/standard/tests/assert/assert_basic4.phpt +++ b/ext/standard/tests/assert/assert_basic4.phpt @@ -4,7 +4,6 @@ assert() - basic - test initial values using ini.get and assert_options assert.active = 0 assert.warning = 0 assert.bail = 0 -assert.quiet_eval = 0 assert.callback = f1 --FILE-- <?php @@ -14,23 +13,19 @@ assert.callback = f1 echo "Initial values: assert_options(ASSERT_ACTIVE) => [".assert_options(ASSERT_ACTIVE)."]\n"; echo "Initial values: assert_options(ASSERT_WARNING) => [".assert_options(ASSERT_WARNING)."]\n"; echo "Initial values: assert_options(ASSERT_BAIL) => [".assert_options(ASSERT_BAIL)."]\n"; -echo "Initial values: assert_options(ASSERT_QUIET_EVAL) => [".assert_options(ASSERT_QUIET_EVAL)."]\n"; echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; //Using ini.get; echo "Initial values: ini.get(\"assert.active\") => [".ini_get("assert.active")."]\n"; echo "Initial values: ini.get(\"assert.warning\") => [".ini_get("assert.warning")."]\n"; echo "Initial values: ini.get(\"assert.bail\") => [".ini_get("assert.bail")."]\n"; -echo "Initial values: ini.get(\"assert.quiet_eval\") => [".ini_get("assert.quiet_eval")."]\n"; echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; --EXPECT-- Initial values: assert_options(ASSERT_ACTIVE) => [0] Initial values: assert_options(ASSERT_WARNING) => [0] Initial values: assert_options(ASSERT_BAIL) => [0] -Initial values: assert_options(ASSERT_QUIET_EVAL) => [0] Initial values: assert_options(ASSERT_CALLBACK) => [f1] Initial values: ini.get("assert.active") => [0] Initial values: ini.get("assert.warning") => [0] Initial values: ini.get("assert.bail") => [0] -Initial values: ini.get("assert.quiet_eval") => [0] Initial values: ini.get("assert.callback") => [f1] diff --git a/ext/standard/tests/assert/assert_basic5.phpt b/ext/standard/tests/assert/assert_basic5.phpt index f4943cdf16..cf2ed6ded3 100644 --- a/ext/standard/tests/assert/assert_basic5.phpt +++ b/ext/standard/tests/assert/assert_basic5.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() @@ -15,22 +14,16 @@ function f1() //switch warning on and test return value var_dump($rao=assert_options(ASSERT_WARNING, 1)); -$sa = "0 != 0"; -var_dump($r2=assert($sa)); -$sa = "0 == 0"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); +var_dump($r2=assert(0 == 0)); //switch warning on and test return value var_dump($rao=assert_options(ASSERT_WARNING, 0)); --EXPECTF-- int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f1 called -Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10 +Warning: assert(): assert(0 != 0) failed in %s on line %d bool(false) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d bool(true) int(1) diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt deleted file mode 100644 index 216c85c94b..0000000000 --- a/ext/standard/tests/assert/assert_basic6.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -assert() - basic - Test that bailout works ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.quiet_eval = 1 -assert.bail = 0 ---FILE-- -<?php -function f1($message) -{ - echo "f1 called\n"; -} - -//bail out on error -var_dump($rao = assert_options(ASSERT_BAIL, 1)); -$sa = "0 != 0"; -var_dump($r2 = assert($sa, "0 is 0")); -echo "If this is printed BAIL hasn't worked"; ---EXPECTF-- -int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -f1 called - -Warning: assert(): 0 is 0: "0 != 0" failed in %s on line 10 diff --git a/ext/standard/tests/assert/assert_closures.phpt b/ext/standard/tests/assert/assert_closures.phpt index 4a013283a8..13a7e5415e 100644 --- a/ext/standard/tests/assert/assert_closures.phpt +++ b/ext/standard/tests/assert/assert_closures.phpt @@ -4,7 +4,6 @@ assert() - basic - accept closures as callback. assert.active = 1 assert.warning = 1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php assert_options(ASSERT_CALLBACK, function () { echo "Hello World!\n"; }); diff --git a/ext/standard/tests/assert/assert_error.phpt b/ext/standard/tests/assert/assert_error.phpt deleted file mode 100644 index 6e04060765..0000000000 --- a/ext/standard/tests/assert/assert_error.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -assert() - error - give assert nonsense string with quiet_eval on then off ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.bail = 0 -assert.quiet_eval = 0 ---FILE-- -<?php -function f1() -{ - echo "f1 called\n"; -} - -$sa = "threemeninaboat"; - -var_dump($r2=assert($sa)); - -var_dump($ra0 = assert_options(ASSERT_QUIET_EVAL, 1)); - -var_dump($r2=assert($sa)); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: Use of undefined constant threemeninaboat - assumed 'threemeninaboat' (this will throw an Error in a future version of PHP) in %s(9) : assert code on line 1 -bool(true) -int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -bool(true) diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt index d1b6f1745f..de00743b1b 100644 --- a/ext/standard/tests/assert/assert_error2.phpt +++ b/ext/standard/tests/assert/assert_error2.phpt @@ -4,7 +4,6 @@ assert() - basic - Test that bailout works assert.active = 1 assert.warning = 1 assert.callback = f1 -assert.quiet_eval = 1 assert.bail = 0 error_reporting = -1 display_errors = 1 @@ -17,18 +16,10 @@ function f1($script, $line, $message, $user_message) //bail out on error var_dump($rao = assert_options(ASSERT_BAIL, 1)); -var_dump($r2 = assert("0 != 0")); +var_dump($r2 = assert(0 != 0)); echo "If this is printed BAIL hasn't worked"; --EXPECTF-- int(0) +f1 called -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: assert(): Assertion "0 != 0" failed in %s on line 9 - -Fatal error: Uncaught ArgumentCountError: Too few arguments to function f1(), 3 passed and exactly 4 expected in %sassert_error2.php:2 -Stack trace: -#0 [internal function]: f1('%s', 9, '0 != 0') -#1 %sassert_error2.php(9): assert('0 != 0') -#2 {main} - thrown in %sassert_error2.php on line 2 +Warning: assert(): assert(0 != 0) failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt deleted file mode 100644 index 24538f4b04..0000000000 --- a/ext/standard/tests/assert/assert_error3.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -assert() - basic - Test recoverable error ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.quiet_eval = 0 -assert.bail = 0 -error_reporting = -1 -display_errors = 1 ---FILE-- -<?php -var_dump($r2 = assert("0 $ 0")); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1 -Stack trace: -#0 %s(%d): assert('0 $ 0') -#1 {main} - -Next Error: Failure evaluating code: -0 $ 0 in %s:%d -Stack trace: -#0 %s(%d): assert('0 $ 0') -#1 {main} - thrown in %s on line %d diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt deleted file mode 100644 index 59b4df6935..0000000000 --- a/ext/standard/tests/assert/assert_error4.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -assert() - basic - Test recoverable error ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.quiet_eval = 0 -assert.bail = 0 -error_reporting = -1 -display_errors = 1 ---FILE-- -<?php -$sa = "0 $ 0"; -var_dump($r2 = assert($sa, "Describing what was asserted")); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1 -Stack trace: -#0 %s(%d): assert('0 $ 0', 'Describing what...') -#1 {main} - -Next Error: Failure evaluating code: -Describing what was asserted:"0 $ 0" in %s:%d -Stack trace: -#0 %s(%d): assert('0 $ 0', 'Describing what...') -#1 {main} - thrown in %s on line %d diff --git a/ext/standard/tests/assert/assert_variation.phpt b/ext/standard/tests/assert/assert_variation.phpt index 023f6690c5..d0cb90ff66 100644 --- a/ext/standard/tests/assert/assert_variation.phpt +++ b/ext/standard/tests/assert/assert_variation.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() @@ -22,29 +21,28 @@ function f3() } class c1 { - function assert($file, $line, $myev) + static function assert($file, $line, $unused, $desc) { - echo "Class assertion failed $line, \"$myev\"\n"; + echo "Class assertion failed $line, \"$desc\"\n"; } } echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -$sa = "0 != 0"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Change callback function using ini.set and test return value \n"; var_dump($rv = ini_set("assert.callback","f2")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Change callback function using assert_options and test return value \n"; var_dump($rv=assert_options(ASSERT_CALLBACK, "f3")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; @@ -52,14 +50,14 @@ echo "Reset the name of the callback routine to a class method and check that it var_dump($rc=assert_options(ASSERT_CALLBACK, "c1")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Reset callback options to use a class method \n"; var_dump($rc = assert_options(ASSERT_CALLBACK,array("c1","assert"))); var_dump($rao=assert_options(ASSERT_CALLBACK)); echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Reset callback options to use an object method \n"; @@ -67,13 +65,11 @@ $o = new c1(); var_dump($rc=assert_options(ASSERT_CALLBACK,array(&$o,"assert"))); var_dump($rao=assert_options(ASSERT_CALLBACK)); echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; --EXPECTF-- Initial values: assert_options(ASSERT_CALLBACK) => [f1] Initial values: ini.get("assert.callback") => [f1] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f1 called bool(false) @@ -81,8 +77,6 @@ Change callback function using ini.set and test return value string(2) "f1" assert_options(ASSERT_CALLBACK) => [f2] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f2 called bool(false) @@ -90,8 +84,6 @@ Change callback function using assert_options and test return value string(2) "f2" assert_options(ASSERT_CALLBACK) => [f3] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f3 called bool(false) @@ -99,8 +91,6 @@ Reset the name of the callback routine to a class method and check that it works string(2) "f3" assert_options(ASSERT_CALLBACK) => [c1] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d bool(false) Reset callback options to use a class method @@ -113,11 +103,7 @@ array(2) { } ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Deprecated: Non-static method c1::assert() should not be called statically in %s on line 53 -Class assertion failed 53, "0 != 0" +Class assertion failed 52, "assert(0 != 0)" bool(false) Reset callback options to use an object method @@ -136,7 +122,5 @@ array(2) { } ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Class assertion failed 61, "0 != 0" +Class assertion failed 60, "assert(0 != 0)" bool(false) diff --git a/ext/standard/tests/assert/bug73303.phpt b/ext/standard/tests/assert/bug73303.phpt deleted file mode 100644 index 7264f5a322..0000000000 --- a/ext/standard/tests/assert/bug73303.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Bug #73303: Scope not inherited by eval in assert() ---FILE-- -<?php - -class Test { - public $prop; - - public function main(){ - assert('self::checkCacheKey(get_object_vars($this))'); - echo 'Success'; - } - private static function checkCacheKey($obj_properties){ - return count($obj_properties) == 1; - } -} - -$obj = new Test(); -$obj->main(); - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Success diff --git a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt index 16a728e088..f3ab471b1f 100644 --- a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt +++ b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt @@ -9,7 +9,7 @@ Test get_class_methods() function : usage variations - unexpected types */ -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt index 8dde525ae8..d331e9a0d1 100644 --- a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt +++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt index d65bfcbc26..e545616667 100644 --- a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt index 0a4c575258..3e5447308b 100644 --- a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt index 4accebe20a..93497c34b1 100644 --- a/ext/standard/tests/class_object/method_exists_variation_001.phpt +++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/property_exists_error.phpt b/ext/standard/tests/class_object/property_exists_error.phpt index 217a5c61f9..7a2f4712da 100644 --- a/ext/standard/tests/class_object/property_exists_error.phpt +++ b/ext/standard/tests/class_object/property_exists_error.phpt @@ -10,19 +10,8 @@ Test property_exists() function : error conditions echo "*** Testing property_exists() : error conditions ***\n"; -$object_or_class = "obj"; -$property_name = 'string_val'; -$extra_arg = 10; - - -echo "\n-- Testing property_exists() function with more than expected no. of arguments --\n"; -var_dump( property_exists($object_or_class, $property_name, $extra_arg) ); - - -echo "\n-- Testing property_exists() function with less than expected no. of arguments --\n"; -var_dump( property_exists($object_or_class) ); - echo "\n-- Testing property_exists() function with incorrect arguments --\n"; +$property_name = 'string_val'; var_dump( property_exists(10, $property_name) ); ?> @@ -30,16 +19,6 @@ var_dump( property_exists(10, $property_name) ); --EXPECTF-- *** Testing property_exists() : error conditions *** --- Testing property_exists() function with more than expected no. of arguments -- - -Warning: property_exists() expects exactly 2 parameters, 3 given in %sproperty_exists_error.php on line %d -NULL - --- Testing property_exists() function with less than expected no. of arguments -- - -Warning: property_exists() expects exactly 2 parameters, 1 given in %sproperty_exists_error.php on line %d -NULL - -- Testing property_exists() function with incorrect arguments -- Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists_error.php on line %d diff --git a/ext/standard/tests/dir/closedir_error-win32-mb.phpt b/ext/standard/tests/dir/closedir_error-win32-mb.phpt deleted file mode 100644 index e5ca80b7d2..0000000000 --- a/ext/standard/tests/dir/closedir_error-win32-mb.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -Test closedir() function : error conditions - Pass incorrect number of arguments ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die("skip Valid only on Windows"); -} -?> ---FILE-- -<?php -/* Prototype : void closedir([resource $dir_handle]) - * Description: Close directory connection identified by the dir_handle - * Source code: ext/standard/dir.c - * Alias to functions: close - */ - -/* - * Pass incorrect number of arguments to closedir() to test behaviour - */ - -echo "*** Testing closedir() : error conditions ***\n"; - - -//Test closedir with one more than the expected number of arguments -echo "\n-- Testing closedir() function with more than expected no. of arguments --\n"; - -$dir_path = dirname(__FILE__) . '\私はガラスを食べられますclosedir_error'; -mkdir($dir_path); -$dir_handle = opendir($dir_path); - -$extra_arg = 10; -var_dump( closedir($dir_handle, $extra_arg) ); - -//successfully close the directory handle so can delete in CLEAN section -closedir($dir_handle); -?> -===DONE=== ---CLEAN-- -<?php -$base_dir = dirname(__FILE__); -$dir_path = $base_dir . '\私はガラスを食べられますclosedir_error'; -rmdir($dir_path); -?> ---EXPECTF-- -*** Testing closedir() : error conditions *** - --- Testing closedir() function with more than expected no. of arguments -- - -Warning: closedir() expects at most 1 parameter, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt deleted file mode 100644 index ffb0284d95..0000000000 --- a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt +++ /dev/null @@ -1,244 +0,0 @@ ---TEST-- -Test scandir() function : usage variations - diff data types as $context arg ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die("skip Valid only on Windows"); -} -?> ---FILE-- -<?php -/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) - * Description: List files & directories inside the specified path - * Source code: ext/standard/dir.c - */ - -/* - * Pass different data types as $context argument to test how scandir() behaves - */ - -echo "*** Testing scandir() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation3'; -mkdir($dir); -$sorting_order = SCANDIR_SORT_ASCENDING; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $context argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of scandir() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( scandir($dir, $sorting_order, $input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---CLEAN-- -<?php -$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation3'; -rmdir($dir); -?> ---EXPECTF-- -*** Testing scandir() : usage variations *** - --- Iteration 1 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d -array(2) { - [0]=> - string(1) "." - [1]=> - string(2) ".." -} -===DONE=== diff --git a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt index cba61d3fbf..ed68c2a7d7 100644 --- a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt +++ b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt @@ -21,12 +21,6 @@ var_dump($d->read()); var_dump($d->rewind()); var_dump($d->close()); -echo "\n--> Try all methods with wrong number of args:\n"; -$d = new Directory($d); -var_dump($d->read(1,2)); -var_dump($d->rewind(1,2)); -var_dump($d->close(1,2)); - ?> --CLEAN-- <?php @@ -56,14 +50,3 @@ bool(false) Warning: Directory::close(): Unable to find my handle property in %s on line %d bool(false) - ---> Try all methods with wrong number of args: - -Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d -NULL diff --git a/ext/standard/tests/directory/DirectoryClass_error_001.phpt b/ext/standard/tests/directory/DirectoryClass_error_001.phpt index 5b2771eef6..0a693dd9b7 100644 --- a/ext/standard/tests/directory/DirectoryClass_error_001.phpt +++ b/ext/standard/tests/directory/DirectoryClass_error_001.phpt @@ -17,12 +17,6 @@ var_dump($d->read()); var_dump($d->rewind()); var_dump($d->close()); -echo "\n--> Try all methods with wrong number of args:\n"; -$d = new Directory(getcwd()); -var_dump($d->read(1,2)); -var_dump($d->rewind(1,2)); -var_dump($d->close(1,2)); - ?> --EXPECTF-- --> Try all methods with bad handle: @@ -46,14 +40,3 @@ bool(false) Warning: Directory::close(): Unable to find my handle property in %s on line %d bool(false) - ---> Try all methods with wrong number of args: - -Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d -NULL diff --git a/ext/standard/tests/file/005_error.phpt b/ext/standard/tests/file/005_error.phpt index e3ce551b3d..bc2bf3f978 100644 --- a/ext/standard/tests/file/005_error.phpt +++ b/ext/standard/tests/file/005_error.phpt @@ -29,31 +29,6 @@ var_dump( filemtime("/no/such/file/or/dir") ); var_dump( filectime("/no/such/file/or/dir") ); var_dump( touch("/no/such/file/or/dir", 10) ); -/* Only one invalid argument */ -var_dump( fileatime(__FILE__, "string") ); -var_dump( filemtime(__FILE__, 100) ); -var_dump( filectime(__FILE__, TRUE) ); -var_dump( touch(__FILE__, 10, 100, 123) ); - -echo "\n-- Testing No.of arguments less than expected --"; -var_dump( fileatime() ); -var_dump( filemtime() ); -var_dump( filectime() ); -var_dump( touch() ); - -echo "\n-- Testing No.of arguments greater than expected --"; -/* Both invalid arguments */ -var_dump( fileatime("/no/such/file/or/dir", "string") ); -var_dump( filemtime("/no/such/file/or/dir", 100) ); -var_dump( filectime("/no/such/file/or/dir", TRUE) ); -var_dump( touch("/no/such/file/or/dir", 10, 100, 123) ); - -/* Only one invalid argument */ -var_dump( fileatime(__FILE__, "string") ); -var_dump( filemtime(__FILE__, 100) ); -var_dump( filectime(__FILE__, TRUE) ); -var_dump( touch(__FILE__, 10, 100, 123) ); - echo "\nDone"; ?> --EXPECTF-- @@ -72,54 +47,4 @@ bool(false) Warning: touch(): Unable to create file /no/such/file/or/dir because No such file or directory in %s on line %d bool(false) -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - --- Testing No.of arguments less than expected -- -Warning: fileatime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing No.of arguments greater than expected -- -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/file/006_error.phpt b/ext/standard/tests/file/006_error.phpt index c35eba2128..e3bdda1b52 100644 --- a/ext/standard/tests/file/006_error.phpt +++ b/ext/standard/tests/file/006_error.phpt @@ -46,19 +46,6 @@ var_dump( chmod("/no/such/file/dir", 0777) ); var_dump( fileperms("/no/such/file/dir") ); echo "\n"; -/* With args less than expected */ -$fp = fopen(dirname(__FILE__)."/006_error.tmp", "w"); -fclose($fp); -var_dump( chmod(dirname(__FILE__)."/006_error.tmp") ); -var_dump( chmod("nofile") ); -var_dump( chmod() ); -var_dump( fileperms() ); - -/* With args greater than expected */ -var_dump( chmod(dirname(__FILE__)."/006_error.tmp", 0755, TRUE) ); -var_dump( fileperms(dirname(__FILE__)."/006_error.tmp", 0777) ); -var_dump( fileperms("nofile", 0777) ); - echo "\n*** Done ***\n"; ?> --CLEAN-- @@ -83,25 +70,4 @@ Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d bool(false) -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt index 19bbf60fe9..cf81a83ea0 100644 --- a/ext/standard/tests/file/006_variation2.phpt +++ b/ext/standard/tests/file/006_variation2.phpt @@ -68,15 +68,23 @@ $perms_array = array( $count = 1; foreach($perms_array as $permission) { echo "-- Iteration $count --\n"; - var_dump( chmod($file_name, $permission) ); - printf("%o", fileperms($file_name) ); - echo "\n"; - clearstatcache(); - - var_dump( chmod($dir_name, $permission) ); - printf("%o", fileperms($dir_name) ); - echo "\n"; - clearstatcache(); + try { + var_dump( chmod($file_name, $permission) ); + printf("%o", fileperms($file_name) ); + echo "\n"; + clearstatcache(); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + try { + var_dump( chmod($dir_name, $permission) ); + printf("%o", fileperms($dir_name) ); + echo "\n"; + clearstatcache(); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } echo "*** Done ***\n"; @@ -148,39 +156,15 @@ bool(true) bool(true) 43567 -- Iteration 12 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 13 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 14 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 15 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given *** Done *** diff --git a/ext/standard/tests/file/007_error.phpt b/ext/standard/tests/file/007_error.phpt deleted file mode 100644 index 93a6a23e5f..0000000000 --- a/ext/standard/tests/file/007_error.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test fopen, fclose() & feof() functions: error conditions ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* - Prototype: resource fopen(string $filename, string $mode - [, bool $use_include_path [, resource $context]] ); - Description: Opens file or URL. - - Prototype: bool fclose ( resource $handle ); - Description: Closes an open file pointer - - Prototype: bool feof ( resource $handle ) - Description: Returns TRUE if the file pointer is at EOF or an error occurs - (including socket timeout); otherwise returns FALSE. -*/ - -echo "*** Testing error conditions for fopen(), fclsoe() & feof() ***\n"; -/* Arguments less than minimum no.of args */ - -// fopen () -var_dump(fopen(__FILE__)); // one valid argument -var_dump(fopen()); // zero argument - -// fclose() -$fp = fopen(__FILE__, "r"); -fclose($fp); -var_dump( fclose($fp) ); // closed handle -var_dump( fclose(__FILE__) ); // invalid handle -var_dump( fclose() ); // zero argument - -//feof() -var_dump( feof($fp) ); // closed handle -var_dump( feof(__FILE__) ); // invalid handle -var_dump( feof() ); //zero argument - -/* Arguments greater than maximum no.of ags */ -var_dump(fopen(__FILE__, "r", TRUE, "www.example.com", 100)); - -$fp = fopen(__FILE__, "r"); -var_dump( fclose($fp, "handle") ); - -var_dump( feof($fp, "handle")); -fclose($fp); - -/* test invalid arguments : non-resources */ -echo "-- Testing fopen(), fclose() & feof() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, - NULL, - "" -); - -/* loop to test fclose with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fopen($invalid_args[$loop_counter - 1], "r") ); - var_dump( fclose($invalid_args[$loop_counter - 1]) ); - var_dump( feof($invalid_args[$loop_counter - 1]) ); -} - -?> ---EXPECTF-- -*** Testing error conditions for fopen(), fclsoe() & feof() *** - -Warning: fopen() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: fclose(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: fopen() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -Warning: fclose() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: feof() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing fopen(), fclose() & feof() with invalid arguments -- --- Iteration 1 -- - -Warning: fopen(string): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fopen(10): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fopen(10.5): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, float given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fopen(1): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fopen() expects parameter 1 to be a valid path, array given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fopen() expects parameter 1 to be a valid path, object given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, object given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: fopen(): Filename cannot be empty in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, null given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: fopen(): Filename cannot be empty in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) diff --git a/ext/standard/tests/file/basename-win32.phpt b/ext/standard/tests/file/basename-win32.phpt index 996b060cea..703861dec7 100644 --- a/ext/standard/tests/file/basename-win32.phpt +++ b/ext/standard/tests/file/basename-win32.phpt @@ -115,23 +115,6 @@ check_basename( $file_paths ); echo "\n*** Testing possible variations in path and suffix ***\n"; check_basename( $file_path_variations ); -echo "\n*** Testing error conditions ***\n"; -// zero arguments -var_dump( basename() ); - -// more than expected no. of arguments -var_dump( basename("\\blah\\tmp\\bar.zip", ".zip", ".zip") ); - -// passing invalid type arguments -$object = new stdclass; -var_dump( basename( array("string\\bar") ) ); -var_dump( basename( array("string\\bar"), "bar" ) ); -var_dump( basename( "bar", array("string\\bar") ) ); -var_dump( basename( $object, "bar" ) ); -var_dump( basename( $object ) ); -var_dump( basename( $object, $object ) ); -var_dump( basename( "bar", $object ) ); - echo "Done\n"; ?> --EXPECTF-- @@ -309,33 +292,4 @@ string(0) "" --Iteration 32-- string(0) "" - -*** Testing error conditions *** - -Warning: basename() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: basename() expects at most 2 parameters, 3 given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 2 to be string, object given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/basename.phpt b/ext/standard/tests/file/basename.phpt Binary files differindex a9b4389b5a..8352f4da4b 100644 --- a/ext/standard/tests/file/basename.phpt +++ b/ext/standard/tests/file/basename.phpt diff --git a/ext/standard/tests/file/bug39863.phpt b/ext/standard/tests/file/bug39863.phpt index 5460203e05..174e349b15 100644 --- a/ext/standard/tests/file/bug39863.phpt +++ b/ext/standard/tests/file/bug39863.phpt @@ -7,16 +7,11 @@ Andrew van der Stock, vanderaj @ owasp.org $filename = __FILE__ . chr(0). ".ridiculous"; -if (file_exists($filename)) { - echo "FAIL\n"; -} -else { - echo "PASS\n"; +try { + var_dump(file_exists($filename)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } ?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d -PASS -===DONE=== +--EXPECT-- +file_exists() expects parameter 1 to be a valid path, string given diff --git a/ext/standard/tests/file/bug72035.phpt b/ext/standard/tests/file/bug72035.phpt index feb4eb9acd..eb784f737d 100644 --- a/ext/standard/tests/file/bug72035.phpt +++ b/ext/standard/tests/file/bug72035.phpt @@ -3,7 +3,6 @@ Bug #72035 php-cgi.exe fails to run scripts relative to drive root --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test'); -if(php_sapi_name() != "cli") die('skip CLI only test'); $cgi = realpath(dirname(PHP_BINARY)) . DIRECTORY_SEPARATOR . "php-cgi.exe"; if (!file_exists($cgi)) die('skip CGI binary not found'); diff --git a/ext/standard/tests/file/chmod_error.phpt b/ext/standard/tests/file/chmod_error.phpt index 3b234c741f..b7999aa03d 100644 --- a/ext/standard/tests/file/chmod_error.phpt +++ b/ext/standard/tests/file/chmod_error.phpt @@ -10,19 +10,6 @@ Test chmod() function : error conditions echo "*** Testing chmod() : error conditions ***\n"; - -//Test chmod with one more than the expected number of arguments -echo "\n-- Testing chmod() function with more than expected no. of arguments --\n"; -$filename = 'string_val'; -$mode = 10; -$extra_arg = 10; -var_dump( chmod($filename, $mode, $extra_arg) ); - -// Testing chmod with one less than the expected number of arguments -echo "\n-- Testing chmod() function with less than expected no. of arguments --\n"; -$filename = 'string_val'; -var_dump( chmod($filename) ); - // testing chmod with a non-existing file $filename = "___nonExisitingFile___"; var_dump(chmod($filename, 0777)); @@ -32,16 +19,6 @@ var_dump(chmod($filename, 0777)); --EXPECTF-- *** Testing chmod() : error conditions *** --- Testing chmod() function with more than expected no. of arguments -- - -Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d -NULL - --- Testing chmod() function with less than expected no. of arguments -- - -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: chmod(): No such file or directory in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/file/copy_error.phpt b/ext/standard/tests/file/copy_error.phpt index 2d6395167b..36eb58fc2a 100644 --- a/ext/standard/tests/file/copy_error.phpt +++ b/ext/standard/tests/file/copy_error.phpt @@ -11,13 +11,6 @@ echo "*** Testing copy() function: error conditions --\n"; /* Invalid args */ var_dump( copy("/no/file", "file") ); -/* No.of args less than expected */ -var_dump( copy() ); -var_dump( copy(__FILE__) ); - -/* No.of args less than expected */ -var_dump( copy(__FILE__, "file1", "file1") ); - echo "*** Done ***\n"; ?> --EXPECTF-- @@ -25,13 +18,4 @@ echo "*** Done ***\n"; Warning: copy(/no/file): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: copy() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: copy() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: copy() expects parameter 3 to be resource, string given in %s on line %d -NULL *** Done *** diff --git a/ext/standard/tests/file/copy_variation4.phpt b/ext/standard/tests/file/copy_variation4.phpt Binary files differindex 3c3abea05a..8a2f8972fc 100644 --- a/ext/standard/tests/file/copy_variation4.phpt +++ b/ext/standard/tests/file/copy_variation4.phpt diff --git a/ext/standard/tests/file/disk.phpt b/ext/standard/tests/file/disk.phpt index a048af6ccb..fe415535ba 100644 --- a/ext/standard/tests/file/disk.phpt +++ b/ext/standard/tests/file/disk.phpt @@ -11,9 +11,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { --FILE-- <?php -var_dump(disk_free_space()); -var_dump(disk_total_space()); - var_dump(disk_free_space(-1)); var_dump(disk_total_space(-1)); @@ -26,12 +23,6 @@ var_dump(disk_total_space("/some/path/here")); echo "Done\n"; ?> --EXPECTF-- -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_error-win32.phpt b/ext/standard/tests/file/disk_free_space_error-win32.phpt index acb0fdd717..35140d23fb 100644 --- a/ext/standard/tests/file/disk_free_space_error-win32.phpt +++ b/ext/standard/tests/file/disk_free_space_error-win32.phpt @@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_free_space() ); // Zero Arguments -var_dump( diskfreespace() ); - -var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments -var_dump( diskfreespace( $file_path, "extra argument") ); - var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory var_dump( diskfreespace( $file_path."/dir1" )); @@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_free_space(): The system cannot find the path specified. in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_error.phpt b/ext/standard/tests/file/disk_free_space_error.phpt index 6433cde702..00ec271f8d 100644 --- a/ext/standard/tests/file/disk_free_space_error.phpt +++ b/ext/standard/tests/file/disk_free_space_error.phpt @@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN') echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_free_space() ); // Zero Arguments -var_dump( diskfreespace() ); - -var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments -var_dump( diskfreespace( $file_path, "extra argument") ); - var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory var_dump( diskfreespace( $file_path."/dir1" )); @@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt index 6c6575d896..912648f100 100644 --- a/ext/standard/tests/file/disk_free_space_variation.phpt +++ b/ext/standard/tests/file/disk_free_space_variation.phpt @@ -48,8 +48,16 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; - var_dump( disk_free_space( $dir1 ) ); - var_dump( diskfreespace( $dir1 ) ); + try { + var_dump( disk_free_space( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( diskfreespace( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -102,35 +110,19 @@ float(%d) float(%d) -- Iteration 9 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 11 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 12 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given --- Done --- diff --git a/ext/standard/tests/file/disk_total_space_error-win32.phpt b/ext/standard/tests/file/disk_total_space_error-win32.phpt index 0d511b37a7..29462bb31c 100644 --- a/ext/standard/tests/file/disk_total_space_error-win32.phpt +++ b/ext/standard/tests/file/disk_total_space_error-win32.phpt @@ -16,10 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_total_space() ); // Zero Arguments - -var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments - var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory @@ -38,12 +34,6 @@ unlink($file_path."/disk_total_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_total_space(): The system cannot find the path specified. in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_total_space_error.phpt b/ext/standard/tests/file/disk_total_space_error.phpt index 2c8a940117..b504727089 100644 --- a/ext/standard/tests/file/disk_total_space_error.phpt +++ b/ext/standard/tests/file/disk_total_space_error.phpt @@ -16,10 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN') echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_total_space() ); // Zero Arguments - -var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments - var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory @@ -38,12 +34,6 @@ unlink($file_path."/disk_total_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_total_space(): No such file or directory in %s on line %d bool(false) float(%d) diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt index 071fa60749..89c47dcaba 100644 --- a/ext/standard/tests/file/disk_total_space_variation.phpt +++ b/ext/standard/tests/file/disk_total_space_variation.phpt @@ -49,7 +49,11 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; - var_dump( disk_total_space( $dir1 ) ); + try { + var_dump( disk_total_space( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -96,25 +100,17 @@ float(%d) float(%d) -- Iteration 9 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 11 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 12 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given *** Testing with Binary Input *** -float(%d) +float(%s) --- Done --- diff --git a/ext/standard/tests/file/fgetc_variation2.phpt b/ext/standard/tests/file/fgetc_variation2.phpt index d444209af4..dd0dbb2096 100644 --- a/ext/standard/tests/file/fgetc_variation2.phpt +++ b/ext/standard/tests/file/fgetc_variation2.phpt @@ -26,15 +26,6 @@ fclose($file_handle); // read from closed file var_dump( fgetc($file_handle) ); -echo "-- Testing fgetc() with unset handle --\n"; -// open the file for reading -$file_handle = fopen(__FILE__, "r"); -// unset the file handle -unset($file_handle); - -//fgetc using unset handle -var_dump( fgetc($file_handle) ); - echo "Done"; ?> --EXPECTF-- @@ -43,10 +34,4 @@ echo "Done"; Warning: fgetc(): supplied resource is not a valid stream resource in %s on line %d bool(false) --- Testing fgetc() with unset handle -- - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgetc() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fgets_error.phpt b/ext/standard/tests/file/fgets_error.phpt index 919343aa87..eed35b3001 100644 --- a/ext/standard/tests/file/fgets_error.phpt +++ b/ext/standard/tests/file/fgets_error.phpt @@ -8,14 +8,8 @@ Test fgets() function : error conditions */ echo "*** Testing error conditions ***\n"; -// zero argument -echo "-- Testing fgets() with zero argument --\n"; -var_dump( fgets() ); -// more than expected no. of args -echo "-- Testing fgets() with more than expected number of arguments --\n"; $fp = fopen(__FILE__, "r"); -var_dump( fgets($fp, 10, $fp) ); // invalid length argument echo "-- Testing fgets() with invalid length arguments --\n"; @@ -26,45 +20,10 @@ var_dump( fgets($fp, $len) ); $len = 1; var_dump( fgets($fp, $len) ); // return length - 1 always, expect false - -// test invalid arguments : non-resources -echo "-- Testing fgets() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fgets() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fgets($invalid_args[$loop_counter - 1], 10) ); -} - -// fgets() on a file handle which is already closed -echo "-- Testing fgets() with closed/unset file handle --"; -fclose($fp); -var_dump(fgets($fp,10)); - -// fgets() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fgets(@$file_handle,10)); - echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** --- Testing fgets() with zero argument -- - -Warning: fgets() expects at least 1 parameter, 0 given in %s on line %d -bool(false) --- Testing fgets() with more than expected number of arguments -- - -Warning: fgets() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -- Testing fgets() with invalid length arguments -- Warning: fgets(): Length parameter must be greater than 0 in %s on line %d @@ -73,35 +32,4 @@ bool(false) Warning: fgets(): Length parameter must be greater than 0 in %s on line %d bool(false) bool(false) --- Testing fgets() with invalid arguments -- --- Iteration 1 -- - -Warning: fgets() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fgets() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fgets() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fgets() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fgets() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fgets() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fgets() with closed/unset file handle -- -Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt index 0bbcf22039..aa8beb2d4d 100644 --- a/ext/standard/tests/file/fgets_variation2.phpt +++ b/ext/standard/tests/file/fgets_variation2.phpt @@ -27,16 +27,6 @@ fclose($file_handle); var_dump( fgets($file_handle) ); // default length var_dump( fgets($file_handle, 10) ); // with specific length -echo "-- Testing fgets() with unset handle --\n"; -// open the file for reading -$file_handle = fopen(__FILE__, "r"); -// unset the file handle -unset($file_handle); - -//fgets using unset handle -var_dump( fgets($file_handle) ); // default length -var_dump( fgets($file_handle, 10) ); // with specific length - echo "Done"; ?> --EXPECTF-- @@ -48,15 +38,4 @@ bool(false) Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d bool(false) --- Testing fgets() with unset handle -- - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fgetss.phpt b/ext/standard/tests/file/fgetss.phpt deleted file mode 100644 index 41ac46dc92..0000000000 --- a/ext/standard/tests/file/fgetss.phpt +++ /dev/null @@ -1,144 +0,0 @@ ---TEST-- -fgetss() tests ---FILE-- -<?php - -$filename = dirname(__FILE__)."/fgetss.html"; - -$array = array( - "askasdfasdf<b>aaaaaa\n</b>dddddd", - "asdqw<i onClick=\"hello();\">\naaaa<>qqqq", - "aaa<script>function foo() {}</script>qqq", - "asdasd<a\n asdjeje", - "", - "some text \n<b>blah</i>", - "some another text <> hoho </>" - ); - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp)); - var_dump(fgetss($fp)); -} - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 10)); - var_dump(fgetss($fp, 10)); -} - -var_dump(fgetss($fp, -10)); -var_dump(fgetss($fp, 0)); -fclose($fp); -var_dump(fgetss($fp, 0)); - -@unlink($filename); - -echo "Done\n"; -?> ---EXPECTF-- -Deprecated: Function fgetss() is deprecated in %s on line %d -string(18) "askasdfasdfaaaaaa -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "dddddd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdqw -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(8) "aaaaqqqq" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(23) "aaafunction foo() {}qqq" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdasd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(11) "some text -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(4) "blah" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(24) "some another text hoho " - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "askasdfas" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "dfaaaa" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(5) "asdqw" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(3) "aaa" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(7) "functio" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdasd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "some text" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(2) " -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "some anot" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "her text " - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss1.phpt b/ext/standard/tests/file/fgetss1.phpt deleted file mode 100644 index 0266371865..0000000000 --- a/ext/standard/tests/file/fgetss1.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -more fgetss() tests ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -$filename = dirname(__FILE__)."/fgetss1.html"; - -$array = array( - "askasdfasdf<b>aaaaaa\n</b>dddddd", - "asdqw<i onClick=\"hello();\">\naaaa<>qqqq", - "aaa<script>function foo() {}</script>qqq", - "asdasd<a\n asdjeje", - "", - "some text \n<b>blah</i>", - "some another text <> hoho </>" - ); - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 1000, "<i>,<b>,<a>")); - var_dump(fgetss($fp)); -} - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 10)); - var_dump(fgetss($fp, 10, "<script>,<a>")); -} - -echo "Done\n"; -?> ---CLEAN-- -<?php -$filename = dirname(__FILE__)."/fgetss1.html"; -unlink($filename); -?> ---EXPECT-- -string(21) "askasdfasdf<b>aaaaaa -" -string(6) "dddddd" -string(28) "asdqw<i onClick="hello();"> -" -string(8) "aaaaqqqq" -string(23) "aaafunction foo() {}qqq" -bool(false) -string(6) "asdasd" -string(0) "" -bool(false) -bool(false) -string(11) "some text -" -string(4) "blah" -string(24) "some another text hoho " -bool(false) -string(9) "askasdfas" -string(6) "dfaaaa" -string(5) "asdqw" -string(0) "" -string(3) "aaa" -string(9) "t>functio" -string(6) "asdasd" -string(0) "" -bool(false) -bool(false) -string(9) "some text" -string(2) " -" -string(9) "some anot" -string(9) "her text " -Done diff --git a/ext/standard/tests/file/fgetss_basic1.phpt b/ext/standard/tests/file/fgetss_basic1.phpt deleted file mode 100644 index b1e4a89c64..0000000000 --- a/ext/standard/tests/file/fgetss_basic1.phpt +++ /dev/null @@ -1,137 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read modes only ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* test fgetss with all read modes */ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : Basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $filename = dirname(__FILE__)."/fgetss_basic1.tmp"; - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - rewind($file_handle); - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : Basic operations *** - --- Testing fgetss() with file opened using r mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using rb mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using rt mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+ mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+b mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+t mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt b/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt deleted file mode 100644 index 41ebf8e1da..0000000000 --- a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -$filename = dirname(__FILE__)."/fgetss_basic2私はガラスを食べられます.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2-win32.phpt b/ext/standard/tests/file/fgetss_basic2-win32.phpt deleted file mode 100644 index ea76bb8a8b..0000000000 --- a/ext/standard/tests/file/fgetss_basic2-win32.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -$filename = dirname(__FILE__)."/fgetss_basic2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2.phpt b/ext/standard/tests/file/fgetss_basic2.phpt deleted file mode 100644 index d77689d980..0000000000 --- a/ext/standard/tests/file/fgetss_basic2.phpt +++ /dev/null @@ -1,216 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; - -$filename = dirname(__FILE__)."/fgetss_basic2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_error.phpt b/ext/standard/tests/file/fgetss_error.phpt deleted file mode 100644 index 13a5399406..0000000000 --- a/ext/standard/tests/file/fgetss_error.phpt +++ /dev/null @@ -1,108 +0,0 @@ ---TEST-- -Test fgetss() function : error conditions ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -echo "*** Testing error conditions ***\n"; -// zero argument -echo "-- Testing fgetss() with zero argument --\n"; -var_dump( fgetss() ); - -// more than expected no. of args -echo "-- Testing fgetss() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( fgetss($fp, 100, '<p><a>', $fp) ); - -// invalid length argument -echo "-- Testing fgetss() with invalid length arguments --\n"; -$len = 0; -$allowable_tags = '<p><a>'; -var_dump( fgetss($fp, $len, $allowable_tags) ); -$len = -10; -var_dump( fgetss($fp, $len, $allowable_tags) ); -$len = 1; -var_dump( fgetss($fp, $len, $allowable_tags) ); // return length - 1 always, expect false - -// test invalid arguments : non-resources -echo "-- Testing fgetss() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fgetss() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fgetss($invalid_args[$loop_counter - 1], 10, $allowable_tags) ); -} -// fgetss() on a file handle which is already closed -echo "-- Testing fgetss() with closed/unset file handle --"; -fclose($fp); -var_dump(fgetss($fp,10,$allowable_tags)); - -// fgetss() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fgetss(@$file_handle,10)); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing error conditions *** --- Testing fgetss() with zero argument -- - -Warning: fgetss() expects at least 1 parameter, 0 given in %s on line %d -bool(false) --- Testing fgetss() with more than expected number of arguments -- - -Warning: fgetss() expects at most 3 parameters, 4 given in %s on line %d -bool(false) --- Testing fgetss() with invalid length arguments -- - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) -bool(false) --- Testing fgetss() with invalid arguments -- --- Iteration 1 -- - -Warning: fgetss() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fgetss() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fgetss() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fgetss() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fgetss() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fgetss() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fgetss() with closed/unset file handle -- -Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fgetss() expects parameter 1 to be resource, null given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation1-win32.phpt b/ext/standard/tests/file/fgetss_variation1-win32.phpt deleted file mode 100644 index b8ad242d9e..0000000000 --- a/ext/standard/tests/file/fgetss_variation1-win32.phpt +++ /dev/null @@ -1,174 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - write only modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgets on files which are opened in non readable modes - w, wb, wt, - a, ab, at, - x, xb, xt -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = dirname(__FILE__)."/fgetss_variation1.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n"; - var_dump( fgetss($file_handle) ); // expected : no character should be read - var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed - var_dump( feof($file_handle) ); // check if end of file pointer is set - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wt mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using a mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using ab mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using at mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using x mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xt mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation1.phpt b/ext/standard/tests/file/fgetss_variation1.phpt deleted file mode 100644 index 6166f8468c..0000000000 --- a/ext/standard/tests/file/fgetss_variation1.phpt +++ /dev/null @@ -1,170 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - write only modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgets on files which are opened in non readable modes - w, wb, wt, - a, ab, at, - x, xb, xt -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation1.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n"; - var_dump( fgetss($file_handle) ); // expected : no character should be read - var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed - var_dump( feof($file_handle) ); // check if end of file pointer is set - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wt mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using a mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using ab mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using at mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using x mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xt mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation2.phpt b/ext/standard/tests/file/fgetss_variation2.phpt deleted file mode 100644 index 228d476079..0000000000 --- a/ext/standard/tests/file/fgetss_variation2.phpt +++ /dev/null @@ -1,436 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read modes ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -// include the common file related test functions -include ("file.inc"); - -/*Test fgetss() with all read modes , reading line by line with allowable tags: <test>, <html>, <?> */ - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this is the text containing \r character -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - rewind($file_handle); - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using r mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using rb mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using rt mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+ mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+b mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+t mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation3-win32.phpt b/ext/standard/tests/file/fgetss_variation3-win32.phpt deleted file mode 100644 index c1777fc495..0000000000 --- a/ext/standard/tests/file/fgetss_variation3-win32.phpt +++ /dev/null @@ -1,573 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t - reading line by line with allowable tags: <test>, <html>, <?> -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = dirname(__FILE__)."/fgetss_variation3.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - rewind($file_handle); - var_dump( ftell($file_handle) ); - var_dump( filesize($filename) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation3.phpt b/ext/standard/tests/file/fgetss_variation3.phpt deleted file mode 100644 index 53a2ac879c..0000000000 --- a/ext/standard/tests/file/fgetss_variation3.phpt +++ /dev/null @@ -1,569 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t - reading line by line with allowable tags: <test>, <html>, <?> -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation3.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - rewind($file_handle); - var_dump( ftell($file_handle) ); - var_dump( filesize($filename) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation4.phpt b/ext/standard/tests/file/fgetss_variation4.phpt deleted file mode 100644 index 91470e1d44..0000000000 --- a/ext/standard/tests/file/fgetss_variation4.phpt +++ /dev/null @@ -1,170 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read modes, file pointer at EOF ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip not for Windows"); -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this is the text containing \r character -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation4.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // close the file - fclose($file_handle); - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using r mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using rb mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using rt mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+ mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+b mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+t mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation5-win32.phpt b/ext/standard/tests/file/fgetss_variation5-win32.phpt deleted file mode 100644 index 57f1fd9059..0000000000 --- a/ext/standard/tests/file/fgetss_variation5-win32.phpt +++ /dev/null @@ -1,222 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes, file pointer at EOF ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = dirname(__FILE__)."/fgetss_variation5.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation5.phpt b/ext/standard/tests/file/fgetss_variation5.phpt deleted file mode 100644 index e6fc15a98c..0000000000 --- a/ext/standard/tests/file/fgetss_variation5.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes, file pointer at EOF ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation5.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/file_error.phpt b/ext/standard/tests/file/file_error.phpt index 12148189e8..2efacd1b31 100644 --- a/ext/standard/tests/file/file_error.phpt +++ b/ext/standard/tests/file/file_error.phpt @@ -8,14 +8,10 @@ Test file() function : error conditions Returns the file in an array */ $file_path = dirname(__FILE__); -echo "\n*** Testing error conditions ***"; +echo "\n*** Testing error conditions ***\n"; $file_handle = fopen($file_path."/file.tmp", "w"); -var_dump( file() ); // Zero No. of args $filename = $file_path."/file.tmp"; -var_dump( file($filename, $filename, $filename, $filename) ); // more than expected number of arguments - -var_dump( file($filename, "INCORRECT_FLAG", NULL) ); // Incorrect flag var_dump( file($filename, 10, NULL) ); // Incorrect flag var_dump( file("temp.tmp") ); // non existing filename @@ -30,14 +26,6 @@ unlink($file_path."/file.tmp"); ?> --EXPECTF-- *** Testing error conditions *** -Warning: file() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: file() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: file() expects parameter 2 to be int, string given in %s on line %d -NULL array(0) { } diff --git a/ext/standard/tests/file/file_get_contents_error.phpt b/ext/standard/tests/file/file_get_contents_error.phpt index f06628f516..6677d78866 100644 --- a/ext/standard/tests/file/file_get_contents_error.phpt +++ b/ext/standard/tests/file/file_get_contents_error.phpt @@ -17,14 +17,8 @@ include($file_path."/file.inc"); echo "\n-- Testing with Non-existing file --\n"; print( file_get_contents("/no/such/file/or/dir") ); -echo "\n-- Testing No.of arguments less than expected --\n"; -print( file_get_contents() ); - -echo "\n-- Testing No.of arguments greater than expected --\n"; - create_files($file_path, 1, "text", 0755, 100, "w", "file", 1, "byte"); $file_handle = fopen($file_path."/file_put_contents_error.tmp", "w"); -print( file_get_contents($file_path."/file1.tmp", false, $file_handle, 1, 2, "extra_argument") ); echo "\n-- Testing for invalid negative maxlen values --"; var_dump( file_get_contents($file_path."/file1.tmp", FALSE, $file_handle, 0, -5) ); @@ -52,14 +46,6 @@ if(file_exists($file_path."/file_put_contents1.tmp")) { Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d --- Testing No.of arguments less than expected -- - -Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d - --- Testing No.of arguments greater than expected -- - -Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d - -- Testing for invalid negative maxlen values -- Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d bool(false) diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt index b2a09798e3..23c33b60d3 100644 --- a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt +++ b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt @@ -18,15 +18,7 @@ $file_path = dirname(__FILE__); echo "\n-- Testing with Non-existing file --\n"; print( file_get_contents("/no/such/file/or/dir") ); -echo "\n-- Testing No.of arguments less than expected --\n"; -print( file_get_contents() ); -print( file_put_contents() ); -print( file_put_contents($file_path."/".__FILE__) ); - $file_handle = fopen($file_path."/file_put_contents.tmp", "w"); -echo "\n-- Testing No.of arguments greater than expected --\n"; -print( file_put_contents("abc.tmp", 12345, 1, $file_handle, "extra_argument") ); -print( file_get_contents("abc.tmp", false, $file_handle, 1, 2, "extra_argument") ); echo "\n-- Testing for invalid negative maxlen values --"; file_put_contents($file_path."/file_put_contents1.tmp", "Garbage data in the file"); @@ -50,20 +42,6 @@ unlink($file_path."/file_put_contents1.tmp"); Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d --- Testing No.of arguments less than expected -- - -Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d - -Warning: file_put_contents() expects at least 2 parameters, 0 given in %s on line %d - -Warning: file_put_contents() expects at least 2 parameters, 1 given in %s on line %d - --- Testing No.of arguments greater than expected -- - -Warning: file_put_contents() expects at most 4 parameters, 5 given in %s on line %d - -Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d - -- Testing for invalid negative maxlen values -- Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d bool(false) diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt index 4928404098..25060ea0cf 100644 --- a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt @@ -38,7 +38,11 @@ $names_arr = array( foreach($names_arr as $key =>$value) { echo "\n-- Filename: $key --\n"; - var_dump(file_get_contents($value)); + try { + var_dump(file_get_contents($value)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> @@ -77,14 +81,10 @@ Warning: file_get_contents( ): failed to open stream: Permission denied in %s on bool(false) -- Filename: \0 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt index 97a3495d54..f826ad60c2 100644 --- a/ext/standard/tests/file/file_get_contents_variation8.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8.phpt @@ -37,7 +37,11 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - var_dump(file_get_contents($names_arr[$i])); + try { + var_dump(file_get_contents($names_arr[$i])); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "\n*** Done ***\n"; @@ -69,13 +73,9 @@ bool(false) Warning: file_get_contents( ): failed to open stream: No such file or directory in %s on line %d bool(false) -- Iteration 6 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/file_put_contents_variation2.phpt b/ext/standard/tests/file/file_put_contents_variation2.phpt index ae56486d5f..5e18ce1948 100644 --- a/ext/standard/tests/file/file_put_contents_variation2.phpt +++ b/ext/standard/tests/file/file_put_contents_variation2.phpt @@ -13,8 +13,8 @@ Dave Kelsey <d_kelsey@uk.ibm.com> echo "*** Testing file_put_contents() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt index 095980b536..4c03581c48 100644 --- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt @@ -35,14 +35,18 @@ $names_arr = array( ); foreach($names_arr as $key =>$value) { - echo "\n-- Filename: $key --\n"; - $res = file_put_contents($value, "Some data"); - if ($res !== false && $res != null) { - echo "$res bytes written to: $value\n"; - unlink($value); - } else { - echo "Failed to write data to: $key\n"; - } + echo "\n-- Filename: $key --\n"; + try { + $res = file_put_contents($value, "Some data"); + if ($res !== false && $res != null) { + echo "$res bytes written to: $value\n"; + unlink($value); + } else { + echo "Failed to write data to: $key\n"; + } + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> @@ -77,14 +81,10 @@ Warning: file_put_contents( ): failed to open stream: Permission denied in %s on Failed to write data to: " " -- Filename: \0 -- - -Warning: file_put_contents() expects parameter 1 to be a valid path, string given in %s on line %d -Failed to write data to: \0 +file_put_contents() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: file_put_contents() expects parameter 1 to be a valid path, array given in %s on line %d -Failed to write data to: array() +file_put_contents() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt Binary files differindex 4aef0644f9..76b7b6f5c6 100644 --- a/ext/standard/tests/file/file_put_contents_variation8.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8.phpt diff --git a/ext/standard/tests/file/filegroup_error.phpt b/ext/standard/tests/file/filegroup_error.phpt index e32711cd5b..e602f3441f 100644 --- a/ext/standard/tests/file/filegroup_error.phpt +++ b/ext/standard/tests/file/filegroup_error.phpt @@ -15,10 +15,6 @@ var_dump( filegroup("/no/such/file/dir") ); var_dump( filegroup("string") ); var_dump( filegroup(100) ); -/* Invalid no.of arguments */ -var_dump( filegroup() ); // args < expected -var_dump( filegroup("/no/such/file", "root") ); // args > expected - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -33,10 +29,4 @@ bool(false) Warning: filegroup(): stat failed for 100 in %s on line %d bool(false) -Warning: filegroup() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filegroup() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/filegroup_variation2.phpt b/ext/standard/tests/file/filegroup_variation2.phpt index 809d61ba73..46a3dc9f35 100644 --- a/ext/standard/tests/file/filegroup_variation2.phpt +++ b/ext/standard/tests/file/filegroup_variation2.phpt @@ -11,7 +11,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing filegroup() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/filegroup_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -22,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -34,7 +32,6 @@ foreach( $filenames as $filename ) { var_dump( filegroup($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -58,9 +55,6 @@ bool(false) bool(false) bool(false) -Warning: filegroup() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: filegroup(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/filegroup_variation3.phpt b/ext/standard/tests/file/filegroup_variation3.phpt index ebefeb7e3f..a0d4b2fdee 100644 --- a/ext/standard/tests/file/filegroup_variation3.phpt +++ b/ext/standard/tests/file/filegroup_variation3.phpt @@ -39,7 +39,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( filegroup( $file_path."/".$file ) ); + try { + var_dump( filegroup( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -74,12 +78,8 @@ bool(false) Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +filegroup() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +filegroup() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileinode_error.phpt b/ext/standard/tests/file/fileinode_error.phpt index 462ab62367..d080467f04 100644 --- a/ext/standard/tests/file/fileinode_error.phpt +++ b/ext/standard/tests/file/fileinode_error.phpt @@ -16,12 +16,6 @@ var_dump( fileinode("/no/such/file/dir") ); var_dump( fileinode("string") ); var_dump( fileinode(100) ); -/* No.of arguments less than expected */ -var_dump( fileinode() ); - -/* No.of arguments greater than expected */ -var_dump( fileinode(__FILE__, "string") ); - echo "\n*** Done ***"; --EXPECTF-- *** Testing error conditions of fileinode() *** @@ -34,10 +28,4 @@ bool(false) Warning: fileinode(): stat failed for 100 in %s on line 14 bool(false) -Warning: fileinode() expects exactly 1 parameter, 0 given in %s on line 17 -NULL - -Warning: fileinode() expects exactly 1 parameter, 2 given in %s on line 20 -NULL - *** Done *** diff --git a/ext/standard/tests/file/fileinode_variation2.phpt b/ext/standard/tests/file/fileinode_variation2.phpt index 90c7eb19e3..d6397d33b8 100644 --- a/ext/standard/tests/file/fileinode_variation2.phpt +++ b/ext/standard/tests/file/fileinode_variation2.phpt @@ -12,7 +12,6 @@ Description: Returns the inode number of the file, or FALSE in case of an error. /* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/fileinode_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -23,7 +22,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -35,7 +33,6 @@ foreach( $filenames as $filename ) { var_dump( fileinode($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -59,9 +56,6 @@ bool(false) bool(false) bool(false) -Warning: fileinode() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileinode(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileinode_variation3.phpt b/ext/standard/tests/file/fileinode_variation3.phpt index 2f51e8f595..e50fcfb767 100644 --- a/ext/standard/tests/file/fileinode_variation3.phpt +++ b/ext/standard/tests/file/fileinode_variation3.phpt @@ -40,7 +40,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileinode( $file_path."/".$file ) ); + try { + var_dump( fileinode( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -75,12 +79,8 @@ bool(false) Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileinode() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileinode() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileowner_error.phpt b/ext/standard/tests/file/fileowner_error.phpt index 967a541cc0..807c09f0f0 100644 --- a/ext/standard/tests/file/fileowner_error.phpt +++ b/ext/standard/tests/file/fileowner_error.phpt @@ -15,10 +15,6 @@ var_dump( fileowner("/no/such/file/dir") ); var_dump( fileowner("string") ); var_dump( fileowner(100) ); -/* Invalid no.of arguments */ -var_dump( fileowner() ); // args < expected -var_dump( fileowner("/no/such/file", "root") ); // args > expected - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -33,10 +29,4 @@ bool(false) Warning: fileowner(): stat failed for 100 in %s on line %d bool(false) -Warning: fileowner() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: fileowner() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/fileowner_variation2.phpt b/ext/standard/tests/file/fileowner_variation2.phpt index 131d43bfaa..f6741cb9ca 100644 --- a/ext/standard/tests/file/fileowner_variation2.phpt +++ b/ext/standard/tests/file/fileowner_variation2.phpt @@ -12,7 +12,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing fileowner() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/fileowner_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -23,7 +22,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -35,7 +33,6 @@ foreach( $filenames as $filename ) { var_dump( fileowner($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -59,9 +56,6 @@ bool(false) bool(false) bool(false) -Warning: fileowner() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileowner(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileowner_variation3.phpt b/ext/standard/tests/file/fileowner_variation3.phpt index 5768f528f1..6a2953aa6c 100644 --- a/ext/standard/tests/file/fileowner_variation3.phpt +++ b/ext/standard/tests/file/fileowner_variation3.phpt @@ -40,7 +40,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileowner( $file_path."/".$file ) ); + try { + var_dump( fileowner( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -75,12 +79,8 @@ bool(false) Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileowner() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileowner() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileperms_variation2.phpt b/ext/standard/tests/file/fileperms_variation2.phpt index 6b1778e74e..b2b8a19859 100644 --- a/ext/standard/tests/file/fileperms_variation2.phpt +++ b/ext/standard/tests/file/fileperms_variation2.phpt @@ -11,7 +11,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing fileperms() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/fileperms_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -22,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -34,7 +32,6 @@ foreach( $filenames as $filename ) { var_dump( fileperms($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -58,9 +55,6 @@ bool(false) bool(false) bool(false) -Warning: fileperms() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileperms(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileperms_variation3.phpt b/ext/standard/tests/file/fileperms_variation3.phpt index 6ae97d1601..5b1160019a 100644 --- a/ext/standard/tests/file/fileperms_variation3.phpt +++ b/ext/standard/tests/file/fileperms_variation3.phpt @@ -39,7 +39,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileperms( $file_path."/".$file ) ); + try { + var_dump( fileperms( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -74,12 +78,8 @@ bool(false) Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileperms() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileperms() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/filesize_error.phpt b/ext/standard/tests/file/filesize_error.phpt index 9f721ff921..5ad8ee99ca 100644 --- a/ext/standard/tests/file/filesize_error.phpt +++ b/ext/standard/tests/file/filesize_error.phpt @@ -14,13 +14,6 @@ echo "*** Testing filesize(): error conditions ***"; var_dump( filesize("/no/such/file") ); var_dump( filesize("/no/such/dir") ); -/* No.of arguments less than expected */ -var_dump( filesize() ); - -/* No.of arguments greater than expected */ -var_dump( filesize(__FILE__, 2000) ); -echo "\n"; - echo "*** Done ***\n"; ?> --EXPECTF-- @@ -30,11 +23,4 @@ bool(false) Warning: filesize(): stat failed for /no/such/dir in %s on line %d bool(false) - -Warning: filesize() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filesize() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/filetype_error.phpt b/ext/standard/tests/file/filetype_error.phpt index b49a5286c6..a34671d9b0 100644 --- a/ext/standard/tests/file/filetype_error.phpt +++ b/ext/standard/tests/file/filetype_error.phpt @@ -16,12 +16,6 @@ print( filetype("/no/such/file/dir") ); print( filetype("string") ); print( filetype(100) ); -/* No.of args less than expected */ -print( filetype() ); - -/* No.of args greater than expected */ -print( filetype("file", "file") ); - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -32,8 +26,4 @@ Warning: filetype(): Lstat failed for string in %s on line %d Warning: filetype(): Lstat failed for 100 in %s on line %d -Warning: filetype() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: filetype() expects exactly 1 parameter, 2 given in %s on line %d - *** Done *** diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt index 2330270113..4c3cb45c06 100644 --- a/ext/standard/tests/file/flock.phpt +++ b/ext/standard/tests/file/flock.phpt @@ -5,9 +5,6 @@ flock() tests $file = dirname(__FILE__)."/flock.dat"; -var_dump(flock()); -var_dump(flock("", "", $var)); - $fp = fopen($file, "w"); fclose($fp); @@ -41,12 +38,6 @@ $file = dirname(__FILE__)."/flock.dat"; unlink($file); ?> --EXPECTF-- -Warning: flock() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: flock() expects parameter 1 to be resource, string given in %s on line %d -NULL - Warning: flock(): supplied resource is not a valid stream resource in %s on line %d bool(false) bool(true) diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt index ccb6274756..0e3f1d949c 100644 --- a/ext/standard/tests/file/flock_error.phpt +++ b/ext/standard/tests/file/flock_error.phpt @@ -29,7 +29,11 @@ $operations = array( $i = 0; foreach($operations as $operation) { echo "\n--- Iteration $i ---"; - var_dump(flock($fp, $operation)); + try { + var_dump(flock($fp, $operation)); + } catch (TypeError $e) { + echo "\n", $e->getMessage(), "\n"; + } $i++; } @@ -39,15 +43,6 @@ $fp = fopen($file, "w"); fclose($fp); var_dump(flock($fp, LOCK_SH|LOCK_NB)); -var_dump(flock("", "", $var)); - -/* No.of args leass than expected */ -var_dump(flock()); -var_dump(flock($fp)); - -/* No.of args greater than expected */ -var_dump(flock($fp, "", $var, "")); - echo "\n*** Done ***\n"; ?> --CLEAN-- @@ -75,38 +70,21 @@ Warning: flock(): Illegal operation argument in %s on line %d bool(false) --- Iteration 4 --- -Warning: flock() expects parameter 2 to be int, array given in %s on line %d -NULL +flock() expects parameter 2 to be int, array given --- Iteration 5 --- -Warning: flock() expects parameter 2 to be int, array given in %s on line %d -NULL +flock() expects parameter 2 to be int, array given --- Iteration 6 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given --- Iteration 7 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given --- Iteration 8 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given Warning: flock(): supplied resource is not a valid stream resource in %s on line %d bool(false) -Warning: flock() expects parameter 1 to be resource, string given in %s on line %d -NULL - -Warning: flock() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: flock() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: flock() expects at most 3 parameters, 4 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt index b3607be58b..048eb1475c 100644 --- a/ext/standard/tests/file/fnmatch_variation.phpt +++ b/ext/standard/tests/file/fnmatch_variation.phpt @@ -66,7 +66,11 @@ $pattern_arr = array( for( $i = 0; $i<count($pattern_arr); $i++ ) { echo "-- Iteration $i --\n"; - var_dump( fnmatch($pattern_arr[$i], $file_name) ); + try { + var_dump( fnmatch($pattern_arr[$i], $file_name) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } unlink($file_name); @@ -78,7 +82,11 @@ function match( $pattern, $string ) { for( $i = 0; $i<count($pattern); $i++ ) { echo "-- Iteration $i --\n"; for( $j = 0; $j<count($string); $j++ ) { - var_dump( fnmatch($pattern[$i], $string[$j]) ); + try { + var_dump( fnmatch($pattern[$i], $string[$j]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } } @@ -134,7 +142,7 @@ match($null_arr, $null_arr); echo "\n*** Done ***\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fnmatch() with file and various patterns *** -- Iteration 0 -- bool(true) @@ -183,13 +191,9 @@ bool(false) -- Iteration 22 -- bool(false) -- Iteration 23 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 24 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 25 -- bool(false) -- Iteration 26 -- @@ -263,84 +267,44 @@ bool(true) --- With Strings --- -- Iteration 0 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) -- Iteration 1 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 2 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) -- Iteration 3 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 4 -- bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) bool(false) -- Iteration 5 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) @@ -441,64 +405,42 @@ bool(true) bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 1 -- bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 2 -- bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 3 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 4 -- bool(false) bool(false) bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) bool(false) -- Iteration 5 -- bool(false) bool(false) bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) diff --git a/ext/standard/tests/file/fread_error.phpt b/ext/standard/tests/file/fread_error.phpt index 1c4068cd97..f51f24c754 100644 --- a/ext/standard/tests/file/fread_error.phpt +++ b/ext/standard/tests/file/fread_error.phpt @@ -14,14 +14,6 @@ echo "*** Testing error conditions ***\n"; $filename = __FILE__; $file_handle = fopen($filename, "r"); -// zero argument -echo "-- Testing fread() with zero argument --\n"; -var_dump( fread() ); - -// more than expected no. of args -echo "-- Testing fread() with more than expected number of arguments --\n"; -var_dump( fread($file_handle, 10, $file_handle) ); - // invalid length argument echo "-- Testing fread() with invalid length arguments --\n"; $len = 0; @@ -29,44 +21,9 @@ var_dump( fread($file_handle, $len) ); $len = -10; var_dump( fread($file_handle, $len) ); -// test invalid arguments : non-resources -echo "-- Testing fread() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fread() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fread($invalid_args[$loop_counter - 1], 10) ); -} - -// fwrite() on a file handle which is already closed -echo "-- Testing fwrite() with closed/unset file handle --\n"; -fclose($file_handle); -var_dump( fread($file_handle,$file_content_type) ); - -// fwrite on a file handle which is unset -$fp = fopen($filename, "r"); -unset($fp); //unset file handle -var_dump( fread(@$fp,10) ); -var_dump( fclose(@$fp) ); - echo "Done\n"; --EXPECTF-- *** Testing error conditions *** --- Testing fread() with zero argument -- - -Warning: fread() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) --- Testing fread() with more than expected number of arguments -- - -Warning: fread() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) -- Testing fread() with invalid length arguments -- Warning: fread(): Length parameter must be greater than 0 in %s on line %d @@ -74,41 +31,4 @@ bool(false) Warning: fread(): Length parameter must be greater than 0 in %s on line %d bool(false) --- Testing fread() with invalid arguments -- --- Iteration 1 -- - -Warning: fread() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fread() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fread() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fread() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fread() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fread() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fwrite() with closed/unset file handle -- - -Notice: Undefined variable: file_content_type in %s on line %d - -Warning: fread(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fread() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf.phpt index 6d3d0a5b96..7e40d20b48 100644 --- a/ext/standard/tests/file/fscanf.phpt +++ b/ext/standard/tests/file/fscanf.phpt @@ -5,10 +5,6 @@ fscanf() tests $filename = dirname(__FILE__)."/fscanf.dat"; -var_dump(fscanf()); -var_dump(fscanf(array())); -var_dump(fscanf(array(), array())); - file_put_contents($filename, "data"); $fp = fopen($filename, "rt"); @@ -64,14 +60,6 @@ $filename = dirname(__FILE__)."/fscanf.dat"; unlink($filename); ?> --EXPECTF-- -Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: fscanf() expects parameter 1 to be resource, array given in %s on line %d -NULL int(0) NULL int(1) diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt index db2a881d6c..d5b2ba73aa 100644 --- a/ext/standard/tests/file/fscanf_error.phpt +++ b/ext/standard/tests/file/fscanf_error.phpt @@ -17,16 +17,6 @@ if ($file_handle == false) fwrite($file_handle, "hello world"); fclose($file_handle); -// zero argument -var_dump( fscanf() ); - -// single argument -$file_handle = fopen($filename, 'r'); -if ($file_handle == false) - exit("Error:failed to open file $filename"); -var_dump( fscanf($file_handle) ); -fclose($file_handle); - // invalid file handle var_dump( fscanf($file_handle, "%s") ); @@ -38,7 +28,7 @@ var_dump( fscanf($file_handle, "%d%s%f", $int_var, $string_var) ); fclose($file_handle); // different invalid format strings -$invalid_formats = array( $undefined_var, undefined_constant, +$invalid_formats = array( $undefined_var, "%", "%h", "%.", "%d%m" ); @@ -63,12 +53,6 @@ unlink($filename); --EXPECTF-- *** Testing fscanf() for error conditions *** -Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - Warning: fscanf(): supplied resource is not a valid File-Handle resource in %s on line %d bool(false) @@ -76,10 +60,6 @@ Warning: fscanf(): Different numbers of variable names and field specifiers in % int(-1) Notice: Undefined variable: undefined_var in %s on line %d - -Warning: Use of undefined constant undefined_constant - assumed 'undefined_constant' (this will throw an Error in a future version of PHP) in %s on line %d -array(0) { -} array(0) { } diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt index 9c1b3a822d..c39b3bcbe5 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt @@ -14,86 +14,18 @@ Test fseek(), ftell() & rewind() functions : error conditions - fseek() */ echo "*** Testing fseek() : error conditions ***\n"; -// zero argument -echo "-- Testing fseek() with zero argument --\n"; -var_dump( fseek() ); - -// unexpected no. of args -echo "-- Testing fseek() with unexpected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( fseek($fp) ); -var_dump( fseek($fp, 10, $fp,10) ); - -// test invalid arguments : non-resources -echo "-- Testing fseek() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass -); -/* loop to test fseek() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fseek($invalid_args[$loop_counter - 1], 10) ); -} // fseek() on a file handle which is already closed echo "-- Testing fseek() with closed/unset file handle --"; +$fp = fopen(__FILE__, "r"); fclose($fp); var_dump(fseek($fp,10)); -// fseek() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fseek(@$file_handle,10)); - echo "Done\n"; ?> --EXPECTF-- *** Testing fseek() : error conditions *** --- Testing fseek() with zero argument -- - -Warning: fseek() expects at least 2 parameters, 0 given in %s on line %d -bool(false) --- Testing fseek() with unexpected number of arguments -- - -Warning: fseek() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fseek() expects at most 3 parameters, 4 given in %s on line %d -bool(false) --- Testing fseek() with invalid arguments -- --- Iteration 1 -- - -Warning: fseek() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fseek() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fseek() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fseek() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fseek() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fseek() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing fseek() with closed/unset file handle -- Warning: fseek(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: fseek() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt index 8835046f6c..87f70b8717 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt @@ -14,82 +14,18 @@ Test fseek(), ftell() & rewind() functions : error conditions - ftell() */ echo "*** Testing ftell() : error conditions ***\n"; -// zero argument -echo "-- Testing ftell() with zero argument --\n"; -var_dump( ftell() ); - -// more than expected no. of args -echo "-- Testing ftell() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( ftell($fp, 10) ); - -// test invalid arguments : non-resources -echo "-- Testing ftell() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test ftell with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( ftell($invalid_args[$loop_counter - 1]) ); -} // ftell on a file handle which is already closed echo "-- Testing ftell with closed/unset file handle --"; +$fp = fopen(__FILE__, "r"); fclose($fp); var_dump(ftell($fp)); -// ftell on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( ftell(@$file_handle) ); - echo "Done\n"; ?> --EXPECTF-- *** Testing ftell() : error conditions *** --- Testing ftell() with zero argument -- - -Warning: ftell() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) --- Testing ftell() with more than expected number of arguments -- - -Warning: ftell() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing ftell() with invalid arguments -- --- Iteration 1 -- - -Warning: ftell() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: ftell() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: ftell() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: ftell() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: ftell() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: ftell() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing ftell with closed/unset file handle -- Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: ftell() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt index 0b94bcffc7..edbb9e22f2 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt @@ -14,82 +14,18 @@ Test fseek(), ftell() & rewind() functions : error conditions - rewind() */ echo "*** Testing rewind() : error conditions ***\n"; -// zero argument -echo "-- Testing rewind() with zero argument --\n"; -var_dump( rewind() ); - -// more than expected no. of args -echo "-- Testing rewind() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( rewind($fp, 10) ); - -// test invalid arguments : non-resources -echo "-- Testing rewind() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test rewind with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( rewind($invalid_args[$loop_counter - 1]) ); -} // rewind on a file handle which is already closed echo "-- Testing rewind() with closed/unset file handle --"; +$fp = fopen(__FILE__, "r"); fclose($fp); var_dump(rewind($fp)); -// rewind on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( rewind(@$file_handle) ); - echo "Done\n"; ?> --EXPECTF-- *** Testing rewind() : error conditions *** --- Testing rewind() with zero argument -- - -Warning: rewind() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) --- Testing rewind() with more than expected number of arguments -- - -Warning: rewind() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing rewind() with invalid arguments -- --- Iteration 1 -- - -Warning: rewind() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: rewind() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: rewind() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: rewind() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: rewind() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: rewind() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing rewind() with closed/unset file handle -- Warning: rewind(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: rewind() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt index 3cb6db27f8..ecbdeddf06 100644 --- a/ext/standard/tests/file/ftruncate_error.phpt +++ b/ext/standard/tests/file/ftruncate_error.phpt @@ -15,38 +15,6 @@ fwrite($file_handle, "Testing ftruncate error conditions \n"); fflush($file_handle); echo "\n Initial file size = ".filesize($filename)."\n"; -echo "-- Testing ftruncate() with less than expected number of arguments --\n"; - -// zero arguments -var_dump( ftruncate() ); - -// arguments less than expected numbers -var_dump( ftruncate( $file_handle ) ); -// check the first size -var_dump( filesize($filename) ); - -echo "-- Testing ftruncate() with more than expected number of arguments --\n"; -// more than expected number of arguments -var_dump( ftruncate($file_handle, 10, 20) ); -// check the first size -var_dump( filesize($filename) ); - -// test invalid arguments : non-resources -echo "-- Testing ftruncate() with invalid file pointer --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test ftruncate() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( ftruncate($invalid_args[$loop_counter - 1], 10) ); -} - // ftruncate() on a file handle which is already closed/unset echo "-- Testing ftruncate() with closed/unset file handle --\n"; @@ -56,13 +24,6 @@ var_dump( ftruncate($file_handle,10) ); // check the first size var_dump( filesize($filename) ); -// ftruncate on a file handle which is unset -$fp = fopen($filename, "w"); -unset($fp); //unset file handle -var_dump( ftruncate(@$fp,10)); -// check the first size -var_dump( filesize($filename) ); - echo "Done\n"; ?> --CLEAN-- @@ -74,51 +35,9 @@ unlink( $filename ); *** Testing ftruncate() : error conditions *** Initial file size = 36 --- Testing ftruncate() with less than expected number of arguments -- - -Warning: ftruncate() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: ftruncate() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) -int(36) --- Testing ftruncate() with more than expected number of arguments -- - -Warning: ftruncate() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) -int(36) --- Testing ftruncate() with invalid file pointer -- --- Iteration 1 -- - -Warning: ftruncate() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: ftruncate() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: ftruncate() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: ftruncate() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: ftruncate() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: ftruncate() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing ftruncate() with closed/unset file handle -- Warning: ftruncate(): supplied resource is not a valid stream resource in %s on line %d bool(false) int(36) - -Warning: ftruncate() expects parameter 1 to be resource, null given in %s on line %d -bool(false) -int(36) Done diff --git a/ext/standard/tests/file/fwrite.phpt b/ext/standard/tests/file/fwrite.phpt index 443710b99d..195d3afe77 100644 --- a/ext/standard/tests/file/fwrite.phpt +++ b/ext/standard/tests/file/fwrite.phpt @@ -6,8 +6,7 @@ fwrite() tests $filename = dirname(__FILE__)."/fwrite.dat"; $fp = fopen($filename, "w"); -var_dump(fwrite($fp)); -var_dump(fwrite($fp, array())); +var_dump(fwrite($fp, "")); fclose($fp); $fp = fopen($filename, "r"); @@ -20,33 +19,16 @@ fclose($fp); var_dump(fwrite($fp, "data", -1)); -var_dump(fwrite(array(), "data", -1)); -var_dump(fwrite(array(), "data")); -var_dump(fwrite(array())); - var_dump(file_get_contents($filename)); @unlink($filename); echo "Done\n"; ?> --EXPECTF-- -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fwrite() expects parameter 2 to be string, array given in %s on line %d -bool(false) +int(0) int(0) int(0) int(4) int(0) - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) string(4) "data" Done diff --git a/ext/standard/tests/file/fwrite_error.phpt b/ext/standard/tests/file/fwrite_error.phpt index f4f691be35..a52d2dd003 100644 --- a/ext/standard/tests/file/fwrite_error.phpt +++ b/ext/standard/tests/file/fwrite_error.phpt @@ -16,18 +16,8 @@ include ("file.inc"); echo "*** Testing fwrite() : error conditions ***\n"; $filename = dirname(__FILE__)."/fwrite_error.tmp"; - -echo "-- Testing fwrite() with less than expected number of arguments --\n"; -// zero argument -var_dump( fwrite() ); -// less than expected, 1 arg $file_handle = fopen ( $filename, "w"); -var_dump( fwrite($file_handle) ); - -// more than expected no. of args -echo "-- Testing fwrite() with more than expected number of arguments --\n"; $data = "data"; -var_dump( fwrite($file_handle, $data, strlen($data), 10) ); // invalid length argument echo "-- Testing fwrite() with invalid length arguments --\n"; @@ -36,32 +26,11 @@ var_dump( fwrite($file_handle, $data, $len) ); $len = -10; var_dump( fwrite($file_handle, $data, $len) ); -// test invalid arguments : non-resources -echo "-- Testing fwrite() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fwrite() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fwrite($invalid_args[$loop_counter - 1], 10) ); -} - // fwrite() on a file handle which is already closed echo "-- Testing fwrite() with closed/unset file handle --\n"; fclose($file_handle); var_dump(fwrite($file_handle,"data")); -// fwrite on a file handle which is unset -$fp = fopen($filename, "w"); -unset($fp); //unset file handle -var_dump( fwrite(@$fp,"data")); - echo "Done\n"; ?> --CLEAN-- @@ -71,50 +40,11 @@ unlink( $filename ); ?> --EXPECTF-- *** Testing fwrite() : error conditions *** --- Testing fwrite() with less than expected number of arguments -- - -Warning: fwrite() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) --- Testing fwrite() with more than expected number of arguments -- - -Warning: fwrite() expects at most 3 parameters, 4 given in %s on line %d -bool(false) -- Testing fwrite() with invalid length arguments -- int(0) int(0) --- Testing fwrite() with invalid arguments -- --- Iteration 1 -- - -Warning: fwrite() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fwrite() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fwrite() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fwrite() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fwrite() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing fwrite() with closed/unset file handle -- Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: fwrite() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/get_current_user.phpt b/ext/standard/tests/file/get_current_user.phpt index f23d2fabef..04938e3d6b 100644 --- a/ext/standard/tests/file/get_current_user.phpt +++ b/ext/standard/tests/file/get_current_user.phpt @@ -3,13 +3,10 @@ get_current_user() tests --FILE-- <?php -var_dump(get_current_user("blah")); var_dump(get_current_user()); echo "Done\n"; ?> --EXPECTF-- -Warning: get_current_user() expects exactly 0 parameters, 1 given in %s on line %d -NULL string(%d) %s Done diff --git a/ext/standard/tests/file/glob_variation-win32-mb.phpt b/ext/standard/tests/file/glob_variation-win32-mb.phpt index cba2e2b343..8d1ae00c34 100644 --- a/ext/standard/tests/file/glob_variation-win32-mb.phpt +++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt @@ -46,12 +46,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -73,7 +77,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -326,24 +334,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -446,9 +437,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32-mb.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt index 5027ac03e6..2706377d8c 100644 --- a/ext/standard/tests/file/glob_variation-win32.phpt +++ b/ext/standard/tests/file/glob_variation-win32.phpt @@ -45,12 +45,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -72,7 +76,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -325,24 +333,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -445,9 +436,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt index 9d3b879379..3c20a49b31 100644 --- a/ext/standard/tests/file/glob_variation.phpt +++ b/ext/standard/tests/file/glob_variation.phpt @@ -48,12 +48,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -75,7 +79,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -328,24 +336,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -448,9 +439,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt index c1664165eb..060739ff3d 100644 --- a/ext/standard/tests/file/is_dir_variation3.phpt +++ b/ext/standard/tests/file/is_dir_variation3.phpt @@ -9,8 +9,6 @@ Test is_dir() function: usage variations - invalid arguments /* Passing invalid arguments to is_dir() */ -$dir_handle = opendir( dirname(__FILE__) ); - echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n"; $dirnames = array( /* Invalid dirnames */ @@ -19,7 +17,6 @@ $dirnames = array( FALSE, NULL, " ", - $dir_handle, /* scalars */ 0, @@ -30,7 +27,6 @@ $dirnames = array( foreach($dirnames as $dirname) { var_dump( is_dir($dirname) ); } -closedir($dir_handle); echo "\n*** Done ***"; ?> @@ -41,9 +37,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_dir() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL bool(false) bool(false) diff --git a/ext/standard/tests/file/is_dir_variation4.phpt b/ext/standard/tests/file/is_dir_variation4.phpt index 5c0be485c5..3c3d0852ef 100644 --- a/ext/standard/tests/file/is_dir_variation4.phpt +++ b/ext/standard/tests/file/is_dir_variation4.phpt @@ -38,7 +38,11 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir) { echo "\n-- Iteration $count --\n"; - var_dump( is_dir($file_path."/".$dir ) ); + try { + var_dump( is_dir($file_path."/".$dir ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -77,13 +81,9 @@ bool(true) bool(false) -- Iteration 9 -- - -Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_dir() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_dir() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/is_executable_error.phpt b/ext/standard/tests/file/is_executable_error.phpt index 4fb3dbaf5f..e4b43095e3 100644 --- a/ext/standard/tests/file/is_executable_error.phpt +++ b/ext/standard/tests/file/is_executable_error.phpt @@ -6,24 +6,11 @@ Test is_executable() function: error conditions Description: Tells whether the filename is executable */ -echo "*** Testing is_executable(): error conditions ***\n"; -var_dump( is_executable() ); // args < expected no of arguments - -var_dump( is_executable(1, 2) ); // args > expected no. of arguments - echo "\n*** Testing is_exceutable() on non-existent directory ***\n"; var_dump( is_executable(dirname(__FILE__)."/is_executable") ); echo "Done\n"; --EXPECTF-- -*** Testing is_executable(): error conditions *** - -Warning: is_executable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_executable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_exceutable() on non-existent directory *** bool(false) Done diff --git a/ext/standard/tests/file/is_executable_variation1.phpt b/ext/standard/tests/file/is_executable_variation1.phpt index 1cd0a8d209..784685705b 100644 --- a/ext/standard/tests/file/is_executable_variation1.phpt +++ b/ext/standard/tests/file/is_executable_variation1.phpt @@ -51,7 +51,11 @@ $counter = 1; is an executable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_executable($file) ); + try { + var_dump( is_executable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -76,13 +80,9 @@ bool(false) -- Iteration 5 -- bool(false) -- Iteration 6 -- - -Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_executable() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_executable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- bool(false) -- Iteration 9 -- diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt index a804f66eb2..637bbacd67 100644 --- a/ext/standard/tests/file/is_executable_variation3.phpt +++ b/ext/standard/tests/file/is_executable_variation3.phpt @@ -38,7 +38,6 @@ $invalid_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -61,8 +60,5 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_executable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) Done diff --git a/ext/standard/tests/file/is_file_variation3.phpt b/ext/standard/tests/file/is_file_variation3.phpt index ec70371417..1b94594faa 100644 --- a/ext/standard/tests/file/is_file_variation3.phpt +++ b/ext/standard/tests/file/is_file_variation3.phpt @@ -21,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -50,9 +49,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_file() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL bool(false) bool(false) diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt index 505331d2c9..689ae1098f 100644 --- a/ext/standard/tests/file/is_file_variation4.phpt +++ b/ext/standard/tests/file/is_file_variation4.phpt @@ -38,7 +38,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( is_file( $file_path."/".$file ) ); + try { + var_dump( is_file( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -67,12 +71,8 @@ bool(false) - Iteration 6 - bool(false) - Iteration 7 - - -Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_file() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_file() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/is_readable_error.phpt b/ext/standard/tests/file/is_readable_error.phpt index 9a734cd14d..8a4b507b6f 100644 --- a/ext/standard/tests/file/is_readable_error.phpt +++ b/ext/standard/tests/file/is_readable_error.phpt @@ -6,24 +6,12 @@ Test is_readable() function: error conditions Description: Tells whether the filename is readable */ -echo "*** Testing is_readable(): error conditions ***\n"; -var_dump( is_readable() ); // args < expected -var_dump( is_readable(1, 2) ); // args > expected - echo "\n*** Testing is_readable() on non-existent file ***\n"; var_dump( is_readable(dirname(__FILE__)."/is_readable.tmp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing is_readable(): error conditions *** - -Warning: is_readable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_readable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_readable() on non-existent file *** bool(false) Done diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt index 0ba2324f9a..b6570fb911 100644 --- a/ext/standard/tests/file/is_readable_variation1.phpt +++ b/ext/standard/tests/file/is_readable_variation1.phpt @@ -60,7 +60,11 @@ $counter = 1; is a writable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_readable($file) ); + try { + var_dump( is_readable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -87,17 +91,11 @@ bool(false) -- Iteration 6 -- bool(false) -- Iteration 7 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 9 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 10 -- bool(true) -- Iteration 11 -- diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt index 74fc7af574..48b4e30386 100644 --- a/ext/standard/tests/file/is_readable_variation3.phpt +++ b/ext/standard/tests/file/is_readable_variation3.phpt @@ -37,7 +37,6 @@ $misc_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -60,8 +59,5 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_readable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) Done diff --git a/ext/standard/tests/file/is_uploaded_file_basic.phpt b/ext/standard/tests/file/is_uploaded_file_basic.phpt index 1721935549..d053244a79 100644 --- a/ext/standard/tests/file/is_uploaded_file_basic.phpt +++ b/ext/standard/tests/file/is_uploaded_file_basic.phpt @@ -29,19 +29,9 @@ var_dump(is_uploaded_file('random_filename.txt')); // not an uploaded file var_dump(is_uploaded_file('__FILE__')); -// Error cases -var_dump(is_uploaded_file()); -var_dump(is_uploaded_file('a', 'b')); - ?> --EXPECTF-- bool(true) bool(false) bool(false) bool(false) - -Warning: is_uploaded_file() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_uploaded_file() expects exactly 1 parameter, 2 given in %s on line %d -NULL diff --git a/ext/standard/tests/file/is_writable_error.phpt b/ext/standard/tests/file/is_writable_error.phpt index e3755bc748..e1641e0e9f 100644 --- a/ext/standard/tests/file/is_writable_error.phpt +++ b/ext/standard/tests/file/is_writable_error.phpt @@ -8,14 +8,6 @@ Test is_writable() and its alias is_writeable() function: error conditions is_writeable() is an alias of is_writable() */ -echo "*** Testing is_writable(): error conditions ***\n"; -var_dump( is_writable() ); // args < expected -var_dump( is_writeable() ); - -echo "\n*** Testing is_writeable(): error conditions ***\n"; -var_dump( is_writable(1, 2) ); // args > expected -var_dump( is_writeable(1, 2) ); - echo "\n*** Testing is_writable() on non-existent file ***\n"; var_dump( is_writable(dirname(__FILE__)."/is_writable") ); var_dump( is_writeable(dirname(__FILE__)."/is_writable") ); @@ -23,22 +15,6 @@ var_dump( is_writeable(dirname(__FILE__)."/is_writable") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing is_writable(): error conditions *** - -Warning: is_writable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_writeable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -*** Testing is_writeable(): error conditions *** - -Warning: is_writable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: is_writeable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_writable() on non-existent file *** bool(false) bool(false) diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt index f5cdf6a8a0..ec9756fbf1 100644 --- a/ext/standard/tests/file/is_writable_variation1.phpt +++ b/ext/standard/tests/file/is_writable_variation1.phpt @@ -62,8 +62,16 @@ $counter = 1; is a writable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_writable($file) ); - var_dump( is_writeable($file) ); + try { + var_dump( is_writable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( is_writeable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -96,26 +104,14 @@ bool(false) bool(false) bool(false) -- Iteration 7 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 9 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 10 -- bool(true) bool(true) diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt index 3cc7a4da9d..d533a2745d 100644 --- a/ext/standard/tests/file/is_writable_variation3.phpt +++ b/ext/standard/tests/file/is_writable_variation3.phpt @@ -35,7 +35,6 @@ $misc_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -66,12 +65,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_writable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) bool(false) Done diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt index f4b4f5089e..18e0407fdc 100644 --- a/ext/standard/tests/file/lchown_error.phpt +++ b/ext/standard/tests/file/lchown_error.phpt @@ -29,20 +29,9 @@ $filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown.txt'; touch( $filename ); $uid = posix_getuid(); - -// Less than expected arguments -var_dump( lchown( $filename ) ); - -// More than expected arguments -var_dump( lchown( $filename, $uid, 'foobar' ) ); - // Non-existent filename var_dump( lchown( 'foobar_lchown.txt', $uid ) ); -// Wrong argument types -var_dump( lchown( new StdClass(), $uid ) ); -var_dump( lchown( array(), $uid ) ); - // Bad user var_dump( lchown( $filename, -5 ) ); @@ -58,21 +47,9 @@ unlink($filename); --EXPECTF-- *** Testing lchown() : error functionality *** -Warning: lchown() expects exactly 2 parameters, 1 given in %s on line %d -bool(true) - -Warning: lchown() expects exactly 2 parameters, 3 given in %s on line %d -bool(true) - Warning: lchown(): No such file or directory in %s on line %d bool(false) -Warning: lchown() expects parameter 1 to be a valid path, object given in %s on line %d -bool(true) - -Warning: lchown() expects parameter 1 to be a valid path, array given in %s on line %d -bool(true) - Warning: lchown(): %r(Operation not permitted|Invalid argument)%r in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/file/lstat_stat_error.phpt b/ext/standard/tests/file/lstat_stat_error.phpt index 8f290a32e3..e6fccd5acc 100644 --- a/ext/standard/tests/file/lstat_stat_error.phpt +++ b/ext/standard/tests/file/lstat_stat_error.phpt @@ -17,54 +17,28 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing lstat() for error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( lstat() ); // args < expected -var_dump( lstat(__FILE__, 2) ); // args > expected var_dump( lstat("$file_path/temp.tmp") ); // non existing file var_dump( lstat(22) ); // scalar argument -$arr = array(__FILE__); -var_dump( lstat($arr) ); // array argument echo "\n*** Testing stat() for error conditions ***\n"; -var_dump( stat() ); // args < expected -var_dump( stat(__FILE__, 2) ); // file, args > expected -var_dump( stat(dirname(__FILE__), 2) ); //dir, args > expected var_dump( stat("$file_path/temp.tmp") ); // non existing file var_dump( stat("$file_path/temp/") ); // non existing dir var_dump( stat(22) ); // scalar argument -var_dump( stat($arr) ); // array argument echo "Done\n"; ?> --EXPECTF-- *** Testing lstat() for error conditions *** -Warning: lstat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: lstat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: lstat(): Lstat failed for %s in %s on line %d bool(false) Warning: lstat(): Lstat failed for 22 in %s on line %d bool(false) -Warning: lstat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL - *** Testing stat() for error conditions *** -Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: stat(): stat failed for %s in %s on line %d bool(false) @@ -73,7 +47,4 @@ bool(false) Warning: stat(): stat failed for 22 in %s on line %d bool(false) - -Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/mkdir_rmdir_error.phpt b/ext/standard/tests/file/mkdir_rmdir_error.phpt index 17f908c3f6..be0b434c2c 100644 --- a/ext/standard/tests/file/mkdir_rmdir_error.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_error.phpt @@ -9,48 +9,12 @@ Test mkdir() and rmdir() functions : error conditions Description: Removes directory */ -echo "*** Testing mkdir(): error conditions ***\n"; -var_dump( mkdir() ); // args < expected -var_dump( mkdir(1, 2, 3, 4, 5) ); // args > expected -var_dump( mkdir("testdir", 0777, false, $context, "test") ); // args > expected - -echo "\n*** Testing rmdir(): error conditions ***\n"; -var_dump( rmdir() ); // args < expected -var_dump( rmdir(1, 2, 3) ); // args > expected -var_dump( rmdir("testdir", $context, "test") ); // args > expected - echo "\n*** Testing rmdir() on non-existent directory ***\n"; var_dump( rmdir("temp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing mkdir(): error conditions *** - -Warning: mkdir() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -Notice: Undefined variable: context in %s on line %d - -Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -*** Testing rmdir(): error conditions *** - -Warning: rmdir() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: context in %s on line %d - -Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - *** Testing rmdir() on non-existent directory *** Warning: rmdir(temp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt index 24dfc96ac9..0af1055178 100644 --- a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt @@ -35,8 +35,16 @@ var_dump( mkdir("$file_path/mkdir_variation2/test/", 0777, true) ); var_dump( rmdir("$file_path/mkdir_variation2/") ); echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n"; -var_dump( mkdir("$file_path/temp".chr(0)."/") ); -var_dump( rmdir("$file_path/temp".chr(0)."/") ); +try { + var_dump( mkdir("$file_path/temp".chr(0)."/") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( rmdir("$file_path/temp".chr(0)."/") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n*** Testing mkdir() with miscelleneous input ***\n"; /* changing mode of mkdir to prevent creating sub-directory under it */ @@ -64,12 +72,8 @@ Warning: rmdir(%s/mkdir_variation2/): %s on line %d bool(false) *** Testing mkdir() and rmdir() for binary safe functionality *** - -Warning: mkdir() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) - -Warning: rmdir() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) +mkdir() expects parameter 1 to be a valid path, string given +rmdir() expects parameter 1 to be a valid path, string given *** Testing mkdir() with miscelleneous input *** bool(true) diff --git a/ext/standard/tests/file/move_uploaded_file_basic.phpt b/ext/standard/tests/file/move_uploaded_file_basic.phpt index c6cfdd3203..7af8748fe2 100644 --- a/ext/standard/tests/file/move_uploaded_file_basic.phpt +++ b/ext/standard/tests/file/move_uploaded_file_basic.phpt @@ -49,11 +49,6 @@ fclose($fd); var_dump(move_uploaded_file($_FILES['file2']['tmp_name'], $destination4)); unlink($destination4); -echo "Wrong parameters\n"; -var_dump(move_uploaded_file()); -var_dump(move_uploaded_file(1, 2, 3)); - - ?> --EXPECTF-- Valid move @@ -66,10 +61,3 @@ Non-uploaded source file bool(false) Valid move to existing file bool(true) -Wrong parameters - -Warning: move_uploaded_file() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: move_uploaded_file() expects exactly 2 parameters, 3 given in %s on line %d -NULL diff --git a/ext/standard/tests/file/parse_ini_file_error.phpt b/ext/standard/tests/file/parse_ini_file_error.phpt index 29e022fb13..5c812d7b9a 100644 --- a/ext/standard/tests/file/parse_ini_file_error.phpt +++ b/ext/standard/tests/file/parse_ini_file_error.phpt @@ -10,10 +10,6 @@ Test parse_ini_file() function : error conditions echo "*** Testing parse_ini_file() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing parse_ini_file() function with Zero arguments --\n"; -var_dump( parse_ini_file() ); - //Test parse_ini_file with one more than the expected number of arguments echo "\n-- Testing parse_ini_file() function with more than expected no. of arguments --\n"; $filename = 'string_val'; @@ -30,11 +26,6 @@ echo "Done"; --EXPECTF-- *** Testing parse_ini_file() : error conditions *** --- Testing parse_ini_file() function with Zero arguments -- - -Warning: parse_ini_file() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -- Testing parse_ini_file() function with more than expected no. of arguments -- Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/parse_ini_file_variation3.phpt b/ext/standard/tests/file/parse_ini_file_variation3.phpt index 96d44433f7..acdb4d83eb 100644 --- a/ext/standard/tests/file/parse_ini_file_variation3.phpt +++ b/ext/standard/tests/file/parse_ini_file_variation3.phpt @@ -43,7 +43,6 @@ log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On -track_errors = Off docref_root = "/phpmanual/" docref_ext = .html @@ -77,7 +76,7 @@ foreach($newdirs as $newdir) { --EXPECTF-- *** Testing parse_ini_file() : variation *** New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S -array(11) { +array(10) { ["error_reporting"]=> string(5) "32767" ["display_errors"]=> @@ -94,8 +93,6 @@ array(11) { string(0) "" ["report_memleaks"]=> string(1) "1" - ["track_errors"]=> - string(0) "" ["docref_root"]=> string(11) "/phpmanual/" ["docref_ext"]=> diff --git a/ext/standard/tests/file/pathinfo_variaton.phpt b/ext/standard/tests/file/pathinfo_variaton.phpt index 421f378e01..6f4492e375 100644 --- a/ext/standard/tests/file/pathinfo_variaton.phpt +++ b/ext/standard/tests/file/pathinfo_variaton.phpt @@ -43,9 +43,6 @@ $paths = array ( "./array(1, 2)", "array( array(), null)", - /* pathname as object */ - $obj, - /* pathname as spaces */ " ", ' ', @@ -199,22 +196,6 @@ string(21) "array( array(), null)" string(0) "" string(21) "array( array(), null)" -- Iteration 9 -- - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL --- Iteration 10 -- array(3) { ["dirname"]=> string(1) "." @@ -227,7 +208,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 11 -- +-- Iteration 10 -- array(3) { ["dirname"]=> string(1) "." @@ -240,7 +221,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 12 -- +-- Iteration 11 -- array(2) { ["basename"]=> string(0) "" @@ -251,7 +232,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 13 -- +-- Iteration 12 -- array(2) { ["basename"]=> string(0) "" @@ -262,7 +243,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 14 -- +-- Iteration 13 -- array(2) { ["basename"]=> string(0) "" @@ -273,7 +254,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 15 -- +-- Iteration 14 -- array(2) { ["basename"]=> string(0) "" @@ -284,7 +265,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 16 -- +-- Iteration 15 -- array(2) { ["basename"]=> string(0) "" @@ -295,7 +276,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 17 -- +-- Iteration 16 -- array(4) { ["dirname"]=> string(1) "." @@ -310,7 +291,7 @@ string(1) "." string(11) "www.foo.com" string(3) "com" string(7) "www.foo" --- Iteration 18 -- +-- Iteration 17 -- array(4) { ["dirname"]=> string(17) "/var/html/testdir" @@ -325,7 +306,7 @@ string(17) "/var/html/testdir" string(12) "example.html" string(4) "html" string(7) "example" --- Iteration 19 -- +-- Iteration 18 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -338,7 +319,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 20 -- +-- Iteration 19 -- array(4) { ["dirname"]=> string(4) "/foo" @@ -353,7 +334,7 @@ string(4) "/foo" string(12) "symlink.link" string(4) "link" string(7) "symlink" --- Iteration 21 -- +-- Iteration 20 -- array(3) { ["dirname"]=> string(1) "." @@ -366,7 +347,7 @@ string(1) "." string(5) "12345" string(0) "" string(5) "12345" --- Iteration 22 -- +-- Iteration 21 -- array(4) { ["dirname"]=> string(1) "." @@ -381,7 +362,7 @@ string(1) "." string(15) "www.example.com" string(3) "com" string(11) "www.example" --- Iteration 23 -- +-- Iteration 22 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -394,7 +375,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 24 -- +-- Iteration 23 -- array(4) { ["dirname"]=> string(6) "../foo" @@ -409,7 +390,7 @@ string(6) "../foo" string(9) "test.link" string(4) "link" string(4) "test" --- Iteration 25 -- +-- Iteration 24 -- array(4) { ["dirname"]=> string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6" @@ -424,7 +405,7 @@ string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/tes string(8) "test.tmp" string(3) "tmp" string(4) "test" --- Iteration 26 -- +-- Iteration 25 -- array(4) { ["dirname"]=> string(1) "." diff --git a/ext/standard/tests/file/popen_pclose_error.phpt b/ext/standard/tests/file/popen_pclose_error.phpt index 93ed5d946e..22fe309741 100644 --- a/ext/standard/tests/file/popen_pclose_error.phpt +++ b/ext/standard/tests/file/popen_pclose_error.phpt @@ -16,14 +16,9 @@ if (strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN') */ $file_path = dirname(__FILE__); echo "*** Testing for error conditions ***\n"; -var_dump( popen() ); // Zero Arguments -var_dump( popen("abc.txt") ); // Single Argument var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument -var_dump( pclose() ); $file_handle = fopen($file_path."/popen.tmp", "w"); -var_dump( pclose($file_handle, $file_handle) ); fclose($file_handle); -var_dump( pclose(1) ); echo "\n--- Done ---"; ?> --CLEAN-- @@ -34,22 +29,7 @@ unlink($file_path."/popen.tmp"); --EXPECTF-- *** Testing for error conditions *** -Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: popen(abc.txt,rw): %s on line %d bool(false) -Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: pclose() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - --- Done --- diff --git a/ext/standard/tests/file/readfile_error.phpt b/ext/standard/tests/file/readfile_error.phpt index fcaa7f3946..c74b63d0d6 100644 --- a/ext/standard/tests/file/readfile_error.phpt +++ b/ext/standard/tests/file/readfile_error.phpt @@ -9,17 +9,12 @@ Test readfile() function: error conditions $context = stream_context_create(); echo "*** Test readfile(): error conditions ***\n"; -echo "-- Testing readfile() with unexpected no. of arguments --\n"; -var_dump( readfile() ); // args < expected -var_dump( readfile(__FILE__, true, $context, 4) ); // args > expected echo "\n-- Testing readfile() with invalid arguments --\n"; // invalid arguments var_dump( readfile(NULL) ); // NULL as $filename var_dump( readfile('') ); // empty string as $filename var_dump( readfile(false) ); // boolean false as $filename -var_dump( readfile(__FILE__, false, '') ); // empty string as $context -var_dump( readfile(__FILE__, true, false) ); // boolean false as $context echo "\n-- Testing readfile() with non-existent file --\n"; $non_existent_file = dirname(__FILE__)."/non_existent_file.tmp"; @@ -29,13 +24,6 @@ echo "Done\n"; ?> --EXPECTF-- *** Test readfile(): error conditions *** --- Testing readfile() with unexpected no. of arguments -- - -Warning: readfile() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: readfile() expects at most 3 parameters, 4 given in %s on line %d -bool(false) -- Testing readfile() with invalid arguments -- @@ -48,12 +36,6 @@ bool(false) Warning: readfile(): Filename cannot be empty in %s on line %d bool(false) -Warning: readfile() expects parameter 3 to be resource, string given in %s on line %d -bool(false) - -Warning: readfile() expects parameter 3 to be resource, bool given in %s on line %d -bool(false) - -- Testing readfile() with non-existent file -- Warning: readfile(%s/non_existent_file.tmp): failed to open stream: %s in %s on line %d diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt index a240a826b9..04fdafca79 100644 --- a/ext/standard/tests/file/readfile_variation10-win32.phpt +++ b/ext/standard/tests/file/readfile_variation10-win32.phpt @@ -36,8 +36,12 @@ $names_arr = array( ); foreach($names_arr as $key => $value) { - echo "\n-- Filename: $key --\n"; - readfile($value); + echo "\n-- Filename: $key --\n"; + try { + readfile($value); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> @@ -70,12 +74,10 @@ Warning: readfile(): Filename cannot be empty in %s on line %d Warning: readfile( ): failed to open stream: Permission denied in %s on line %d -- Filename: \0 -- - -Warning: readfile() expects parameter 1 to be a valid path, string given in %s on line %d +readfile() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: readfile() expects parameter 1 to be a valid path, array given in %s on line %d +readfile() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt Binary files differindex 59b92ad365..5a0070c04f 100644 --- a/ext/standard/tests/file/readfile_variation10.phpt +++ b/ext/standard/tests/file/readfile_variation10.phpt diff --git a/ext/standard/tests/file/readlink_realpath_error.phpt b/ext/standard/tests/file/readlink_realpath_error.phpt index dc042bfff5..f7fd340aab 100644 --- a/ext/standard/tests/file/readlink_realpath_error.phpt +++ b/ext/standard/tests/file/readlink_realpath_error.phpt @@ -15,10 +15,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { Description: Returns canonicalized absolute pathname */ -echo "*** Testing readlink(): error conditions ***\n"; -var_dump( readlink() ); // args < expected -var_dump( readlink(__FILE__, 2) ); // args > expected - echo "\n*** Testing readlink() on a non-existent link ***\n"; var_dump( readlink(dirname(__FILE__)."/readlink_error.tmp") ); @@ -28,24 +24,12 @@ var_dump( readlink(__FILE__) ); echo "\n*** Testing readlink() on existing directory ***\n"; var_dump( readlink(dirname(__FILE__)) ); -echo "*** Testing realpath(): error conditions ***\n"; -var_dump( realpath() ); // args < expected -var_dump( realpath(1, 2) ); // args > expected - echo "\n*** Testing realpath() on a non-existent file ***\n"; var_dump( realpath(dirname(__FILE__)."/realpath_error.tmp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing readlink(): error conditions *** - -Warning: readlink() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: readlink() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing readlink() on a non-existent link *** Warning: readlink(): No such file or directory in %s on line %d @@ -60,13 +44,6 @@ bool(false) Warning: readlink(): Invalid argument in %s on line %d bool(false) -*** Testing realpath(): error conditions *** - -Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d -NULL *** Testing realpath() on a non-existent file *** %s diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt index c350a94c77..eef16630d2 100644 --- a/ext/standard/tests/file/readlink_variation1.phpt +++ b/ext/standard/tests/file/readlink_variation1.phpt @@ -16,7 +16,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { /* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/readlink_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -26,7 +25,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -38,7 +36,6 @@ foreach( $filenames as $filename ) { var_dump( readlink($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -65,9 +62,6 @@ bool(false) Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: readlink(): %s in %s on line %d bool(false) diff --git a/ext/standard/tests/file/realpath_error-win32.phpt b/ext/standard/tests/file/realpath_error-win32.phpt deleted file mode 100644 index 2fd221e45a..0000000000 --- a/ext/standard/tests/file/realpath_error-win32.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Test realpath() function: error conditions ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip only on Windows'); -} -?> ---FILE-- -<?php -/* Prototype: string realpath ( string $path ); - Description: Returns canonicalized absolute pathname -*/ - -echo "*** Testing realpath() for error conditions ***\n"; -var_dump( realpath() ); // args < expected -var_dump( realpath(1, 2) ); // args > expected - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing realpath() for error conditions *** - -Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt Binary files differindex 6319d4ad61..977746a21d 100644 --- a/ext/standard/tests/file/rename_variation13-win32.phpt +++ b/ext/standard/tests/file/rename_variation13-win32.phpt diff --git a/ext/standard/tests/file/rename_variation13.phpt b/ext/standard/tests/file/rename_variation13.phpt index 2686150f23..07ee8aa9d8 100644 --- a/ext/standard/tests/file/rename_variation13.phpt +++ b/ext/standard/tests/file/rename_variation13.phpt @@ -30,8 +30,6 @@ $names_arr = array( NULL, "", " ", - "\0", - array(), /* prefix with path separator of a non existing directory*/ "/no/such/file/dir", @@ -97,24 +95,6 @@ bool(true) Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d bool(false) --- testing '%s' -- - -Warning: rename() %s in %s on line %d -bool(false) - -Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d - -Warning: rename() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) --- testing 'Array' -- - -Warning: rename() expects parameter 2 to be a valid path, array given in %s on line %d -bool(false) - -Warning: file_exists() expects parameter 1 to be a valid path, array given in %s on line %d - -Warning: rename() expects parameter 1 to be a valid path, array given in %s on line %d -bool(false) -- testing '/no/such/file/dir' -- Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/stat_error-win32.phpt b/ext/standard/tests/file/stat_error-win32.phpt index 20bffc79df..59c4fd6dee 100644 --- a/ext/standard/tests/file/stat_error-win32.phpt +++ b/ext/standard/tests/file/stat_error-win32.phpt @@ -17,29 +17,16 @@ $file_path = dirname(__FILE__); $arr = array(__FILE__); echo "\n*** Testing stat() for error conditions ***\n"; -var_dump( stat() ); // args < expected -var_dump( stat(__FILE__, 2) ); // file, args > expected -var_dump( stat(dirname(__FILE__), 2) ); //dir, args > expected var_dump( stat("$file_path/temp.tmp") ); // non existing file var_dump( stat("$file_path/temp/") ); // non existing dir var_dump( stat(22) ); // scalar argument -var_dump( stat($arr) ); // array argument echo "Done\n"; ?> --EXPECTF-- *** Testing stat() for error conditions *** -Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: stat(): stat failed for %s in %s on line %d bool(false) @@ -48,7 +35,4 @@ bool(false) Warning: stat(): stat failed for 22 in %s on line %d bool(false) - -Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/stream_002.phpt b/ext/standard/tests/file/stream_002.phpt index b18dd85b31..84f3b78f06 100644 --- a/ext/standard/tests/file/stream_002.phpt +++ b/ext/standard/tests/file/stream_002.phpt @@ -15,8 +15,6 @@ var_dump(stream_socket_client(".", $a, $b)); var_dump($a, $b); var_dump(stream_socket_client(1, $a, $b)); var_dump($a, $b); -var_dump(stream_socket_client(array(), $a, $b)); -var_dump($a, $b); echo "Done\n"; ?> @@ -45,9 +43,4 @@ Warning: stream_socket_client(): unable to connect to 1 (Failed to parse address bool(false) int(0) string(27) "Failed to parse address "1"" - -Warning: stream_socket_client() expects parameter 1 to be string, array given in %s on line %d -bool(false) -int(0) -string(27) "Failed to parse address "1"" Done diff --git a/ext/standard/tests/file/stream_rfc2397_002.phpt b/ext/standard/tests/file/stream_rfc2397_002.phpt index 1dce5adf6c..6c58d0d7ad 100644 --- a/ext/standard/tests/file/stream_rfc2397_002.phpt +++ b/ext/standard/tests/file/stream_rfc2397_002.phpt @@ -24,9 +24,11 @@ $streams = array( foreach($streams as $stream) { $stream = fopen($stream, 'r'); - $meta = @stream_get_meta_data($stream); - var_dump($meta); - var_dump(isset($meta['foo']) ? $meta['foo'] : null); + if ($stream) { + $meta = stream_get_meta_data($stream); + var_dump($meta); + var_dump(isset($meta['foo']) ? $meta['foo'] : null); + } } ?> @@ -52,8 +54,6 @@ array(7) { NULL Warning: fopen(data://): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL array(7) { ["base64"]=> bool(true) @@ -73,16 +73,10 @@ array(7) { NULL Warning: fopen(data://;base64): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL Warning: fopen(data://foo,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d -NULL -NULL Warning: fopen(data://foo=bar,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d -NULL -NULL array(8) { ["mediatype"]=> string(10) "text/plain" @@ -104,8 +98,6 @@ array(8) { NULL Warning: fopen(data://text/plain;foo,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d -NULL -NULL array(9) { ["mediatype"]=> string(10) "text/plain" @@ -129,8 +121,6 @@ array(9) { string(3) "bar" Warning: fopen(data://text/plain;foo=bar;bla,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d -NULL -NULL array(9) { ["mediatype"]=> string(10) "text/plain" @@ -154,8 +144,6 @@ array(9) { string(3) "bar" Warning: fopen(data://text/plain;foo=bar;bar=baz): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL array(10) { ["mediatype"]=> string(10) "text/plain" diff --git a/ext/standard/tests/file/stream_rfc2397_006.phpt b/ext/standard/tests/file/stream_rfc2397_006.phpt index f6616a0c88..18d1c1b280 100644 --- a/ext/standard/tests/file/stream_rfc2397_006.phpt +++ b/ext/standard/tests/file/stream_rfc2397_006.phpt @@ -14,18 +14,19 @@ $streams = array( foreach($streams as $stream) { - var_dump(file_get_contents($stream)); + try { + var_dump(file_get_contents($stream)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d -NULL - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given +file_get_contents() expects parameter 1 to be a valid path, string given Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhcg==): failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d bool(false) diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt index 7e8b5b24cf..6a1d026a79 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt @@ -33,11 +33,6 @@ fclose($fp); $linkname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error1.tmp"; echo "*** Testing symlink() for error conditions ***\n"; -//zero arguments -var_dump( symlink() ); - -//more than expected -var_dump( symlink($filename, $linkname, true) ); //invalid arguments var_dump( symlink(NULL, $linkname) ); // NULL as filename @@ -48,11 +43,6 @@ var_dump( symlink($filename, '') ); // '' as linkname var_dump( symlink($filename, false) ); // false as linkname echo "\n*** Testing linkinfo() for error conditions ***\n"; -//zero arguments -var_dump( linkinfo() ); - -//more than expected -var_dump( linkinfo($linkname, true) ); //invalid arguments var_dump( linkinfo(NULL) ); // NULL as linkname @@ -69,12 +59,6 @@ unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_error1.tmp"); --EXPECTF-- *** Testing symlink() for error conditions *** -Warning: symlink() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: symlink() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: symlink(): %s in %s on line %d bool(false) @@ -95,12 +79,6 @@ bool(false) *** Testing linkinfo() for error conditions *** -Warning: linkinfo() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: linkinfo() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: linkinfo(): %s in %s on line %d int(-1) diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt index fc891fde7b..00047cde5e 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt @@ -30,11 +30,6 @@ fclose($fp); $linkname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error2.tmp"; echo "*** Testing link() for error conditions ***\n"; -//zero arguments -var_dump( link() ); - -//more than expected -var_dump( link($filename, $linkname, false) ); //invalid arguments var_dump( link(NULL, $linkname) ); // NULL as filename @@ -46,11 +41,6 @@ var_dump( link($filename, '') ); // '' as linkname var_dump( link($filename, false) ); // false as linkname echo "\n*** Testing is_link() for error conditions ***\n"; -//zero arguments -var_dump( is_link() ); - -//more than expected -var_dump( is_link($linkname, "/") ); //invalid arguments var_dump( is_link(NULL) ); // NULL as linkname @@ -68,12 +58,6 @@ unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_error2.tmp"); --EXPECTF-- *** Testing link() for error conditions *** -Warning: link() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: link() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: link(): No such file or directory in %s on line %d bool(false) @@ -96,12 +80,6 @@ Warning: link(): No such file or directory in %s on line %d bool(false) *** Testing is_link() for error conditions *** - -Warning: is_link() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_link() expects exactly 1 parameter, 2 given in %s on line %d -NULL bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index 6d5071b5e5..d7602326d9 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -59,7 +59,12 @@ $res_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($file_path, $names_arr[$i]); + try { + $file_name = tempnam($file_path, $names_arr[$i]); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } /* creating the files in existing dir */ if (file_exists($file_name) && !$res_arr[$i]) { @@ -104,14 +109,9 @@ Notice: tempnam(): file created in the system's temporary directory in %stempnam Failed, not created in the correct directory %s vs %s 0 -- Iteration 6 -- - -Warning: tempnam() expects parameter 2 to be a valid path, string given in %stempnam_variation3-win32.php on line 54 -Failed, not created in the correct directory %s vs %sext\standard\tests\file\tempnamVar3 -0 +tempnam() expects parameter 2 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 2 to be a valid path, array given in %s\ext\standard\tests\file\tempnam_variation3-win32.php on line %d -OK +tempnam() expects parameter 2 to be a valid path, array given -- Iteration 8 -- OK -- Iteration 9 -- diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index 2d95cb0a43..ccbd35084f 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -37,7 +37,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam("$file_path", $names_arr[$i]); + try { + $file_name = tempnam("$file_path", $names_arr[$i]); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } /* creating the files in existing dir */ if( file_exists($file_name) ) { @@ -100,17 +105,9 @@ File name is => %s/%s File permissions are => 100600 File created in => directory specified -- Iteration 6 -- - -Warning: tempnam() expects parameter 2 to be a valid path, string given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 2 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 2 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 2 to be a valid path, array given -- Iteration 8 -- File name is => %s/dir%s File permissions are => 100600 diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 5bacb5e876..f4b3cf016c 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -34,7 +34,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + try { + $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } if( file_exists($file_name) ){ @@ -95,17 +100,9 @@ File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 6 -- - -Warning: tempnam() expects parameter 1 to be a valid path, string given in %stempnam_variation7-win32.php on line %d --- File is not created -- - -Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d +tempnam() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d +tempnam() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index 9ed84f974a..680e207718 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -35,7 +35,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + try { + $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } if( file_exists($file_name) ){ @@ -100,17 +105,9 @@ File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 6 -- - -Warning: tempnam() expects parameter 1 to be a valid path, string given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt index 42d1fad1e5..119ffd3204 100644 --- a/ext/standard/tests/file/touch.phpt +++ b/ext/standard/tests/file/touch.phpt @@ -13,7 +13,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { // output to linux. This could be a php.net bug on windows or a windows querk. $filename = dirname(__FILE__)."/touch.dat"; -var_dump(touch()); var_dump(touch($filename)); var_dump(filemtime($filename)); @unlink($filename); @@ -39,8 +38,6 @@ var_dump(touch("/no/such/file/or/directory")); echo "Done\n"; ?> --EXPECTF-- -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL bool(true) int(%d) bool(true) diff --git a/ext/standard/tests/file/touch_error.phpt b/ext/standard/tests/file/touch_error.phpt index 0520055a90..9a4bd01e13 100644 --- a/ext/standard/tests/file/touch_error.phpt +++ b/ext/standard/tests/file/touch_error.phpt @@ -5,17 +5,9 @@ Dave Kelsey <d_kelsey@uk.ibm.com> --FILE-- <?php -var_dump(touch()); -var_dump(touch(1, 2, 3, 4)); var_dump(touch("/no/such/file/or/directory")); ?> --EXPECTF-- -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/unlink_error-win32-mb.phpt b/ext/standard/tests/file/unlink_error-win32-mb.phpt index efd6ee8323..2c81e33b72 100644 --- a/ext/standard/tests/file/unlink_error-win32-mb.phpt +++ b/ext/standard/tests/file/unlink_error-win32-mb.phpt @@ -25,13 +25,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected: true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -43,9 +36,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") ); @@ -68,14 +58,6 @@ rmdir(dirname(__FILE__)."/私はガラスを食べられます"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -91,12 +73,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/unlink_error-win32.phpt b/ext/standard/tests/file/unlink_error-win32.phpt index 8dde64cff0..fe165ec8c6 100644 --- a/ext/standard/tests/file/unlink_error-win32.phpt +++ b/ext/standard/tests/file/unlink_error-win32.phpt @@ -23,13 +23,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected: true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -41,9 +34,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") ); @@ -65,14 +55,6 @@ rmdir(dirname(__FILE__)."/unlink_error"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -88,12 +70,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/unlink_error.phpt b/ext/standard/tests/file/unlink_error.phpt index f7f8f00847..87b189f3cf 100644 --- a/ext/standard/tests/file/unlink_error.phpt +++ b/ext/standard/tests/file/unlink_error.phpt @@ -23,13 +23,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -41,10 +34,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") ); @@ -65,14 +54,6 @@ rmdir(dirname(__FILE__)."/unlink_error"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -88,12 +69,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/filters/001.phpt b/ext/standard/tests/filters/001.phpt index fbfdda2385..53d9fc2b50 100644 --- a/ext/standard/tests/filters/001.phpt +++ b/ext/standard/tests/filters/001.phpt @@ -7,8 +7,6 @@ var_dump(stream_filter_register("", "")); var_dump(stream_filter_register("test", "")); var_dump(stream_filter_register("", "test")); var_dump(stream_filter_register("------", "nonexistentclass")); -var_dump(stream_filter_register(array(), "aa")); -var_dump(stream_filter_register("", array())); echo "Done\n"; ?> @@ -22,10 +20,4 @@ bool(false) Warning: stream_filter_register(): Filter name cannot be empty in %s on line %d bool(false) bool(true) - -Warning: stream_filter_register() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: stream_filter_register() expects parameter 2 to be string, array given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/filters/stream_filter_remove_error.phpt b/ext/standard/tests/filters/stream_filter_remove_error.phpt index 37820a99c4..e389b20fd8 100644 --- a/ext/standard/tests/filters/stream_filter_remove_error.phpt +++ b/ext/standard/tests/filters/stream_filter_remove_error.phpt @@ -20,16 +20,6 @@ $filter = stream_filter_append( $fp, "string.rot13", STREAM_FILTER_WRITE ); echo "*** Testing stream_filter_remove() : error conditions ***\n"; -echo "\n-- Testing stream_filter_remove() function with Zero arguments --\n"; -var_dump( stream_filter_remove() ); - -echo "\n-- Testing stream_filter_remove() function with more than expected no. of arguments --\n"; -$arg = 'bogus arg'; -var_dump( stream_filter_remove( $filter, $arg ) ); - -echo "\n-- Testing stream_filter_remove() function with unexisting stream filter --\n"; -var_dump( stream_filter_remove( "fakefilter" ) ); - echo "\n-- Testing stream_filter_remove() function with bad resource --\n"; var_dump( stream_filter_remove( $fp ) ); @@ -52,21 +42,6 @@ unlink( $file ); --EXPECTF-- *** Testing stream_filter_remove() : error conditions *** --- Testing stream_filter_remove() function with Zero arguments -- - -Warning: stream_filter_remove() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing stream_filter_remove() function with more than expected no. of arguments -- - -Warning: stream_filter_remove() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - --- Testing stream_filter_remove() function with unexisting stream filter -- - -Warning: stream_filter_remove() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -- Testing stream_filter_remove() function with bad resource -- Warning: stream_filter_remove(): Invalid resource given, not a stream filter in %s on line %d diff --git a/ext/standard/tests/filters/strip_tags_filter.phpt b/ext/standard/tests/filters/strip_tags_filter.phpt deleted file mode 100644 index f353e79a9a..0000000000 --- a/ext/standard/tests/filters/strip_tags_filter.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -string.strip_tags filter ---FILE-- -<?php -$fp = fopen('php://output', 'w'); -stream_filter_append($fp, 'string.strip_tags'); -fwrite($fp, "test <b>bold</b> <i>italic</i> test\n"); -fclose($fp); - -$fp = fopen('php://output', 'w'); -stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, "<b>"); -fwrite($fp, "test <b>bold</b> <i>italic</i> test\n"); -fclose($fp); - -$fp = fopen('php://output', 'w'); -stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, ["b"]); -fwrite($fp, "test <b>bold</b> <i>italic</i> test\n"); -fclose($fp); - -?> ---EXPECTF-- -Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d -test bold italic test - -Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d -test <b>bold</b> italic test - -Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d -test <b>bold</b> italic test diff --git a/ext/standard/tests/general_functions/010.phpt b/ext/standard/tests/general_functions/010.phpt index 51132c6a15..99971616d2 100644 --- a/ext/standard/tests/general_functions/010.phpt +++ b/ext/standard/tests/general_functions/010.phpt @@ -3,24 +3,19 @@ register_shutdown_function() & __call --FILE-- <?php class test { - function _foo() { - throw new Exception('test'); - } - function __call($name=null, $args=null) { - return test::_foo(); - } + function _foo() { + throw new Exception('test'); + } + function __call($name=null, $args=null) { + return test::_foo(); + } } -try { - var_dump(register_shutdown_function(array("test","__call"))); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; -} +var_dump(register_shutdown_function(array("test","__call"))); echo "Done\n"; ?> --EXPECTF-- -Exception: Non-static method test::__call() cannot be called statically +Warning: register_shutdown_function(): Invalid shutdown callback 'test::__call' passed in %s on line %d +bool(false) Done - -Fatal error: Non-static method test::__call() cannot be called statically in %s on line %d diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt index c6ff94833d..a9d84e798b 100644 --- a/ext/standard/tests/general_functions/bug32647.phpt +++ b/ext/standard/tests/general_functions/bug32647.phpt @@ -46,13 +46,8 @@ Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d -Deprecated: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d +Warning: register_shutdown_function(): Invalid shutdown callback 'bar::barfoo' passed in %sbug32647.php on line %d Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d foo! - -Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0 - -Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0 -bar! bar! diff --git a/ext/standard/tests/general_functions/bug41970.phpt b/ext/standard/tests/general_functions/bug41970.phpt index 6f05137afc..f43bf64380 100644 --- a/ext/standard/tests/general_functions/bug41970.phpt +++ b/ext/standard/tests/general_functions/bug41970.phpt @@ -6,22 +6,26 @@ Bug #41970 (call_user_func_*() leaks on failure) $a = array(4,3,2); var_dump(call_user_func_array("sort", array($a))); -var_dump(call_user_func_array("strlen", array($a))); +try { + var_dump(call_user_func_array("strlen", array($a))); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(call_user_func("sort", $a)); -var_dump(call_user_func("strlen", $a)); +try { + var_dump(call_user_func("strlen", $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> --EXPECTF-- -Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 5 +Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d bool(true) +strlen() expects parameter 1 to be string, array given -Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 6 -NULL - -Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 7 +Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d bool(true) - -Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 8 -NULL +strlen() expects parameter 1 to be string, array given Done diff --git a/ext/standard/tests/general_functions/bug47857.phpt b/ext/standard/tests/general_functions/bug47857.phpt index d19eca7248..c06673bc34 100644 --- a/ext/standard/tests/general_functions/bug47857.phpt +++ b/ext/standard/tests/general_functions/bug47857.phpt @@ -8,18 +8,20 @@ class foo { } } var_dump(is_callable(array('foo','bar'))); -foo::bar(); +try { + foo::bar(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} var_dump(is_callable(array('Exception','getMessage'))); -Exception::getMessage(); +try { + Exception::getMessage(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -bool(true) - -Deprecated: Non-static method foo::bar() should not be called statically in %sbug47857.php on line %d -ok +--EXPECT-- +bool(false) +Non-static method foo::bar() cannot be called statically bool(false) - -Fatal error: Uncaught Error: Non-static method Exception::getMessage() cannot be called statically in %sbug47857.php:%d -Stack trace: -#0 {main} - thrown in %sbug47857.php on line %d +Non-static method Exception::getMessage() cannot be called statically diff --git a/ext/standard/tests/general_functions/bug70018.phpt b/ext/standard/tests/general_functions/bug70018.phpt index d4c38b9d8a..43139fc029 100644 --- a/ext/standard/tests/general_functions/bug70018.phpt +++ b/ext/standard/tests/general_functions/bug70018.phpt @@ -1,11 +1,5 @@ --TEST-- Bug #70018 (exec does not strip all whitespace) ---SKIPIF-- -<?php -if ("cli" != php_sapi_name()) { - die("skip.. CLI only test"); -} -?> --FILE-- <?php $output = array(); diff --git a/ext/standard/tests/general_functions/callbacks_001.phpt b/ext/standard/tests/general_functions/callbacks_001.phpt index a58f19d932..76d0e94c82 100644 --- a/ext/standard/tests/general_functions/callbacks_001.phpt +++ b/ext/standard/tests/general_functions/callbacks_001.phpt @@ -69,7 +69,11 @@ class P extends O { $this->call(array('parent', 'who')); $this->call(array('P', 'parent::who')); $this->call(array($this, 'O::who')); - $this->call(array($this, 'B::who')); + try { + $this->call(array($this, 'B::who')); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } @@ -103,6 +107,5 @@ O $this|O::who O $this|B::who - -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' ===DONE=== diff --git a/ext/standard/tests/general_functions/callbacks_002.phpt b/ext/standard/tests/general_functions/callbacks_002.phpt index 22130c524a..0d44035e0e 100644 --- a/ext/standard/tests/general_functions/callbacks_002.phpt +++ b/ext/standard/tests/general_functions/callbacks_002.phpt @@ -3,14 +3,24 @@ call_user_func(): Wrong parameters --FILE-- <?php -call_user_func(array('Foo', 'bar')); -call_user_func(array(NULL, 'bar')); -call_user_func(array('stdclass', NULL)); +try { + call_user_func(array('Foo', 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array(NULL, 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array('stdclass', NULL)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found +call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object +call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt index 71f068f104..e6cea73f4d 100644 --- a/ext/standard/tests/general_functions/error_get_last.phpt +++ b/ext/standard/tests/general_functions/error_get_last.phpt @@ -4,7 +4,11 @@ error_get_last() tests <?php var_dump(error_get_last()); -var_dump(error_get_last(true)); +try { + var_dump(error_get_last(true)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(error_get_last()); $a = $b; @@ -15,19 +19,8 @@ echo "Done\n"; ?> --EXPECTF-- NULL - -Warning: error_get_last() expects exactly 0 parameters, 1 given in %s on line %d +error_get_last() expects exactly 0 parameters, 1 given NULL -array(4) { - ["type"]=> - int(2) - ["message"]=> - string(54) "error_get_last() expects exactly 0 parameters, 1 given" - ["file"]=> - string(%i) "%s" - ["line"]=> - int(4) -} Notice: Undefined variable: b in %s on line %d array(4) { @@ -38,6 +31,6 @@ array(4) { ["file"]=> string(%i) "%s" ["line"]=> - int(7) + int(11) } Done diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt index 1bb4d1151c..2b681e631d 100644 --- a/ext/standard/tests/general_functions/floatval.phpt +++ b/ext/standard/tests/general_functions/floatval.phpt @@ -91,18 +91,6 @@ foreach ($not_float_types as $type ) { var_dump( doubleval($type) ); } - - - -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( floatval() ); -var_dump( doubleval() ); - -//arguments more than expected -var_dump( floatval(TRUE, FALSE) ); -var_dump( doubleval(TRUE, FALSE) ); - echo "\nDone\n"; @@ -194,18 +182,4 @@ float(1) float(0) float(0) -*** Testing error conditions *** - -Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: doubleval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt index 33d4af03d2..c74e4f71fe 100644 --- a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt +++ b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt @@ -14,10 +14,14 @@ $result = get_extension_funcs("standard"); var_dump(gettype($result)); var_dump(in_array("cos", $result)); +// Unknown extension +var_dump(get_extension_funcs("foo")); + ?> ===DONE=== --EXPECT-- Simple testcase for get_extension_funcs() function string(5) "array" bool(true) +bool(false) ===DONE=== diff --git a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt deleted file mode 100644 index 44bd822d12..0000000000 --- a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test get_extension_funcs() function : error conditions ---FILE-- -<?php -/* Prototype : array get_extension_funcs ( string $module_name ) - * Description: Returns an array with the names of the functions of a module. - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -echo "*** Testing get_extension_funcs() : error conditions ***\n"; - -echo "\n-- Too few arguments --\n"; -var_dump(get_extension_funcs()); - -$extra_arg = 1; -echo "\n-- Too many arguments --\n"; -var_dump(get_extension_funcs("standard", $extra_arg)); - -echo "\n-- Invalid extension name --\n"; -var_dump(get_extension_funcs("foo")); - -?> -===DONE=== ---EXPECTF-- -*** Testing get_extension_funcs() : error conditions *** - --- Too few arguments -- - -Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Too many arguments -- - -Warning: get_extension_funcs() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Invalid extension name -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/general_functions/get_include_path_basic.phpt b/ext/standard/tests/general_functions/get_include_path_basic.phpt index 2017bf697a..5b45c86449 100644 --- a/ext/standard/tests/general_functions/get_include_path_basic.phpt +++ b/ext/standard/tests/general_functions/get_include_path_basic.phpt @@ -19,19 +19,10 @@ if (ini_get("include_path") == get_include_path()) { echo "FAILED\n"; } -echo "\nError cases:\n"; -var_dump(get_include_path(TRUE)); - - ?> ===DONE=== --EXPECTF-- *** Testing get_include_path() string(1) "." PASSED - -Error cases: - -Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/get_included_files.phpt b/ext/standard/tests/general_functions/get_included_files.phpt index e6d00a56a1..e4dfe0f974 100644 --- a/ext/standard/tests/general_functions/get_included_files.phpt +++ b/ext/standard/tests/general_functions/get_included_files.phpt @@ -22,9 +22,6 @@ include(dirname(__FILE__)."/get_included_files_inc2.inc"); echo "\n-- List included files atfter including inc2 which will include inc3 which includes inc1 --\n"; var_dump(get_included_files()); -echo "\n-- Error cases --\n"; -var_dump(get_included_files(true)); - ?> ===DONE=== --EXPECTF-- @@ -55,9 +52,4 @@ array(4) { [3]=> string(%d) "%sget_included_files_inc3.inc" } - --- Error cases -- - -Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/getrusage.phpt b/ext/standard/tests/general_functions/getrusage.phpt index 4caca88e1b..8ec131809f 100644 --- a/ext/standard/tests/general_functions/getrusage.phpt +++ b/ext/standard/tests/general_functions/getrusage.phpt @@ -8,16 +8,12 @@ getrusage() tests var_dump(gettype(getrusage())); var_dump(gettype(getrusage(1))); var_dump(gettype(getrusage(-1))); -var_dump(getrusage(array())); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- string(5) "array" string(5) "array" string(5) "array" - -Warning: getrusage() expects parameter 1 to be int, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt index a876ac1fea..f387161bf4 100644 --- a/ext/standard/tests/general_functions/getservbyport_variation1.phpt +++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt @@ -12,29 +12,13 @@ Simone Gentili (sensorario@gmail.com) var_dump(getservbyport( -1, "tcp" )); var_dump(getservbyport( 80, "ppp" )); var_dump(getservbyport( null, null)); - var_dump(getservbyport( array(), array())); - var_dump(getservbyport( array(80), array("tcp"))); - var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2))); var_dump(getservbyport( 2, 2)); var_dump(getservbyport( "80", "tcp")); - var_dump(getservbyport( new stdClass(), new stdClass())); ?> --EXPECTF-- bool(false) bool(false) bool(false) - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL bool(false) string(%d) "%s" - -Warning: getservbyport() expects parameter 1 to be int, object given in %s on line %d -NULL diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt index 325e91e47f..e204c64d4c 100644 --- a/ext/standard/tests/general_functions/gettype_settype_error.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt @@ -13,19 +13,7 @@ Test gettype() & settype() functions : error conditions echo "**** Testing gettype() and settype() functions ****\n"; -echo "\n*** Testing gettype(): error conditions ***\n"; -//Zero arguments -var_dump( gettype() ); -// args more than expected -var_dump( gettype( "1", "2" ) ); - echo "\n*** Testing settype(): error conditions ***\n"; -//Zero arguments -var_dump( settype() ); - -// args more than expected -$var = 10.5; -var_dump( settype( $var, $var, "int" ) ); // passing an invalid type to set var_dump( settype( $var, "unknown" ) ); @@ -35,22 +23,8 @@ echo "Done\n"; --EXPECTF-- **** Testing gettype() and settype() functions **** -*** Testing gettype(): error conditions *** - -Warning: gettype() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: gettype() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing settype(): error conditions *** -Warning: settype() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: settype() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: settype(): Invalid type in %s on line %d bool(false) Done diff --git a/ext/standard/tests/general_functions/head.phpt b/ext/standard/tests/general_functions/head.phpt index 059c56b258..f8d4c28338 100644 --- a/ext/standard/tests/general_functions/head.phpt +++ b/ext/standard/tests/general_functions/head.phpt @@ -1,11 +1,5 @@ --TEST-- header() and friends ---SKIPIF-- -<?php -if (php_sapi_name() != "cli") { - die("skip this test is for CLI"); -} -?> --FILE-- <?php diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt index 8b6626fbc8..de6aa278eb 100644 --- a/ext/standard/tests/general_functions/include_path.phpt +++ b/ext/standard/tests/general_functions/include_path.phpt @@ -6,14 +6,9 @@ include_path=. <?php var_dump(get_include_path()); -var_dump(get_include_path("var")); var_dump(restore_include_path()); -var_dump(restore_include_path("")); - -var_dump(set_include_path()); -var_dump(get_include_path()); var_dump(set_include_path("var")); var_dump(get_include_path()); @@ -32,9 +27,6 @@ var_dump(get_include_path()); var_dump(restore_include_path()); var_dump(get_include_path()); -var_dump(set_include_path(array())); -var_dump(get_include_path()); - var_dump(restore_include_path()); var_dump(get_include_path()); @@ -43,18 +35,8 @@ echo "Done\n"; ?> --EXPECTF-- string(1) "." - -Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL -NULL - -Warning: restore_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: set_include_path() expects exactly 1 parameter, 0 given in %s on line %d NULL string(1) "." -string(1) "." string(3) "var" NULL string(1) "." @@ -66,10 +48,6 @@ bool(false) string(1) "." NULL string(1) "." - -Warning: set_include_path() expects parameter 1 to be a valid path, array given in %s on line %d -NULL -string(1) "." NULL string(1) "." Done diff --git a/ext/standard/tests/general_functions/intval.phpt b/ext/standard/tests/general_functions/intval.phpt index 7f3d895fbe..00b2dc04ab 100644 --- a/ext/standard/tests/general_functions/intval.phpt +++ b/ext/standard/tests/general_functions/intval.phpt @@ -146,13 +146,6 @@ foreach ($not_int_types as $type ) { var_dump( intval($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( intval() ); - -//arguments more than expected -var_dump( intval(TRUE, FALSE, TRUE) ); - echo "\n--- Done ---\n"; @@ -295,12 +288,4 @@ int(0) int(0) int(0) -*** Testing error conditions *** - -Warning: intval() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: intval() expects at most 2 parameters, 3 given in %s on line %d -NULL - --- Done --- diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt index e76d7083d4..e44bc1db80 100644 --- a/ext/standard/tests/general_functions/intval_variation1.phpt +++ b/ext/standard/tests/general_functions/intval_variation1.phpt @@ -11,8 +11,8 @@ Test intval() function : usage variation echo "*** Testing intval() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/general_functions/is_array.phpt b/ext/standard/tests/general_functions/is_array.phpt index 223b732904..f3b0c75db3 100644 --- a/ext/standard/tests/general_functions/is_array.phpt +++ b/ext/standard/tests/general_functions/is_array.phpt @@ -98,13 +98,6 @@ foreach ($varient_arrays as $type ) { var_dump( is_array ($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_array() ); - -//arguments more than expected -var_dump( is_array ($fp, $fp) ); - echo "Done\n"; /* close resources */ fclose($fp); @@ -202,12 +195,4 @@ bool(false) bool(false) -- Iteration 29 -- bool(false) - -*** Testing error conditions *** - -Warning: is_array() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_array() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_bool.phpt b/ext/standard/tests/general_functions/is_bool.phpt index a6c6111fa1..4f0ae4fff5 100644 --- a/ext/standard/tests/general_functions/is_bool.phpt +++ b/ext/standard/tests/general_functions/is_bool.phpt @@ -127,13 +127,6 @@ foreach ($not_bool_types as $type ) { var_dump( is_bool($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_bool() ); - -//arguments more than expected -var_dump( is_bool(TRUE, FALSE) ); - echo "Done\n"; // close resources @@ -283,12 +276,4 @@ bool(false) bool(false) -- Iteration 65 -- bool(false) - -*** Testing error conditions *** - -Warning: is_bool() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_bool() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_callable_basic2.phpt b/ext/standard/tests/general_functions/is_callable_basic2.phpt index 7657875311..7b43191aab 100644 --- a/ext/standard/tests/general_functions/is_callable_basic2.phpt +++ b/ext/standard/tests/general_functions/is_callable_basic2.phpt @@ -207,12 +207,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 1 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 2 --- -- Innerloop iteration 1 of Outerloop iteration 2 -- @@ -288,12 +288,12 @@ no_member_class::func bool(false) no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 2 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 3 --- -- Innerloop iteration 1 of Outerloop iteration 3 -- @@ -369,12 +369,12 @@ contains_object_class::func bool(true) contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 3 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 4 --- -- Innerloop iteration 1 of Outerloop iteration 4 -- @@ -450,12 +450,12 @@ contains_object_class::func bool(true) contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 4 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 5 --- -- Innerloop iteration 1 of Outerloop iteration 5 -- @@ -531,12 +531,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 5 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 6 --- -- Innerloop iteration 1 of Outerloop iteration 6 -- @@ -612,12 +612,12 @@ no_member_class::func bool(false) no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 6 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 7 --- -- Innerloop iteration 1 of Outerloop iteration 7 -- @@ -693,12 +693,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 7 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 8 --- -- Innerloop iteration 1 of Outerloop iteration 8 -- @@ -774,11 +774,11 @@ Array bool(false) Array -- Innerloop iteration 10 of Outerloop iteration 8 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 ===DONE=== diff --git a/ext/standard/tests/general_functions/is_countable_with_variables.phpt b/ext/standard/tests/general_functions/is_countable_with_variables.phpt index 700077ef17..0cb18769d6 100644 --- a/ext/standard/tests/general_functions/is_countable_with_variables.phpt +++ b/ext/standard/tests/general_functions/is_countable_with_variables.phpt @@ -7,7 +7,6 @@ Gabriel Caruso (carusogabriel34@gmail.com) var_dump(is_countable([1, 2, 3])); var_dump(is_countable((array) 1)); var_dump(is_countable((object) ['foo', 'bar', 'baz'])); -var_dump(is_countable()); $foo = ['', []]; @@ -24,9 +23,6 @@ if (!is_countable($bar)) { bool(true) bool(true) bool(false) - -Warning: is_countable() expects exactly 1 parameter, 0 given in %s on line %d -NULL int(2) Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt index b71a5283db..0ee1c60959 100644 --- a/ext/standard/tests/general_functions/is_float.phpt +++ b/ext/standard/tests/general_functions/is_float.phpt @@ -127,17 +127,6 @@ foreach ($not_floats as $value ) { var_dump( is_real($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_float() ); -var_dump( is_double() ); -var_dump( is_real() ); - -//arguments more than expected -var_dump( is_float( $floats[0], $floats[1]) ); -var_dump( is_double( $floats[0], $floats[1]) ); -var_dump( is_real( $floats[0], $floats[1]) ); - echo "Done\n"; // close the resources used @@ -417,24 +406,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt index 9410a21fe2..76cbf0c5d2 100644 --- a/ext/standard/tests/general_functions/is_float_64bit.phpt +++ b/ext/standard/tests/general_functions/is_float_64bit.phpt @@ -129,17 +129,6 @@ foreach ($not_floats as $value ) { var_dump( is_real($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_float() ); -var_dump( is_double() ); -var_dump( is_real() ); - -//arguments more than expected -var_dump( is_float( $floats[0], $floats[1]) ); -var_dump( is_double( $floats[0], $floats[1]) ); -var_dump( is_real( $floats[0], $floats[1]) ); - echo "Done\n"; ?> --EXPECTF-- @@ -414,24 +403,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_int.phpt b/ext/standard/tests/general_functions/is_int.phpt index d154b30748..2f452cd48b 100644 --- a/ext/standard/tests/general_functions/is_int.phpt +++ b/ext/standard/tests/general_functions/is_int.phpt @@ -132,17 +132,6 @@ foreach ($not_int_types as $type ) { var_dump( is_long($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_int() ); -var_dump( is_integer() ); -var_dump( is_long() ); - -//arguments more than expected -var_dump( is_int(TRUE, FALSE) ); -var_dump( is_integer(TRUE, FALSE) ); -var_dump( is_long(TRUE, FALSE) ); - echo "Done\n"; // close the resources @@ -442,24 +431,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_int_64bit.phpt b/ext/standard/tests/general_functions/is_int_64bit.phpt index 68ef75b35b..ac919ced16 100644 --- a/ext/standard/tests/general_functions/is_int_64bit.phpt +++ b/ext/standard/tests/general_functions/is_int_64bit.phpt @@ -134,17 +134,6 @@ foreach ($not_int_types as $type ) { var_dump( is_long($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_int() ); -var_dump( is_integer() ); -var_dump( is_long() ); - -//arguments more than expected -var_dump( is_int(TRUE, FALSE) ); -var_dump( is_integer(TRUE, FALSE) ); -var_dump( is_long(TRUE, FALSE) ); - echo "Done\n"; ?> --EXPECTF-- @@ -439,24 +428,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_null.phpt b/ext/standard/tests/general_functions/is_null.phpt index fa7c87f791..5a3269a28a 100644 --- a/ext/standard/tests/general_functions/is_null.phpt +++ b/ext/standard/tests/general_functions/is_null.phpt @@ -127,13 +127,6 @@ foreach ($not_null_types as $type ) { var_dump( is_null($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_null() ); - -//arguments more than expected -var_dump( is_null(NULL, null) ); - echo "Done\n"; // close the resources used @@ -285,12 +278,4 @@ bool(false) bool(false) -- Iteration 59 -- bool(false) - -*** Testing error conditions *** - -Warning: is_null() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_null() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt index 0019cf18d2..509ee7e686 100644 --- a/ext/standard/tests/general_functions/is_numeric.phpt +++ b/ext/standard/tests/general_functions/is_numeric.phpt @@ -145,13 +145,6 @@ foreach ($not_numerics as $type ) { var_dump( is_numeric($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_numeric() ); - -//arguments more than expected -var_dump( is_numeric("10", "20") ); - echo "Done\n"; // close the resources used @@ -373,12 +366,4 @@ bool(false) bool(false) -- Iteration 29 -- bool(false) - -*** Testing error conditions *** - -Warning: is_numeric() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/is_object.phpt b/ext/standard/tests/general_functions/is_object.phpt index 8abc766376..2b5d1ae475 100644 --- a/ext/standard/tests/general_functions/is_object.phpt +++ b/ext/standard/tests/general_functions/is_object.phpt @@ -138,13 +138,6 @@ foreach ($not_objects as $type ) { var_dump( is_object($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_object() ); - -//arguments more than expected -var_dump( is_object($myClass_object, $myClass_object) ); - echo "Done\n"; // close the resources used @@ -216,12 +209,4 @@ bool(false) bool(false) -- Iteration 19 -- bool(false) - -*** Testing error conditions *** - -Warning: is_object() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_object() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_scalar.phpt b/ext/standard/tests/general_functions/is_scalar.phpt index 53620178c4..f7ef3f5317 100644 --- a/ext/standard/tests/general_functions/is_scalar.phpt +++ b/ext/standard/tests/general_functions/is_scalar.phpt @@ -105,14 +105,6 @@ foreach( $variation_array as $value ) { var_dump( is_scalar($value) ); } -echo "\n*** Testing error conditions ***\n"; -// Zero arguments -var_dump( is_scalar() ); - -// Arguments more than expected -var_dump( is_scalar( $scalar_variables[2], $scalar_variables[2]) ); -var_dump( is_scalar( new stdclass, new stdclass) ); - echo "Done\n"; // close the resources used @@ -226,15 +218,4 @@ bool(false) bool(false) -- Iteration 18 -- bool(false) - -*** Testing error conditions *** - -Warning: is_scalar() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt index 72a885a57a..d48fbd1729 100644 --- a/ext/standard/tests/general_functions/is_string.phpt +++ b/ext/standard/tests/general_functions/is_string.phpt @@ -140,13 +140,6 @@ foreach ($not_strings as $type ) { var_dump( is_string($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_string() ); - -//arguments more than expected -var_dump( is_string("string", "test") ); - echo "Done\n"; // close the resources used @@ -292,12 +285,4 @@ bool(false) bool(false) -- Iteration 45 -- bool(false) - -*** Testing error conditions *** - -Warning: is_string() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_string() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/ob_get_flush_error.phpt b/ext/standard/tests/general_functions/ob_get_flush_error.phpt index 0664043eba..5603e3d238 100644 --- a/ext/standard/tests/general_functions/ob_get_flush_error.phpt +++ b/ext/standard/tests/general_functions/ob_get_flush_error.phpt @@ -12,10 +12,6 @@ output_buffering=0 echo "*** Testing ob_get_flush() : error conditions ***\n"; -// One extra argument -$extra_arg = 10; -var_dump( ob_get_flush( $extra_arg ) ); - // No ob_start() executed var_dump( ob_get_flush() ); @@ -24,9 +20,6 @@ var_dump( ob_get_flush() ); --EXPECTF-- *** Testing ob_get_flush() : error conditions *** -Warning: ob_get_flush() expects exactly 0 parameters, 1 given in %s on line %d -NULL - Notice: ob_get_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/general_functions/ob_get_length_basic.phpt b/ext/standard/tests/general_functions/ob_get_length_basic.phpt index b3470bec55..75e22e7741 100644 --- a/ext/standard/tests/general_functions/ob_get_length_basic.phpt +++ b/ext/standard/tests/general_functions/ob_get_length_basic.phpt @@ -31,9 +31,6 @@ dump_string_length( ' lsf' ); dump_string_length( '' ); dump_string_length( null ); -// Extra argument -var_dump( ob_get_length( 'foobar' ) ); - ?> ===DONE=== --EXPECTF-- @@ -45,7 +42,4 @@ int(1) int(15) int(0) int(0) - -Warning: ob_get_length() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt index ebc714455d..14c1fc18ef 100644 --- a/ext/standard/tests/general_functions/parse_ini_file.phpt +++ b/ext/standard/tests/general_functions/parse_ini_file.phpt @@ -8,8 +8,6 @@ parse_ini_file() multiple calls $filename = dirname(__FILE__)."/parse_ini_file.dat"; @unlink($filename); /* Make sure the file really does not exist! */ -var_dump(parse_ini_file()); -var_dump(parse_ini_file(1,1,1,1)); var_dump(parse_ini_file($filename)); var_dump(parse_ini_file($filename, true)); @@ -121,16 +119,10 @@ var_dump(parse_ini_file($filename, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: parse_ini_file() expects at least 1 parameter, 0 given in %sparse_ini_file.php on line 6 +Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line %d bool(false) -Warning: parse_ini_file() expects at most 3 parameters, 4 given in %sparse_ini_file.php on line 7 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 8 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 9 +Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line %d bool(false) array(1) { ["test"]=> @@ -138,11 +130,11 @@ array(1) { } Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 - in %sparse_ini_file.php on line 20 + in %sparse_ini_file.php on line %d bool(false) Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 - in %sparse_ini_file.php on line 26 + in %sparse_ini_file.php on line %d bool(false) array(1) { ["test"]=> diff --git a/ext/standard/tests/general_functions/parse_ini_string_002.phpt b/ext/standard/tests/general_functions/parse_ini_string_002.phpt index 106cd0c842..384398cdb2 100644 --- a/ext/standard/tests/general_functions/parse_ini_string_002.phpt +++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt @@ -3,9 +3,6 @@ parse_ini_string() multiple calls --FILE-- <?php -var_dump(parse_ini_string()); -var_dump(parse_ini_string(1,1,1,1)); - $ini = " test = "; @@ -87,11 +84,6 @@ var_dump(parse_ini_string($ini, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: parse_ini_string() expects at least 1 parameter, 0 given in %s -bool(false) - -Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s -bool(false) array(1) { ["test"]=> string(0) "" diff --git a/ext/standard/tests/general_functions/php_uname_error.phpt b/ext/standard/tests/general_functions/php_uname_error.phpt index 392e1c930e..ec5b2b5839 100644 --- a/ext/standard/tests/general_functions/php_uname_error.phpt +++ b/ext/standard/tests/general_functions/php_uname_error.phpt @@ -8,49 +8,15 @@ Test php_uname() function - error conditions - pass function incorrect argument echo "*** Testing php_uname() - error test\n"; -echo "\n-- Testing php_uname() function with more than expected no. of arguments --\n"; -var_dump( php_uname('a', true) ); - echo "\n-- Testing php_uname() function with invalid mode --\n"; // am invalid mode should result in same o/p as mode 'a' var_dump( php_uname('z') == php_uname('z') ); -class barClass { -} - -$fp = fopen(__FILE__, "r"); - -echo "\n-- Testing php_uname() function with invalid argument types --\n"; -var_dump(php_uname(array())); -var_dump(php_uname(array('color' => 'red', 'item' => 'pen'))); -var_dump(php_uname(new barClass())); -var_dump(php_uname($fp)); - -fclose($fp); ?> ===DONE=== --EXPECTF-- *** Testing php_uname() - error test --- Testing php_uname() function with more than expected no. of arguments -- - -Warning: php_uname() expects at most 1 parameter, 2 given in %s on line %d -NULL - -- Testing php_uname() function with invalid mode -- bool(true) - --- Testing php_uname() function with invalid argument types -- - -Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, resource given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt index 044232570e..dfcddc61f3 100644 --- a/ext/standard/tests/general_functions/phpcredits.phpt +++ b/ext/standard/tests/general_functions/phpcredits.phpt @@ -4,7 +4,6 @@ phpcredits() <?php var_dump(phpcredits()); -var_dump(phpcredits(array())); echo "--\n"; var_dump(phpcredits(0)); @@ -40,9 +39,6 @@ PHP Quality Assurance Team %wWebsites and Infrastructure team%w %a bool(true) - -Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits.php on line 4 -NULL -- PHP Credits bool(true) diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt index 9966f23a96..6aa023e919 100644 --- a/ext/standard/tests/general_functions/phpcredits2.phpt +++ b/ext/standard/tests/general_functions/phpcredits2.phpt @@ -6,7 +6,6 @@ dummy=x <?php var_dump(phpcredits()); -var_dump(phpcredits(array())); echo "--\n"; var_dump(phpcredits(0)); @@ -18,9 +17,6 @@ var_dump(phpcredits(CREDITS_GROUP)); --EXPECTF-- <!DOCTYPE %a>%s</html> bool(true) - -Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits2.php on line 4 -NULL -- <h1>PHP Credits</h1> bool(true) diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt index a805876aab..5f4d99ffba 100644 --- a/ext/standard/tests/general_functions/phpinfo.phpt +++ b/ext/standard/tests/general_functions/phpinfo.phpt @@ -5,9 +5,6 @@ phpinfo() var_dump(phpinfo()); echo "--\n"; -var_dump(phpinfo(array())); - -echo "--\n"; var_dump(phpinfo(0)); echo "--\n"; @@ -62,10 +59,6 @@ PHP License %A bool(true) -- - -Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo.php on line 5 -NULL --- phpinfo() bool(true) -- diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt index f422f923d9..5a36aa9d28 100644 --- a/ext/standard/tests/general_functions/phpinfo2.phpt +++ b/ext/standard/tests/general_functions/phpinfo2.phpt @@ -7,9 +7,6 @@ dummy=x var_dump(phpinfo()); echo "--\n"; -var_dump(phpinfo(array())); - -echo "--\n"; var_dump(phpinfo(0)); echo "--\n"; @@ -20,10 +17,6 @@ var_dump(phpinfo(INFO_LICENSE)); <!DOCTYPE %s> %a</html>bool(true) -- - -Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo2.php on line 5 -NULL --- <!DOCTYPE %s> %a</html>bool(true) -- diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt index fe02a97c18..15155fe0d2 100644 --- a/ext/standard/tests/general_functions/print_r.phpt +++ b/ext/standard/tests/general_functions/print_r.phpt @@ -271,24 +271,6 @@ $misc_values = array ( /* calling check_printr() to display miscelleneous data using print_r() */ check_printr($misc_values); -/* checking print_r() on functions */ -echo "\n*** Testing print_r() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -print_r( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump( print_r() ); - -//passing more than required no. of arguments -var_dump( print_r(123, true, "abc") ); - -// check when second arg is given other than boolean TRUE -var_dump( print_r ($value, "string") ); - /* closing resource handle used */ closedir($dir_handle); @@ -1714,23 +1696,4 @@ Array -- Iteration 4 -- - -*** Testing print_r() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -2 * 3 = 6 -Deprecated: Function create_function() is deprecated in %s on line %d - - -*** Testing error conditions *** - -Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: value in %s on line %d -string(0) "" Done diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt index 5447a94db8..db5b92bf84 100644 --- a/ext/standard/tests/general_functions/print_r_64bit.phpt +++ b/ext/standard/tests/general_functions/print_r_64bit.phpt @@ -275,24 +275,6 @@ $misc_values = array ( /* calling check_printr() to display miscelleneous data using print_r() */ check_printr($misc_values); -/* checking print_r() on functions */ -echo "\n*** Testing print_r() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -print_r( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump( print_r() ); - -//passing more than required no. of arguments -var_dump( print_r(123, true, "abc") ); - -// check when second arg is given other than boolean TRUE -var_dump( print_r ($value, "string") ); - /* closing resource handle used */ closedir($dir_handle); @@ -1718,23 +1700,4 @@ Array -- Iteration 4 -- - -*** Testing print_r() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -2 * 3 = 6 -Deprecated: Function create_function() is deprecated in %s on line %d - - -*** Testing error conditions *** - -Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: value in %s on line %d -string(0) "" Done diff --git a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt index 87a4545501..37f8e17af2 100644 --- a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt +++ b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt @@ -8,10 +8,6 @@ if (!defined('PHP_WINDOWS_VERSION_MAJOR')) { die('skip: Only for Windows'); } -if (PHP_SAPI != 'cli') { - die('skip: Only for CLI'); -} - if (getenv('SKIP_SLOW_TESTS')) { doe('skip: Slow test'); } diff --git a/ext/standard/tests/general_functions/proc_open-mb0.phpt b/ext/standard/tests/general_functions/proc_open-mb0.phpt index 69c3dd53e5..3b832f6ea4 100644 --- a/ext/standard/tests/general_functions/proc_open-mb0.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb0.phpt @@ -2,7 +2,6 @@ proc_open with bypass_shell subprocess parameter passing --SKIPIF-- <?php -if (php_sapi_name() != "cli") die('skip CLI only test'); if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> --FILE-- diff --git a/ext/standard/tests/general_functions/proc_open-mb1.phpt b/ext/standard/tests/general_functions/proc_open-mb1.phpt index 2b922917f3..b91b44a739 100644 --- a/ext/standard/tests/general_functions/proc_open-mb1.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb1.phpt @@ -2,7 +2,6 @@ proc_open without bypass_shell subprocess parameter passing --SKIPIF-- <?php -if (php_sapi_name() != "cli") die('skip CLI only test'); if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> --FILE-- diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt index e6639a71c7..73dec4eb75 100644 --- a/ext/standard/tests/general_functions/rand.phpt +++ b/ext/standard/tests/general_functions/rand.phpt @@ -4,60 +4,36 @@ rand() and mt_rand() tests <?php var_dump(mt_rand()); -var_dump(mt_rand(-1)); var_dump(mt_rand(-1,1)); var_dump(mt_rand(0,3)); var_dump(rand()); -var_dump(rand(-1)); var_dump(rand(-1,1)); var_dump(rand(0,3)); var_dump(srand()); var_dump(srand(-1)); -var_dump(srand(array())); var_dump(mt_srand()); var_dump(mt_srand(-1)); -var_dump(mt_srand(array())); var_dump(getrandmax()); -var_dump(getrandmax(1)); var_dump(mt_getrandmax()); -var_dump(mt_getrandmax(1)); echo "Done\n"; ?> --EXPECTF-- int(%d) - -Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(%i) int(%d) int(%d) - -Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(%i) int(%d) NULL NULL - -Warning: srand() expects parameter 1 to be int, array given in %s on line %d -NULL -NULL NULL - -Warning: mt_srand() expects parameter 1 to be int, array given in %s on line %d NULL int(%d) - -Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line %d -NULL int(%d) - -Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt index c4f069a3d2..3b46a35e5d 100644 --- a/ext/standard/tests/general_functions/sleep_error.phpt +++ b/ext/standard/tests/general_functions/sleep_error.phpt @@ -10,14 +10,6 @@ Test sleep() function : error conditions echo "*** Testing sleep() : error conditions ***\n"; -echo "\n-- Testing sleep() function with zero arguments --\n"; -var_dump( sleep() ); - -echo "\n-- Testing sleep() function with more than expected no. of arguments --\n"; -$seconds = 10; -$extra_arg = 10; -var_dump( sleep($seconds, $extra_arg) ); - echo "\n-- Testing sleep() function with negative interval --\n"; $seconds = -10; var_dump( sleep($seconds) ); @@ -27,16 +19,6 @@ var_dump( sleep($seconds) ); --EXPECTF-- *** Testing sleep() : error conditions *** --- Testing sleep() function with zero arguments -- - -Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing sleep() function with more than expected no. of arguments -- - -Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing sleep() function with negative interval -- Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt index b814733dd0..0e513a3c47 100644 --- a/ext/standard/tests/general_functions/strval.phpt +++ b/ext/standard/tests/general_functions/strval.phpt @@ -141,13 +141,6 @@ foreach ($not_scalars as $value ) { var_dump( strval($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( strval() ); - -//arguments more than expected -var_dump( strval( $scalars[0], $scalars[1]) ); - echo "Done\n"; // close the resources used @@ -306,12 +299,4 @@ string(0) "" string(0) "" -- Iteration 11 -- string(0) "" - -*** Testing error conditions *** - -Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt index 5763084f70..1775978a12 100644 --- a/ext/standard/tests/general_functions/sys_getloadavg.phpt +++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt @@ -7,14 +7,11 @@ if (!function_exists("sys_getloadavg")) die("skip"); --FILE-- <?php -var_dump(sys_getloadavg("")); var_dump(sys_getloadavg()); echo "Done\n"; ?> --EXPECTF-- -Warning: sys_getloadavg() expects exactly 0 parameters, %d given in %s -NULL array(3) { [0]=> float(%f) diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt index 474aab7d5d..283e7f30e5 100644 --- a/ext/standard/tests/general_functions/usleep_error.phpt +++ b/ext/standard/tests/general_functions/usleep_error.phpt @@ -11,14 +11,6 @@ set_time_limit(20); echo "*** Testing usleep() : error conditions ***\n"; -echo "\n-- Testing usleep() function with zero arguments --\n"; -var_dump( usleep() ); - -echo "\n-- Testing usleep() function with more than expected no. of arguments --\n"; -$seconds = 10; -$extra_arg = 10; -var_dump( usleep($seconds, $extra_arg) ); - echo "\n-- Testing usleep() function with negative interval --\n"; $seconds = -10; var_dump( usleep($seconds) ); @@ -28,16 +20,6 @@ var_dump( usleep($seconds) ); --EXPECTF-- *** Testing usleep() : error conditions *** --- Testing usleep() function with zero arguments -- - -Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing usleep() function with more than expected no. of arguments -- - -Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -- Testing usleep() function with negative interval -- Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt index f0da840c3b..5de84c531e 100644 --- a/ext/standard/tests/general_functions/var_dump.phpt +++ b/ext/standard/tests/general_functions/var_dump.phpt @@ -274,18 +274,6 @@ echo "\n*** Testing var_dump() on multiple arguments ***\n"; var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, $objects, $misc_values, $variations ); -/* checking var_dump() on functions */ -echo "\n*** Testing var_dump() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -var_dump( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump(); - /* closing resource handle used */ closedir($dir_handle); @@ -1561,17 +1549,4 @@ array(6) { string(5) "/00\7" } } - -*** Testing var_dump() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -string(9) "2 * 3 = 6" - -Deprecated: Function create_function() is deprecated in %s on line %d -string(9) " - -*** Testing error conditions *** - -Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt index a2476ef3f6..0815c9d62f 100644 --- a/ext/standard/tests/general_functions/var_dump_64bit.phpt +++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt @@ -274,18 +274,6 @@ echo "\n*** Testing var_dump() on multiple arguments ***\n"; var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, $objects, $misc_values, $variations ); -/* checking var_dump() on functions */ -echo "\n*** Testing var_dump() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -var_dump( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump(); - /* closing resource handle used */ closedir($dir_handle); @@ -1561,17 +1549,4 @@ array(6) { string(5) "/00\7" } } - -*** Testing var_dump() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -string(9) "2 * 3 = 6" - -Deprecated: Function create_function() is deprecated in %s on line %d -string(9) " - -*** Testing error conditions *** - -Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt index e8939f1d0a..52896eb788 100644 --- a/ext/standard/tests/general_functions/var_export-locale.phpt +++ b/ext/standard/tests/general_functions/var_export-locale.phpt @@ -300,14 +300,7 @@ echo "\n"; $counter++; } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_export( var_export() ); - -//arguments more than expected -var_export( var_export(TRUE, FALSE, TRUE) ); - -echo "\n\nDone"; +echo "\nDone"; ?> @@ -1135,11 +1128,4 @@ NULL string(4) "NULL" -*** Testing error conditions *** - -Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d -NULL -Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/image/getimagesize_variation2.phpt b/ext/standard/tests/image/getimagesize_variation2.phpt index eec2301c40..1bb515fe24 100644 --- a/ext/standard/tests/image/getimagesize_variation2.phpt +++ b/ext/standard/tests/image/getimagesize_variation2.phpt @@ -8,7 +8,7 @@ Test getimagesize() function : usage variations - unexpected type for arg 2 * Alias to functions: */ -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/image/image_type_to_extension.phpt b/ext/standard/tests/image/image_type_to_extension.phpt index 8418a4b8c7..249df57943 100644 --- a/ext/standard/tests/image/image_type_to_extension.phpt +++ b/ext/standard/tests/image/image_type_to_extension.phpt @@ -29,12 +29,8 @@ image_type_to_extension() printf("Constant: %s\n\tWith dot: %s\n\tWithout dot: %s\n", $name, image_type_to_extension($constant), image_type_to_extension($constant, false)); } - var_dump(image_type_to_extension(-1, array())); - var_dump(image_type_to_extension(new stdclass)); var_dump(image_type_to_extension(1000000, NULL)); - var_dump(image_type_to_extension()); var_dump(image_type_to_extension(0)); - var_dump(image_type_to_extension(0, 0, 0)); ?> Done --EXPECTF-- @@ -89,18 +85,6 @@ Constant: IMAGETYPE_XBM Constant: IMAGETYPE_WEBP With dot: .webp Without dot: webp - -Warning: image_type_to_extension() expects parameter 2 to be bool, array given in %s on line %d -bool(false) - -Warning: image_type_to_extension() expects parameter 1 to be int, object given in %s on line %d -bool(false) bool(false) - -Warning: image_type_to_extension() expects at least 1 parameter, 0 given in %s on line %d -bool(false) -bool(false) - -Warning: image_type_to_extension() expects at most 2 parameters, 3 given in %s on line %d bool(false) Done diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt index 5575ec5796..4fe8437fd5 100644 --- a/ext/standard/tests/math/acos_variation.phpt +++ b/ext/standard/tests/math/acos_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: acos() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt index cc89ce3e76..12200e035c 100644 --- a/ext/standard/tests/math/acosh_variation.phpt +++ b/ext/standard/tests/math/acosh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(3.828168471) float(3.828168471) float(3.847562739) float(3.847562739) - -Warning: acosh() expects parameter 1 to be float, string given in %s on line %d -NULL float(7.60090221) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt index c8063849fd..c5d170e8db 100644 --- a/ext/standard/tests/math/asin_variation.phpt +++ b/ext/standard/tests/math/asin_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: asin() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt index 5e41a45900..2470f7d401 100644 --- a/ext/standard/tests/math/asinh_variation.phpt +++ b/ext/standard/tests/math/asinh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(3.829113652) float(3.829113652) float(3.848471992) float(3.848471992) - -Warning: asinh() expects parameter 1 to be float, string given in %s on line %d -NULL float(7.60090271) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt index b6a9a9ec32..625b6d0b83 100644 --- a/ext/standard/tests/math/atan_variation.phpt +++ b/ext/standard/tests/math/atan_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.527345431) float(1.527345431) float(1.528178225) float(1.528178225) - -Warning: atan() expects parameter 1 to be float, string given in %s on line %d -NULL float(1.569796327) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt index 2b0a4b1085..f14406bb0d 100644 --- a/ext/standard/tests/math/atanh_variation.phpt +++ b/ext/standard/tests/math/atanh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: atanh() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt index f27d0a66cf..7e1a12c8bc 100644 --- a/ext/standard/tests/math/base_convert_error.phpt +++ b/ext/standard/tests/math/base_convert_error.phpt @@ -14,30 +14,18 @@ class classA { } -echo "Incorrect number of arguments\n"; -base_convert(); -base_convert(35); -base_convert(35,2); +echo "Incorrect input\n"; base_convert(1234, 1, 10); base_convert(1234, 10, 37); - -echo "Incorrect input\n"; base_convert(new classA(), 8, 10); ?> --EXPECTF-- *** Testing base_convert() : error conditions *** -Incorrect number of arguments - -Warning: base_convert() expects exactly 3 parameters, 0 given in %s on line %d - -Warning: base_convert() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: base_convert() expects exactly 3 parameters, 2 given in %s on line %d +Incorrect input Warning: base_convert(): Invalid `from base' (1) in %s on line %d Warning: base_convert(): Invalid `to base' (37) in %s on line %d -Incorrect input Recoverable fatal error: Object of class classA could not be converted to string in %s on line %d diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt index 6323042dc7..f9d1b26246 100644 --- a/ext/standard/tests/math/cos_variation.phpt +++ b/ext/standard/tests/math/cos_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(-0.5328330203) float(-0.5328330203) float(-0.1117112391) float(-0.1117112391) - -Warning: cos() expects parameter 1 to be float, string given in %s on line %d -NULL float(0.5623790763) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt index cd64670668..ec58c0151f 100644 --- a/ext/standard/tests/math/cosh_variation.phpt +++ b/ext/standard/tests/math/cosh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(4872401723) float(4872401723) float(7641446995) float(7641446995) - -Warning: cosh() expects parameter 1 to be float, string given in %s on line %d -NULL float(INF) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt index d5f6920ea7..eb3c7eae0e 100644 --- a/ext/standard/tests/math/deg2rad_variation.phpt +++ b/ext/standard/tests/math/deg2rad_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(0.401425728) float(0.401425728) float(0.4092797096) float(0.4092797096) - -Warning: deg2rad() expects parameter 1 to be float, string given in %s on line %d -NULL float(17.45329252) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt index 44304f2475..7660f67c24 100644 --- a/ext/standard/tests/math/lcg_value_basic.phpt +++ b/ext/standard/tests/math/lcg_value_basic.phpt @@ -21,22 +21,6 @@ if ($i != 100) { echo "PASSED\n"; } -echo "\n lcg_value error cases..\n"; -$res = lcg_value(23); - -if (is_null($res)) { - echo "PASSED\n"; -} else { - echo "FAILED\n"; -} - -$res = lcg_value(10,false); -if (is_null($res)) { - echo "PASSED\n"; -} else { - echo "FAILED\n"; -} - echo "MATHS test script completed\n"; ?> @@ -45,12 +29,4 @@ MATHS test script started lcg_value tests... PASSED - - lcg_value error cases.. - -Warning: lcg_value() expects exactly 0 parameters, 1 given in %slcg_value_basic.php on line %d -PASSED - -Warning: lcg_value() expects exactly 0 parameters, 2 given in %slcg_value_basic.php on line %d -PASSED MATHS test script completed diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt index 5304325952..8dbea47a84 100644 --- a/ext/standard/tests/math/log10_variation.phpt +++ b/ext/standard/tests/math/log10_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.361727836) float(1.361727836) float(1.370142847) float(1.370142847) - -Warning: log10() expects parameter 1 to be float, string given in %s on line %d -NULL float(3) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/log_error.phpt b/ext/standard/tests/math/log_error.phpt index 48a23df3c0..7c305a4cba 100644 --- a/ext/standard/tests/math/log_error.phpt +++ b/ext/standard/tests/math/log_error.phpt @@ -4,13 +4,7 @@ Test log() - wrong params test log() precision=14 --FILE-- <?php -log(); -log(36,4,true); log(36, -4); ?> --EXPECTF-- -Warning: log() expects at least 1 parameter, 0 given in %s on line %d - -Warning: log() expects at most 2 parameters, 3 given in %s on line %d - Warning: log(): base must be greater than 0 in %s on line %d diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt index 596a1940a4..6ea7d0c8a4 100644 --- a/ext/standard/tests/math/rad2deg_variation.phpt +++ b/ext/standard/tests/math/rad2deg_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1317.802929) float(1317.802929) float(1343.58603) float(1343.58603) - -Warning: rad2deg() expects parameter 1 to be float, string given in %s on line %d -NULL float(57295.77951) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt index 5b635dfbdc..d044a16b40 100644 --- a/ext/standard/tests/math/sin_variation.phpt +++ b/ext/standard/tests/math/sin_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(-0.8462204042) float(-0.8462204042) float(-0.9937407102) float(-0.9937407102) - -Warning: sin() expects parameter 1 to be float, string given in %s on line %d -NULL float(0.8268795405) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt index e47e94d629..5e576f447f 100644 --- a/ext/standard/tests/math/sinh_variation.phpt +++ b/ext/standard/tests/math/sinh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(4872401723) float(4872401723) float(7641446995) float(7641446995) - -Warning: sinh() expects parameter 1 to be float, string given in %s on line %d -NULL float(INF) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt index 7369b98dfd..6e2304b437 100644 --- a/ext/standard/tests/math/sqrt_variation.phpt +++ b/ext/standard/tests/math/sqrt_variation.phpt @@ -22,7 +22,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -47,9 +46,6 @@ float(4.7958315233127) float(4.7958315233127) float(4.8425200051213) float(4.8425200051213) - -Warning: sqrt() expects parameter 1 to be float, string given in %s on line %d -NULL float(31.622776601684) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt index 81546bbf6f..2c9ede4738 100644 --- a/ext/standard/tests/math/tan_variation.phpt +++ b/ext/standard/tests/math/tan_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.588153083) float(1.588153083) float(8.895619796) float(8.895619796) - -Warning: tan() expects parameter 1 to be float, string given in %s on line %d -NULL float(1.470324156) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt index b1b477c150..907f802b8a 100644 --- a/ext/standard/tests/math/tanh_variation.phpt +++ b/ext/standard/tests/math/tanh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1) float(1) float(1) float(1) - -Warning: tanh() expects parameter 1 to be float, string given in %s on line %d -NULL float(1) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/misc/get_browser_error.phpt b/ext/standard/tests/misc/get_browser_error.phpt index 049c8b9431..cf15e3c5ef 100644 --- a/ext/standard/tests/misc/get_browser_error.phpt +++ b/ext/standard/tests/misc/get_browser_error.phpt @@ -30,9 +30,6 @@ echo "*** Testing get_browser() : error functionality ***\n"; /* Unknown browser uses defaults. */ var_dump( get_browser( 'foobar', true ) ); -/* More than expected arguments */ -var_dump( get_browser( 'foobar', true, 15 ) ); - /* Some wrong parameters, no HTTP_USER_AGENT set */ var_dump( get_browser( null, 'foobar' ) ); @@ -111,9 +108,6 @@ array(34) { string(1) "0" } -Warning: get_browser() expects at most 2 parameters, 3 given in %s on line %d -NULL - Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/network/fsockopen_error.phpt b/ext/standard/tests/network/fsockopen_error.phpt index 638412b47f..ea08335f2d 100644 --- a/ext/standard/tests/network/fsockopen_error.phpt +++ b/ext/standard/tests/network/fsockopen_error.phpt @@ -11,21 +11,6 @@ Test fsockopen() function : error conditions echo "*** Testing fsockopen() : basic error conditions ***\n"; - -echo "\n-- Testing fsockopen() function with more than expected no. of arguments --\n"; -$hostname = 'string_val'; -$port = 10; -$errno = 10; -$errstr = 'string_val'; -$timeout = 10.5; -$extra_arg = 10; -var_dump( fsockopen($hostname, $port, $errno, $errstr, $timeout, $extra_arg) ); -var_dump($errstr); -var_dump($errno); - -echo "\n-- Testing fsockopen() function with less than expected no. of arguments --\n"; -var_dump( fsockopen() ); - echo "\n-- Attempting to connect to a non-existent socket --\n"; $hostname = 'tcp://127.0.0.1'; // loopback address $port = 31337; @@ -49,18 +34,6 @@ echo "Done"; --EXPECTF-- *** Testing fsockopen() : basic error conditions *** --- Testing fsockopen() function with more than expected no. of arguments -- - -Warning: fsockopen() expects at most 5 parameters, 6 given in %s on line %d -bool(false) -string(10) "string_val" -int(10) - --- Testing fsockopen() function with less than expected no. of arguments -- - -Warning: fsockopen() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -- Attempting to connect to a non-existent socket -- Warning: fsockopen(): unable to connect to tcp://127.0.0.1:31337 (%a) in %s on line %d diff --git a/ext/standard/tests/network/gethostbyaddr_error.phpt b/ext/standard/tests/network/gethostbyaddr_error.phpt index f7982d5ca4..a33a71185f 100644 --- a/ext/standard/tests/network/gethostbyaddr_error.phpt +++ b/ext/standard/tests/network/gethostbyaddr_error.phpt @@ -11,16 +11,6 @@ Test gethostbyaddr() function : error conditions echo "Testing gethostbyaddr : error conditions\n"; -// Zero arguments -echo "\n-- Testing gethostbyaddr function with Zero arguments --\n"; -var_dump( gethostbyaddr() ); - -//Test gethostbyaddr with one more than the expected number of arguments -echo "\n-- Testing gethostbyaddr function with more than expected no. of arguments --\n"; -$ip_address = 'string_val'; -$extra_arg = 10; -var_dump( gethostbyaddr($ip_address, $extra_arg) ); - echo "\n-- Testing gethostbyaddr function with invalid addresses --\n"; $ip_address = 'invalid'; @@ -37,16 +27,6 @@ echo "Done"; --EXPECTREGEX-- Testing gethostbyaddr : error conditions --- Testing gethostbyaddr function with Zero arguments -- - -Warning: gethostbyaddr\(\) expects exactly 1 parameter, 0 given in .* on line \d+ -NULL - --- Testing gethostbyaddr function with more than expected no. of arguments -- - -Warning: gethostbyaddr\(\) expects exactly 1 parameter, 2 given in .* on line \d+ -NULL - -- Testing gethostbyaddr function with invalid addresses -- Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+ diff --git a/ext/standard/tests/network/gethostname.phpt b/ext/standard/tests/network/gethostname.phpt index e7caaf48eb..57f4c498d0 100644 --- a/ext/standard/tests/network/gethostname.phpt +++ b/ext/standard/tests/network/gethostname.phpt @@ -5,10 +5,6 @@ marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao p --FILE-- <?php var_dump(gethostname()); -var_dump(gethostname("php-zend-brazil")); ?> --EXPECTF-- -%s - -Warning: gethostname() expects exactly %d parameters, %d given in %s on line %d -NULL +string(%d) "%s" diff --git a/ext/standard/tests/network/getprotobyname_error.phpt b/ext/standard/tests/network/getprotobyname_error.phpt index 7ee366ac7a..52ef3b8ee0 100644 --- a/ext/standard/tests/network/getprotobyname_error.phpt +++ b/ext/standard/tests/network/getprotobyname_error.phpt @@ -4,13 +4,8 @@ getprotobyname function errors test edgarsandi - <edgar.r.sandi@gmail.com> --FILE-- <?php - // empty protocol name - var_dump(getprotobyname()); - - // invalid protocol name - var_dump(getprotobyname('abc')); +// invalid protocol name +var_dump(getprotobyname('abc')); ?> ---EXPECTF-- -Warning: getprotobyname() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- bool(false) diff --git a/ext/standard/tests/network/getprotobynumber_error.phpt b/ext/standard/tests/network/getprotobynumber_error.phpt index 7df12e864a..dda2661b5a 100644 --- a/ext/standard/tests/network/getprotobynumber_error.phpt +++ b/ext/standard/tests/network/getprotobynumber_error.phpt @@ -4,13 +4,8 @@ getprotobynumber function errors test edgarsandi - <edgar.r.sandi@gmail.com> --FILE-- <?php - // empty protocol number - var_dump(getprotobynumber()); - - // invalid protocol number - var_dump(getprotobynumber(999)); +// invalid protocol number +var_dump(getprotobynumber(999)); ?> ---EXPECTF-- -Warning: getprotobynumber() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- bool(false) diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt index a1e70a0020..81db0016b5 100644 --- a/ext/standard/tests/network/inet.phpt +++ b/ext/standard/tests/network/inet.phpt @@ -14,12 +14,10 @@ var_dump(inet_ntop($packed)); $packed = chr(255) . chr(255) . chr(255) . chr(0); var_dump(inet_ntop($packed)); -var_dump(inet_ntop()); var_dump(inet_ntop(-1)); var_dump(inet_ntop("")); var_dump(inet_ntop("blah-blah")); -var_dump(inet_pton()); var_dump(inet_pton("")); var_dump(inet_pton(-1)); var_dump(inet_pton("abra")); @@ -40,15 +38,9 @@ echo "Done\n"; --EXPECTF-- string(9) "127.0.0.1" string(13) "255.255.255.0" - -Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) bool(false) bool(false) bool(false) - -Warning: inet_pton() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt index 5237c89776..831eee018a 100644 --- a/ext/standard/tests/network/ip.phpt +++ b/ext/standard/tests/network/ip.phpt @@ -21,16 +21,11 @@ foreach ($array as $ip) { var_dump(long2ip($long)); } -var_dump(ip2long()); var_dump(ip2long("")); var_dump(ip2long("777.777.777.777")); var_dump(ip2long("111.111.111.111")); -var_dump(ip2long(array())); -var_dump(long2ip()); var_dump(long2ip(-110000)); -var_dump(long2ip("")); -var_dump(long2ip(array())); echo "Done\n"; ?> @@ -47,23 +42,8 @@ int(0) string(7) "0.0.0.0" int(1118019956) string(14) "66.163.161.116" - -Warning: ip2long() expects exactly 1 parameter, 0 given in %sip.php on line %d -NULL bool(false) bool(false) int(1869573999) - -Warning: ip2long() expects parameter 1 to be string, array given in %sip.php on line %d -NULL - -Warning: long2ip() expects exactly 1 parameter, 0 given in %sip.php on line %d -NULL string(13) "255.254.82.80" - -Warning: long2ip() expects parameter 1 to be int, string given in %sip.php on line %d -NULL - -Warning: long2ip() expects parameter 1 to be int, array given in %sip.php on line %d -NULL Done diff --git a/ext/standard/tests/network/ip_x86_64.phpt b/ext/standard/tests/network/ip_x86_64.phpt index 3c530b8371..06ed1549a6 100644 --- a/ext/standard/tests/network/ip_x86_64.phpt +++ b/ext/standard/tests/network/ip_x86_64.phpt @@ -21,16 +21,11 @@ foreach ($array as $ip) { var_dump(long2ip($long)); } -var_dump(ip2long()); var_dump(ip2long("")); var_dump(ip2long("777.777.777.777")); var_dump(ip2long("111.111.111.111")); -var_dump(ip2long(array())); -var_dump(long2ip()); var_dump(long2ip(-110000)); -var_dump(long2ip("")); -var_dump(long2ip(array())); echo "Done\n"; ?> @@ -47,23 +42,8 @@ int(0) string(7) "0.0.0.0" int(1118019956) string(14) "66.163.161.116" - -Warning: ip2long() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d -NULL bool(false) bool(false) int(1869573999) - -Warning: ip2long() expects parameter 1 to be string, array given in %sip_x86_64.php on line %d -NULL - -Warning: long2ip() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d -NULL string(13) "255.254.82.80" - -Warning: long2ip() expects parameter 1 to be int, string given in %sip_x86_64.php on line %d -NULL - -Warning: long2ip() expects parameter 1 to be int, array given in %sip_x86_64.php on line %d -NULL Done diff --git a/ext/standard/tests/password/password_bcrypt_errors.phpt b/ext/standard/tests/password/password_bcrypt_errors.phpt index a0826080e6..64496744cb 100644 --- a/ext/standard/tests/password/password_bcrypt_errors.phpt +++ b/ext/standard/tests/password/password_bcrypt_errors.phpt @@ -8,14 +8,6 @@ var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 3))); var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 32))); -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "foo"))); - -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "123456789012345678901"))); - -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => 123))); - -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => "foo"))); - ?> --EXPECTF-- Warning: password_hash(): Invalid bcrypt cost parameter specified: 3 in %s on line %d @@ -23,21 +15,3 @@ NULL Warning: password_hash(): Invalid bcrypt cost parameter specified: 32 in %s on line %d NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 21 expecting 22 in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d -NULL - -Warning: password_hash(): Invalid bcrypt cost parameter specified: 0 in %s on line %d -NULL diff --git a/ext/standard/tests/password/password_deprecated_salts.phpt b/ext/standard/tests/password/password_deprecated_salts.phpt deleted file mode 100644 index c173401067..0000000000 --- a/ext/standard/tests/password/password_deprecated_salts.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Test deprecated operation of password_hash() ---FILE-- -<?php -//-=-=-=- - - -var_dump(password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt"))); - -var_dump(password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0)))); - -echo "OK!"; -?> ---EXPECTF-- -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d -string(60) "$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi" - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d -string(60) "$2y$10$MTIzNDU2Nzg5MDEyMzQ1Nej0NmcAWSLR.oP7XOR9HD/vjUuOj100y" -OK! diff --git a/ext/standard/tests/password/password_hash_error.phpt b/ext/standard/tests/password/password_hash_error.phpt index 6416eca91b..04a8249ced 100644 --- a/ext/standard/tests/password/password_hash_error.phpt +++ b/ext/standard/tests/password/password_hash_error.phpt @@ -4,30 +4,31 @@ Test error operation of password_hash() <?php //-=-=-=- -var_dump(password_hash()); - -var_dump(password_hash("foo")); +try { + var_dump(password_hash("foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(password_hash("foo", array())); var_dump(password_hash("foo", 19, new StdClass)); -var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz")); - -var_dump(password_hash(array(), PASSWORD_BCRYPT)); +try { + var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -var_dump(password_hash("123", PASSWORD_BCRYPT, array("salt" => array()))); - -/* Non-string salt, checking for memory leaks */ -var_dump(password_hash('123', PASSWORD_BCRYPT, array('salt' => 1234))); +try { + var_dump(password_hash(array(), PASSWORD_BCRYPT)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- -Warning: password_hash() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: password_hash() expects at least 2 parameters, 1 given in %s on line %d -NULL +password_hash() expects at least 2 parameters, 1 given Notice: Array to string conversion in %s on line %d @@ -36,19 +37,5 @@ NULL Warning: password_hash(): Unknown password hashing algorithm: 19 in %s on line %d NULL - -Warning: password_hash() expects parameter 3 to be array, string given in %s on line %d -NULL - -Warning: password_hash() expects parameter 1 to be string, array given in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Non-string salt parameter supplied in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 4 expecting 22 in %s on line %d -NULL +password_hash() expects parameter 3 to be array, string given +password_hash() expects parameter 1 to be string, array given diff --git a/ext/standard/tests/password/password_needs_rehash_error.phpt b/ext/standard/tests/password/password_needs_rehash_error.phpt index 7180d11de7..f64723ee85 100644 --- a/ext/standard/tests/password/password_needs_rehash_error.phpt +++ b/ext/standard/tests/password/password_needs_rehash_error.phpt @@ -3,29 +3,32 @@ Test error operation of password_needs_rehash() --FILE-- <?php //-=-=-=- -var_dump(password_needs_rehash()); -var_dump(password_needs_rehash('')); +try { + var_dump(password_needs_rehash('')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(password_needs_rehash('', [])); -var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT)); +try { + var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo")); +try { + var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "OK!"; ?> --EXPECTF-- -Warning: password_needs_rehash() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: password_needs_rehash() expects at least 2 parameters, 1 given in %s on line %d -NULL +password_needs_rehash() expects at least 2 parameters, 1 given bool(false) - -Warning: password_needs_rehash() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: password_needs_rehash() expects parameter 3 to be array, string given in %s on line %d -NULL +password_needs_rehash() expects parameter 1 to be string, array given +password_needs_rehash() expects parameter 3 to be array, string given OK! diff --git a/ext/standard/tests/password/password_removed_salt_option.phpt b/ext/standard/tests/password/password_removed_salt_option.phpt new file mode 100644 index 0000000000..356bdec3e8 --- /dev/null +++ b/ext/standard/tests/password/password_removed_salt_option.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test removed support for explicit salt option +--FILE-- +<?php +//-=-=-=- + + +var_dump(strlen(password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt")))); + +var_dump(strlen(password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0))))); + +echo "OK!"; +?> +--EXPECTF-- +Warning: password_hash(): The 'salt' option is no longer supported. The provided salt has been been ignored in %s on line %d +int(60) + +Warning: password_hash(): The 'salt' option is no longer supported. The provided salt has been been ignored in %s on line %d +int(60) +OK! diff --git a/ext/standard/tests/password/password_verify_error.phpt b/ext/standard/tests/password/password_verify_error.phpt index 7f680af448..192a4ae288 100644 --- a/ext/standard/tests/password/password_verify_error.phpt +++ b/ext/standard/tests/password/password_verify_error.phpt @@ -4,14 +4,12 @@ Test error operation of password_verify() <?php //-=-=-=- -var_dump(password_verify()); - -var_dump(password_verify("foo")); +try { + var_dump(password_verify("foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: password_verify() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: password_verify() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) +--EXPECT-- +password_verify() expects exactly 2 parameters, 1 given diff --git a/ext/standard/tests/streams/bug46426.phpt b/ext/standard/tests/streams/bug46426.phpt index 8c95ea456e..b69c6c557b 100644 --- a/ext/standard/tests/streams/bug46426.phpt +++ b/ext/standard/tests/streams/bug46426.phpt @@ -21,8 +21,6 @@ echo stream_get_contents($tmp, 1, 0); echo "\n"; echo stream_get_contents($tmp, -1); -@unlink($tmp); - ?> --EXPECT-- 23 diff --git a/ext/standard/tests/streams/stream_get_contents_001.phpt b/ext/standard/tests/streams/stream_get_contents_001.phpt index dc7fcb239c..6f5abcb782 100644 --- a/ext/standard/tests/streams/stream_get_contents_001.phpt +++ b/ext/standard/tests/streams/stream_get_contents_001.phpt @@ -12,8 +12,6 @@ echo stream_get_contents($tmp, 2), "--\n"; echo stream_get_contents($tmp, 2, 3), "--\n"; echo stream_get_contents($tmp, 2, -1), "--\n"; -@unlink($tmp); - ?> --EXPECT-- -- diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt index bb98d7c6e7..5530322fec 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt @@ -10,21 +10,6 @@ Test stream_get_meta_data() function : error conditions echo "*** Testing stream_get_meta_data() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n"; -var_dump( stream_get_meta_data() ); - -//Test stream_get_meta_data with one more than the expected number of arguments -echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n"; - -$fp = null; -$extra_arg = 10; -var_dump( stream_get_meta_data($fp, $extra_arg) ); - -echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n"; -$fp = null; -var_dump(stream_get_meta_data($fp)); - echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n"; $fp = fopen(__FILE__, 'r'); fclose($fp); @@ -35,21 +20,6 @@ echo "Done"; --EXPECTF-- *** Testing stream_get_meta_data() : error conditions *** --- Testing stream_get_meta_data() function with Zero arguments -- - -Warning: stream_get_meta_data() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing stream_get_meta_data() function with more than expected no. of arguments -- - -Warning: stream_get_meta_data() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing stream_get_meta_data() function with invalid stream resource -- - -Warning: stream_get_meta_data() expects parameter 1 to be resource, null given in %s on line %d -NULL - -- Testing stream_get_meta_data() function with closed stream resource -- Warning: stream_get_meta_data(): supplied resource is not a valid stream resource in %s on line %d diff --git a/ext/standard/tests/streams/stream_resolve_include_path.phpt b/ext/standard/tests/streams/stream_resolve_include_path.phpt index 4109b5672e..f77c0730f3 100644 --- a/ext/standard/tests/streams/stream_resolve_include_path.phpt +++ b/ext/standard/tests/streams/stream_resolve_include_path.phpt @@ -14,8 +14,6 @@ mkdir($include_path_nested); file_put_contents($include_path_file, 'include_path'); file_put_contents($include_path_nested_file, 'include_path'); -var_dump(stream_resolve_include_path()); - set_include_path($include_path . PATH_SEPARATOR . $include_path_nested); var_dump(stream_resolve_include_path('file-does-not-exist')); @@ -24,13 +22,20 @@ var_dump(stream_resolve_include_path('file')); set_include_path($include_path_nested . PATH_SEPARATOR . $include_path); var_dump(stream_resolve_include_path('file')); +?> +--CLEAN-- +<?php +$include_path = __DIR__ . '/test_path'; +$include_path_nested = $include_path . '/nested'; +$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file'; +$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file'; + unlink($include_path_nested_file); rmdir($include_path_nested); unlink($include_path_file); rmdir($include_path); +?> --EXPECTF-- -Warning: stream_resolve_include_path() expects exactly 1 parameter, 0 given in %s on line %d -NULL bool(false) string(%d) "%stest_path%sfile" string(%d) "%stest_path%snested%sfile" diff --git a/ext/standard/tests/streams/stream_set_chunk_size.phpt b/ext/standard/tests/streams/stream_set_chunk_size.phpt index 8c2ae9865b..851fd2cfcf 100644 --- a/ext/standard/tests/streams/stream_set_chunk_size.phpt +++ b/ext/standard/tests/streams/stream_set_chunk_size.phpt @@ -51,7 +51,6 @@ var_dump(strlen(fwrite($f, str_repeat('b', 250)))); echo "\nerror conditions\n"; var_dump(stream_set_chunk_size($f, 0)); var_dump(stream_set_chunk_size($f, -1)); -var_dump(stream_set_chunk_size($f, array())); --EXPECTF-- bool(true) should return previous chunk size (8192) @@ -87,6 +86,3 @@ bool(false) Warning: stream_set_chunk_size(): The chunk size must be a positive integer, given -1 in %s on line %d bool(false) - -Warning: stream_set_chunk_size() expects parameter 2 to be int, array given in %s on line %d -bool(false) diff --git a/ext/standard/tests/streams/stream_set_timeout_error.phpt b/ext/standard/tests/streams/stream_set_timeout_error.phpt index 0334b951e0..6c5b992dd5 100644 --- a/ext/standard/tests/streams/stream_set_timeout_error.phpt +++ b/ext/standard/tests/streams/stream_set_timeout_error.phpt @@ -10,9 +10,6 @@ Test stream_set_timeout() function : error conditions echo "*** Testing stream_set_timeout() : error conditions ***\n"; -//Test stream_set_timeout with one more than the expected number of arguments -echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n"; - for ($i=0; $i<100; $i++) { $port = rand(10000, 65000); /* Setup socket server */ @@ -26,23 +23,11 @@ $client = fsockopen("tcp://127.0.0.1:$port"); $seconds = 10; $microseconds = 10; -$extra_arg = 10; -var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) ); - -// Testing stream_set_timeout with one less than the expected number of arguments -echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n"; - -$seconds = 10; -var_dump( stream_set_timeout($client) ); - echo "\n-- Testing stream_set_timeout() function with a closed socket --\n"; fclose($client); var_dump( stream_set_timeout($client, $seconds) ); -echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n"; -var_dump( stream_set_timeout($seconds, $seconds) ); - echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n"; $filestream = fopen(__FILE__, "r"); var_dump( stream_set_timeout($filestream, $seconds) ); @@ -55,26 +40,11 @@ echo "Done"; --EXPECTF-- *** Testing stream_set_timeout() : error conditions *** --- Testing stream_set_timeout() function with more than expected no. of arguments -- - -Warning: stream_set_timeout() expects at most 3 parameters, 4 given in %s on line %d -NULL - --- Testing stream_set_timeout() function with less than expected no. of arguments -- - -Warning: stream_set_timeout() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing stream_set_timeout() function with a closed socket -- Warning: stream_set_timeout(): supplied resource is not a valid stream resource in %s on line %d bool(false) --- Testing stream_set_timeout() function with an invalid stream -- - -Warning: stream_set_timeout() expects parameter 1 to be resource, int given in %s on line %d -NULL - -- Testing stream_set_timeout() function with a stream that does not support timeouts -- bool(false) Done diff --git a/ext/standard/tests/streams/stream_socket_sendto.phpt b/ext/standard/tests/streams/stream_socket_sendto.phpt index 2812d30930..ab223f4314 100644 --- a/ext/standard/tests/streams/stream_socket_sendto.phpt +++ b/ext/standard/tests/streams/stream_socket_sendto.phpt @@ -16,8 +16,6 @@ $sock = stream_socket_server($serverUri, $errno, $errstr); if (is_resource($sock)) { fwrite($sock, $stringFWrite); - var_dump(stream_socket_sendto()); - var_dump(stream_socket_sendto($sock)); var_dump(stream_socket_sendto($sock, $stringSocket)); var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB)); var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB, $serverUri)); @@ -29,12 +27,6 @@ if (is_resource($sock)) { --EXPECTF-- Notice: fwrite(): send of %i bytes failed with errno=%i Broken pipe in %s on line %d -Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %d -bool(%s) - -Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %d -bool(%s) - Warning: stream_socket_sendto(): Broken pipe in %s on line %d int(%i) diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt Binary files differindex 4080c7214d..5b60f6168d 100644 --- a/ext/standard/tests/strings/addcslashes_001.phpt +++ b/ext/standard/tests/strings/addcslashes_001.phpt diff --git a/ext/standard/tests/strings/bug24208.phpt b/ext/standard/tests/strings/bug24208.phpt deleted file mode 100644 index f85c9c1e54..0000000000 --- a/ext/standard/tests/strings/bug24208.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Bug #24208 (parse_str() is not working) ---FILE-- -<?php -$a = $b = $c = "oops"; -parse_str("a=1&b=2&c=3"); -var_dump($a, $b, $c); -?> ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -string(1) "1" -string(1) "2" -string(1) "3" diff --git a/ext/standard/tests/strings/bug37262.phpt b/ext/standard/tests/strings/bug37262.phpt index b964c4a659..92abb29206 100644 --- a/ext/standard/tests/strings/bug37262.phpt +++ b/ext/standard/tests/strings/bug37262.phpt @@ -2,9 +2,7 @@ Bug #37262 (var_export() does not escape \0 character) --FILE-- <?php -$func = create_function('$a', 'return $a;'); -var_export($func); +var_export("foo\0bar"); ?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -'' . "\0" . 'lambda_%d' +--EXPECT-- +'foo' . "\0" . 'bar' diff --git a/ext/standard/tests/strings/bug54322.phpt b/ext/standard/tests/strings/bug54322.phpt index 6b8d10daa7..f31f94fd84 100644 --- a/ext/standard/tests/strings/bug54322.phpt +++ b/ext/standard/tests/strings/bug54322.phpt @@ -2,9 +2,11 @@ Bug #54322: Null pointer deref in get_html_translation_table due to information loss in long-to-int conversion --FILE-- <?php -var_dump( -get_html_translation_table(NAN, 0, "UTF-8") > 0 -); ---EXPECTF-- -Warning: get_html_translation_table() expects parameter 1 to be int, float given in %s on line %d -bool(false) +try { + var_dump(get_html_translation_table(NAN, 0, "UTF-8") > 0); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +get_html_translation_table() expects parameter 1 to be int, float given diff --git a/ext/standard/tests/strings/bug77439.phpt b/ext/standard/tests/strings/bug77439.phpt index ee8a3d2845..98ae56222b 100644 --- a/ext/standard/tests/strings/bug77439.phpt +++ b/ext/standard/tests/strings/bug77439.phpt @@ -2,12 +2,11 @@ Bug #77439: parse_str segfaults when inserting item into existing array --FILE-- <?php -$a = []; -parse_str('a[1]=1'); -var_dump($a); +$vars = ['a' => []]; +parse_str('a[1]=1', $vars); +var_dump($vars['a']); ?> ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d +--EXPECT-- array(1) { [1]=> string(1) "1" diff --git a/ext/standard/tests/strings/chr_error.phpt b/ext/standard/tests/strings/chr_error.phpt index d5fb974559..7f089ac5b5 100644 --- a/ext/standard/tests/strings/chr_error.phpt +++ b/ext/standard/tests/strings/chr_error.phpt @@ -11,11 +11,19 @@ Test chr() function : error conditions echo "*** Testing chr() : error conditions ***\n"; echo "\n-- Testing chr() function with no arguments --\n"; -var_dump( chr() ); +try { + var_dump( chr() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing chr() function with more than expected no. of arguments --\n"; $extra_arg = 10; -var_dump( chr(72, $extra_arg) ); +try { + var_dump( chr(72, $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== @@ -23,12 +31,8 @@ var_dump( chr(72, $extra_arg) ); *** Testing chr() : error conditions *** -- Testing chr() function with no arguments -- - -Warning: Wrong parameter count for chr() in %s on line %d -NULL +Wrong parameter count for chr() -- Testing chr() function with more than expected no. of arguments -- - -Warning: Wrong parameter count for chr() in %s on line %d -NULL +Wrong parameter count for chr() ===DONE=== diff --git a/ext/standard/tests/strings/chr_ord.phpt b/ext/standard/tests/strings/chr_ord.phpt Binary files differindex be0b1a32da..43e31a20f3 100644 --- a/ext/standard/tests/strings/chr_ord.phpt +++ b/ext/standard/tests/strings/chr_ord.phpt diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt Binary files differindex 8a5a8cd6bb..8650f2cb92 100644 --- a/ext/standard/tests/strings/chunk_split_variation5.phpt +++ b/ext/standard/tests/strings/chunk_split_variation5.phpt diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt index bfafd1af0b..9804ee21e1 100644 --- a/ext/standard/tests/strings/chunk_split_variation8.phpt +++ b/ext/standard/tests/strings/chunk_split_variation8.phpt @@ -46,7 +46,11 @@ $values = array ( // loop through each element of values for 'chunklen' for($count = 0; $count < count($values); $count++) { echo "-- Iteration ".($count+1). " --\n"; - var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); + try { + var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "Done" @@ -82,9 +86,7 @@ string(129) "This's heredoc string with and It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test chunk_split():::" -- Iteration 7 -- - -Warning: chunk_split() expects parameter 2 to be int, float given in %s on line %d -NULL +chunk_split() expects parameter 2 to be int, float given -- Iteration 8 -- Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt index af239543c5..a1473ad316 100644 --- a/ext/standard/tests/strings/convert_cyr_string.phpt +++ b/ext/standard/tests/strings/convert_cyr_string.phpt @@ -3,11 +3,7 @@ basic convert_cyr_string() tests --FILE-- <?php -var_dump(convert_cyr_string()); -var_dump(convert_cyr_string("")); -var_dump(convert_cyr_string("", "")); var_dump(convert_cyr_string("", "", "")); -var_dump(convert_cyr_string(array(), array(), array())); var_dump(convert_cyr_string("[[[[[[", "q", "m")); var_dump(convert_cyr_string("[[[[[[", "k", "w")); @@ -20,23 +16,11 @@ var_dump(convert_cyr_string("", "d", "i")); echo "Done\n"; ?> --EXPECTF-- -Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: convert_cyr_string() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d -NULL - Warning: convert_cyr_string(): Unknown source charset: in %s on line %d Warning: convert_cyr_string(): Unknown destination charset: in %s on line %d string(0) "" -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL - Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d string(6) "[[[[[[" string(6) "[[[[[[" diff --git a/ext/standard/tests/strings/convert_cyr_string_error.phpt b/ext/standard/tests/strings/convert_cyr_string_error.phpt index 66effea430..6ac438efaf 100644 --- a/ext/standard/tests/strings/convert_cyr_string_error.phpt +++ b/ext/standard/tests/strings/convert_cyr_string_error.phpt @@ -15,15 +15,6 @@ $extra_arg = 10; echo "*** Testing convert_cyr_string() : error conditions ***\n"; -echo "\n-- Testing convert_cyr_string() function with no arguments --\n"; -var_dump( convert_cyr_string() ); - -echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n"; -var_dump( convert_cyr_string($str, $from) ); - -echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n"; -var_dump( convert_cyr_string($str, $from, $to, $extra_arg) ); - echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n"; var_dump(bin2hex( convert_cyr_string($str, "?", $to) )); @@ -38,21 +29,6 @@ var_dump(bin2hex( convert_cyr_string($str, ">", "?")) ); --EXPECTF-- *** Testing convert_cyr_string() : error conditions *** --- Testing convert_cyr_string() function with no arguments -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d -NULL - --- Testing convert_cyr_string() function with no 'to' character set -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d -NULL - --- Testing convert_cyr_string() function with more than expected no. of arguments -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d -NULL - -- Testing convert_cyr_string() function with invalid 'from' character set -- Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt index f64b61cb5f..270f0372d1 100644 --- a/ext/standard/tests/strings/crypt.phpt +++ b/ext/standard/tests/strings/crypt.phpt @@ -19,8 +19,6 @@ echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n"; var_dump(crypt($str)); -var_dump(crypt()); -var_dump(crypt("", "", "")); ?> --EXPECTF-- @@ -31,9 +29,3 @@ BLO Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in %s on line %d string(%d) "%s" - -Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d -NULL diff --git a/ext/standard/tests/strings/dirname_error.phpt b/ext/standard/tests/strings/dirname_error.phpt index 98a9ea5b45..79fac30029 100644 --- a/ext/standard/tests/strings/dirname_error.phpt +++ b/ext/standard/tests/strings/dirname_error.phpt @@ -6,26 +6,15 @@ Test dirname() function : error conditions Description: Returns directory name component of path. */ echo "*** Testing error conditions ***\n"; -// zero arguments -var_dump( dirname() ); // Bad arg var_dump( dirname("/var/tmp/bar.gz", 0) ); -// more than expected no. of arguments -var_dump( dirname("/var/tmp/bar.gz", 1, ".gz") ); - echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** -Warning: dirname() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: dirname(): Invalid argument, levels must be >= 1 in %s on line %d NULL - -Warning: dirname() expects at most 2 parameters, 3 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt index 6842947605..de3049a47b 100644 --- a/ext/standard/tests/strings/explode1.phpt +++ b/ext/standard/tests/strings/explode1.phpt @@ -77,11 +77,6 @@ class string1 { $obj = new string1; var_dump( explode("b", $obj) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for arguments <2 and >3 */ -var_dump( explode(":", "array1:array2:array3", -1, -33) ); -var_dump( explode(":") ); - echo "Done\n"; ?> --EXPECTF-- @@ -498,12 +493,4 @@ array(2) { [1]=> string(4) "ject" } - -*** Testing error conditions *** - -Warning: explode() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: explode() expects at least 2 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt index ccc37407e8..1ffc188051 100644 --- a/ext/standard/tests/strings/fprintf_error.phpt +++ b/ext/standard/tests/strings/fprintf_error.phpt @@ -7,25 +7,31 @@ Test fprintf() function (errors) echo "*** Testing Error Conditions ***\n"; /* zero argument */ -var_dump( fprintf() ); +try { + var_dump( fprintf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* scalar argument */ -var_dump( fprintf(3) ); +try { + var_dump( fprintf(3) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* NULL argument */ -var_dump( fprintf(NULL) ); +try { + var_dump( fprintf(NULL) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> --EXPECTF-- *** Testing Error Conditions *** - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL +Wrong parameter count for fprintf() +Wrong parameter count for fprintf() +Wrong parameter count for fprintf() Done diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt index 65636908e6..10ea752291 100644 --- a/ext/standard/tests/strings/highlight_file.phpt +++ b/ext/standard/tests/strings/highlight_file.phpt @@ -13,7 +13,6 @@ allow_url_fopen=1 $filename = dirname(__FILE__)."/highlight_file.dat"; -var_dump(highlight_file()); var_dump(highlight_file($filename)); var_dump(highlight_file('data:,<?php echo "test"; ?>')); @@ -37,9 +36,6 @@ var_dump(highlight_file($filename)); echo "Done\n"; ?> --EXPECTF-- -Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d diff --git a/ext/standard/tests/strings/htmlentities24.phpt b/ext/standard/tests/strings/htmlentities24.phpt index 5a023df701..f2abfd5ba8 100644 --- a/ext/standard/tests/strings/htmlentities24.phpt +++ b/ext/standard/tests/strings/htmlentities24.phpt @@ -35,12 +35,6 @@ var_dump( htmlentities($str, ENT_QUOTES) ); var_dump( htmlentities($str, ENT_NOQUOTES) ); var_dump( htmlentities($str, ENT_COMPAT) ); -echo "\n*** Testing error conditions ***\n"; -/* zero argument */ -var_dump( htmlentities() ); -/* arguments more than expected */ -var_dump( htmlentities("\x84\x91",ENT_QUOTES, 'cp1252', "test1") ); - echo "Done\n"; ?> --EXPECTF-- @@ -320,10 +314,4 @@ string(36) "A 'quote' is <b>bold</b>" string(46) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" - -*** Testing error conditions *** - -Warning: htmlentities() expects at least 1 parameter, 0 given in %s on line %d -NULL -string(14) "„‘" Done diff --git a/ext/standard/tests/strings/htmlspecialchars.phpt b/ext/standard/tests/strings/htmlspecialchars.phpt index 8506c73e72..6e5c5fac36 100644 --- a/ext/standard/tests/strings/htmlspecialchars.phpt +++ b/ext/standard/tests/strings/htmlspecialchars.phpt @@ -35,13 +35,6 @@ var_dump( htmlspecialchars($str, ENT_QUOTES) ); var_dump( htmlspecialchars($str, ENT_NOQUOTES) ); var_dump( htmlspecialchars($str, ENT_COMPAT) ); -echo "\n*** Testing error conditions ***\n"; -/* zero argument */ -var_dump( htmlspecialchars() ); - -/* giving arguments more than expected */ -var_dump( htmlspecialchars("<br>",ENT_QUOTES,'iso-8859-1', "test2") ); - echo "Done\n" ?> --EXPECTF-- @@ -321,10 +314,4 @@ string(36) "A 'quote' is <b>bold</b>" string(46) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" - -*** Testing error conditions *** - -Warning: htmlspecialchars() expects at least 1 parameter, 0 given in %s on line %d -NULL -string(10) "<br>" Done diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt Binary files differindex d5de391e96..9d9afc6f3c 100644 --- a/ext/standard/tests/strings/implode1.phpt +++ b/ext/standard/tests/strings/implode1.phpt diff --git a/ext/standard/tests/strings/join_error.phpt b/ext/standard/tests/strings/join_error.phpt index 36ee9d7ba6..832fb58c05 100644 --- a/ext/standard/tests/strings/join_error.phpt +++ b/ext/standard/tests/strings/join_error.phpt @@ -10,18 +10,6 @@ Test join() function: error conditions echo "*** Testing join() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing join() function with Zero arguments --\n"; -var_dump( join() ); - -// More than expected number of arguments -echo "\n-- Testing join() function with more than expected no. of arguments --\n"; -$glue = 'string_val'; -$pieces = array(1, 2); -$extra_arg = 10; - -var_dump( join($glue, $pieces, $extra_arg) ); - // Less than expected number of arguments echo "\n-- Testing join() with less than expected no. of arguments --\n"; $glue = 'string_val'; @@ -33,16 +21,6 @@ echo "Done\n"; --EXPECTF-- *** Testing join() : error conditions *** --- Testing join() function with Zero arguments -- - -Warning: join() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing join() function with more than expected no. of arguments -- - -Warning: join() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Testing join() with less than expected no. of arguments -- Warning: join(): Argument must be an array in %s on line %d diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt Binary files differindex 8178fa2eb5..38cb7e566f 100644 --- a/ext/standard/tests/strings/lcfirst.phpt +++ b/ext/standard/tests/strings/lcfirst.phpt diff --git a/ext/standard/tests/strings/levenshtein.phpt b/ext/standard/tests/strings/levenshtein.phpt index 1ac05cf2ae..b4b7c03e7f 100644 --- a/ext/standard/tests/strings/levenshtein.phpt +++ b/ext/standard/tests/strings/levenshtein.phpt @@ -63,10 +63,8 @@ $n += test_me("gt maxlength2", -1, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijkl echo ($n==0)?"all passed\n":"$n failed\n"; -var_dump(levenshtein(array(), array())); var_dump(levenshtein("", "", -1, -1, -1)); var_dump(levenshtein("", "", 10, 10, 10)); -var_dump(levenshtein("")); ?> --EXPECTF-- @@ -76,11 +74,5 @@ Warning: levenshtein(): Argument string(s) too long in %s on line %d Warning: levenshtein(): Argument string(s) too long in %s on line %d all passed - -Warning: levenshtein() expects parameter 1 to be string, array given in %s on line %d -NULL int(0) int(0) - -Warning: Wrong parameter count for levenshtein() in %s on line %d -NULL diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt index 638c93557f..51287e04d7 100644 --- a/ext/standard/tests/strings/ltrim.phpt +++ b/ext/standard/tests/strings/ltrim.phpt @@ -9,12 +9,6 @@ Test ltrim() function echo "\n *** Output for Error Conditions ***\n"; - echo "\n *** Output for zero argument ***\n"; - var_dump( ltrim() ); - - echo "\n *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***\n"; - var_dump( ltrim("", " ", 1) ); - /* heredoc string */ $str = <<<EOD us @@ -50,16 +44,6 @@ echo "\nDone\n"; --EXPECTF-- *** Output for Error Conditions *** - *** Output for zero argument *** - -Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - - *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) *** - -Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - *** Using heredoc string *** string(17) "ng heredoc string" diff --git a/ext/standard/tests/strings/ltrim_error.phpt b/ext/standard/tests/strings/ltrim_error.phpt index 694d9fea18..58324d7f3a 100644 --- a/ext/standard/tests/strings/ltrim_error.phpt +++ b/ext/standard/tests/strings/ltrim_error.phpt @@ -11,14 +11,6 @@ Test ltrim() function : error conditions echo "*** Testing ltrim() : error conditions ***\n"; -echo "\n-- Testing ltrim() function with no arguments --\n"; -var_dump( ltrim() ); - -echo "\n-- Testing ltrim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( ltrim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test ltrim function with various invalid charlists\n"; var_dump(ltrim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(ltrim($hello, "a..b..c")); --EXPECTF-- *** Testing ltrim() : error conditions *** --- Testing ltrim() function with no arguments -- - -Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing ltrim() function with more than expected no. of arguments -- - -Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test ltrim function with various invalid charlists Warning: ltrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt Binary files differindex 45009669f4..e56987cd6a 100644 --- a/ext/standard/tests/strings/md5_file.phpt +++ b/ext/standard/tests/strings/md5_file.phpt diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt index ef1d23d89a..c70b4846a1 100644 --- a/ext/standard/tests/strings/metaphone.phpt +++ b/ext/standard/tests/strings/metaphone.phpt @@ -3,7 +3,6 @@ metaphone() tests --FILE-- <?php -var_dump(metaphone()); var_dump(metaphone("")); var_dump(metaphone(-1)); var_dump(metaphone(-1, -1)); @@ -26,8 +25,6 @@ foreach($array as $str) { echo "Done\n"; ?> --EXPECTF-- -Warning: metaphone() expects at least 1 parameter, 0 given in %s on line %d -NULL string(0) "" string(0) "" bool(false) diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt index 454b593537..8a4366f1bb 100644 --- a/ext/standard/tests/strings/money_format_error.phpt +++ b/ext/standard/tests/strings/money_format_error.phpt @@ -23,15 +23,6 @@ $extra_arg = 10; echo "*** Testing money_format() : error conditions ***\n"; -echo "\n-- Testing money_format() function with no arguments --\n"; -var_dump( money_format() ); - -echo "\n-- Testing money_format() function with insufficient arguments --\n"; -var_dump( money_format($string) ); - -echo "\n-- Testing money_format() function with more than expected no. of arguments --\n"; -var_dump( money_format($string, $value, $extra_arg) ); - echo "\n-- Testing money_format() function with more than one token --\n"; var_dump( money_format($string . $string, $value) ); ?> @@ -39,21 +30,6 @@ var_dump( money_format($string . $string, $value) ); --EXPECTF-- *** Testing money_format() : error conditions *** --- Testing money_format() function with no arguments -- - -Warning: money_format() expects exactly 2 parameters, 0 given in %s on line %d -NULL - --- Testing money_format() function with insufficient arguments -- - -Warning: money_format() expects exactly 2 parameters, 1 given in %s on line %d -NULL - --- Testing money_format() function with more than expected no. of arguments -- - -Warning: money_format() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -- Testing money_format() function with more than one token -- Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d diff --git a/ext/standard/tests/strings/parse_str_basic1.phpt b/ext/standard/tests/strings/parse_str_basic1.phpt index b3f2fe5cfc..e442c0fd70 100644 --- a/ext/standard/tests/strings/parse_str_basic1.phpt +++ b/ext/standard/tests/strings/parse_str_basic1.phpt @@ -3,18 +3,13 @@ Test parse_str() function : basic functionality --FILE-- <?php -/* Prototype : void parse_str ( string $str [, array &$arr ] ) +/* Prototype : void parse_str ( string $str , array &$arr ) * Description: Parses the string into variables * Source code: ext/standard/string.c */ echo "*** Testing parse_str() : basic functionality ***\n"; -echo "Basic test WITHOUT result arg\n"; -$s1 = "first=val1&second=val2&third=val3"; -var_dump(parse_str($s1)); -var_dump($first, $second, $third); - echo "\nBasic test WITH undefined var for result arg\n"; $s1 = "first=val1&second=val2&third=val3"; var_dump(parse_str($s1, $res1)); @@ -35,13 +30,6 @@ var_dump($res3_array); ===DONE=== --EXPECTF-- *** Testing parse_str() : basic functionality *** -Basic test WITHOUT result arg - -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -NULL -string(4) "val1" -string(4) "val2" -string(4) "val3" Basic test WITH undefined var for result arg NULL diff --git a/ext/standard/tests/strings/parse_str_basic3.phpt b/ext/standard/tests/strings/parse_str_basic3.phpt Binary files differindex 0368dea5f9..06f9579188 100644 --- a/ext/standard/tests/strings/parse_str_basic3.phpt +++ b/ext/standard/tests/strings/parse_str_basic3.phpt diff --git a/ext/standard/tests/strings/pathinfo.phpt b/ext/standard/tests/strings/pathinfo.phpt index a3d735069d..2bbea73588 100644 --- a/ext/standard/tests/strings/pathinfo.phpt +++ b/ext/standard/tests/strings/pathinfo.phpt @@ -3,7 +3,6 @@ pathinfo() tests --FILE-- <?php -var_dump(pathinfo()); var_dump(pathinfo("")); var_dump(pathinfo(".")); var_dump(pathinfo("..")); @@ -27,8 +26,6 @@ var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_BASENAME)); echo "Done\n"; ?> --EXPECTF-- -Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d -NULL array(2) { ["basename"]=> string(0) "" diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt index d9376b101a..caab3bc1d2 100644 --- a/ext/standard/tests/strings/php_strip_whitespace.phpt +++ b/ext/standard/tests/strings/php_strip_whitespace.phpt @@ -5,7 +5,6 @@ php_strip_whitespace() tests $filename = dirname(__FILE__)."/php_strip_whitespace.dat"; -var_dump(php_strip_whitespace()); var_dump(php_strip_whitespace($filename)); $data = '/* test comment */'; @@ -40,9 +39,6 @@ var_dump(php_strip_whitespace($filename)); echo "Done\n"; ?> --EXPECTF-- -Warning: php_strip_whitespace() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): failed to open stream: No such file or directory in %s on line %d string(0) "" string(18) "/* test comment */" diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt index eab44a4a65..89b1b9ace2 100644 --- a/ext/standard/tests/strings/printf.phpt +++ b/ext/standard/tests/strings/printf.phpt @@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' ); /* Zero argument */ echo "\n*** Output for zero argument ***\n"; -printf(); +try { + printf(); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* Number of arguments not matching as specified in format field */ echo "\n*** Output for insufficient number of arguments ***\n"; @@ -226,8 +230,7 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** - -Warning: printf() expects at least %d parameter, %d given in %s on line %d +printf() expects at least %d parameter, %d given *** Output for insufficient number of arguments *** diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt index 1a90970371..0106f71445 100644 --- a/ext/standard/tests/strings/printf_64bit.phpt +++ b/ext/standard/tests/strings/printf_64bit.phpt @@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' ); /* Zero argument */ echo "\n*** Output for zero argument ***\n"; -printf(); +try { + printf(); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* Number of arguments not matching as specified in format field */ echo "\n*** Output for insufficient number of arguments ***\n"; @@ -226,8 +230,7 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** - -Warning: printf() expects at least 1 parameter, 0 given in %s on line %d +printf() expects at least 1 parameter, 0 given *** Output for insufficient number of arguments *** diff --git a/ext/standard/tests/strings/printf_error.phpt b/ext/standard/tests/strings/printf_error.phpt index a88390bc04..aff95426e6 100644 --- a/ext/standard/tests/strings/printf_error.phpt +++ b/ext/standard/tests/strings/printf_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing printf() : error conditions ***\n"; // Zero arguments echo "\n-- Testing printf() function with Zero arguments --\n"; -var_dump( printf() ); +try { + var_dump( printf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing printf() function with less than expected no. of arguments --\n"; $format1 = '%s'; @@ -38,9 +42,7 @@ var_dump( printf($format3) ); *** Testing printf() : error conditions *** -- Testing printf() function with Zero arguments -- - -Warning: printf() expects at least 1 parameter, 0 given in %s on line %d -bool(false) +printf() expects at least 1 parameter, 0 given -- Testing printf() function with less than expected no. of arguments -- diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt index 1ce7d791dc..df26d5cf4b 100644 --- a/ext/standard/tests/strings/quoted_printable_encode_001.phpt +++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt @@ -3,30 +3,18 @@ quoted_printable_encode() tests - 1 --FILE-- <?php -var_dump(quoted_printable_encode()); var_dump(quoted_printable_encode("")); var_dump(quoted_printable_encode("test")); -var_dump(quoted_printable_encode("test", "more")); -$a = array("str"); -var_dump(quoted_printable_encode($a)); var_dump(quoted_printable_encode(1)); var_dump(quoted_printable_encode(NULL)); var_dump(quoted_printable_encode(false)); echo "Done\n"; ?> ---EXPECTF-- -Warning: quoted_printable_encode() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- string(0) "" string(4) "test" - -Warning: quoted_printable_encode() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: quoted_printable_encode() expects parameter 1 to be string, array given in %s on line %d -NULL string(1) "1" string(0) "" string(0) "" diff --git a/ext/standard/tests/strings/quotemeta_basic_1.phpt b/ext/standard/tests/strings/quotemeta_basic_1.phpt index 4b479a9a60..4d1feb5ae1 100644 --- a/ext/standard/tests/strings/quotemeta_basic_1.phpt +++ b/ext/standard/tests/strings/quotemeta_basic_1.phpt @@ -1,5 +1,5 @@ --TEST-- -Test function quotemeta() - using an empty string is given as str. +Test function quotemeta() - using an empty string is given as str --CREDITS-- Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> User Group: PHPSP #PHPTestFestBrasil @@ -9,4 +9,4 @@ $str = ""; var_dump(quotemeta($str)); ?> --EXPECT-- -bool(false) +string(0) "" diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt Binary files differindex 5f57b0e850..223a839f58 100644 --- a/ext/standard/tests/strings/rtrim.phpt +++ b/ext/standard/tests/strings/rtrim.phpt diff --git a/ext/standard/tests/strings/rtrim_error.phpt b/ext/standard/tests/strings/rtrim_error.phpt index 108f96a1f0..210fb58c4e 100644 --- a/ext/standard/tests/strings/rtrim_error.phpt +++ b/ext/standard/tests/strings/rtrim_error.phpt @@ -11,14 +11,6 @@ Test rtrim() function : error conditions echo "*** Testing rtrim() : error conditions ***\n"; -echo "\n-- Testing rtrim() function with no arguments --\n"; -var_dump( rtrim() ); - -echo "\n-- Testing rtrim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( rtrim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test rtrim function with various invalid charlists\n"; var_dump(rtrim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(rtrim($hello, "a..b..c")); --EXPECTF-- *** Testing rtrim() : error conditions *** --- Testing rtrim() function with no arguments -- - -Warning: rtrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing rtrim() function with more than expected no. of arguments -- - -Warning: rtrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test rtrim function with various invalid charlists Warning: rtrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/setlocale_error.phpt b/ext/standard/tests/strings/setlocale_error.phpt index 14bb7d7ed5..c2b18b1992 100644 --- a/ext/standard/tests/strings/setlocale_error.phpt +++ b/ext/standard/tests/strings/setlocale_error.phpt @@ -18,14 +18,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing setlocale() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing setlocale() function with Zero arguments --"; -var_dump( setlocale()); - -// One argument -echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --"; -var_dump( setlocale(LC_ALL) ); - echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n"; //Invalid array of locales $invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid"); @@ -44,14 +36,6 @@ echo "\nDone"; --EXPECTF-- *** Testing setlocale() : error conditions *** --- Testing setlocale() function with Zero arguments -- -Warning: setlocale() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing setlocale() function with One argument, 'category' = LC_ALL -- -Warning: setlocale() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing setlocale() function with invalid locale array, 'category' = LC_ALL -- bool(false) diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt index 102dab75ff..09e81be014 100644 --- a/ext/standard/tests/strings/sha1_file.phpt +++ b/ext/standard/tests/strings/sha1_file.phpt @@ -46,12 +46,6 @@ var_dump( sha1_file(12) ); echo "\n-- NULL as filename --\n"; var_dump( sha1_file(NULL) ); -echo "\n-- Zero arguments --\n"; - var_dump ( sha1_file() ); - -echo "\n-- More than valid number of arguments ( valid is 2) --\n"; -var_dump ( sha1_file("EmptyFileSHA1.txt", true, NULL) ); - echo "\n-- Hexadecimal Output for Empty file as Argument --\n"; var_dump( sha1_file("EmptyFileSHA1.txt") ); @@ -95,16 +89,6 @@ bool(false) Warning: sha1_file(): Filename cannot be empty in %s on line %d bool(false) --- Zero arguments -- - -Warning: sha1_file() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- More than valid number of arguments ( valid is 2) -- - -Warning: sha1_file() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Hexadecimal Output for Empty file as Argument -- string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" diff --git a/ext/standard/tests/strings/soundex.phpt b/ext/standard/tests/strings/soundex.phpt index 650236c2e5..744f71c17a 100644 --- a/ext/standard/tests/strings/soundex.phpt +++ b/ext/standard/tests/strings/soundex.phpt @@ -5,7 +5,6 @@ soundex() tests var_dump(soundex("")); var_dump(soundex(-1)); -var_dump(soundex(array())); $array = array( "From", @@ -34,9 +33,6 @@ echo "Done\n"; --EXPECTF-- bool(false) string(4) "0000" - -Warning: soundex() expects parameter 1 to be string, array given in %s on line %d -NULL string(4) "F650" string(4) "T300" string(4) "T500" diff --git a/ext/standard/tests/strings/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt index 1c12cd3168..1b21b8b141 100644 --- a/ext/standard/tests/strings/sprintf_error.phpt +++ b/ext/standard/tests/strings/sprintf_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing sprintf() : error conditions ***\n"; // Zero arguments echo "\n-- Testing sprintf() function with Zero arguments --\n"; -var_dump( sprintf() ); +try { + var_dump( sprintf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n"; $format1 = '%s'; @@ -38,9 +42,7 @@ echo "Done"; *** Testing sprintf() : error conditions *** -- Testing sprintf() function with Zero arguments -- - -Warning: sprintf() expects at least %d parameter, %d given in %s on line %d -bool(false) +sprintf() expects at least %d parameter, %d given -- Testing sprintf() function with less than expected no. of arguments -- diff --git a/ext/standard/tests/strings/sscanf_error.phpt b/ext/standard/tests/strings/sscanf_error.phpt index ca967758ab..3e54a42f1e 100644 --- a/ext/standard/tests/strings/sscanf_error.phpt +++ b/ext/standard/tests/strings/sscanf_error.phpt @@ -12,12 +12,6 @@ echo "*** Testing sscanf() : error conditions ***\n"; $str = "Hello World"; $format = "%s %s"; -echo "\n-- Testing sscanf() function with no arguments --\n"; -var_dump( sscanf() ); - -echo "\n-- Testing sscanf() function with one argument --\n"; -var_dump( sscanf($str) ); - echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n"; var_dump( sscanf($str, $format, $str1, $str2, $extra_str) ); @@ -27,16 +21,6 @@ var_dump( sscanf($str, $format, $str1, $str2, $extra_str) ); --EXPECTF-- *** Testing sscanf() : error conditions *** --- Testing sscanf() function with no arguments -- - -Warning: sscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing sscanf() function with one argument -- - -Warning: sscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing sscanf() function with more than expected no. of arguments -- Warning: sscanf(): Variable is not assigned by any conversion specifiers in %s on line %d diff --git a/ext/standard/tests/strings/str_ireplace.phpt b/ext/standard/tests/strings/str_ireplace.phpt index 526b8ac723..71a9d1e127 100644 --- a/ext/standard/tests/strings/str_ireplace.phpt +++ b/ext/standard/tests/strings/str_ireplace.phpt @@ -3,9 +3,6 @@ str_ireplace() tests --FILE-- <?php -var_dump(str_ireplace()); -var_dump(str_ireplace("")); -var_dump(str_ireplace("", "")); var_dump(str_ireplace("", "", "")); var_dump(str_ireplace("tt", "a", "ttttTttttttttTT")); @@ -48,14 +45,6 @@ var_dump($Data = str_ireplace("\n", "<br>", $Data)); echo "Done\n"; ?> --EXPECTF-- -Warning: str_ireplace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: str_ireplace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_ireplace() expects at least 3 parameters, 2 given in %s on line %d -NULL string(0) "" string(8) "aaaaaaaT" string(8) "aaaaaaaT" diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt Binary files differindex b44a9517ab..be4c9ed942 100644 --- a/ext/standard/tests/strings/str_pad.phpt +++ b/ext/standard/tests/strings/str_pad.phpt diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt Binary files differindex 306b7d381a..766bea1f9c 100644 --- a/ext/standard/tests/strings/str_repeat.phpt +++ b/ext/standard/tests/strings/str_repeat.phpt diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt index 7b411abac5..bef11f872a 100644 --- a/ext/standard/tests/strings/str_replace.phpt +++ b/ext/standard/tests/strings/str_replace.phpt @@ -223,15 +223,6 @@ var_dump( str_replace("worldS", "FOUND", "$strS") ); var_dump( str_replace("worldS", "FOUND", "${str}S") ); var_dump( str_replace("worldS", "FOUND", "{$str}S") ); - -echo "\n*** Testing error conditions ***"; -/* Invalid arguments */ -var_dump( str_replace() ); -var_dump( str_replace("") ); -var_dump( str_replace(NULL) ); -var_dump( str_replace(1, 2) ); -var_dump( str_replace(1,2,3,$var,5) ); - fclose($resource1); closedir($resource2); echo "Done\n"; @@ -938,20 +929,4 @@ Notice: Undefined variable: strS in %s on line %d string(0) "" string(5) "FOUND" string(5) "FOUND" - -*** Testing error conditions *** -Warning: str_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: str_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt index a477800a26..1aea668026 100644 --- a/ext/standard/tests/strings/str_split_variation6.phpt +++ b/ext/standard/tests/strings/str_split_variation6.phpt @@ -30,7 +30,6 @@ $values = array ( 0234, //octal number 0x1A, //hexadecimal number 2147483647, //max positive integer number - 2147483648, //max positive integer+1 -2147483648, //min negative integer ); @@ -157,10 +156,6 @@ array(1) { } -- Iteration 7 -- -Warning: str_split() expects parameter 2 to be int, float given in %s line %d -NULL --- Iteration 8 -- - Warning: str_split(): The length of each segment must be greater than zero in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt index 5082c7ba2f..1a2471a20a 100644 --- a/ext/standard/tests/strings/str_split_variation7.phpt +++ b/ext/standard/tests/strings/str_split_variation7.phpt @@ -32,7 +32,6 @@ $values = array ( 0234, //octal number 0x1A, //hexadecimal number 2147483647, //max positive integer number - 2147483648, //max positive integer+1 -2147483648, //min negative integer ); @@ -135,10 +134,6 @@ array(1) { } -- Iteration 7 -- -Warning: str_split() expects parameter 2 to be int, float given in %s on line %d -NULL --- Iteration 8 -- - Warning: str_split(): The length of each segment must be greater than zero in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/str_word_count.phpt b/ext/standard/tests/strings/str_word_count.phpt index f88646370b..e8fa12aca6 100644 --- a/ext/standard/tests/strings/str_word_count.phpt +++ b/ext/standard/tests/strings/str_word_count.phpt @@ -13,28 +13,20 @@ var_dump(str_word_count($str, 3)); var_dump(str_word_count($str, 123)); var_dump(str_word_count($str, -1)); var_dump(str_word_count($str, 999999999)); -var_dump(str_word_count($str, array())); -var_dump(str_word_count($str, $b)); var_dump($str); $str2 = "F0o B4r 1s bar foo"; var_dump(str_word_count($str2, NULL, "04")); var_dump(str_word_count($str2, NULL, "01")); var_dump(str_word_count($str2, NULL, "014")); -var_dump(str_word_count($str2, NULL, array())); -var_dump(str_word_count($str2, NULL, new stdClass)); var_dump(str_word_count($str2, NULL, "")); var_dump(str_word_count($str2, 1, "04")); var_dump(str_word_count($str2, 1, "01")); var_dump(str_word_count($str2, 1, "014")); -var_dump(str_word_count($str2, 1, array())); -var_dump(str_word_count($str2, 1, new stdClass)); var_dump(str_word_count($str2, 1, "")); var_dump(str_word_count($str2, 2, "04")); var_dump(str_word_count($str2, 2, "01")); var_dump(str_word_count($str2, 2, "014")); -var_dump(str_word_count($str2, 2, array())); -var_dump(str_word_count($str2, 2, new stdClass)); var_dump(str_word_count($str2, 2, "")); var_dump(str_word_count("foo'0 bar-0var", 2, "0")); var_dump(str_word_count("'foo'", 2)); @@ -86,23 +78,11 @@ bool(false) Warning: str_word_count(): Invalid format value 999999999 in %s on line %d bool(false) - -Warning: str_word_count() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 2 to be int, string given in %s on line %d -NULL string(55) "Hello friend, you're looking good today!" int(5) int(6) int(5) - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL int(7) array(5) { [0]=> @@ -142,12 +122,6 @@ array(5) { [4]=> string(3) "foo" } - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL array(7) { [0]=> string(1) "F" @@ -202,12 +176,6 @@ array(5) { [15]=> string(3) "foo" } - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL array(7) { [0]=> string(1) "F" diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt Binary files differindex 3086c2be92..d9063cc9de 100644 --- a/ext/standard/tests/strings/strcasecmp.phpt +++ b/ext/standard/tests/strings/strcasecmp.phpt diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt Binary files differindex 397e072c52..fd20e50195 100644 --- a/ext/standard/tests/strings/strcmp.phpt +++ b/ext/standard/tests/strings/strcmp.phpt diff --git a/ext/standard/tests/strings/stripos.phpt b/ext/standard/tests/strings/stripos.phpt index 057b8ca494..4c3c5a7fcc 100644 --- a/ext/standard/tests/strings/stripos.phpt +++ b/ext/standard/tests/strings/stripos.phpt @@ -28,7 +28,7 @@ stripos() function test echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- int(0) int(5) int(5) @@ -45,23 +45,11 @@ int(0) bool(false) bool(false) bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) +int(0) int(1) Done diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt index 324014cf6d..0420bb090b 100644 --- a/ext/standard/tests/strings/stripos_error.phpt +++ b/ext/standard/tests/strings/stripos_error.phpt @@ -8,14 +8,6 @@ Test stripos() function : error conditions */ echo "*** Testing stripos() function: error conditions ***\n"; -echo "\n-- With Zero arguments --"; -var_dump( stripos() ); - -echo "\n-- With less than expected number of arguments --"; -var_dump( stripos("String") ); - -echo "\n-- With more than expected number of arguments --"; -var_dump( stripos("string", "String", 1, 'extra_arg') ); echo "\n-- Offset beyond the end of the string --"; var_dump( stripos("Hello World", "o", 12) ); @@ -28,18 +20,6 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function: error conditions *** --- With Zero arguments -- -Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- With less than expected number of arguments -- -Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- With more than expected number of arguments -- -Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Offset beyond the end of the string -- Warning: stripos(): Offset not contained in string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/stripos_variation1.phpt b/ext/standard/tests/strings/stripos_variation1.phpt index a3fc324dd7..53d6be65e7 100644 --- a/ext/standard/tests/strings/stripos_variation1.phpt +++ b/ext/standard/tests/strings/stripos_variation1.phpt @@ -81,7 +81,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stripos() function: with double quoted strings *** -- Iteration 1 -- int(2) @@ -117,32 +117,16 @@ int(9) int(8) bool(false) -- Iteration 12 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 13 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 14 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 16 -- bool(false) diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt index 81b8f5adb1..6792b4d0b2 100644 --- a/ext/standard/tests/strings/stripos_variation10.phpt +++ b/ext/standard/tests/strings/stripos_variation10.phpt @@ -83,7 +83,11 @@ $needles = array ( $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "\n-- Iteration $counter --\n"; - var_dump( stripos($haystack, $needles[$index]) ); + try { + var_dump( stripos($haystack, $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -95,101 +99,61 @@ echo "*** Done ***"; *** Testing stripos() function with unexpected values for needle *** -- Iteration 1 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(7) -- Iteration 2 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 3 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(16) -- Iteration 6 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(21) -- Iteration 7 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 8 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 9 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(17) -- Iteration 10 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 16 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 18 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(64) -- Iteration 20 -- bool(false) @@ -198,27 +162,17 @@ bool(false) bool(false) -- Iteration 22 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 24 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -%s +stripos() expects parameter 2 to be string, resource given -- Iteration 25 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt index b4b83a1641..aab3181df3 100644 --- a/ext/standard/tests/strings/stripos_variation11.phpt +++ b/ext/standard/tests/strings/stripos_variation11.phpt @@ -81,8 +81,16 @@ $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $haystack = $values[$index]; - var_dump( stripos($values[$index], $values[$index]) ); - var_dump( stripos($values[$index], $values[$index], 1) ); + try { + var_dump( stripos($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( stripos($values[$index], $values[$index], 1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -91,109 +99,49 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function with unexpected values for haystack and needle *** -- Iteration 1 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 2 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 3 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 4 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 5 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 6 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 7 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 8 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 9 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 10 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 16 -- bool(false) @@ -201,11 +149,7 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 18 -- bool(false) @@ -213,15 +157,7 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 20 -- bool(false) @@ -244,12 +180,8 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 24 -- - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL +stripos() expects parameter 1 to be string, resource given +stripos() expects parameter 1 to be string, resource given -- Iteration 25 -- bool(false) diff --git a/ext/standard/tests/strings/stripos_variation2.phpt b/ext/standard/tests/strings/stripos_variation2.phpt index bb77d1becb..0f4c887869 100644 --- a/ext/standard/tests/strings/stripos_variation2.phpt +++ b/ext/standard/tests/strings/stripos_variation2.phpt @@ -83,7 +83,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stripos() function: with single quoted strings *** -- Iteration 1 -- int(2) @@ -119,32 +119,16 @@ bool(false) int(10) int(10) -- Iteration 12 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 16 -- bool(false) @@ -234,11 +218,7 @@ bool(false) bool(false) bool(false) -- Iteration 45 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(26) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 46 -- int(0) diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt index 8fca54b082..92cfa09eb1 100644 --- a/ext/standard/tests/strings/stristr.phpt +++ b/ext/standard/tests/strings/stristr.phpt @@ -2,10 +2,6 @@ stristr() function --FILE-- <?php - var_dump(stristr()); - var_dump(stristr(array(), "")); - var_dump(stristr("", array())); - var_dump(stristr(array(), array())); var_dump(stristr("tEsT sTrInG", "tEsT")); var_dump(stristr("tEsT sTrInG", "stRiNg")); var_dump(stristr("tEsT sTrInG", "stRiN")); @@ -19,17 +15,6 @@ stristr() function var_dump(stristr("tEsT sTrInG", " ")); ?> --EXPECTF-- -Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d -NULL string(11) "tEsT sTrInG" string(6) "sTrInG" string(6) "sTrInG" diff --git a/ext/standard/tests/strings/stristr2.phpt b/ext/standard/tests/strings/stristr2.phpt index b899b4739d..ae2c8e93cf 100644 --- a/ext/standard/tests/strings/stristr2.phpt +++ b/ext/standard/tests/strings/stristr2.phpt @@ -16,14 +16,10 @@ var_dump(stristr($email, 97)); var_dump(stristr($email, 97, 1)); ?> ---EXPECTF-- +--EXPECT-- string(7) "cCdEfGh" string(2) "Ab" string(5) "eEfGh" string(4) "AbCd" - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(11) "azAbCdeEfGh" - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(1) "w" +bool(false) +bool(false) diff --git a/ext/standard/tests/strings/stristr_error.phpt b/ext/standard/tests/strings/stristr_error.phpt index a0057574f9..a7b683d3b8 100644 --- a/ext/standard/tests/strings/stristr_error.phpt +++ b/ext/standard/tests/strings/stristr_error.phpt @@ -8,17 +8,6 @@ Test stristr() function : error conditions */ echo "*** Testing stristr() : error conditions ***\n"; -echo "\n-- Testing stristr() function with no arguments --\n"; -var_dump( stristr() ); -var_dump( stristr("") ); - -echo "\n-- Testing stristr() function with no needle --\n"; -var_dump( stristr("Hello World") ); // without "needle" - -echo "\n-- Testing stristr() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( stristr("Hello World", "World", true, $extra_arg) ); - echo "\n-- Testing stristr() function with empty haystack --\n"; var_dump( stristr(NULL, "") ); @@ -30,24 +19,6 @@ var_dump( stristr("Hello World", "") ); --EXPECTF-- *** Testing stristr() : error conditions *** --- Testing stristr() function with no arguments -- - -Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing stristr() function with no needle -- - -Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing stristr() function with more than expected no. of arguments -- - -Warning: stristr() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing stristr() function with empty haystack -- Warning: stristr(): Empty needle in %s on line %d diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt index 4a0b62f261..fd842d1106 100644 --- a/ext/standard/tests/strings/stristr_variation2.phpt +++ b/ext/standard/tests/strings/stristr_variation2.phpt @@ -72,7 +72,11 @@ $pad_length = "20"; $count = 1; foreach($inputs as $input) { echo "-- Iteration $count --\n"; - var_dump( stristr("Hello World", $input) ); + try { + var_dump( stristr("Hello World", $input) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count ++; } @@ -83,85 +87,55 @@ fclose($file_handle); //closing the file handle --EXPECTF-- *** Testing stristr() function: with unexpected inputs for 'needle' argument *** -- Iteration 1 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 2 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 3 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 6 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 7 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 8 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, array given -- Iteration 9 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, array given -- Iteration 10 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, array given -- Iteration 11 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 12 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 14 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 15 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 16 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 17 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 18 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, resource given -- Iteration 19 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 20 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt Binary files differindex a546bdb8d2..156038ed7b 100644 --- a/ext/standard/tests/strings/strlen.phpt +++ b/ext/standard/tests/strings/strlen.phpt diff --git a/ext/standard/tests/strings/strncasecmp_error.phpt b/ext/standard/tests/strings/strncasecmp_error.phpt index d443f8113b..00ddfaed9b 100644 --- a/ext/standard/tests/strings/strncasecmp_error.phpt +++ b/ext/standard/tests/strings/strncasecmp_error.phpt @@ -10,18 +10,6 @@ Test strncasecmp() function : error conditions echo "*** Testing strncasecmp() function: error conditions ***\n"; $str1 = 'string_val'; $str2 = 'string_val'; -$len = 10; -$extra_arg = 10; - -echo "\n-- Testing strncasecmp() function with Zero arguments --"; -var_dump( strncasecmp() ); - -echo "\n-- Testing strncasecmp() function with less than expected number of arguments --"; -var_dump( strncasecmp($str1) ); -var_dump( strncasecmp($str1, $str2) ); - -echo "\n-- Testing strncasecmp() function with more than expected number of arguments --"; -var_dump( strncasecmp($str1, $str2, $len, $extra_arg) ); echo "\n-- Testing strncasecmp() function with invalid argument --"; $len = -10; @@ -31,21 +19,6 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing strncasecmp() function: error conditions *** --- Testing strncasecmp() function with Zero arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 0 given in %s on line %d -NULL - --- Testing strncasecmp() function with less than expected number of arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: strncasecmp() expects exactly 3 parameters, 2 given in %s on line %d -NULL - --- Testing strncasecmp() function with more than expected number of arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 4 given in %s on line %d -NULL - -- Testing strncasecmp() function with invalid argument -- Warning: Length must be greater than or equal to 0 in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strncmp_error.phpt b/ext/standard/tests/strings/strncmp_error.phpt index 4eb73eb318..13a4cb0350 100644 --- a/ext/standard/tests/strings/strncmp_error.phpt +++ b/ext/standard/tests/strings/strncmp_error.phpt @@ -12,13 +12,6 @@ Test strncmp() function : error conditions echo "*** Testing strncmp() function: error conditions ***\n"; $str1 = 'string_val'; $str2 = 'string_val'; -$len = 10; -$extra_arg = 10; - -var_dump( strncmp() ); //Zero argument -var_dump( strncmp($str1) ); //One argument, less than expected no. of args -var_dump( strncmp($str1, $str2) ); //Two arguments, less than expected no. of args -var_dump( strncmp($str1, $str2, $len, $extra_arg) ); //Four arguments, greater than expected no. of args /* Invalid argument for $len */ $len = -10; @@ -28,18 +21,6 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing strncmp() function: error conditions *** -Warning: strncmp() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 4 given in %s on line %d -NULL - Warning: Length must be greater than or equal to 0 in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strpbrk_error.phpt b/ext/standard/tests/strings/strpbrk_error.phpt index 658e2f429e..cce843c2f1 100644 --- a/ext/standard/tests/strings/strpbrk_error.phpt +++ b/ext/standard/tests/strings/strpbrk_error.phpt @@ -11,47 +11,17 @@ Test strpbrk() function : error conditions echo "*** Testing strpbrk() : error conditions ***\n"; $haystack = 'This is a Simple text.'; -$char_list = 'string_val'; -$extra_arg = 10; - -echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n"; -var_dump( strpbrk($haystack, $char_list, $extra_arg) ); - -echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n"; -var_dump( strpbrk($haystack) ); echo "\n-- Testing strpbrk() function with empty second argument --\n"; var_dump( strpbrk($haystack, '') ); -echo "\n-- Testing strpbrk() function with arrays --\n"; -var_dump( strpbrk($haystack, array('a', 'b', 'c') ) ); -var_dump( strpbrk(array('foo', 'bar'), 'b') ); - ?> ===DONE=== --EXPECTF-- *** Testing strpbrk() : error conditions *** --- Testing strpbrk() function with more than expected no. of arguments -- - -Warning: strpbrk() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - --- Testing strpbrk() function with less than expected no. of arguments -- - -Warning: strpbrk() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - -- Testing strpbrk() function with empty second argument -- Warning: strpbrk(): The character list cannot be empty in %s on line %d bool(false) - --- Testing strpbrk() function with arrays -- - -Warning: strpbrk() expects parameter 2 to be string, array given in %s on line %d -bool(false) - -Warning: strpbrk() expects parameter 1 to be string, array given in %s on line %d -bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt Binary files differindex 578539804d..4640b670f3 100644 --- a/ext/standard/tests/strings/strpos.phpt +++ b/ext/standard/tests/strings/strpos.phpt diff --git a/ext/standard/tests/strings/strpos_number.phpt b/ext/standard/tests/strings/strpos_number.phpt index fd045c64d3..76cf8e59ef 100644 --- a/ext/standard/tests/strings/strpos_number.phpt +++ b/ext/standard/tests/strings/strpos_number.phpt @@ -9,10 +9,7 @@ var_dump(strpos("foo bar", 111)); // string("11") is contained var_dump(strpos("foo 11", "11")); ?> ---EXPECTF-- -Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +--EXPECT-- +int(4) bool(false) - -Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(1) int(4) diff --git a/ext/standard/tests/strings/strrchr_variation1.phpt b/ext/standard/tests/strings/strrchr_variation1.phpt Binary files differindex 5043128945..a75dd96bbf 100644 --- a/ext/standard/tests/strings/strrchr_variation1.phpt +++ b/ext/standard/tests/strings/strrchr_variation1.phpt diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt index 3b06b20be1..1004a3d915 100644 --- a/ext/standard/tests/strings/strrchr_variation10.phpt +++ b/ext/standard/tests/strings/strrchr_variation10.phpt @@ -121,7 +121,11 @@ $needles = array ( $count = 1; for($index = 0; $index < count($haystacks); $index++) { echo "-- Iteration $count --\n"; - var_dump( strrchr($haystacks[$index], $needles[$index]) ); + try { + var_dump( strrchr($haystacks[$index], $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count ++; } @@ -129,108 +133,58 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function with unexpected inputs for needle *** -- Iteration 1 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "0" -- Iteration 2 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 3 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "-2" -- Iteration 5 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "10.5" -- Iteration 6 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-10.5" -- Iteration 7 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "10" -- Iteration 8 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "10" -- Iteration 9 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 10 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 18 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 20 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 21 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(6) "object" -- Iteration 22 -- bool(false) -- Iteration 23 -- bool(false) -- Iteration 24 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, resource given -- Iteration 25 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt index 108ba2e0f2..79ffe4c2ec 100644 --- a/ext/standard/tests/strings/strrchr_variation11.phpt +++ b/ext/standard/tests/strings/strrchr_variation11.phpt @@ -80,7 +80,11 @@ $values = array ( $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; - var_dump( strrchr($values[$index], $values[$index]) ); + try { + var_dump( strrchr($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -88,108 +92,58 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function: with unexpected inputs for haystack and needle *** -- Iteration 1 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "0" -- Iteration 2 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 3 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "12345" -- Iteration 4 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-2345" -- Iteration 5 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "10.5" -- Iteration 6 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-10.5" -- Iteration 7 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(10) "1234567000" -- Iteration 8 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "1E-9" -- Iteration 9 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(3) "0.5" -- Iteration 10 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 16 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 18 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(6) "object" -- Iteration 20 -- bool(false) -- Iteration 21 -- bool(false) -- Iteration 22 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- - -Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, resource given -- Iteration 25 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation12.phpt b/ext/standard/tests/strings/strrchr_variation12.phpt Binary files differindex 730811ea47..a17902604a 100644 --- a/ext/standard/tests/strings/strrchr_variation12.phpt +++ b/ext/standard/tests/strings/strrchr_variation12.phpt diff --git a/ext/standard/tests/strings/strrchr_variation2.phpt b/ext/standard/tests/strings/strrchr_variation2.phpt index ddce2c2ccb..2ff6720fb9 100644 --- a/ext/standard/tests/strings/strrchr_variation2.phpt +++ b/ext/standard/tests/strings/strrchr_variation2.phpt @@ -117,23 +117,15 @@ bool(false) string(5) "\101 " -- Iteration 12 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- @@ -221,9 +213,7 @@ bool(false) string(7) "4 \101 " -- Iteration 44 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -string(37) "*+-./:;<=>?@hello123456he \x234 \101 " +string(7) "4 \101 " -- Iteration 45 -- string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " diff --git a/ext/standard/tests/strings/strrchr_variation8.phpt b/ext/standard/tests/strings/strrchr_variation8.phpt index 6b49b698f4..31a727ed6f 100644 --- a/ext/standard/tests/strings/strrchr_variation8.phpt +++ b/ext/standard/tests/strings/strrchr_variation8.phpt @@ -30,15 +30,11 @@ foreach($needles as $needle) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function: with heredoc strings *** bool(false) bool(false) - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/strings/strripos.phpt b/ext/standard/tests/strings/strripos.phpt index 291ff78cd7..fa15e2fcac 100644 --- a/ext/standard/tests/strings/strripos.phpt +++ b/ext/standard/tests/strings/strripos.phpt @@ -15,9 +15,6 @@ strripos() function var_dump(@strripos("a", "")); var_dump(@strripos("", "a")); var_dump(@strripos("\\\\a", "\\a")); - - $fp = fopen(__FILE__, "r"); - var_dump(@strripos("", $fp)); ?> --EXPECT-- int(5) @@ -33,4 +30,3 @@ bool(false) bool(false) bool(false) int(1) -bool(false) diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt index 70a9534ebd..5981c9b6cb 100644 --- a/ext/standard/tests/strings/strripos_offset.phpt +++ b/ext/standard/tests/strings/strripos_offset.phpt @@ -3,11 +3,12 @@ strripos() offset integer overflow --FILE-- <?php -var_dump(strripos("t", "t", PHP_INT_MAX+1)); -var_dump(strripos("tttt", "tt", PHP_INT_MAX+1)); -var_dump(strripos(100, 101, PHP_INT_MAX+1)); -var_dump(strripos(1024, 1024, PHP_INT_MAX+1)); -var_dump(strripos(array(), array(), PHP_INT_MAX+1)); +try { + var_dump(strripos("t", "t", PHP_INT_MAX+1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(strripos(1024, 1024, -PHP_INT_MAX)); var_dump(strripos(1024, "te", -PHP_INT_MAX)); var_dump(strripos(1024, 1024, -PHP_INT_MAX-1)); @@ -16,22 +17,7 @@ var_dump(strripos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +strripos() expects parameter 3 to be int, float given Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) @@ -39,8 +25,6 @@ bool(false) Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) -Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strripos_variation1.phpt b/ext/standard/tests/strings/strripos_variation1.phpt index 59d7a64686..ce396695af 100644 --- a/ext/standard/tests/strings/strripos_variation1.phpt +++ b/ext/standard/tests/strings/strripos_variation1.phpt @@ -74,7 +74,7 @@ foreach ($needles as $needle) { } ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing strripos() function: with double quoted strings *** -- Iteration 1 -- int(28) @@ -132,57 +132,25 @@ int(8) bool(false) int(8) -- Iteration 12 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 13 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 14 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 15 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 16 -- bool(false) bool(false) diff --git a/ext/standard/tests/strings/strripos_variation2.phpt b/ext/standard/tests/strings/strripos_variation2.phpt index 7b47b787be..3800c32155 100644 --- a/ext/standard/tests/strings/strripos_variation2.phpt +++ b/ext/standard/tests/strings/strripos_variation2.phpt @@ -75,7 +75,7 @@ foreach ($needles as $needle) { } ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing strripos() function: with single quoted strings *** -- Iteration 1 -- int(32) @@ -133,56 +133,24 @@ int(10) bool(false) int(10) -- Iteration 12 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- bool(false) @@ -280,18 +248,10 @@ bool(false) bool(false) bool(false) -- Iteration 35 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) +bool(false) +bool(false) +bool(false) +bool(false) -- Iteration 36 -- int(0) bool(false) diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt index 9ef4f42d18..d1bbc856a3 100644 --- a/ext/standard/tests/strings/strrpos_offset.phpt +++ b/ext/standard/tests/strings/strrpos_offset.phpt @@ -3,10 +3,12 @@ strrpos() offset integer overflow --FILE-- <?php -var_dump(strrpos("t", "t", PHP_INT_MAX+1)); -var_dump(strrpos("tttt", "tt", PHP_INT_MAX+1)); -var_dump(strrpos(100, 101, PHP_INT_MAX+1)); -var_dump(strrpos(1024, 1024, PHP_INT_MAX+1)); +try { + var_dump(strrpos("t", "t", PHP_INT_MAX+1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(strrpos(1024, 1024, -PHP_INT_MAX)); var_dump(strrpos(1024, "te", -PHP_INT_MAX)); var_dump(strrpos(1024, 1024, -PHP_INT_MAX-1)); @@ -15,19 +17,7 @@ var_dump(strrpos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +strrpos() expects parameter 3 to be int, float given Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) @@ -35,8 +25,6 @@ bool(false) Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strrpos_variation1.phpt b/ext/standard/tests/strings/strrpos_variation1.phpt index fd236d04d4..4fc480face 100644 --- a/ext/standard/tests/strings/strrpos_variation1.phpt +++ b/ext/standard/tests/strings/strrpos_variation1.phpt @@ -72,7 +72,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with double quoted strings *** -- Iteration 1 -- int(28) @@ -108,32 +108,16 @@ int(9) int(8) bool(false) -- Iteration 12 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 13 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 14 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 16 -- bool(false) diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt index b9b24b9cb1..440605d430 100644 --- a/ext/standard/tests/strings/strrpos_variation10.phpt +++ b/ext/standard/tests/strings/strrpos_variation10.phpt @@ -83,7 +83,11 @@ $needles = array ( $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "-- Iteration $counter --\n"; - var_dump( strrpos($haystack, $needles[$index]) ); + try { + var_dump( strrpos($haystack, $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -91,108 +95,58 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function with unexpected values for needle *** -- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(42) -- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(27) -- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(21) -- Iteration 7 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(28) -- Iteration 10 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(64) -- Iteration 20 -- bool(false) -- Iteration 21 -- bool(false) -- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, resource given -- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt index 94c1b9d96d..71201a1c21 100644 --- a/ext/standard/tests/strings/strrpos_variation11.phpt +++ b/ext/standard/tests/strings/strrpos_variation11.phpt @@ -81,151 +81,79 @@ $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $haystack = $values[$index]; - var_dump( strrpos($values[$index], $values[$index]) ); - var_dump( strrpos($values[$index], $values[$index], 1) ); + try { + var_dump( strrpos($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( strrpos($values[$index], $values[$index], 1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function with unexpected values for haystack and needle *** -- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 7 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 20 -- bool(false) @@ -234,38 +162,18 @@ bool(false) bool(false) bool(false) -- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, resource given +strrpos() expects parameter 1 to be string, resource given -- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation15.phpt b/ext/standard/tests/strings/strrpos_variation15.phpt deleted file mode 100644 index 798a6877e4..0000000000 --- a/ext/standard/tests/strings/strrpos_variation15.phpt +++ /dev/null @@ -1,205 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of last occurrence of 'needle' in 'haystack'. - * Source code: ext/standard/string.c -*/ - -/* Test strrpos() function with unexpected inputs for 'haystack', 'needle' & 'offset' arguments */ - -echo "*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - //resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of strrpos() -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - var_dump( strrpos($values[$index], $values[$index], $values[$index]) ); - $counter ++; -} - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrpos() function: with unexpected values for haystack, needle & offset *** --- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) --- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: strrpos() expects parameter 3 to be int, object given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) --- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation2.phpt b/ext/standard/tests/strings/strrpos_variation2.phpt index 9c0a320785..af5c9e349d 100644 --- a/ext/standard/tests/strings/strrpos_variation2.phpt +++ b/ext/standard/tests/strings/strrpos_variation2.phpt @@ -73,7 +73,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with single quoted strings *** -- Iteration 1 -- int(32) @@ -109,32 +109,16 @@ bool(false) int(10) int(10) -- Iteration 12 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- bool(false) @@ -194,11 +178,7 @@ bool(false) bool(false) bool(false) -- Iteration 35 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 36 -- int(0) diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt index 54db4b372e..c0546c74f8 100644 --- a/ext/standard/tests/strings/strrpos_variation7.phpt +++ b/ext/standard/tests/strings/strrpos_variation7.phpt @@ -22,15 +22,11 @@ var_dump( strrpos($empty_string, NULL) ); echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with heredoc strings *** -- With empty heredoc string -- bool(false) bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt Binary files differindex 2908de7a27..6bdc3feab1 100644 --- a/ext/standard/tests/strings/strstr.phpt +++ b/ext/standard/tests/strings/strstr.phpt diff --git a/ext/standard/tests/strings/strtolower-win32.phpt b/ext/standard/tests/strings/strtolower-win32.phpt Binary files differindex c0ad1d0115..ff631754df 100644 --- a/ext/standard/tests/strings/strtolower-win32.phpt +++ b/ext/standard/tests/strings/strtolower-win32.phpt diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt Binary files differindex 47dfe09762..7c7e2bb4c7 100644 --- a/ext/standard/tests/strings/strtolower.phpt +++ b/ext/standard/tests/strings/strtolower.phpt diff --git a/ext/standard/tests/strings/strtoupper1-win32.phpt b/ext/standard/tests/strings/strtoupper1-win32.phpt Binary files differindex 60701652e1..7240e5c021 100644 --- a/ext/standard/tests/strings/strtoupper1-win32.phpt +++ b/ext/standard/tests/strings/strtoupper1-win32.phpt diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt Binary files differindex e0ebf42ea7..c243ff10c7 100644 --- a/ext/standard/tests/strings/strtoupper1.phpt +++ b/ext/standard/tests/strings/strtoupper1.phpt diff --git a/ext/standard/tests/strings/strval_error.phpt b/ext/standard/tests/strings/strval_error.phpt index 37ecfd14d5..acf3cc623a 100644 --- a/ext/standard/tests/strings/strval_error.phpt +++ b/ext/standard/tests/strings/strval_error.phpt @@ -16,17 +16,6 @@ class MyClass // no toString() method defined } -$string = "Hello"; -$extra_arg = 10; - -//Test strval with one more than the expected number of arguments -echo "\n-- Testing strval() function with more than expected no. of arguments --\n"; -var_dump( strval($string, $extra_arg) ); - -// Testing strval with one less than the expected number of arguments -echo "\n-- Testing strval() function with less than expected no. of arguments --\n"; -var_dump( strval() ); - // Testing strval with a object which has no toString() method echo "\n-- Testing strval() function with object which has not toString() method --\n"; var_dump( strval(new MyClass()) ); @@ -36,16 +25,6 @@ var_dump( strval(new MyClass()) ); --EXPECTF-- *** Testing strval() : error conditions *** --- Testing strval() function with more than expected no. of arguments -- - -Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing strval() function with less than expected no. of arguments -- - -Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -- Testing strval() function with object which has not toString() method -- Recoverable fatal error: Object of class MyClass could not be converted to string in %s on line %d diff --git a/ext/standard/tests/strings/substr.phpt b/ext/standard/tests/strings/substr.phpt Binary files differindex 0901d2082e..18e7cd1781 100644 --- a/ext/standard/tests/strings/substr.phpt +++ b/ext/standard/tests/strings/substr.phpt diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt index 1fdf1b144f..2e3256631c 100644 --- a/ext/standard/tests/strings/substr_compare.phpt +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -12,11 +12,9 @@ var_dump(substr_compare("abcde", "cd", 1, 2) < 0); var_dump(substr_compare("abcde", "abc", 5, 1)); var_dump(substr_compare("abcde", "abcdef", -10, 10) < 0); var_dump(substr_compare("abcde", "abc", 0, 0)); -var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass)); echo "Test\n"; var_dump(substr_compare("abcde", "abc", 0, -1)); var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0); -var_dump(substr_compare("abcde", -1, 0, "str", new stdClass)); echo "Done\n"; ?> @@ -32,15 +30,9 @@ Warning: substr_compare(): The start position cannot exceed initial string lengt bool(false) bool(true) int(0) - -Warning: substr_compare() expects parameter 5 to be bool, object given in %s on line %d -bool(false) Test Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d bool(false) bool(true) - -Warning: substr_compare() expects parameter 4 to be int, string given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt index eecc251e6c..246963d13b 100644 --- a/ext/standard/tests/strings/substr_count_error.phpt +++ b/ext/standard/tests/strings/substr_count_error.phpt @@ -6,12 +6,6 @@ Test substr_count() function (error conditions) echo "\n*** Testing error conditions ***\n"; $str = 'abcdefghik'; -/* Zero argument */ -var_dump( substr_count() ); - -/* more than expected no. of args */ -var_dump( substr_count($str, "t", 0, 15, 30) ); - /* offset before start */ var_dump(substr_count($str, "t", -20)); @@ -22,9 +16,6 @@ var_dump(substr_count($str, "t", 25)); Warning message expected, as length+offset > length of string */ var_dump( substr_count($str, "i", 5, 7) ); -/* Invalid offset argument */ -var_dump( substr_count($str, "t", "") ); - /* length too small */ var_dump( substr_count($str, "t", 2, -20) ); @@ -34,12 +25,6 @@ echo "Done\n"; --EXPECTF-- *** Testing error conditions *** -Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: substr_count(): Offset not contained in string in %s on line %d bool(false) @@ -49,9 +34,6 @@ bool(false) Warning: substr_count(): Invalid length value in %s on line %d bool(false) -Warning: substr_count() expects parameter 3 to be int, string given in %s on line %d -NULL - Warning: substr_count(): Invalid length value in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_variation_001.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt index 71f2d223e1..19a9a0310d 100644 --- a/ext/standard/tests/strings/substr_count_variation_001.phpt +++ b/ext/standard/tests/strings/substr_count_variation_001.phpt @@ -12,9 +12,6 @@ var_dump( substr_count($str, "i", "5t") ); var_dump( substr_count($str, "i", "5t", "10t") ); echo "\n-- 3rd or 4th arg as NULL --\n"; -var_dump( substr_count($str, "t", "") ); -var_dump( substr_count($str, "T", "") ); -var_dump( substr_count($str, "t", "", 15) ); var_dump( substr_count($str, "I", NULL) ); var_dump( substr_count($str, "i", NULL, 10) ); @@ -67,15 +64,6 @@ Notice: A non well formed numeric value encountered in %s on line %d int(2) -- 3rd or 4th arg as NULL -- - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL int(0) int(2) diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt index ac945349fe..936d0fd1d5 100644 --- a/ext/standard/tests/strings/substr_replace_error.phpt +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -15,13 +15,6 @@ echo "*** Testing substr_replace() : error conditions ***\n"; $s1 = "Good morning"; -echo "\n-- Testing substr_replace() function with less than expected no. of arguments --\n"; -var_dump(substr_replace()); -var_dump(substr_replace($s1, "evening")); - -echo "\n-- Testing substr_replace() function with more than expected no. of arguments --\n"; -var_dump(substr_replace($s1, "evening", 5, 7, true)); - echo "\n-- Testing substr_replace() function with start and length different types --\n"; var_dump(substr_replace($s1, "evening", array(5))); var_dump(substr_replace($s1, "evening", 5, array(8))); @@ -37,19 +30,6 @@ var_dump(substr_replace($s1, "evening", array(5), array(8))); --EXPECTF-- *** Testing substr_replace() : error conditions *** --- Testing substr_replace() function with less than expected no. of arguments -- - -Warning: substr_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: substr_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - --- Testing substr_replace() function with more than expected no. of arguments -- - -Warning: substr_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing substr_replace() function with start and length different types -- Warning: substr_replace(): 'start' and 'length' should be of same type - numerical or array in %s on line %d diff --git a/ext/standard/tests/strings/trim1.phpt b/ext/standard/tests/strings/trim1.phpt Binary files differindex d0e4070d80..1ad504c61d 100644 --- a/ext/standard/tests/strings/trim1.phpt +++ b/ext/standard/tests/strings/trim1.phpt diff --git a/ext/standard/tests/strings/trim_error.phpt b/ext/standard/tests/strings/trim_error.phpt index b845cee1ac..046a2b04f9 100644 --- a/ext/standard/tests/strings/trim_error.phpt +++ b/ext/standard/tests/strings/trim_error.phpt @@ -11,14 +11,6 @@ Test trim() function : error conditions echo "*** Testing trim() : error conditions ***\n"; -echo "\n-- Testing trim() function with no arguments --\n"; -var_dump( trim() ); - -echo "\n-- Testing trim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( trim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test trim function with various invalid charlists --\n"; var_dump(trim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(trim($hello, "a..b..c")); --EXPECTF-- *** Testing trim() : error conditions *** --- Testing trim() function with no arguments -- - -Warning: trim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing trim() function with more than expected no. of arguments -- - -Warning: trim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test trim function with various invalid charlists -- Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt Binary files differindex b524b45e59..3508881d3c 100644 --- a/ext/standard/tests/strings/ucfirst.phpt +++ b/ext/standard/tests/strings/ucfirst.phpt diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt index f04e493772..b34be23267 100644 --- a/ext/standard/tests/strings/unpack_error.phpt +++ b/ext/standard/tests/strings/unpack_error.phpt @@ -10,13 +10,6 @@ Test unpack() function : error conditions echo "*** Testing unpack() : error conditions ***\n"; -echo "\n-- Testing unpack() function with no arguments --\n"; -var_dump( unpack() ); - -echo "\n-- Testing unpack() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump(unpack("I", pack("I", 65534), 0, $extra_arg)); - echo "\n-- Testing unpack() function with invalid format character --\n"; $extra_arg = 10; var_dump(unpack("B", pack("I", 65534))); @@ -25,16 +18,6 @@ var_dump(unpack("B", pack("I", 65534))); --EXPECTF-- *** Testing unpack() : error conditions *** --- Testing unpack() function with no arguments -- - -Warning: unpack() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing unpack() function with more than expected no. of arguments -- - -Warning: unpack() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing unpack() function with invalid format character -- Warning: unpack(): Invalid format type B in %s on line %d diff --git a/ext/standard/tests/strings/uuencode.phpt b/ext/standard/tests/strings/uuencode.phpt index 5a1f3d2a24..8199a2ed05 100644 --- a/ext/standard/tests/strings/uuencode.phpt +++ b/ext/standard/tests/strings/uuencode.phpt @@ -3,9 +3,6 @@ uuencode family tests --FILE-- <?php -var_dump(convert_uuencode(array())); -var_dump(convert_uudecode(array())); - var_dump(convert_uuencode("")); var_dump(convert_uudecode("")); var_dump($enc = convert_uuencode("~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL:<MNBVCXZ")); @@ -18,11 +15,6 @@ var_dump(convert_uudecode(substr($enc, 0, -10))); echo "Done\n"; ?> --EXPECTF-- -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) bool(false) bool(false) string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA: diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt index c56631ecd7..b4548e8b49 100644 --- a/ext/standard/tests/strings/vfprintf_error1.phpt +++ b/ext/standard/tests/strings/vfprintf_error1.phpt @@ -20,8 +20,16 @@ echo "\n-- Testing vfprintf() function with more than expected no. of arguments $format = 'string_val'; $args = array( 1, 2 ); $extra_arg = 10; -var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); -var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +try { + var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Close handle fclose($fp); @@ -37,10 +45,6 @@ unlink( $file ); ?> --EXPECTF-- -- Testing vfprintf() function with more than expected no. of arguments -- - -Warning: Wrong parameter count for vfprintf() in %s on line %d -NULL - -Warning: Wrong parameter count for vfprintf() in %s on line %d -NULL +Wrong parameter count for vfprintf() +Wrong parameter count for vfprintf() ===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_error4.phpt b/ext/standard/tests/strings/vfprintf_error4.phpt index 2865d42a9e..e54e34f4cd 100644 --- a/ext/standard/tests/strings/vfprintf_error4.phpt +++ b/ext/standard/tests/strings/vfprintf_error4.phpt @@ -17,7 +17,11 @@ $file = 'vfprintf_error4.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with other strangeties --\n"; -var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) ); +try { + var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump( vfprintf( $fp, 'Foo %$c-0202Sd', array( 2 ) ) ); // Close handle @@ -34,9 +38,7 @@ unlink( $file ); ?> --EXPECTF-- -- Testing vfprintf() function with other strangeties -- - -Warning: vfprintf() expects parameter 1 to be resource, string given in %s on line %d -bool(false) +vfprintf() expects parameter 1 to be resource, string given Warning: vfprintf(): Argument number must be greater than zero in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt index 76422011c2..7c969ffff9 100644 --- a/ext/standard/tests/strings/vfprintf_variation1.phpt +++ b/ext/standard/tests/strings/vfprintf_variation1.phpt @@ -48,8 +48,6 @@ writeAndDump( $fp, "%s %s %s", array( 'bar', 'bar', 'bar' ) ); writeAndDump( $fp, "%02d", array( 50 ) ); writeAndDump( $fp, "", array() ); writeAndDump( $fp, "Testing %b %d %f %o %s %x %X", array( 9, 6, 2.5502, 24, "foobar", 15, 65 ) ); -@writeAndDump( $funset, "Foo with %s", array( 'string' ) ); -@writeAndDump( new FooClass(), "Foo with %s", array( 'string' ) ); // Close handle fclose( $fp ); @@ -79,8 +77,4 @@ string(0) "" int(0) string(38) "Testing 1001 6 2.550200 30 foobar f 41" int(38) -bool(false) -bool(false) -bool(false) -bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/wordwrap_error.phpt b/ext/standard/tests/strings/wordwrap_error.phpt index 41c5cbdb69..ad75461d3d 100644 --- a/ext/standard/tests/strings/wordwrap_error.phpt +++ b/ext/standard/tests/strings/wordwrap_error.phpt @@ -9,19 +9,10 @@ Test wordwrap() function : error conditions echo "*** Testing wordwrap() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing wordwrap() function with Zero arguments --\n"; -var_dump( wordwrap() ); - -// More than expected number of arguments -echo "\n-- Testing wordwrap() function with more than expected no. of arguments --\n"; $str = 'testing wordwrap function'; $width = 10; $break = '<br />\n'; $cut = true; -$extra_arg = "extra_arg"; - -var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) ); // $width arg as negative value echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n"; @@ -54,16 +45,6 @@ echo "Done\n"; --EXPECTF-- *** Testing wordwrap() : error conditions *** --- Testing wordwrap() function with Zero arguments -- - -Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing wordwrap() function with more than expected no. of arguments -- - -Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing wordwrap() function with negative/zero value for width argument -- -- width = 0 & cut = false -- string(39) "testing<br />\nwordwrap<br />\nfunction" diff --git a/ext/standard/tests/time/strptime_error.phpt b/ext/standard/tests/time/strptime_error.phpt index f49025be44..3f7bbbdb82 100644 --- a/ext/standard/tests/time/strptime_error.phpt +++ b/ext/standard/tests/time/strptime_error.phpt @@ -19,20 +19,8 @@ date_default_timezone_set("Europe/London"); echo "*** Testing strptime() : error conditions ***\n"; -echo "\n-- Testing strptime() function with Zero arguments --\n"; -var_dump( strptime() ); - -echo "\n-- Testing strptime() function with less than expected no. of arguments --\n"; -$format = '%b %d %Y %H:%M:%S'; -$timestamp = mktime(8, 8, 8, 8, 8, 2008); -$date = strftime($format, $timestamp); -var_dump( strptime($date) ); - -echo "\n-- Testing strptime() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( strptime($date, $format, $extra_arg) ); - echo "\n-- Testing strptime() function on failure --\n"; +$format = '%b %d %Y %H:%M:%S'; var_dump( strptime('foo', $format) ); ?> @@ -40,21 +28,6 @@ var_dump( strptime('foo', $format) ); --EXPECTF-- *** Testing strptime() : error conditions *** --- Testing strptime() function with Zero arguments -- - -Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d -NULL - --- Testing strptime() function with less than expected no. of arguments -- - -Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d -NULL - --- Testing strptime() function with more than expected no. of arguments -- - -Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -- Testing strptime() function on failure -- bool(false) ===DONE=== diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 34e877707c..bc1010243e 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -164,7 +164,7 @@ php_stream_filter_status_t userfilter_filter( zval func_name; zval retval; zval args[4]; - zval zpropname; + zend_string *propname; int call_result; /* the userfilter object probably doesn't exist anymore */ @@ -239,9 +239,9 @@ php_stream_filter_status_t userfilter_filter( /* filter resources are cleaned up by the stream destructor, * keeping a reference to the stream resource here would prevent it * from being destroyed properly */ - ZVAL_STRINGL(&zpropname, "stream", sizeof("stream")-1); - Z_OBJ_HANDLER_P(obj, unset_property)(obj, &zpropname, NULL); - zval_ptr_dtor(&zpropname); + propname = zend_string_init("stream", sizeof("stream")-1, 0); + Z_OBJ_HANDLER_P(obj, unset_property)(Z_OBJ_P(obj), propname, NULL); + zend_string_release_ex(propname, 0); zval_ptr_dtor(&args[3]); zval_ptr_dtor(&args[2]); diff --git a/ext/sysvmsg/tests/005.phpt b/ext/sysvmsg/tests/005.phpt index a2680c21c0..0016ab82c2 100644 --- a/ext/sysvmsg/tests/005.phpt +++ b/ext/sysvmsg/tests/005.phpt @@ -10,13 +10,12 @@ $tests = array(null, 'foo'); foreach ($tests as $q) { if ($q === null) { - do { - $id = ftok(__FILE__, chr(mt_rand(0, 255))); - } while (msg_queue_exists($id)); + do { + $id = ftok(__FILE__, chr(mt_rand(0, 255))); } while (msg_queue_exists($id)); + } $q = msg_get_queue($id) or die("Failed to create queue"); msg_remove_queue($q) or die("Failed to close queue"); - } echo "Using '$q' as queue resource:\n"; @@ -50,22 +49,16 @@ bool(false) Warning: msg_send(): msgsnd failed: Invalid argument in %s on line %d bool(false) bool(true) -Using 'foo' as queue resource: - -Warning: msg_set_queue() expects parameter 1 to be resource, string given in %s on line %d +Using 'Resource id #5' as queue resource: bool(false) - -Warning: msg_stat_queue() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: msg_receive() expects parameter 1 to be resource, string given in %s on line %d bool(false) bool(false) +bool(true) -Warning: msg_receive() expects parameter 1 to be resource, string given in %s on line %d +Warning: msg_receive(): maximum size of the message has to be greater than zero in %s on line %d bool(false) -Warning: msg_send() expects parameter 1 to be resource, string given in %s on line %d -bool(false) +Warning: msg_send(): msgsnd failed: Invalid argument in %s on line %d bool(false) +bool(true) Done diff --git a/ext/sysvshm/tests/001.phpt b/ext/sysvshm/tests/001.phpt index 55fd8eec1d..55d5444b98 100644 --- a/ext/sysvshm/tests/001.phpt +++ b/ext/sysvshm/tests/001.phpt @@ -8,10 +8,6 @@ if (!function_exists('ftok')){ print 'skip'; } --FILE-- <?php -var_dump(ftok()); -var_dump(ftok(1)); -var_dump(ftok(1,1,1)); - var_dump(ftok("","")); var_dump(ftok(-1, -1)); var_dump(ftok("qwertyu","qwertyu")); @@ -23,15 +19,6 @@ var_dump(ftok(__FILE__,"q")); echo "Done\n"; ?> --EXPECTF-- -Warning: ftok() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: ftok() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ftok() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: ftok(): Pathname is invalid in %s on line %d int(-1) diff --git a/ext/sysvshm/tests/002.phpt b/ext/sysvshm/tests/002.phpt index 3bfb28e5c6..d558623242 100644 --- a/ext/sysvshm/tests/002.phpt +++ b/ext/sysvshm/tests/002.phpt @@ -10,19 +10,14 @@ if (!function_exists('ftok')){ print 'skip'; } $key = ftok(__FILE__, 't'); -var_dump(shm_attach()); -var_dump(shm_attach(1,2,3,4)); - var_dump(shm_attach(-1, 0)); var_dump(shm_attach(0, -1)); var_dump(shm_attach(123, -1)); -var_dump($s = shm_attach($key, -1)); -shm_remove($s); -var_dump($s = shm_attach($key, 0)); -shm_remove($s); +var_dump(shm_attach($key, -1)); +var_dump(shm_attach($key, 0)); var_dump($s = shm_attach($key, 1024)); -shm_remove($key); +shm_remove($s); var_dump($s = shm_attach($key, 1024)); shm_remove($s); var_dump($s = shm_attach($key, 1024, 0666)); @@ -36,12 +31,6 @@ shm_remove($s); echo "Done\n"; ?> --EXPECTF-- -Warning: shm_attach() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: shm_attach() expects at most 3 parameters, 4 given in %s on line %d -NULL - Warning: shm_attach(): Segment size must be greater than zero in %s on line %d bool(false) @@ -54,15 +43,9 @@ bool(false) Warning: shm_attach(): Segment size must be greater than zero in %s on line %d bool(false) -Warning: shm_remove() expects parameter 1 to be resource, bool given in %s on line %d - Warning: shm_attach(): Segment size must be greater than zero in %s on line %d bool(false) - -Warning: shm_remove() expects parameter 1 to be resource, bool given in %s on line %d resource(%d) of type (sysvshm) - -Warning: shm_remove() expects parameter 1 to be resource, int given in %s on line %d resource(%d) of type (sysvshm) resource(%d) of type (sysvshm) resource(%d) of type (sysvshm) diff --git a/ext/sysvshm/tests/003.phpt b/ext/sysvshm/tests/003.phpt index 010ac83cd3..fd81c48a67 100644 --- a/ext/sysvshm/tests/003.phpt +++ b/ext/sysvshm/tests/003.phpt @@ -10,19 +10,12 @@ if (!function_exists('ftok')){ print 'skip'; } $key = ftok(dirname(__FILE__)."/003.phpt", 'q'); -var_dump(shm_detach()); -var_dump(shm_detach(1,1)); - $s = shm_attach($key); var_dump(shm_detach($s)); var_dump(shm_detach($s)); shm_remove($s); -var_dump(shm_detach(0)); -var_dump(shm_detach(1)); -var_dump(shm_detach(-1)); - echo "Done\n"; ?> --CLEAN-- @@ -34,24 +27,10 @@ shm_remove($s); ?> --EXPECTF-- -Warning: shm_detach() expects exactly 1 parameter, 0 given in %s003.php on line %d -NULL - -Warning: shm_detach() expects exactly 1 parameter, 2 given in %s003.php on line %d -NULL bool(true) Warning: shm_detach(): supplied resource is not a valid sysvshm resource in %s003.php on line %d bool(false) Warning: shm_remove(): supplied resource is not a valid sysvshm resource in %s003.php on line %d - -Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d -NULL - -Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d -NULL - -Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d -NULL Done diff --git a/ext/sysvshm/tests/004.phpt b/ext/sysvshm/tests/004.phpt index ee64491840..23496f5c1c 100644 --- a/ext/sysvshm/tests/004.phpt +++ b/ext/sysvshm/tests/004.phpt @@ -11,9 +11,6 @@ if (!function_exists('ftok')){ print 'skip'; } $key = ftok(__FILE__, 't'); $s = shm_attach($key, 1024); -var_dump(shm_put_var()); -var_dump(shm_put_var(-1, -1, -1)); -var_dump(shm_put_var(-1, 10, "qwerty")); var_dump(shm_put_var($s, -1, "qwerty")); var_dump(shm_put_var($s, 10, "qwerty")); var_dump(shm_put_var($s, 10, "qwerty")); @@ -26,18 +23,10 @@ shm_remove($s); echo "Done\n"; ?> --EXPECTF-- -Warning: shm_put_var() expects exactly 3 parameters, 0 given in %s004.php on line %d -NULL - -Warning: shm_put_var() expects parameter 1 to be resource, int given in %s004.php on line %d -NULL - -Warning: shm_put_var() expects parameter 1 to be resource, int given in %s004.php on line %d -NULL bool(true) bool(true) bool(true) -Warning: shm_put_var(): not enough shared memory left in %s004.php on line 14 +Warning: shm_put_var(): not enough shared memory left in %s004.php on line %d bool(false) Done diff --git a/ext/sysvshm/tests/005.phpt b/ext/sysvshm/tests/005.phpt index 0a3d3422e8..879be31c13 100644 --- a/ext/sysvshm/tests/005.phpt +++ b/ext/sysvshm/tests/005.phpt @@ -17,14 +17,9 @@ shm_put_var($s, 1, array(1,2,3)); shm_put_var($s, 2, false); shm_put_var($s, 3, null); -var_dump(shm_get_var()); - -var_dump(shm_get_var(-1, -1)); - var_dump(shm_get_var($s, 1000)); var_dump(shm_get_var($s, -10000)); -var_dump(shm_get_var($s, array())); var_dump(shm_get_var($s, -1)); var_dump(shm_get_var($s, 0)); var_dump(shm_get_var($s, 1)); @@ -41,20 +36,11 @@ shm_remove($s); echo "Done\n"; ?> --EXPECTF-- -Warning: shm_get_var() expects exactly 2 parameters, 0 given in %s005.php on line %d -NULL - -Warning: shm_get_var() expects parameter 1 to be resource, int given in %s005.php on line %d -NULL - Warning: shm_get_var(): variable key 1000 doesn't exist in %s005.php on line %d bool(false) Warning: shm_get_var(): variable key -10000 doesn't exist in %s005.php on line %d bool(false) - -Warning: shm_get_var() expects parameter 2 to be int, array given in %s005.php on line %d -NULL string(11) "test string" object(stdClass)#%d (0) { } diff --git a/ext/sysvshm/tests/006.phpt b/ext/sysvshm/tests/006.phpt index b38aee02a1..278838f063 100644 --- a/ext/sysvshm/tests/006.phpt +++ b/ext/sysvshm/tests/006.phpt @@ -13,8 +13,6 @@ $s = shm_attach($key, 1024); shm_put_var($s, 1, "test string"); -var_dump(shm_remove_var()); -var_dump(shm_remove_var(-1, -1)); var_dump(shm_remove_var($s, -10)); var_dump(shm_get_var($s, 1)); @@ -29,12 +27,6 @@ shm_remove($s); echo "Done\n"; ?> --EXPECTF-- -Warning: shm_remove_var() expects exactly 2 parameters, 0 given in %s006.php on line %d -NULL - -Warning: shm_remove_var() expects parameter 1 to be resource, int given in %s006.php on line %d -NULL - Warning: shm_remove_var(): variable key -10 doesn't exist in %s006.php on line %d bool(false) string(11) "test string" diff --git a/ext/sysvshm/tests/007.phpt b/ext/sysvshm/tests/007.phpt index a165a8bfbf..747d401333 100644 --- a/ext/sysvshm/tests/007.phpt +++ b/ext/sysvshm/tests/007.phpt @@ -11,11 +11,6 @@ if (!function_exists('ftok')){ print 'skip'; } $key = ftok(__FILE__, 't'); $s = shm_attach($key, 1024); -var_dump(shm_remove()); -var_dump(shm_remove(-1)); -var_dump(shm_remove(0)); -var_dump(shm_remove("")); - var_dump(shm_remove($s)); shm_detach($s); @@ -24,17 +19,6 @@ var_dump(shm_remove($s)); echo "Done\n"; ?> --EXPECTF-- -Warning: shm_remove() expects exactly 1 parameter, 0 given in %s007.php on line %d -NULL - -Warning: shm_remove() expects parameter 1 to be resource, int given in %s007.php on line %d -NULL - -Warning: shm_remove() expects parameter 1 to be resource, int given in %s007.php on line %d -NULL - -Warning: shm_remove() expects parameter 1 to be resource, string given in %s007.php on line %d -NULL bool(true) Warning: shm_remove(): supplied resource is not a valid sysvshm resource in %s007.php on line %d diff --git a/ext/tidy/tests/019.phpt b/ext/tidy/tests/019.phpt index 188b8cd4e9..dae23127b5 100644 --- a/ext/tidy/tests/019.phpt +++ b/ext/tidy/tests/019.phpt @@ -7,17 +7,14 @@ tidy_repair_*() and invalid parameters $l = 1; $s = ""; -$a = array(); tidy_repair_string($s, $l, $l, $l); tidy_repair_string($s, $s, $s, $s); tidy_repair_string($l, $l, $l ,$l); -tidy_repair_string($a, $a, $a, $a); tidy_repair_file($s, $l, $l, $l); tidy_repair_file($s, $s, $s, $s); tidy_repair_file($l, $l, $l ,$l); -tidy_repair_file($a, $a, $a, $a); echo "Done\n"; ?> @@ -32,11 +29,7 @@ Warning: tidy_repair_string(): Could not load configuration file '1' in %s on li Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d -Warning: tidy_repair_string() expects parameter 1 to be string, array given in %s on line %d - Warning: tidy_repair_file(): Filename cannot be empty in %s on line %d Warning: tidy_repair_file(): Filename cannot be empty in %s on line %d - -Warning: tidy_repair_file() expects parameter 1 to be a valid path, array given in %s on line %d Done diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index ee7defeac4..656af8b4f0 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -215,8 +215,8 @@ static void tidy_object_free_storage(zend_object *); static zend_object *tidy_object_new_node(zend_class_entry *); static zend_object *tidy_object_new_doc(zend_class_entry *); static zval * tidy_instanciate(zend_class_entry *, zval *); -static int tidy_doc_cast_handler(zval *, zval *, int); -static int tidy_node_cast_handler(zval *, zval *, int); +static int tidy_doc_cast_handler(zend_object *, zval *, int); +static int tidy_node_cast_handler(zend_object *, zval *, int); static void tidy_doc_update_properties(PHPTidyObj *); static void tidy_add_default_properties(PHPTidyObj *, tidy_obj_type); static void *php_tidy_get_opt_val(PHPTidyDoc *, TidyOption, TidyOptionType *); @@ -329,6 +329,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_diagnose, 0, 0, 1) ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_tidy_no_args, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_tidy_get_release, 0) ZEND_END_ARG_INFO() @@ -444,40 +447,40 @@ static const zend_function_entry tidy_functions[] = { static const zend_function_entry tidy_funcs_doc[] = { TIDY_METHOD_MAP(getOpt, tidy_getopt, arginfo_tidy_getopt_method) - TIDY_METHOD_MAP(cleanRepair, tidy_clean_repair, NULL) + TIDY_METHOD_MAP(cleanRepair, tidy_clean_repair, arginfo_tidy_no_args) TIDY_DOC_ME(parseFile, arginfo_tidy_parse_file) TIDY_DOC_ME(parseString, arginfo_tidy_parse_string) TIDY_METHOD_MAP(repairString, tidy_repair_string, arginfo_tidy_repair_string) TIDY_METHOD_MAP(repairFile, tidy_repair_file, arginfo_tidy_repair_file) - TIDY_METHOD_MAP(diagnose, tidy_diagnose, NULL) - TIDY_METHOD_MAP(getRelease, tidy_get_release, NULL) - TIDY_METHOD_MAP(getConfig, tidy_get_config, NULL) - TIDY_METHOD_MAP(getStatus, tidy_get_status, NULL) - TIDY_METHOD_MAP(getHtmlVer, tidy_get_html_ver, NULL) + TIDY_METHOD_MAP(diagnose, tidy_diagnose, arginfo_tidy_no_args) + TIDY_METHOD_MAP(getRelease, tidy_get_release, arginfo_tidy_no_args) + TIDY_METHOD_MAP(getConfig, tidy_get_config, arginfo_tidy_no_args) + TIDY_METHOD_MAP(getStatus, tidy_get_status, arginfo_tidy_no_args) + TIDY_METHOD_MAP(getHtmlVer, tidy_get_html_ver, arginfo_tidy_no_args) #if HAVE_TIDYOPTGETDOC TIDY_METHOD_MAP(getOptDoc, tidy_get_opt_doc, arginfo_tidy_get_opt_doc_method) #endif - TIDY_METHOD_MAP(isXhtml, tidy_is_xhtml, NULL) - TIDY_METHOD_MAP(isXml, tidy_is_xml, NULL) - TIDY_METHOD_MAP(root, tidy_get_root, NULL) - TIDY_METHOD_MAP(head, tidy_get_head, NULL) - TIDY_METHOD_MAP(html, tidy_get_html, NULL) - TIDY_METHOD_MAP(body, tidy_get_body, NULL) + TIDY_METHOD_MAP(isXhtml, tidy_is_xhtml, arginfo_tidy_no_args) + TIDY_METHOD_MAP(isXml, tidy_is_xml, arginfo_tidy_no_args) + TIDY_METHOD_MAP(root, tidy_get_root, arginfo_tidy_no_args) + TIDY_METHOD_MAP(head, tidy_get_head, arginfo_tidy_no_args) + TIDY_METHOD_MAP(html, tidy_get_html, arginfo_tidy_no_args) + TIDY_METHOD_MAP(body, tidy_get_body, arginfo_tidy_no_args) TIDY_DOC_ME(__construct, arginfo_tidy_construct) PHP_FE_END }; static const zend_function_entry tidy_funcs_node[] = { - TIDY_NODE_ME(hasChildren, NULL) - TIDY_NODE_ME(hasSiblings, NULL) - TIDY_NODE_ME(isComment, NULL) - TIDY_NODE_ME(isHtml, NULL) - TIDY_NODE_ME(isText, NULL) - TIDY_NODE_ME(isJste, NULL) - TIDY_NODE_ME(isAsp, NULL) - TIDY_NODE_ME(isPhp, NULL) - TIDY_NODE_ME(getParent, NULL) - TIDY_NODE_PRIVATE_ME(__construct, NULL) + TIDY_NODE_ME(hasChildren, arginfo_tidy_no_args) + TIDY_NODE_ME(hasSiblings, arginfo_tidy_no_args) + TIDY_NODE_ME(isComment, arginfo_tidy_no_args) + TIDY_NODE_ME(isHtml, arginfo_tidy_no_args) + TIDY_NODE_ME(isText, arginfo_tidy_no_args) + TIDY_NODE_ME(isJste, arginfo_tidy_no_args) + TIDY_NODE_ME(isAsp, arginfo_tidy_no_args) + TIDY_NODE_ME(isPhp, arginfo_tidy_no_args) + TIDY_NODE_ME(getParent, arginfo_tidy_no_args) + TIDY_NODE_PRIVATE_ME(__construct, arginfo_tidy_no_args) PHP_FE_END }; @@ -760,7 +763,7 @@ static zval * tidy_instanciate(zend_class_entry *pce, zval *object) return object; } -static int tidy_doc_cast_handler(zval *in, zval *out, int type) +static int tidy_doc_cast_handler(zend_object *in, zval *out, int type) { TidyBuffer output; PHPTidyObj *obj; @@ -780,7 +783,7 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type) break; case IS_STRING: - obj = Z_TIDY_P(in); + obj = php_tidy_fetch_object(in); tidyBufInit(&output); tidySaveBuffer (obj->ptdoc->doc, &output); ZVAL_STRINGL(out, (char *) output.bp, output.size ? output.size-1 : 0); @@ -794,7 +797,7 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type) return SUCCESS; } -static int tidy_node_cast_handler(zval *in, zval *out, int type) +static int tidy_node_cast_handler(zend_object *in, zval *out, int type) { TidyBuffer buf; PHPTidyObj *obj; @@ -814,7 +817,7 @@ static int tidy_node_cast_handler(zval *in, zval *out, int type) break; case IS_STRING: - obj = Z_TIDY_P(in); + obj = php_tidy_fetch_object(in); tidyBufInit(&buf); if (obj->ptdoc) { tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf); diff --git a/ext/tokenizer/tests/001.phpt b/ext/tokenizer/tests/001.phpt index 4c6295cdf8..8e58c81891 100644 --- a/ext/tokenizer/tests/001.phpt +++ b/ext/tokenizer/tests/001.phpt @@ -126,8 +126,6 @@ echo token_name(T_HALT_COMPILER), "\n"; echo token_name(-1), "\n"; echo token_name(0x8000000F), "\n"; -echo token_name("string"), "\n"; -echo token_name(array()), "\n"; echo "Done\n"; ?> @@ -251,10 +249,4 @@ T_CLONE T_HALT_COMPILER UNKNOWN UNKNOWN - -Warning: token_name() expects parameter 1 to be int, string given in %s on line %d - - -Warning: token_name() expects parameter 1 to be int, array given in %s on line %d - Done diff --git a/ext/tokenizer/tests/003.phpt b/ext/tokenizer/tests/003.phpt index 3ba6d594df..6c3cc4c559 100644 --- a/ext/tokenizer/tests/003.phpt +++ b/ext/tokenizer/tests/003.phpt @@ -5,8 +5,6 @@ token_get_all() and wrong parameters --FILE-- <?php -var_dump(token_get_all(array())); -var_dump(token_get_all(new stdClass)); var_dump(token_get_all("")); var_dump(token_get_all(0)); var_dump(token_get_all(-1)); @@ -14,11 +12,6 @@ var_dump(token_get_all(-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: token_get_all() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: token_get_all() expects parameter 1 to be string, object given in %s on line %d -NULL array(0) { } array(1) { diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 3ce3fed0e1..6e211adc86 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -114,30 +114,20 @@ static int xmlreader_property_reader(xmlreader_object *obj, xmlreader_prop_handl /* }}} */ /* {{{ xmlreader_get_property_ptr_ptr */ -zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) +zval *xmlreader_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) { xmlreader_object *obj; - zval tmp_member; zval *retval = NULL; xmlreader_prop_handler *hnd = NULL; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - } - - obj = Z_XMLREADER_P(object); + obj = php_xmlreader_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd == NULL) { - retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot); } return retval; @@ -145,22 +135,16 @@ zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void /* }}} */ /* {{{ xmlreader_read_property */ -zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) +zval *xmlreader_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) { xmlreader_object *obj; - zval tmp_member; zval *retval = NULL; xmlreader_prop_handler *hnd = NULL; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - } - - obj = Z_XMLREADER_P(object); + obj = php_xmlreader_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd != NULL) { @@ -170,41 +154,28 @@ zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache retval = rv; } } else { - retval = zend_std_read_property(object, member, type, cache_slot, rv); + retval = zend_std_read_property(object, name, type, cache_slot, rv); } - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } return retval; } /* }}} */ /* {{{ xmlreader_write_property */ -zval *xmlreader_write_property(zval *object, zval *member, zval *value, void **cache_slot) +zval *xmlreader_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) { xmlreader_object *obj; - zval tmp_member; xmlreader_prop_handler *hnd = NULL; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - } - - obj = Z_XMLREADER_P(object); + obj = php_xmlreader_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd != NULL) { php_error_docref(NULL, E_WARNING, "Cannot write to read-only property"); } else { - value = zend_std_write_property(object, member, value, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + value = zend_std_write_property(object, name, value, cache_slot); } return value; @@ -1259,7 +1230,7 @@ static const zend_function_entry xmlreader_functions[] /* {{{ */ = { PHP_ME(xmlreader, moveToElement, arginfo_xmlreader_moveToElement, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, moveToFirstAttribute, arginfo_xmlreader_moveToFirstAttribute, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, moveToNextAttribute, arginfo_xmlreader_moveToNextAttribute, ZEND_ACC_PUBLIC) - PHP_ME(xmlreader, open, arginfo_xmlreader_open, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(xmlreader, open, arginfo_xmlreader_open, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, read, arginfo_xmlreader_read, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, next, arginfo_xmlreader_next, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, readInnerXml, arginfo_xmlreader_readInnerXml, ZEND_ACC_PUBLIC) @@ -1272,7 +1243,7 @@ static const zend_function_entry xmlreader_functions[] /* {{{ */ = { PHP_ME(xmlreader, setParserProperty, arginfo_xmlreader_setParserProperty, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, setRelaxNGSchema, arginfo_xmlreader_setRelaxNGSchema, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, setRelaxNGSchemaSource, arginfo_xmlreader_setRelaxNGSchemaSource, ZEND_ACC_PUBLIC) - PHP_ME(xmlreader, XML, arginfo_xmlreader_XML, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(xmlreader, XML, arginfo_xmlreader_XML, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, expand, arginfo_xmlreader_expand, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ diff --git a/ext/xmlrpc/tests/001.phpt b/ext/xmlrpc/tests/001.phpt index 49dfba8f10..af41530ab2 100644 --- a/ext/xmlrpc/tests/001.phpt +++ b/ext/xmlrpc/tests/001.phpt @@ -7,7 +7,6 @@ xmlrpc_encode_request() with wrong arguments var_dump(xmlrpc_encode_request(-1, 1)); var_dump(xmlrpc_encode_request("", 1)); -var_dump(xmlrpc_encode_request(array(), 1)); var_dump(xmlrpc_encode_request(3.4, 1)); echo "Done\n"; @@ -37,9 +36,6 @@ string(160) "<?xml version="1.0" encoding="iso-8859-1"?> </params> </methodCall> " - -Warning: xmlrpc_encode_request() expects parameter 1 to be string, array given in %s on line %d -NULL string(175) "<?xml version="1.0" encoding="iso-8859-1"?> <methodCall> <methodName>3.4</methodName> diff --git a/ext/xmlrpc/tests/002.phpt b/ext/xmlrpc/tests/002.phpt index cb4b4aa818..a791082337 100644 --- a/ext/xmlrpc/tests/002.phpt +++ b/ext/xmlrpc/tests/002.phpt @@ -21,10 +21,6 @@ $r = xmlrpc_encode_request(-1, ""); var_dump(xmlrpc_decode_request($r, $method)); var_dump($method); -$r = xmlrpc_encode_request(array(), 1); -var_dump(xmlrpc_decode_request($r, $method)); -var_dump($method); - echo "Done\n"; ?> --EXPECTF-- @@ -46,8 +42,4 @@ array(1) { string(0) "" } string(2) "-1" - -Warning: xmlrpc_encode_request() expects parameter 1 to be string, array given in %s on line %d -NULL -string(2) "-1" Done diff --git a/ext/xmlwriter/tests/bug41326.phpt b/ext/xmlwriter/tests/bug41326.phpt index c87af84722..886e149261 100644 --- a/ext/xmlwriter/tests/bug41326.phpt +++ b/ext/xmlwriter/tests/bug41326.phpt @@ -15,7 +15,6 @@ $xml->writeElement('foo', null); $xml->writeElement('foo2', ""); $xml->writeElement('foo3'); $xml->startElement('bar'); -$xml->endElement('bar'); $xml->endElement(); $xml->endElement(); print $xml->flush(true); @@ -37,7 +36,6 @@ $xw->endDocument(); print $xw->flush(true); ?> --EXPECTF-- -Warning: XMLWriter::endElement() expects exactly 0 parameters, 1 given in %s on line %d <?xml version="1.0"?> <test> <foo/> diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index d71460efcf..2bb8fc0849 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -397,7 +397,8 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) xsl_object *intern; int prevSubstValue, prevExtDtdValue, clone_docu = 0; xmlNode *nodep = NULL; - zval *cloneDocu, member, rv; + zval *cloneDocu, rv; + zend_string *member; id = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &docp) == FAILURE) { @@ -433,13 +434,13 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) intern = Z_XSL_P(id); - ZVAL_STRING(&member, "cloneDocument"); - cloneDocu = zend_std_read_property(id, &member, BP_VAR_IS, NULL, &rv); + member = zend_string_init("cloneDocument", sizeof("cloneDocument")-1, 0); + cloneDocu = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_IS, NULL, &rv); if (Z_TYPE_P(cloneDocu) != IS_NULL) { convert_to_long(cloneDocu); clone_docu = Z_LVAL_P(cloneDocu); } - zval_ptr_dtor(&member); + zend_string_release_ex(member, 0); if (clone_docu == 0) { /* check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation */ nodep = xmlDocGetRootElement(sheetp->doc); @@ -479,7 +480,8 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl php_libxml_node_object *object; char **params = NULL; int clone; - zval *doXInclude, member, rv; + zval *doXInclude, rv; + zend_string *member; FILE *f; int secPrefsError = 0; int secPrefsValue; @@ -529,13 +531,13 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl ctxt = xsltNewTransformContext(style, doc); ctxt->_private = (void *) intern; - ZVAL_STRING(&member, "doXInclude"); - doXInclude = zend_std_read_property(id, &member, BP_VAR_IS, NULL, &rv); + member = zend_string_init("doXInclude", sizeof("doXInclude")-1, 0); + doXInclude = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_IS, NULL, &rv); if (Z_TYPE_P(doXInclude) != IS_NULL) { convert_to_long(doXInclude); ctxt->xinclude = Z_LVAL_P(doXInclude); } - zval_ptr_dtor(&member); + zend_string_release_ex(member, 0); secPrefsValue = intern->securityPrefs; diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index 53af862d24..48aea6856a 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -50,7 +50,13 @@ ZEND_END_ARG_INFO() ZEND_FUNCTION(zend_test_func) { - /* dummy */ + RETVAL_STR_COPY(EX(func)->common.function_name); + + /* Cleanup trampoline */ + ZEND_ASSERT(EX(func)->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE); + zend_string_release(EX(func)->common.function_name); + zend_free_trampoline(EX(func)); + EX(func) = NULL; } ZEND_FUNCTION(zend_test_array_return) @@ -144,41 +150,45 @@ static zend_object *zend_test_class_new(zend_class_entry *class_type) /* {{{ */ /* }}} */ static zend_function *zend_test_class_method_get(zend_object **object, zend_string *name, const zval *key) /* {{{ */ { - zend_internal_function *fptr = emalloc(sizeof(zend_internal_function)); - fptr->type = ZEND_OVERLOADED_FUNCTION_TEMPORARY; + zend_internal_function *fptr; + + if (EXPECTED(EG(trampoline).common.function_name == NULL)) { + fptr = &EG(trampoline); + } else { + fptr = emalloc(sizeof(zend_internal_function)); + } + memset(fptr, 0, sizeof(zend_internal_function)); + fptr->type = ZEND_INTERNAL_FUNCTION; fptr->num_args = 1; - fptr->arg_info = NULL; fptr->scope = (*object)->ce; fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER; fptr->function_name = zend_string_copy(name); fptr->handler = ZEND_FN(zend_test_func); - zend_set_function_arg_flags((zend_function*)fptr); return (zend_function*)fptr; } /* }}} */ static zend_function *zend_test_class_static_method_get(zend_class_entry *ce, zend_string *name) /* {{{ */ { - zend_internal_function *fptr = emalloc(sizeof(zend_internal_function)); - fptr->type = ZEND_OVERLOADED_FUNCTION; + zend_internal_function *fptr; + + if (EXPECTED(EG(trampoline).common.function_name == NULL)) { + fptr = &EG(trampoline); + } else { + fptr = emalloc(sizeof(zend_internal_function)); + } + memset(fptr, 0, sizeof(zend_internal_function)); + fptr->type = ZEND_INTERNAL_FUNCTION; fptr->num_args = 1; - fptr->arg_info = NULL; fptr->scope = ce; fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_STATIC; - fptr->function_name = name; + fptr->function_name = zend_string_copy(name); fptr->handler = ZEND_FN(zend_test_func); - zend_set_function_arg_flags((zend_function*)fptr); return (zend_function*)fptr; } /* }}} */ -static int zend_test_class_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ { - RETVAL_STR(zend_string_copy(method)); - return 0; -} -/* }}} */ - static ZEND_METHOD(_ZendTestTrait, testMethod) /* {{{ */ { RETURN_TRUE; } @@ -239,7 +249,6 @@ PHP_MINIT_FUNCTION(zend_test) memcpy(&zend_test_class_handlers, &std_object_handlers, sizeof(zend_object_handlers)); zend_test_class_handlers.get_method = zend_test_class_method_get; - zend_test_class_handlers.call_method = zend_test_class_call_method; INIT_CLASS_ENTRY(class_entry, "_ZendTestTrait", zend_test_trait_methods); zend_test_trait = zend_register_internal_class(&class_entry); diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 9275ab1c46..6c4ada63bd 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -872,54 +872,36 @@ static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd, } /* }}} */ -static zval *php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static zval *php_zip_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */ { ze_zip_object *obj; - zval tmp_member; zval *retval = NULL; zip_prop_handler *hnd = NULL; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_ZIP_P(object); + obj = php_zip_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd == NULL) { - retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot); } return retval; } /* }}} */ -static zval *php_zip_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */ +static zval *php_zip_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */ { ze_zip_object *obj; - zval tmp_member; zval *retval = NULL; zip_prop_handler *hnd = NULL; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_ZIP_P(object); + obj = php_zip_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd != NULL) { @@ -928,34 +910,23 @@ static zval *php_zip_read_property(zval *object, zval *member, int type, void ** retval = &EG(uninitialized_zval); } } else { - retval = zend_std_read_property(object, member, type, cache_slot, rv); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + retval = zend_std_read_property(object, name, type, cache_slot, rv); } return retval; } /* }}} */ -static int php_zip_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static int php_zip_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */ { ze_zip_object *obj; - zval tmp_member; zip_prop_handler *hnd = NULL; int retval = 0; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_ZIP_P(object); + obj = php_zip_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd != NULL) { @@ -973,18 +944,14 @@ static int php_zip_has_property(zval *object, zval *member, int type, void **cac zval_ptr_dtor(&tmp); } else { - retval = zend_std_has_property(object, member, type, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + retval = zend_std_has_property(object, name, type, cache_slot); } return retval; } /* }}} */ -static HashTable *php_zip_get_gc(zval *object, zval **gc_data, int *gc_data_count) /* {{{ */ +static HashTable *php_zip_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) /* {{{ */ { *gc_data = NULL; *gc_data_count = 0; @@ -992,14 +959,14 @@ static HashTable *php_zip_get_gc(zval *object, zval **gc_data, int *gc_data_coun } /* }}} */ -static HashTable *php_zip_get_properties(zval *object)/* {{{ */ +static HashTable *php_zip_get_properties(zend_object *object)/* {{{ */ { ze_zip_object *obj; HashTable *props; zip_prop_handler *hnd; zend_string *key; - obj = Z_ZIP_P(object); + obj = php_zip_fetch_object(object); props = zend_std_get_properties(object); if (obj->prop_handler == NULL) { diff --git a/ext/zip/tests/oo_getcomment.phpt b/ext/zip/tests/oo_getcomment.phpt index c6b505828d..b3da94e5f8 100644 --- a/ext/zip/tests/oo_getcomment.phpt +++ b/ext/zip/tests/oo_getcomment.phpt @@ -20,7 +20,6 @@ echo $zip->getCommentName('foo') . "\n"; echo $zip->getCommentIndex($idx); echo $zip->getCommentName('') . "\n"; -echo $zip->getCommentName() . "\n"; $zip->close(); @@ -30,6 +29,3 @@ Zip archive comment foo comment foo comment Notice: ZipArchive::getCommentName(): Empty string as entry name in %s on line %d - - -Warning: ZipArchive::getCommentName() expects at least 1 parameter, 0 given in %s on line %d diff --git a/ext/zip/tests/zip_open_error.phpt b/ext/zip/tests/zip_open_error.phpt index eaa1d9731e..068956b81f 100644 --- a/ext/zip/tests/zip_open_error.phpt +++ b/ext/zip/tests/zip_open_error.phpt @@ -12,10 +12,7 @@ if(!extension_loaded('zip')) die('skip'); echo "Test case 1:"; $zip = zip_open(""); -echo "Test case 2:"; -$zip = zip_open("i_dont_care_about_this_parameter", "this_is_one_to_many"); - -echo "Test case 3:\n"; +echo "Test case 2:\n"; $zip = zip_open("/non_exisitng_directory/test_procedural.zip"); echo is_resource($zip) ? "OK" : "Failure"; ?> @@ -23,6 +20,4 @@ echo is_resource($zip) ? "OK" : "Failure"; Test case 1: Warning: zip_open(): Empty string as source in %s on line %d Test case 2: -Warning: zip_open() expects exactly 1 parameter, 2 given in %s on line %d -Test case 3: Failure diff --git a/ext/zlib/tests/004-mb.phpt b/ext/zlib/tests/004-mb.phpt index 92f7db1b70..607228fd6f 100644 --- a/ext/zlib/tests/004-mb.phpt +++ b/ext/zlib/tests/004-mb.phpt @@ -5,9 +5,7 @@ gzfile() with various invalid params --FILE-- <?php -var_dump(gzfile()); var_dump(gzfile("nonexistent_file_gzfile",1)); -var_dump(gzfile(1,1,1)); var_dump(gzfile(dirname(__FILE__)."/004私はガラスを食べられます.txt.gz")); var_dump(gzfile(dirname(__FILE__)."/004私はガラスを食べられます.txt.gz", 1)); @@ -15,14 +13,8 @@ var_dump(gzfile(dirname(__FILE__)."/004私はガラスを食べられます.txt. echo "Done\n"; ?> --EXPECTF-- -Warning: gzfile() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: gzfile(nonexistent_file_gzfile): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: gzfile() expects at most 2 parameters, 3 given in %s on line %d -NULL array(6) { [0]=> string(36) "When you're taught through feelings diff --git a/ext/zlib/tests/004.phpt b/ext/zlib/tests/004.phpt index b8d0f0eccd..4437ab154f 100644 --- a/ext/zlib/tests/004.phpt +++ b/ext/zlib/tests/004.phpt @@ -5,9 +5,7 @@ gzfile() with various invalid params --FILE-- <?php -var_dump(gzfile()); var_dump(gzfile("nonexistent_file_gzfile",1)); -var_dump(gzfile(1,1,1)); var_dump(gzfile(dirname(__FILE__)."/004.txt.gz")); var_dump(gzfile(dirname(__FILE__)."/004.txt.gz", 1)); @@ -15,14 +13,8 @@ var_dump(gzfile(dirname(__FILE__)."/004.txt.gz", 1)); echo "Done\n"; ?> --EXPECTF-- -Warning: gzfile() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: gzfile(nonexistent_file_gzfile): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: gzfile() expects at most 2 parameters, 3 given in %s on line %d -NULL array(6) { [0]=> string(36) "When you're taught through feelings diff --git a/ext/zlib/tests/005.phpt b/ext/zlib/tests/005.phpt index 6333612183..69fe8efe6a 100644 --- a/ext/zlib/tests/005.phpt +++ b/ext/zlib/tests/005.phpt @@ -5,7 +5,6 @@ gzcompress()/gzuncompress() and invalid params --FILE-- <?php -var_dump(gzcompress()); var_dump(gzcompress("", 1000)); var_dump(gzcompress("", -1)); @@ -19,7 +18,6 @@ Desolation, grief and agony"; var_dump($data1 = gzcompress($string)); var_dump($data2 = gzcompress($string, 9)); -var_dump(gzuncompress()); var_dump(gzuncompress("", 1000)); var_dump(gzuncompress("", -1)); @@ -34,9 +32,6 @@ var_dump(gzuncompress($data2)); echo "Done\n"; ?> --EXPECTF-- -Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: gzcompress(): compression level (1000) must be within -1..9 in %s on line %d bool(false) string(%d) "%a" @@ -45,9 +40,6 @@ string(%d) "%a" string(%d) "%a" string(%d) "%a" -Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: gzuncompress(): %s error in %s on line %d bool(false) diff --git a/ext/zlib/tests/006.phpt b/ext/zlib/tests/006.phpt index 0d082092ca..2c666390c8 100644 --- a/ext/zlib/tests/006.phpt +++ b/ext/zlib/tests/006.phpt @@ -5,7 +5,6 @@ gzdeflate()/gzinflate() and invalid params --FILE-- <?php -var_dump(gzdeflate()); var_dump(gzdeflate("", 1000)); var_dump(gzdeflate("", -1)); @@ -19,7 +18,6 @@ Desolation, grief and agony"; var_dump($data1 = gzdeflate($string)); var_dump($data2 = gzdeflate($string, 9)); -var_dump(gzinflate()); var_dump(gzinflate("")); var_dump(gzinflate("asfwe", 1000)); var_dump(gzinflate("asdf", -1)); @@ -35,9 +33,6 @@ var_dump(gzinflate($data2)); echo "Done\n"; ?> --EXPECTF-- -Warning: gzdeflate() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: gzdeflate(): compression level (1000) must be within -1..9 in %s on line %d bool(false) string(%d) "%a" @@ -46,9 +41,6 @@ string(%d) "%a" string(%d) "%a" string(%d) "%a" -Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: gzinflate(): data error in %s on line %d bool(false) diff --git a/ext/zlib/tests/007.phpt b/ext/zlib/tests/007.phpt index 6c42bf67db..6028104b9a 100644 --- a/ext/zlib/tests/007.phpt +++ b/ext/zlib/tests/007.phpt @@ -5,8 +5,6 @@ gzencode() and invalid params --FILE-- <?php -var_dump(gzencode()); -var_dump(gzencode(1,1,1,1)); var_dump(gzencode("", -10)); var_dump(gzencode("", 100)); var_dump(gzencode("", 1, 100)); @@ -27,12 +25,6 @@ var_dump(gzencode($string, 9, ZLIB_ENCODING_DEFLATE)); echo "Done\n"; ?> --EXPECTF-- -Warning: gzencode() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d -NULL - Warning: gzencode(): compression level (-10) must be within -1..9 in %s on line %d bool(false) diff --git a/ext/zlib/tests/gzcompress_error1.phpt b/ext/zlib/tests/gzcompress_error1.phpt index 3f742a4dca..3601c61b53 100644 --- a/ext/zlib/tests/gzcompress_error1.phpt +++ b/ext/zlib/tests/gzcompress_error1.phpt @@ -20,53 +20,22 @@ if (!extension_loaded("zlib")) { echo "*** Testing gzcompress() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing gzcompress() function with Zero arguments --\n"; -var_dump( gzcompress() ); - -//Test gzcompress with one more than the expected number of arguments -echo "\n-- Testing gzcompress() function with more than expected no. of arguments --\n"; -$data = 'string_val'; -$level = 2; -$encoding = ZLIB_ENCODING_RAW; -$extra_arg = 10; -var_dump( gzcompress($data, $level, $encoding, $extra_arg) ); - echo "\n-- Testing with incorrect compression level --\n"; +$data = 'string_val'; $bad_level = 99; var_dump(gzcompress($data, $bad_level)); echo "\n-- Testing with invalid encoding --\n"; $data = 'string_val'; +$level = 2; $encoding = 99; var_dump(gzcompress($data, $level, $encoding)); -echo "\n-- Testing with incorrect parameters --\n"; - -class Tester { - function Hello() { - echo "Hello\n"; - } -} - -$testclass = new Tester(); -var_dump(gzcompress($testclass)); - ?> ===Done=== --EXPECTF-- *** Testing gzcompress() : error conditions *** --- Testing gzcompress() function with Zero arguments -- - -Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing gzcompress() function with more than expected no. of arguments -- - -Warning: gzcompress() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing with incorrect compression level -- Warning: gzcompress(): compression level (99) must be within -1..9 in %s on line %d @@ -76,9 +45,4 @@ bool(false) Warning: gzcompress(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d bool(false) - --- Testing with incorrect parameters -- - -Warning: gzcompress() expects parameter 1 to be string, object given in %s on line %d -NULL ===Done=== diff --git a/ext/zlib/tests/gzdeflate_error1.phpt b/ext/zlib/tests/gzdeflate_error1.phpt index 93f8c03b4c..af74d1c771 100644 --- a/ext/zlib/tests/gzdeflate_error1.phpt +++ b/ext/zlib/tests/gzdeflate_error1.phpt @@ -20,52 +20,22 @@ if (!extension_loaded("zlib")) { echo "*** Testing gzdeflate() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing gzdeflate() function with Zero arguments --\n"; -var_dump( gzdeflate() ); - -//Test gzdeflate with one more than the expected number of arguments -echo "\n-- Testing gzdeflate() function with more than expected no. of arguments --\n"; $data = 'string_val'; -$level = 2; -$encoding = ZLIB_ENCODING_RAW; -$extra_arg = 10; -var_dump( gzdeflate($data, $level, $encoding, $extra_arg) ); echo "\n-- Testing with incorrect compression level --\n"; $bad_level = 99; var_dump(gzdeflate($data, $bad_level)); echo "\n-- Testing with incorrect encoding --\n"; +$level = 2; $bad_encoding = 99; var_dump(gzdeflate($data, $level, $bad_encoding)); -class Tester { - function Hello() { - echo "Hello\n"; - } -} - -echo "\n-- Testing with incorrect parameters --\n"; -$testclass = new Tester(); -var_dump(gzdeflate($testclass)); -var_dump(gzdeflate($data, $testclass)); - ?> ===Done=== --EXPECTF-- *** Testing gzdeflate() : error conditions *** --- Testing gzdeflate() function with Zero arguments -- - -Warning: gzdeflate() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing gzdeflate() function with more than expected no. of arguments -- - -Warning: gzdeflate() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing with incorrect compression level -- Warning: gzdeflate(): compression level (99) must be within -1..9 in %s on line %d @@ -75,12 +45,4 @@ bool(false) Warning: gzdeflate(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d bool(false) - --- Testing with incorrect parameters -- - -Warning: gzdeflate() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: gzdeflate() expects parameter 2 to be int, object given in %s on line %d -NULL ===Done=== diff --git a/ext/zlib/tests/gzencode_error1.phpt b/ext/zlib/tests/gzencode_error1.phpt index ac846866c5..15b70afb8a 100644 --- a/ext/zlib/tests/gzencode_error1.phpt +++ b/ext/zlib/tests/gzencode_error1.phpt @@ -20,17 +20,9 @@ if (!extension_loaded("zlib")) { echo "*** Testing gzencode() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing gzencode() function with Zero arguments --\n"; -var_dump( gzencode() ); - -//Test gzencode with one more than the expected number of arguments -echo "\n-- Testing gzencode() function with more than expected no. of arguments --\n"; $data = 'string_val'; $level = 2; $encoding_mode = FORCE_DEFLATE; -$extra_arg = 10; -var_dump( gzencode($data, $level, $encoding_mode, $extra_arg) ); echo "\n-- Testing with incorrect compression level --\n"; $bad_level = 99; @@ -40,35 +32,11 @@ echo "\n-- Testing with incorrect encoding_mode --\n"; $bad_mode = 99; var_dump(gzencode($data, $level, $bad_mode)); -class Tester { - function Hello() { - echo "Hello\n"; - } -} - -echo "\n-- Testing with incorrect parameters --\n"; -$testclass = new Tester(); -var_dump(gzencode($testclass)); -var_dump(gzencode($data, $testclass)); -var_dump(gzencode($data, -1, 99.99)); -var_dump(gzencode($data, -1, $testclass)); -var_dump(gzencode($data, "a very none numeric string\n")); - ?> ===Done=== --EXPECTF-- *** Testing gzencode() : error conditions *** --- Testing gzencode() function with Zero arguments -- - -Warning: gzencode() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing gzencode() function with more than expected no. of arguments -- - -Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing with incorrect compression level -- Warning: gzencode(): compression level (99) must be within -1..9 in %s on line %d @@ -78,21 +46,4 @@ bool(false) Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d bool(false) - --- Testing with incorrect parameters -- - -Warning: gzencode() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: gzencode() expects parameter 2 to be int, object given in %s on line %d -NULL - -Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d -bool(false) - -Warning: gzencode() expects parameter 3 to be int, object given in %s on line %d -NULL - -Warning: gzencode() expects parameter 2 to be int, string given in %s on line %d -NULL ===Done=== diff --git a/ext/zlib/tests/gzgetss.phpt b/ext/zlib/tests/gzgetss.phpt deleted file mode 100644 index 58d13ab733..0000000000 --- a/ext/zlib/tests/gzgetss.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -gzgetss — Get line from gz-file pointer and strip HTML tags - function ---CREDITS-- -marcosptf - <marcosptf@yahoo.com.br> ---SKIPIF-- -<?php -if(!extension_loaded("zlib")){die("skip - ZLIB extension not loaded");} -?> ---FILE-- -<?php -$handle = gzopen(__DIR__ . '/gzgetss.gz', 'r'); - -while (!gzeof($handle)){ - $buffer = gzgetss($handle, 4096, "<code>"); - print($buffer); -} -gzclose($handle); -?> ---EXPECTF-- -Deprecated: Function gzgetss() is deprecated in %s on line %d - - -Deprecated: Function gzgetss() is deprecated in %s on line %d - - -Deprecated: Function gzgetss() is deprecated in %s on line %d - <code>stringgzgetss(resource $zp, int $length [, string $allowable_tags ]);<code/> - -Deprecated: Function gzgetss() is deprecated in %s on line %d - - -Deprecated: Function gzgetss() is deprecated in %s on line %d diff --git a/ext/zlib/tests/gzinflate_error1.phpt b/ext/zlib/tests/gzinflate_error1.phpt index cbfe615511..5b8e40620c 100644 --- a/ext/zlib/tests/gzinflate_error1.phpt +++ b/ext/zlib/tests/gzinflate_error1.phpt @@ -18,58 +18,20 @@ include(dirname(__FILE__) . '/data.inc'); echo "*** Testing gzinflate() : error conditions ***\n"; -echo "\n-- Testing gzcompress() function with Zero arguments --\n"; -var_dump( gzinflate() ); - -echo "\n-- Testing gzcompress() function with more than expected no. of arguments --\n"; -$data = 'string_val'; -$length = 10; -$extra_arg = 10; -var_dump( gzinflate($data, $length, $extra_arg) ); - echo "\n-- Testing with a buffer that is too small --\n"; +$data = 'string_val'; $short_len = strlen($data) - 1; $compressed = gzcompress($data); var_dump(gzinflate($compressed, $short_len)); -echo "\n-- Testing with incorrect parameters --\n"; - -class Tester { - function Hello() { - echo "Hello\n"; - } -} - -$testclass = new Tester(); -var_dump(gzinflate($testclass)); -var_dump(gzinflate($data, $testclass)); - ?> ===DONE=== --EXPECTF-- *** Testing gzinflate() : error conditions *** --- Testing gzcompress() function with Zero arguments -- - -Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing gzcompress() function with more than expected no. of arguments -- - -Warning: gzinflate() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Testing with a buffer that is too small -- Warning: gzinflate(): data error in %s on line %d bool(false) - --- Testing with incorrect parameters -- - -Warning: gzinflate() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: gzinflate() expects parameter 2 to be int, object given in %s on line %d -NULL ===DONE=== diff --git a/ext/zlib/tests/gzopen_variation4.phpt b/ext/zlib/tests/gzopen_variation4.phpt index baa9c715ae..b02c7152a8 100644 --- a/ext/zlib/tests/gzopen_variation4.phpt +++ b/ext/zlib/tests/gzopen_variation4.phpt @@ -32,73 +32,82 @@ restore_include_path(); chdir($baseDir); rmdir($workingDir); foreach($newdirs as $newdir) { - rmdir($newdir); + rmdir($newdir); } chdir(".."); rmdir($thisTestDir); function test_gzopen($mode) { - global $scriptFile, $secondFile, $firstFile, $filename; - - // create a file in the middle directory - $h = gzopen($secondFile, "w"); - gzwrite($h, "This is a file in dir2"); - gzclose($h); - - echo "\n** testing with mode=$mode **\n"; - // should read dir2 file - $h = gzopen($filename, $mode, true); - gzpassthru($h); - gzclose($h); - echo "\n"; - - //create a file in dir1 - $h = gzopen($firstFile, "w"); - gzwrite($h, "This is a file in dir1"); - gzclose($h); - - //should now read dir1 file - $h = gzopen($filename, $mode, true); - gzpassthru($h); - gzclose($h); - echo "\n"; - - // create a file in working directory - $h = gzopen($filename, "w"); - gzwrite($h, "This is a file in working dir"); - gzclose($h); - - //should still read dir1 file - $h = gzopen($filename, $mode, true); - gzpassthru($h); - gzclose($h); - echo "\n"; - - unlink($firstFile); - unlink($secondFile); - - //should read the file in working dir - $h = gzopen($filename, $mode, true); - gzpassthru($h); - gzclose($h); - echo "\n"; - - // create a file in the script directory - $h = gzopen($scriptFile, "w"); - gzwrite($h, "This is a file in script dir"); - gzclose($h); - - //should read the file in script dir - $h = gzopen($filename, $mode, true); - gzpassthru($h); - gzclose($h); - echo "\n"; - - //cleanup - unlink($filename); - unlink($scriptFile); - + global $scriptFile, $secondFile, $firstFile, $filename; + + // create a file in the middle directory + $h = gzopen($secondFile, "w"); + gzwrite($h, "This is a file in dir2"); + gzclose($h); + + echo "\n** testing with mode=$mode **\n"; + // should read dir2 file + $h = gzopen($filename, $mode, true); + if ($h) { + gzpassthru($h); + gzclose($h); + echo "\n"; + } + + //create a file in dir1 + $h = gzopen($firstFile, "w"); + gzwrite($h, "This is a file in dir1"); + gzclose($h); + + //should now read dir1 file + $h = gzopen($filename, $mode, true); + if ($h) { + gzpassthru($h); + gzclose($h); + echo "\n"; + } + + // create a file in working directory + $h = gzopen($filename, "w"); + gzwrite($h, "This is a file in working dir"); + gzclose($h); + + //should still read dir1 file + $h = gzopen($filename, $mode, true); + if ($h) { + gzpassthru($h); + gzclose($h); + echo "\n"; + } + + unlink($firstFile); + unlink($secondFile); + + //should read the file in working dir + $h = gzopen($filename, $mode, true); + if ($h) { + gzpassthru($h); + gzclose($h); + echo "\n"; + } + + // create a file in the script directory + $h = gzopen($scriptFile, "w"); + gzwrite($h, "This is a file in script dir"); + gzclose($h); + + //should read the file in script dir + $h = gzopen($filename, $mode, true); + if ($h) { + gzpassthru($h); + gzclose($h); + echo "\n"; + } + + //cleanup + unlink($filename); + unlink($scriptFile); } ?> @@ -119,39 +128,14 @@ This is a file in script dir Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d -Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d - -Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d - - Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d -Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d - -Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d - - Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d -Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d - -Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d - - Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d -Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d - -Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d - - Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d -Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d - -Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d - - ** testing with mode=rt ** This is a file in dir2 This is a file in dir1 diff --git a/ext/zlib/tests/gzuncompress_error1.phpt b/ext/zlib/tests/gzuncompress_error1.phpt index f200951d4c..8683a6c829 100644 --- a/ext/zlib/tests/gzuncompress_error1.phpt +++ b/ext/zlib/tests/gzuncompress_error1.phpt @@ -16,18 +16,8 @@ if (!extension_loaded("zlib")) { echo "*** Testing gzuncompress() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing gzuncompress() function with Zero arguments --\n"; -var_dump( gzuncompress() ); - -//Test gzuncompress with one more than the expected number of arguments -echo "\n-- Testing gzuncompress() function with more than expected no. of arguments --\n"; -$data = 'string_val'; -$length = 10; -$extra_arg = 10; -var_dump( gzuncompress($data, $length, $extra_arg) ); - echo "\n-- Testing with a buffer that is too small --\n"; +$data = 'string_val'; $short_len = strlen($data) - 1; $compressed = gzcompress($data); @@ -36,32 +26,11 @@ var_dump(gzuncompress($compressed, $short_len)); echo "\n-- Testing with incorrect arguments --\n"; var_dump(gzuncompress(123)); -class Tester { - function Hello() { - echo "Hello\n"; - } -} - -$testclass = new Tester(); -var_dump(gzuncompress($testclass)); - -var_dump(gzuncompress($compressed, "this is not a number\n")); - ?> ===DONE=== --EXPECTF-- *** Testing gzuncompress() : error conditions *** --- Testing gzuncompress() function with Zero arguments -- - -Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing gzuncompress() function with more than expected no. of arguments -- - -Warning: gzuncompress() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Testing with a buffer that is too small -- Warning: gzuncompress(): insufficient memory in %s on line %d @@ -71,10 +40,4 @@ bool(false) Warning: gzuncompress(): data error in %s on line %d bool(false) - -Warning: gzuncompress() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: gzuncompress() expects parameter 2 to be int, string given in %s on line %d -NULL ===DONE=== diff --git a/ext/zlib/tests/inflate_init_error.phpt b/ext/zlib/tests/inflate_init_error.phpt index 58773e61d3..504f795aec 100644 --- a/ext/zlib/tests/inflate_init_error.phpt +++ b/ext/zlib/tests/inflate_init_error.phpt @@ -8,12 +8,8 @@ if (!extension_loaded("zlib")) { ?> --FILE-- <?php -var_dump(inflate_init()); var_dump(inflate_init(42)); ?> --EXPECTF-- -Warning: inflate_init() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: inflate_init(): encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d bool(false) diff --git a/ext/zlib/tests/readgzfile_variation10.phpt b/ext/zlib/tests/readgzfile_variation10.phpt deleted file mode 100644 index 004a07775a..0000000000 --- a/ext/zlib/tests/readgzfile_variation10.phpt +++ /dev/null @@ -1,67 +0,0 @@ ---TEST-- -Test function readgzfile() by substituting argument 2 with emptyUnsetUndefNull values. ---SKIPIF-- -<?php -if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build'); -?> ---FILE-- -<?php - - -$filename = dirname(__FILE__)."/004.txt.gz"; - - -$unset_var = 10; -unset($unset_var); - -$variation = array( - 'unset var' => @$unset_var, - 'undefined var' => @$undefined_var, - 'empty string DQ' => "", - 'empty string SQ' => '', - 'uppercase NULL' => NULL, - 'lowercase null' => null, - ); - - -foreach ( $variation as $var ) { - var_dump(readgzfile( $filename, $var ) ); -} -?> -===DONE=== ---EXPECTF-- -When you're taught through feelings -Destiny flying high above -all I know is that you can realize it -Destiny who cares -as it turns around -and I know that it descends down on me -int(176) -When you're taught through feelings -Destiny flying high above -all I know is that you can realize it -Destiny who cares -as it turns around -and I know that it descends down on me -int(176) - -Warning: readgzfile() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: readgzfile() expects parameter 2 to be int, string given in %s on line %d -NULL -When you're taught through feelings -Destiny flying high above -all I know is that you can realize it -Destiny who cares -as it turns around -and I know that it descends down on me -int(176) -When you're taught through feelings -Destiny flying high above -all I know is that you can realize it -Destiny who cares -as it turns around -and I know that it descends down on me -int(176) -===DONE=== diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index f3bda6398f..7eb38c3c04 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -1340,12 +1340,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_gzread, 0) ZEND_ARG_INFO(0, length) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_gzgetss, 0, 0, 1) - ZEND_ARG_INFO(0, fp) - ZEND_ARG_INFO(0, length) - ZEND_ARG_INFO(0, allowable_tags) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_gzgets, 0, 0, 1) ZEND_ARG_INFO(0, fp) ZEND_ARG_INFO(0, length) @@ -1391,7 +1385,6 @@ static const zend_function_entry php_zlib_functions[] = { PHP_FALIAS(gzeof, feof, arginfo_gzpassthru) PHP_FALIAS(gzgetc, fgetc, arginfo_gzpassthru) PHP_FALIAS(gzgets, fgets, arginfo_gzgets) - PHP_DEP_FALIAS(gzgetss, fgetss, arginfo_gzgetss) PHP_FALIAS(gzread, fread, arginfo_gzread) PHP_FE(gzopen, arginfo_gzopen) PHP_FALIAS(gzpassthru, fpassthru, arginfo_gzpassthru) |
