array is no longer supported. For example, array_pop($GLOBALS) will result
in an error.
RFC: https://wiki.php.net/rfc/restrict_globals_usage
+ . Passing null to a non-nullable argument of a built-in function is
+ deprecated. This matches the behavior of user-defined functions, where null
+ is never accepted by non-nullable arguments.
+ user-defined functions.
+
+ var_dump(str_contains("foobar", null));
+ // Deprecated: Passing null to parameter #2 ($needle) of type string
+ // is deprecated
+
+ RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
- Fileinfo:
. The fileinfo functions now accept and return, respectively, finfo objects
Warning: Undefined variable $undef in %s on line %d
+Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
+
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
Warning: Undefined variable $undef in %s on line %d
+Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
+
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
Warning: Undefined variable $undef in %s on line %d
+Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
+
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
Warning: Undefined variable $undef in %s on line %d
+Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
+
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
Warning: Undefined variable $undef in %s on line %d
+Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
+
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
Warning: Undefined variable $undef in %s on line %d
+Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
+
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
ok
}
}
$cat = new cat();
-$cat->show_output('Files: ', trim(`cd .`)); // this gives invalid args to shell_exec
+$cat->show_output('Files: ', trim((string) `cd .`)); // this gives invalid args to shell_exec
$cat->show_output('Files: ', `cd .`); // this causes a segmentation fault
$cat->show_output(`cd .`); // this causes a segmentation fault
}
var_dump(class_exists(''));
-var_dump(class_exists(NULL));
var_dump(class_exists('FOO'));
var_dump(class_exists('bar'));
var_dump(class_exists(1));
?>
--EXPECT--
bool(false)
-bool(false)
bool(true)
bool(false)
bool(false)
try {
try {
try {
- throw new Exception(NULL);
+ throw new Exception();
} catch (Exception $e) {
var_dump($e->getMessage());
throw $e;
var_dump(interface_exists('foo'));
var_dump(interface_exists(1));
-var_dump(interface_exists(NULL));
?>
--EXPECT--
bool(true)
bool(false)
-bool(false)
--- /dev/null
+--TEST--
+Test null arg behavior for special functions
+--FILE--
+<?php
+
+$null = null;
+var_dump(strlen($null));
+
+?>
+--EXPECTF--
+Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
+int(0)
?>
--EXPECTF--
+Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
int(0)
bool(true)
bool(false)
bool(false)
bool(false)
bool(false)
+
+Deprecated: defined(): Passing null to parameter #1 ($constant_name) of type string is deprecated in %s on line %d
bool(false)
+
+Deprecated: chr(): Passing null to parameter #1 ($codepoint) of type int is deprecated in %s on line %d
string(1) "%s"
+
+Deprecated: ord(): Passing null to parameter #1 ($character) of type string is deprecated in %s on line %d
int(0)
string(98) "call_user_func_array(): Argument #1 ($function) must be a valid callback, no array or string given"
string(77) "call_user_func_array(): Argument #2 ($args) must be of type array, null given"
string(52) "func_num_args() expects exactly 0 arguments, 1 given"
string(52) "func_get_args() expects exactly 0 arguments, 1 given"
string(69) "array_slice(): Argument #1 ($array) must be of type array, null given"
+
+Deprecated: array_slice(): Passing null to parameter #2 ($offset) of type int is deprecated in %s on line %d
array(1) {
[0]=>
string(3) "foo"
}
?>
---EXPECT--
+--EXPECTF--
string(6) "string"
string(1) "1"
+
+Deprecated: zend_string_or_stdclass(): Passing null to parameter #1 ($param) of type string is deprecated in %s on line %d
string(0) ""
object(stdClass)#1 (0) {
}
}
?>
---EXPECT--
+--EXPECTF--
string(6) "string"
string(1) "1"
+
+Deprecated: zend_string_or_object(): Passing null to parameter #1 ($param) of type object|string is deprecated in %s on line %d
string(0) ""
object(stdClass)#1 (0) {
}
var_dump(trait_exists('foo'));
var_dump(trait_exists(1));
-var_dump(trait_exists(NULL));
?>
--EXPECT--
bool(true)
bool(false)
-bool(false)
}
/* }}} */
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, bool *dest) /* {{{ */
+static ZEND_COLD bool zend_null_arg_deprecated(const char *fallback_type, uint32_t arg_num) {
+ zend_function *func = EG(current_execute_data)->func;
+ ZEND_ASSERT(arg_num > 0);
+ uint32_t arg_offset = arg_num - 1;
+ if (arg_offset >= func->common.num_args) {
+ ZEND_ASSERT(func->common.fn_flags & ZEND_ACC_VARIADIC);
+ arg_offset = func->common.num_args;
+ }
+
+ zend_arg_info *arg_info = &func->common.arg_info[arg_offset];
+ zend_string *func_name = get_active_function_or_method_name();
+ const char *arg_name = get_active_function_arg_name(arg_num);
+
+ /* If no type is specified in arginfo, use the specified fallback_type determined through
+ * zend_parse_parameters instead. */
+ zend_string *type_str = zend_type_to_string(arg_info->type);
+ const char *type = type_str ? ZSTR_VAL(type_str) : fallback_type;
+ zend_error(E_DEPRECATED,
+ "%s(): Passing null to parameter #%" PRIu32 "%s%s%s of type %s is deprecated",
+ ZSTR_VAL(func_name), arg_num,
+ arg_name ? " ($" : "", arg_name ? arg_name : "", arg_name ? ")" : "",
+ type);
+ zend_string_release(func_name);
+ if (type_str) {
+ zend_string_release(type_str);
+ }
+ return !EG(exception);
+}
+
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, bool *dest, uint32_t arg_num) /* {{{ */
{
if (EXPECTED(Z_TYPE_P(arg) <= IS_STRING)) {
+ if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("bool", arg_num)) {
+ return 0;
+ }
*dest = zend_is_true(arg);
} else {
return 0;
}
/* }}} */
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, bool *dest) /* {{{ */
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, bool *dest, uint32_t arg_num) /* {{{ */
{
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
return 0;
}
- return zend_parse_arg_bool_weak(arg, dest);
+ return zend_parse_arg_bool_weak(arg, dest, arg_num);
}
/* }}} */
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest) /* {{{ */
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest, uint32_t arg_num) /* {{{ */
{
if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) {
return 0;
}
} else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
+ if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int", arg_num)) {
+ return 0;
+ }
*dest = 0;
} else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
*dest = 1;
}
/* }}} */
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest) /* {{{ */
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest, uint32_t arg_num) /* {{{ */
{
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
return 0;
}
- return zend_parse_arg_long_weak(arg, dest);
+ return zend_parse_arg_long_weak(arg, dest, arg_num);
}
/* }}} */
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /* {{{ */
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest, uint32_t arg_num) /* {{{ */
{
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
*dest = (double)Z_LVAL_P(arg);
return 0;
}
} else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
+ if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("float", arg_num)) {
+ return 0;
+ }
*dest = 0.0;
} else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
*dest = 1.0;
}
/* }}} */
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest) /* {{{ */
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest, uint32_t arg_num) /* {{{ */
{
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
/* SSTH Exception: IS_LONG may be accepted instead as IS_DOUBLE */
} else if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
return 0;
}
- return zend_parse_arg_double_weak(arg, dest);
+ return zend_parse_arg_double_weak(arg, dest, arg_num);
}
/* }}} */
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /* {{{ */
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest, uint32_t arg_num) /* {{{ */
{
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
return 0;
}
zend_string_release(str);
} else if (Z_TYPE_P(arg) < IS_TRUE) {
+ if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int|float", arg_num)) {
+ return 0;
+ }
ZVAL_LONG(arg, 0);
} else if (Z_TYPE_P(arg) == IS_TRUE) {
ZVAL_LONG(arg, 1);
}
/* }}} */
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest) /* {{{ */
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest, uint32_t arg_num) /* {{{ */
{
if (EXPECTED(Z_TYPE_P(arg) < IS_STRING)) {
+ if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("string", arg_num)) {
+ return 0;
+ }
convert_to_string(arg);
*dest = Z_STR_P(arg);
} else if (UNEXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
}
/* }}} */
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest) /* {{{ */
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest, uint32_t arg_num) /* {{{ */
{
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
return 0;
}
- return zend_parse_arg_str_weak(arg, dest);
+ return zend_parse_arg_str_weak(arg, dest, arg_num);
}
/* }}} */
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long) /* {{{ */
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long, uint32_t arg_num) /* {{{ */
{
if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
return 0;
}
- if (zend_parse_arg_long_weak(arg, dest_long)) {
+ if (zend_parse_arg_long_weak(arg, dest_long, arg_num)) {
*dest_str = NULL;
return 1;
- } else if (zend_parse_arg_str_weak(arg, dest_str)) {
+ } else if (zend_parse_arg_str_weak(arg, dest_str, arg_num)) {
*dest_long = 0;
return 1;
} else {
}
/* }}} */
-static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec, char **error) /* {{{ */
+static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec, char **error, uint32_t arg_num) /* {{{ */
{
const char *spec_walk = *spec;
char c = *spec_walk++;
is_null = va_arg(*va, bool *);
}
- if (!zend_parse_arg_long(arg, p, is_null, check_null)) {
+ if (!zend_parse_arg_long(arg, p, is_null, check_null, arg_num)) {
return check_null ? "?int" : "int";
}
}
is_null = va_arg(*va, bool *);
}
- if (!zend_parse_arg_double(arg, p, is_null, check_null)) {
+ if (!zend_parse_arg_double(arg, p, is_null, check_null, arg_num)) {
return check_null ? "?float" : "float";
}
}
{
zval **p = va_arg(*va, zval **);
- if (!zend_parse_arg_number(arg, p, check_null)) {
+ if (!zend_parse_arg_number(arg, p, check_null, arg_num)) {
return check_null ? "int|float|null" : "int|float";
}
}
{
char **p = va_arg(*va, char **);
size_t *pl = va_arg(*va, size_t *);
- if (!zend_parse_arg_string(arg, p, pl, check_null)) {
+ if (!zend_parse_arg_string(arg, p, pl, check_null, arg_num)) {
return check_null ? "?string" : "string";
}
}
{
char **p = va_arg(*va, char **);
size_t *pl = va_arg(*va, size_t *);
- if (!zend_parse_arg_path(arg, p, pl, check_null)) {
+ if (!zend_parse_arg_path(arg, p, pl, check_null, arg_num)) {
if (Z_TYPE_P(arg) == IS_STRING) {
zend_spprintf(error, 0, "must not contain any null bytes");
return "";
case 'P':
{
zend_string **str = va_arg(*va, zend_string **);
- if (!zend_parse_arg_path_str(arg, str, check_null)) {
+ if (!zend_parse_arg_path_str(arg, str, check_null, arg_num)) {
if (Z_TYPE_P(arg) == IS_STRING) {
zend_spprintf(error, 0, "must not contain any null bytes");
return "";
case 'S':
{
zend_string **str = va_arg(*va, zend_string **);
- if (!zend_parse_arg_str(arg, str, check_null)) {
+ if (!zend_parse_arg_str(arg, str, check_null, arg_num)) {
return check_null ? "?string" : "string";
}
}
is_null = va_arg(*va, bool *);
}
- if (!zend_parse_arg_bool(arg, p, is_null, check_null)) {
+ if (!zend_parse_arg_bool(arg, p, is_null, check_null, arg_num)) {
return check_null ? "?bool" : "bool";
}
}
const char *expected_type = NULL;
char *error = NULL;
- expected_type = zend_parse_arg_impl(arg, va, spec, &error);
+ expected_type = zend_parse_arg_impl(arg, va, spec, &error, arg_num);
if (expected_type) {
if (EG(exception)) {
return FAILURE;
/* old "b" */
#define Z_PARAM_BOOL_EX(dest, is_null, check_null, deref) \
Z_PARAM_PROLOGUE(deref, 0); \
- if (UNEXPECTED(!zend_parse_arg_bool(_arg, &dest, &is_null, check_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_bool(_arg, &dest, &is_null, check_null, _i))) { \
_expected_type = check_null ? Z_EXPECTED_BOOL_OR_NULL : Z_EXPECTED_BOOL; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
#define Z_PARAM_OBJ_OR_STR_EX(destination_object, destination_string, allow_null) \
Z_PARAM_PROLOGUE(0, 0); \
- if (UNEXPECTED(!zend_parse_arg_obj_or_str(_arg, &destination_object, NULL, &destination_string, allow_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_obj_or_str(_arg, &destination_object, NULL, &destination_string, allow_null, _i))) { \
_expected_type = allow_null ? Z_EXPECTED_OBJECT_OR_STRING_OR_NULL : Z_EXPECTED_OBJECT_OR_STRING; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
#define Z_PARAM_OBJ_OF_CLASS_OR_STR_EX(destination_object, base_ce, destination_string, allow_null) \
Z_PARAM_PROLOGUE(0, 0); \
- if (UNEXPECTED(!zend_parse_arg_obj_or_str(_arg, &destination_object, base_ce, &destination_string, allow_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_obj_or_str(_arg, &destination_object, base_ce, &destination_string, allow_null, _i))) { \
if (base_ce) { \
_error = ZSTR_VAL((base_ce)->name); \
_error_code = allow_null ? ZPP_ERROR_WRONG_CLASS_OR_STRING_OR_NULL : ZPP_ERROR_WRONG_CLASS_OR_STRING; \
/* old "d" */
#define Z_PARAM_DOUBLE_EX(dest, is_null, check_null, deref) \
Z_PARAM_PROLOGUE(deref, 0); \
- if (UNEXPECTED(!zend_parse_arg_double(_arg, &dest, &is_null, check_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_double(_arg, &dest, &is_null, check_null, _i))) { \
_expected_type = check_null ? Z_EXPECTED_DOUBLE_OR_NULL : Z_EXPECTED_DOUBLE; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
#define Z_PARAM_ARRAY_HT_OR_LONG_EX(dest_ht, dest_long, is_null, allow_null) \
Z_PARAM_PROLOGUE(0, 0); \
- if (UNEXPECTED(!zend_parse_arg_array_ht_or_long(_arg, &dest_ht, &dest_long, &is_null, allow_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_array_ht_or_long(_arg, &dest_ht, &dest_long, &is_null, allow_null, _i))) { \
_expected_type = allow_null ? Z_EXPECTED_ARRAY_OR_LONG_OR_NULL : Z_EXPECTED_ARRAY_OR_LONG; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
/* old "l" */
#define Z_PARAM_LONG_EX(dest, is_null, check_null, deref) \
Z_PARAM_PROLOGUE(deref, 0); \
- if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null, _i))) { \
_expected_type = check_null ? Z_EXPECTED_LONG_OR_NULL : Z_EXPECTED_LONG; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
/* old "n" */
#define Z_PARAM_NUMBER_EX(dest, check_null) \
Z_PARAM_PROLOGUE(0, 0); \
- if (UNEXPECTED(!zend_parse_arg_number(_arg, &dest, check_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_number(_arg, &dest, check_null, _i))) { \
_expected_type = check_null ? Z_EXPECTED_NUMBER_OR_NULL : Z_EXPECTED_NUMBER; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
#define Z_PARAM_OBJ_OF_CLASS_OR_LONG_EX(dest_obj, _ce, dest_long, is_null, allow_null) \
Z_PARAM_PROLOGUE(0, 0); \
- if (UNEXPECTED(!zend_parse_arg_obj_or_long(_arg, &dest_obj, _ce, &dest_long, &is_null, allow_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_obj_or_long(_arg, &dest_obj, _ce, &dest_long, &is_null, allow_null, _i))) { \
_error = ZSTR_VAL((_ce)->name); \
_error_code = allow_null ? ZPP_ERROR_WRONG_CLASS_OR_LONG_OR_NULL : ZPP_ERROR_WRONG_CLASS_OR_LONG; \
break; \
/* old "p" */
#define Z_PARAM_PATH_EX(dest, dest_len, check_null, deref) \
Z_PARAM_PROLOGUE(deref, 0); \
- if (UNEXPECTED(!zend_parse_arg_path(_arg, &dest, &dest_len, check_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_path(_arg, &dest, &dest_len, check_null, _i))) { \
_expected_type = check_null ? Z_EXPECTED_PATH_OR_NULL : Z_EXPECTED_PATH; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
/* old "P" */
#define Z_PARAM_PATH_STR_EX(dest, check_null, deref) \
Z_PARAM_PROLOGUE(deref, 0); \
- if (UNEXPECTED(!zend_parse_arg_path_str(_arg, &dest, check_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_path_str(_arg, &dest, check_null, _i))) { \
_expected_type = check_null ? Z_EXPECTED_PATH_OR_NULL : Z_EXPECTED_PATH; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
/* old "s" */
#define Z_PARAM_STRING_EX(dest, dest_len, check_null, deref) \
Z_PARAM_PROLOGUE(deref, 0); \
- if (UNEXPECTED(!zend_parse_arg_string(_arg, &dest, &dest_len, check_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_string(_arg, &dest, &dest_len, check_null, _i))) { \
_expected_type = check_null ? Z_EXPECTED_STRING_OR_NULL : Z_EXPECTED_STRING; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
/* old "S" */
#define Z_PARAM_STR_EX(dest, check_null, deref) \
Z_PARAM_PROLOGUE(deref, 0); \
- if (UNEXPECTED(!zend_parse_arg_str(_arg, &dest, check_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_str(_arg, &dest, check_null, _i))) { \
_expected_type = check_null ? Z_EXPECTED_STRING_OR_NULL : Z_EXPECTED_STRING; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
#define Z_PARAM_ARRAY_HT_OR_STR_EX(dest_ht, dest_str, allow_null) \
Z_PARAM_PROLOGUE(0, 0); \
- if (UNEXPECTED(!zend_parse_arg_array_ht_or_str(_arg, &dest_ht, &dest_str, allow_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_array_ht_or_str(_arg, &dest_ht, &dest_str, allow_null, _i))) { \
_expected_type = allow_null ? Z_EXPECTED_ARRAY_OR_STRING_OR_NULL : Z_EXPECTED_ARRAY_OR_STRING; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
#define Z_PARAM_STR_OR_LONG_EX(dest_str, dest_long, is_null, allow_null) \
Z_PARAM_PROLOGUE(0, 0); \
- if (UNEXPECTED(!zend_parse_arg_str_or_long(_arg, &dest_str, &dest_long, &is_null, allow_null))) { \
+ if (UNEXPECTED(!zend_parse_arg_str_or_long(_arg, &dest_str, &dest_long, &is_null, allow_null, _i))) { \
_expected_type = allow_null ? Z_EXPECTED_STRING_OR_LONG_OR_NULL : Z_EXPECTED_STRING_OR_LONG; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
/* Inlined implementations shared by new and old parameter parsing APIs */
ZEND_API bool ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, uint32_t num, bool check_null);
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, bool *dest);
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, bool *dest);
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest);
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest);
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest);
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest);
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest);
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest);
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest);
-ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long);
-
-static zend_always_inline bool zend_parse_arg_bool(zval *arg, bool *dest, bool *is_null, bool check_null)
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, bool *dest, uint32_t arg_num);
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, bool *dest, uint32_t arg_num);
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest, uint32_t arg_num);
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest, uint32_t arg_num);
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest, uint32_t arg_num);
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest, uint32_t arg_num);
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest, uint32_t arg_num);
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest, uint32_t arg_num);
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest, uint32_t arg_num);
+ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow(zval *arg, zend_string **dest_str, zend_long *dest_long, uint32_t arg_num);
+
+static zend_always_inline bool zend_parse_arg_bool(zval *arg, bool *dest, bool *is_null, bool check_null, uint32_t arg_num)
{
if (check_null) {
*is_null = 0;
*is_null = 1;
*dest = 0;
} else {
- return zend_parse_arg_bool_slow(arg, dest);
+ return zend_parse_arg_bool_slow(arg, dest, arg_num);
}
return 1;
}
-static zend_always_inline bool zend_parse_arg_long(zval *arg, zend_long *dest, bool *is_null, bool check_null)
+static zend_always_inline bool zend_parse_arg_long(zval *arg, zend_long *dest, bool *is_null, bool check_null, uint32_t arg_num)
{
if (check_null) {
*is_null = 0;
*is_null = 1;
*dest = 0;
} else {
- return zend_parse_arg_long_slow(arg, dest);
+ return zend_parse_arg_long_slow(arg, dest, arg_num);
}
return 1;
}
-static zend_always_inline bool zend_parse_arg_double(zval *arg, double *dest, bool *is_null, bool check_null)
+static zend_always_inline bool zend_parse_arg_double(zval *arg, double *dest, bool *is_null, bool check_null, uint32_t arg_num)
{
if (check_null) {
*is_null = 0;
*is_null = 1;
*dest = 0.0;
} else {
- return zend_parse_arg_double_slow(arg, dest);
+ return zend_parse_arg_double_slow(arg, dest, arg_num);
}
return 1;
}
-static zend_always_inline bool zend_parse_arg_number(zval *arg, zval **dest, bool check_null)
+static zend_always_inline bool zend_parse_arg_number(zval *arg, zval **dest, bool check_null, uint32_t arg_num)
{
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG || Z_TYPE_P(arg) == IS_DOUBLE)) {
*dest = arg;
} else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
*dest = NULL;
} else {
- return zend_parse_arg_number_slow(arg, dest);
+ return zend_parse_arg_number_slow(arg, dest, arg_num);
}
return 1;
}
-static zend_always_inline bool zend_parse_arg_str(zval *arg, zend_string **dest, bool check_null)
+static zend_always_inline bool zend_parse_arg_str(zval *arg, zend_string **dest, bool check_null, uint32_t arg_num)
{
if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
*dest = Z_STR_P(arg);
} else if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*dest = NULL;
} else {
- return zend_parse_arg_str_slow(arg, dest);
+ return zend_parse_arg_str_slow(arg, dest, arg_num);
}
return 1;
}
-static zend_always_inline bool zend_parse_arg_string(zval *arg, char **dest, size_t *dest_len, bool check_null)
+static zend_always_inline bool zend_parse_arg_string(zval *arg, char **dest, size_t *dest_len, bool check_null, uint32_t arg_num)
{
zend_string *str;
- if (!zend_parse_arg_str(arg, &str, check_null)) {
+ if (!zend_parse_arg_str(arg, &str, check_null, arg_num)) {
return 0;
}
if (check_null && UNEXPECTED(!str)) {
return 1;
}
-static zend_always_inline bool zend_parse_arg_path_str(zval *arg, zend_string **dest, bool check_null)
+static zend_always_inline bool zend_parse_arg_path_str(zval *arg, zend_string **dest, bool check_null, uint32_t arg_num)
{
- if (!zend_parse_arg_str(arg, dest, check_null) ||
+ if (!zend_parse_arg_str(arg, dest, check_null, arg_num) ||
(*dest && UNEXPECTED(CHECK_NULL_PATH(ZSTR_VAL(*dest), ZSTR_LEN(*dest))))) {
return 0;
}
return 1;
}
-static zend_always_inline bool zend_parse_arg_path(zval *arg, char **dest, size_t *dest_len, bool check_null)
+static zend_always_inline bool zend_parse_arg_path(zval *arg, char **dest, size_t *dest_len, bool check_null, uint32_t arg_num)
{
zend_string *str;
- if (!zend_parse_arg_path_str(arg, &str, check_null)) {
+ if (!zend_parse_arg_path_str(arg, &str, check_null, arg_num)) {
return 0;
}
if (check_null && UNEXPECTED(!str)) {
}
static zend_always_inline bool zend_parse_arg_array_ht_or_long(
- zval *arg, HashTable **dest_ht, zend_long *dest_long, bool *is_null, bool allow_null
+ zval *arg, HashTable **dest_ht, zend_long *dest_long, bool *is_null, bool allow_null, uint32_t arg_num
) {
if (allow_null) {
*is_null = 0;
*is_null = 1;
} else {
*dest_ht = NULL;
- return zend_parse_arg_long_slow(arg, dest_long);
+ return zend_parse_arg_long_slow(arg, dest_long, arg_num);
}
return 1;
}
static zend_always_inline bool zend_parse_arg_obj_or_long(
- zval *arg, zend_object **dest_obj, zend_class_entry *ce, zend_long *dest_long, bool *is_null, bool allow_null
+ zval *arg, zend_object **dest_obj, zend_class_entry *ce, zend_long *dest_long, bool *is_null, bool allow_null, uint32_t arg_num
) {
if (allow_null) {
*is_null = 0;
*is_null = 1;
} else {
*dest_obj = NULL;
- return zend_parse_arg_long_slow(arg, dest_long);
+ return zend_parse_arg_long_slow(arg, dest_long, arg_num);
}
return 1;
}
static zend_always_inline bool zend_parse_arg_array_ht_or_str(
- zval *arg, HashTable **dest_ht, zend_string **dest_str, bool allow_null)
+ zval *arg, HashTable **dest_ht, zend_string **dest_str, bool allow_null, uint32_t arg_num)
{
if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
*dest_ht = NULL;
*dest_str = NULL;
} else {
*dest_ht = NULL;
- return zend_parse_arg_str_slow(arg, dest_str);
+ return zend_parse_arg_str_slow(arg, dest_str, arg_num);
}
return 1;
}
static zend_always_inline bool zend_parse_arg_str_or_long(zval *arg, zend_string **dest_str, zend_long *dest_long,
- bool *is_null, bool allow_null)
+ bool *is_null, bool allow_null, uint32_t arg_num)
{
if (allow_null) {
*is_null = 0;
*dest_str = NULL;
*is_null = 1;
} else {
- return zend_parse_arg_str_or_long_slow(arg, dest_str, dest_long);
+ return zend_parse_arg_str_or_long_slow(arg, dest_str, dest_long, arg_num);
}
return 1;
}
}
static zend_always_inline bool zend_parse_arg_obj_or_str(
- zval *arg, zend_object **destination_object, zend_class_entry *base_ce, zend_string **destination_string, bool allow_null
+ zval *arg, zend_object **destination_object, zend_class_entry *base_ce, zend_string **destination_string, bool allow_null, uint32_t arg_num
) {
if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
if (!base_ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), base_ce))) {
}
*destination_object = NULL;
- return zend_parse_arg_str(arg, destination_string, allow_null);
+ return zend_parse_arg_str(arg, destination_string, allow_null, arg_num);
}
END_EXTERN_C()
ZVAL_DOUBLE(arg, dval);
return 1;
}
- } else if (zend_parse_arg_long_weak(arg, &lval)) {
+ } else if (zend_parse_arg_long_weak(arg, &lval, 0)) {
zval_ptr_dtor(arg);
ZVAL_LONG(arg, lval);
return 1;
}
}
- if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval)) {
+ if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval, 0)) {
zval_ptr_dtor(arg);
ZVAL_DOUBLE(arg, dval);
return 1;
}
- if ((type_mask & MAY_BE_STRING) && zend_parse_arg_str_weak(arg, &str)) {
+ if ((type_mask & MAY_BE_STRING) && zend_parse_arg_str_weak(arg, &str, 0)) {
/* on success "arg" is converted to IS_STRING */
return 1;
}
- if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval)) {
+ if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval, 0)) {
zval_ptr_dtor(arg);
ZVAL_BOOL(arg, bval);
return 1;
double dval;
bool bval;
- if ((type_mask & MAY_BE_LONG) && zend_parse_arg_long_weak(arg, &lval)) {
+ if ((type_mask & MAY_BE_LONG) && zend_parse_arg_long_weak(arg, &lval, 0)) {
return 1;
}
- if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval)) {
+ if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval, 0)) {
return 1;
}
if ((type_mask & MAY_BE_STRING) && can_convert_to_string(arg)) {
return 1;
}
- if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval)) {
+ if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval, 0)) {
return 1;
}
return 0;
zend_string *str;
zval tmp;
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_NULL)) {
+ zend_error(E_DEPRECATED,
+ "strlen(): Passing null to parameter #1 ($string) of type string is deprecated");
+ if (UNEXPECTED(EG(exception))) {
+ HANDLE_EXCEPTION();
+ }
+ ZVAL_LONG(EX_VAR(opline->result.var), 0);
+ break;
+ }
+
ZVAL_COPY(&tmp, value);
- if (zend_parse_arg_str_weak(&tmp, &str)) {
+ if (zend_parse_arg_str_weak(&tmp, &str, 1)) {
ZVAL_LONG(EX_VAR(opline->result.var), ZSTR_LEN(str));
zval_ptr_dtor(&tmp);
break;
zend_string *str;
zval tmp;
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_NULL)) {
+ zend_error(E_DEPRECATED,
+ "strlen(): Passing null to parameter #1 ($string) of type string is deprecated");
+ if (UNEXPECTED(EG(exception))) {
+ HANDLE_EXCEPTION();
+ }
+ ZVAL_LONG(EX_VAR(opline->result.var), 0);
+ break;
+ }
+
ZVAL_COPY(&tmp, value);
- if (zend_parse_arg_str_weak(&tmp, &str)) {
+ if (zend_parse_arg_str_weak(&tmp, &str, 1)) {
ZVAL_LONG(EX_VAR(opline->result.var), ZSTR_LEN(str));
zval_ptr_dtor(&tmp);
break;
zend_string *str;
zval tmp;
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_NULL)) {
+ zend_error(E_DEPRECATED,
+ "strlen(): Passing null to parameter #1 ($string) of type string is deprecated");
+ if (UNEXPECTED(EG(exception))) {
+ HANDLE_EXCEPTION();
+ }
+ ZVAL_LONG(EX_VAR(opline->result.var), 0);
+ break;
+ }
+
ZVAL_COPY(&tmp, value);
- if (zend_parse_arg_str_weak(&tmp, &str)) {
+ if (zend_parse_arg_str_weak(&tmp, &str, 1)) {
ZVAL_LONG(EX_VAR(opline->result.var), ZSTR_LEN(str));
zval_ptr_dtor(&tmp);
break;
zend_string *str;
zval tmp;
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_NULL)) {
+ zend_error(E_DEPRECATED,
+ "strlen(): Passing null to parameter #1 ($string) of type string is deprecated");
+ if (UNEXPECTED(EG(exception))) {
+ HANDLE_EXCEPTION();
+ }
+ ZVAL_LONG(EX_VAR(opline->result.var), 0);
+ break;
+ }
+
ZVAL_COPY(&tmp, value);
- if (zend_parse_arg_str_weak(&tmp, &str)) {
+ if (zend_parse_arg_str_weak(&tmp, &str, 1)) {
ZVAL_LONG(EX_VAR(opline->result.var), ZSTR_LEN(str));
zval_ptr_dtor(&tmp);
break;
}
?>
---EXPECT--
+--EXPECTF--
+Deprecated: DatePeriod::__construct(): Passing null to parameter #1 ($start) of type string is deprecated in %s on line %d
string(51) "DatePeriod::__construct(): Unknown or bad format ()"
$d= $e->diff($s);
var_dump($d->days); // 0 ... but should be 30
-$s = (new DateTime(null))->setTimestamp(strtotime($ss)); // verbose setup method
-$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method
+$s = (new DateTime("now"))->setTimestamp(strtotime($ss)); // verbose setup method
+$e = (new DateTime("now"))->setTimestamp(strtotime($es)); // verbose setup method
$d = $e->diff($s);
var_dump($d->days); // 30 ... and should be 30
Next we will try mix/match the code to see what happens, surprisingly it seems that the end date ($e)
is the important one, if it uses the verbose method it returns the correct values.
*/
-$s = (new DateTime(null))->setTimestamp(strtotime($ss)); // verbose setup method
+$s = (new DateTime("now"))->setTimestamp(strtotime($ss)); // verbose setup method
$e = new DateTime($es);
$d= $e->diff($s);
var_dump($d->days); // 0 ... but should be 30
$s = new DateTime($ss);
-$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method
+$e = (new DateTime("now"))->setTimestamp(strtotime($es)); // verbose setup method
$d= $e->diff($s);
var_dump($d->days); // 30 ... and should be 30
on, that's just coincidental that seems to imply that the "- 1 second" in the date string is the problem.
*/
$s = new DateTime($ss);
-$e = (new DateTime(null))->setTimestamp(strtotime($es)); // verbose setup method
+$e = (new DateTime("now"))->setTimestamp(strtotime($es)); // verbose setup method
$d= $s->diff($e);
var_dump($d->days); // 30 ... and should be 30
var_dump($i);
?>
--EXPECTF--
+Deprecated: date_interval_create_from_date_string(): Passing null to parameter #1 ($datetime) of type string is deprecated in %s on line %d
+
Warning: date_interval_create_from_date_string(): Unknown or bad format () at position 0 ( ): Empty string in %sdate_interval_create_from_date_string_nullparam.php on line 2
bool(false)
var_dump(date_timestamp_set($dtms021, null));
?>
---EXPECT--
+--EXPECTF--
+Deprecated: date_timestamp_set(): Passing null to parameter #2 ($timestamp) of type int is deprecated in %s on line %d
object(DateTime)#1 (3) {
["date"]=>
string(26) "1970-01-01 00:00:00.000000"
+++ /dev/null
---TEST--
-Test wrong number of arguments for microtime()
---FILE--
-<?php
-/*
- * Function is implemented in ext/standard/microtime.c
-*/
-
-echo "\n-- Bad Arg types --\n";
-
-$bad_args = array(null,
- 1.5,
- "hello",
- array('k'=>'v', array(0)),
- new stdClass,
- 1);
-foreach ($bad_args as $bad_arg) {
- echo "\n--> bad arg: ";
- var_dump($bad_arg);
- try {
- var_dump(microtime($bad_arg));
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
-}
-
-?>
---EXPECTF--
--- Bad Arg types --
-
---> bad arg: NULL
-string(%d) "%s %s"
-
---> bad arg: float(1.5)
-float(%s)
-
---> bad arg: string(5) "hello"
-float(%s)
-
---> bad arg: array(2) {
- ["k"]=>
- string(1) "v"
- [0]=>
- array(1) {
- [0]=>
- int(0)
- }
-}
-microtime(): Argument #1 ($as_float) must be of type bool, array given
-
---> bad arg: object(stdClass)#%d (0) {
-}
-microtime(): Argument #1 ($as_float) must be of type bool, stdClass given
-
---> bad arg: int(1)
-float(%s)
echo "Test 2\n";
-check(dba_handlers(null));
+check(dba_handlers(false));
echo "Test 3\n";
?>
--FILE--
<?php
-$filename = null;
+$filename = '';
$doc = new DOMDocument('1.0');
$root = $doc->createElement('html');
$root = $doc->appendChild($root);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
-try {
- var_dump(finfo_file($fp, NULL));
-} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
-}
var_dump(finfo_file($fp, '.'));
var_dump(finfo_file($fp, '&'));
--EXPECTF--
finfo_file(): Argument #1 ($finfo) must not contain any null bytes
finfo_file(): Argument #1 ($finfo) cannot be empty
-finfo_file(): Argument #1 ($finfo) cannot be empty
string(9) "directory"
Warning: finfo_file(&): Failed to open stream: No such file or directory in %s on line %d
--FILE--
<?php
$values = Array(
- array("01-23-45-67-89-ab", null),
+ array("01-23-45-67-89-ab", 0),
array("01-23-45-67-89-ab", array("options" => array("separator" => "-"))),
array("01-23-45-67-89-ab", array("options" => array("separator" => "."))),
array("01-23-45-67-89-ab", array("options" => array("separator" => ":"))),
- array("01-23-45-67-89-AB", null),
- array("01-23-45-67-89-aB", null),
- array("01:23:45:67:89:ab", null),
- array("01:23:45:67:89:AB", null),
- array("01:23:45:67:89:aB", null),
- array("01:23:45-67:89:aB", null),
- array("xx:23:45:67:89:aB", null),
- array("0123.4567.89ab", null),
+ array("01-23-45-67-89-AB", 0),
+ array("01-23-45-67-89-aB", 0),
+ array("01:23:45:67:89:ab", 0),
+ array("01:23:45:67:89:AB", 0),
+ array("01:23:45:67:89:aB", 0),
+ array("01:23:45-67:89:aB", 0),
+ array("xx:23:45:67:89:aB", 0),
+ array("0123.4567.89ab", 0),
array("01-23-45-67-89-ab", array("options" => array("separator" => "--"))),
array("01-23-45-67-89-ab", array("options" => array("separator" => ""))),
);
}
?>
--EXPECTF--
+Deprecated: filter_input_array(): Passing null to parameter #2 ($options) of type array|int is deprecated in %s on line %d
+
Warning: filter_input_array(): Unknown filter with ID 0 in %s on line %d
bool(false)
+Deprecated: filter_var_array(): Passing null to parameter #2 ($options) of type array|int is deprecated in %s on line %d
+
Warning: filter_var_array(): Unknown filter with ID 0 in %s on line %d
bool(false)
$image = imagecreatetruecolor(50, 50);
trycatch_dump(
- fn() => imagetruecolortopalette($image, true, null)
+ fn() => imagetruecolortopalette($image, true, 0)
);
?>
}
default: {
zend_long lval;
- if (!zend_parse_arg_long_slow(val, &lval)) {
+ if (!zend_parse_arg_long_slow(val, &lval, arg_pos)) {
zend_argument_type_error(arg_pos, "must be of type GMP|string|int, %s given", zend_zval_type_name(val));
return FAILURE;
}
?>
---EXPECT--
+--EXPECTF--
*** Testing hash_init(): error conditions ***
-- Testing hash_init() function with unknown algorithms --
-- Testing hash_init() function with HASH_HMAC and no key --
hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested
+
+Deprecated: hash_init(): Passing null to parameter #3 ($key) of type string is deprecated in %s on line %d
hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested
--FILE--
<?php
$a = str_repeat("/", 9000000);
-var_dump(iconv_mime_decode("a", null, $a));
+var_dump(iconv_mime_decode("a", 0, $a));
?>
--EXPECTF--
Warning: iconv_mime_decode(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
--FILE--
<?php
$a = str_repeat("/", 9000000);
-var_dump(iconv_mime_decode_headers("a", null, $a));
+var_dump(iconv_mime_decode_headers("a", 0, $a));
?>
--EXPECTF--
Warning: iconv_mime_decode_headers(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d
$address = 'John Doe <john@example.com>';
var_dump($address);
-imap_rfc822_parse_adrlist($address, null);
+imap_rfc822_parse_adrlist($address, '');
var_dump($address);
?>
}
?>
---EXPECT--
+--EXPECTF--
NumberFormatter::format(): Argument #1 ($num) must be of type int|float, string given
string(1) "1"
+
+Deprecated: NumberFormatter::format(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
string(1) "0"
NumberFormatter::format(): Argument #1 ($num) must be of type int|float, NumberFormatter given
<?php
$var1=str_repeat("A", 1000);
$out = locale_get_primary_language($var1);
-echo strlen($out) . PHP_EOL;
-echo unpack('H*', $out)[1] . PHP_EOL;
+var_dump($out);
?>
--EXPECT--
-0
+NULL
array( 'ab' , 'b' ),
array( 'ab' , 'a' ),
array( 123 , 'abc' ),
- array( 'ac' , null ),
+ array( 'ac' , '' ),
array( '.' , '.' ),
// Try to compare long strings.
array( 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcde',
'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdea'),
- array( null , null )
);
$res_str .= compare_pairs( 'en_US', $test_params );
array( 'а', 'b' ),
array( 'а', 'bb' ),
array( 'а', 'ab' ),
- array( 'а', null )
+ array( 'а', '' )
);
$res_str .= compare_pairs( 'ru_RU', $test_params );
'ab' < 'b'
'ab' > 'a'
123 < 'abc'
-'ac' > NULL
+'ac' > ''
'.' = '.'
'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcde' < 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdea'
-NULL = NULL
'а' < 'б'
'а' < 'аа'
'аб' < 'ба'
'а' < 'b'
'а' < 'bb'
'а' < 'ab'
-'а' > NULL
+'а' > ''
'y' < 'k'
$test_params = array(
'abc', 'abd', 'aaa',
'аа', 'а', 'z',
- '', null , '3',
+ '', '3',
'y' , 'i' , 'k'
);
key: 5c01050105
source:
key: 0101
-source:
-key: 0101
source: 3
key: 1901050105
source: y
Error: NumberFormatter object is already constructed in %s on line %d
'U_ZERO_ERROR'
+Deprecated: NumberFormatter::__construct(): Passing null to parameter #1 ($locale) of type string is deprecated in %s on line %d
+
+Deprecated: NumberFormatter::__construct(): Passing null to parameter #2 ($style) of type int is deprecated in %s on line %d
+
+Deprecated: NumberFormatter::create(): Passing null to parameter #1 ($locale) of type string is deprecated in %s on line %d
+
+Deprecated: NumberFormatter::create(): Passing null to parameter #2 ($style) of type int is deprecated in %s on line %d
+
+Deprecated: numfmt_create(): Passing null to parameter #1 ($locale) of type string is deprecated in %s on line %d
+
+Deprecated: numfmt_create(): Passing null to parameter #2 ($style) of type int is deprecated in %s 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'
echo $e->getMessage(), "\n";
}
try {
- var_dump(new IntlGregorianCalendar(1,2,3,4,NULL,array()));
+ var_dump(new IntlGregorianCalendar(1,2,3,4,5,array()));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
date_default_timezone_set('Europe/Amsterdam');
-$intlcal = intlgregcal_create_instance(2012, 1, 29, 16, 0, NULL);
+$intlcal = intlgregcal_create_instance(2012, 1, 29, 16, 0, 0);
var_dump($intlcal->getTimeZone()->getId());
var_dump($intlcal->getTime(), (float)strtotime('2012-02-29 16:00:00') * 1000);
ArgumentCountError: MessageFormatter::create() expects exactly 2 arguments, 1 given in %s on line %d
'U_ZERO_ERROR'
+Deprecated: MessageFormatter::__construct(): Passing null to parameter #1 ($locale) of type string is deprecated in %s on line %d
+
+Deprecated: MessageFormatter::__construct(): Passing null to parameter #2 ($pattern) of type string is deprecated in %s on line %d
+
IntlException: msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR in %s on line %d
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+
+Deprecated: MessageFormatter::create(): Passing null to parameter #1 ($locale) of type string is deprecated in %s on line %d
+
+Deprecated: MessageFormatter::create(): Passing null to parameter #2 ($pattern) of type string is deprecated in %s on line %d
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+
+Deprecated: msgfmt_create(): Passing null to parameter #1 ($locale) of type string is deprecated in %s on line %d
+
+Deprecated: msgfmt_create(): Passing null to parameter #2 ($pattern) of type string is deprecated in %s on line %d
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
IntlException: msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR in %s on line %d
return numfmt_create( $locale, $style, $pattern );
}
}
-function ut_nfmt_format( $fmt, $number, $type = null )
+function ut_nfmt_format( $fmt, $number, $type = NumberFormatter::TYPE_DEFAULT )
{
return $GLOBALS['oo-mode'] ? $fmt->format( $number, $type ) : numfmt_format( $fmt, $number, $type );
}
NULL
NULL
NULL
+
+Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in %s on line %d
NULL
object(stdClass)#%d (1) {
["test"]=>
Bug #69187 json_last_error return BC in PHP7
--FILE--
<?php
-var_dump(json_decode(NULL));
-var_dump(json_last_error());
var_dump(json_decode(FALSE));
var_dump(json_last_error());
var_dump(json_decode(""));
int(4)
NULL
int(4)
-NULL
-int(4)
int(0)
int(0)
int(1)
--FILE--
<?php
-$result = json_encode(['end' => json_decode(null, true)]);
+$result = json_encode(['end' => json_decode('', true)]);
var_dump($result);
class A implements \JsonSerializable
{
function jsonSerialize()
{
- return ['end' => json_decode(null, true)];
+ return ['end' => json_decode('', true)];
}
}
$a = new A();
<?php
$subject = " Joe,= \rSmith ";
-var_dump(ldap_escape($subject, null, LDAP_ESCAPE_DN));
+var_dump(ldap_escape($subject, '', LDAP_ESCAPE_DN));
?>
--EXPECT--
string(24) "\20Joe\2c\3d \0dSmith\20"
/* We are assuming 3333 is not connectable */
$ldap = ldap_connect('127.0.0.1', 3333);
-ldap_mod_replace($ldap, null, array(
+ldap_mod_replace($ldap, '', array(
'lockoutTime' => array(0),
));
-ldap_modify_batch($ldap, null, array( [
+ldap_modify_batch($ldap, '', array( [
"attrib" => "mail",
"modtype" => LDAP_MODIFY_BATCH_ADD,
"values" => [
$subject = 'foo=bar(baz)*';
-var_dump(ldap_escape($subject, null, LDAP_ESCAPE_DN | LDAP_ESCAPE_FILTER));
+var_dump(ldap_escape($subject, '', LDAP_ESCAPE_DN | LDAP_ESCAPE_FILTER));
?>
--EXPECT--
$subject = 'foo=bar(baz)*';
-var_dump(ldap_escape($subject, null, LDAP_ESCAPE_DN));
+var_dump(ldap_escape($subject, '', LDAP_ESCAPE_DN));
?>
--EXPECT--
$subject = 'foo=bar(baz)*';
-var_dump(ldap_escape($subject, null, LDAP_ESCAPE_FILTER));
+var_dump(ldap_escape($subject, '', LDAP_ESCAPE_FILTER));
?>
--EXPECT--
<?php
$array = [123, 456, 789];
try {
- ldap_read(null, null, null, $array);
+ ldap_read(null, '', '', $array);
} catch (TypeError $err) {}
var_dump($array);
?>
insert_dummy_data($link, $base);
var_dump(
- $result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER),
+ $result = ldap_search($link, "$base", "(objectClass=person)", array(), 0, 111, 22, LDAP_DEREF_NEVER),
ldap_get_entries($link, $result)
);
var_dump(
* pattern is supplied to mb_ereg. Similar error message to ereg().
*/
-$unset_var = 10;
-unset ($unset_var);
-$inputs = array(NULL, null, false, FALSE, "", '', @$undefined_var,
-@$unset_var);
+$inputs = array(false, FALSE, "", '');
$iterator = 1;
foreach($inputs as $input) {
With $regs arg:
mb_ereg(): Argument #1 ($pattern) must not be empty
NULL
-
--- Iteration 5 --
-Without $regs arg:
-mb_ereg(): Argument #1 ($pattern) must not be empty
-With $regs arg:
-mb_ereg(): Argument #1 ($pattern) must not be empty
-NULL
-
--- Iteration 6 --
-Without $regs arg:
-mb_ereg(): Argument #1 ($pattern) must not be empty
-With $regs arg:
-mb_ereg(): Argument #1 ($pattern) must not be empty
-NULL
-
--- Iteration 7 --
-Without $regs arg:
-mb_ereg(): Argument #1 ($pattern) must not be empty
-With $regs arg:
-mb_ereg(): Argument #1 ($pattern) must not be empty
-NULL
-
--- Iteration 8 --
-Without $regs arg:
-mb_ereg(): Argument #1 ($pattern) must not be empty
-With $regs arg:
-mb_ereg(): Argument #1 ($pattern) must not be empty
-NULL
<?php
$var0 = "e";
$var2 = "";
-$var3 = NULL;
+$var3 = "";
try {
$var8 = mb_ereg_replace($var2,$var3,$var3,$var0);
var_dump($var8);
<?php
var_dump(mb_ereg_search_init(NULL));
?>
---EXPECT--
+--EXPECTF--
+Deprecated: mb_ereg_search_init(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
bool(true)
$string = 'string_val';
$option = '';
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
// get a class
class classA
{
12.3456789000E-10,
.5,
- // null data
-/*10*/ NULL,
- null,
-
// boolean data
/*12*/ true,
false,
// object data
/*21*/ new classA(),
- // undefined data
-/*22*/ @$undefined_var,
-
- // unset data
-/*23*/ @$unset_var,
-
);
// loop through each element of the array for pattern
string(10) "string_val"
-- Iteration 10 --
-string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
+string(10) "string_val"
-- Iteration 11 --
string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 14 --
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 15 --
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"
+string(10) "string_val"
-- Iteration 17 --
-string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
+string(10) "string_val"
-- Iteration 18 --
string(10) "string_val"
-- Iteration 19 --
string(10) "string_val"
-
--- Iteration 20 --
-string(10) "string_val"
-
--- Iteration 21 --
-string(10) "string_val"
-
--- Iteration 22 --
-string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-
--- Iteration 23 --
-string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
Done
--TEST--
-Optional long parameter might be null
+Optional long parameter might be null (deprecated)
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
echo mb_strcut('foobarbaz', 6, null, 'UTF-8') . "\n";
echo mb_strimwidth('foobar', 0, 3, null, 'UTF-8') . "\n";
?>
---EXPECT--
+--EXPECTF--
+Deprecated: mb_strpos(): Passing null to parameter #3 ($offset) of type int is deprecated in %s on line %d
1
+
+Deprecated: mb_strrpos(): Passing null to parameter #3 ($offset) of type int is deprecated in %s on line %d
2
+
+Deprecated: mb_stripos(): Passing null to parameter #3 ($offset) of type int is deprecated in %s on line %d
1
+
+Deprecated: mb_strripos(): Passing null to parameter #3 ($offset) of type int is deprecated in %s on line %d
2
+
+Deprecated: mb_strstr(): Passing null to parameter #3 ($before_needle) of type bool is deprecated in %s on line %d
barbaz
+
+Deprecated: mb_strrchr(): Passing null to parameter #3 ($before_needle) of type bool is deprecated in %s on line %d
baz
+
+Deprecated: mb_stristr(): Passing null to parameter #3 ($before_needle) of type bool is deprecated in %s on line %d
barbaz
+
+Deprecated: mb_strrichr(): Passing null to parameter #3 ($before_needle) of type bool is deprecated in %s on line %d
baz
baz
baz
+
+Deprecated: mb_strimwidth(): Passing null to parameter #4 ($trim_marker) of type string is deprecated in %s on line %d
foo
public function connect() {
require_once("connect.inc");
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /* Pass false as $connect_flags cannot be accessed via globals. */
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, false);
var_dump($link);
$link = mysqli_init();
var_dump($link);
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket, false);
$mysql->query("DROP TABLE IF EXISTS test_warnings");
$mysql->query("CREATE TABLE test_warnings (a int not null)");
$mysql->query("SET sql_mode=''");
<?php
error_reporting(E_ALL);
$tablica = array();
-$test1 = mysqli_poll($test2, $test3, $tablica, null);
+$test1 = mysqli_poll($test2, $test3, $tablica, 0);
$test2 = array();
$test2 = array();
-$test1 = mysqli_poll($test2, $test3, $tablica, null);
+$test1 = mysqli_poll($test2, $test3, $tablica, 0);
echo "okey";
?>
--EXPECTF--
require('table.inc');
- // Zend will cast the NULL to 0
try {
- mysqli_kill($link, null);
+ mysqli_kill($link, 0);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
printf("[004] It is very unlikely that SHOW ENGINES returns no data, check manually\n");
} else {
$found = false;
- foreach ($engines as $k => $engine)
- foreach ($engine as $k => $v)
- if (stristr($v, 'MyISAM')) {
- $found = true;
- break;
- }
+ foreach ($engines as $engine) {
+ if (stristr($engine[0], 'MyISAM')) {
+ $found = true;
+ break;
+ }
+ }
if (!$found)
printf("[005] It is very unlikely that SHOW ENGINES does not show MyISAM, check manually\n");
}
--EXPECTF--
resource(%d) of type (odbc result)
bool(false)
+
+Deprecated: odbc_columnprivileges(): Passing null to parameter #3 ($schema) of type string is deprecated in %s on line %d
+
+Deprecated: odbc_columnprivileges(): Passing null to parameter #4 ($table) of type string is deprecated in %s on line %d
+
+Deprecated: odbc_columnprivileges(): Passing null to parameter #5 ($column) of type string is deprecated in %s on line %d
resource(%d) of type (odbc result)
bool(false)
resource(%d) of type (odbc result)
// no IV
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- NULL, $test['tag'], $test['aad']));
+ '', $test['tag'], $test['aad']));
// failed because no AAD
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
$test['iv'], $test['tag']));
// no IV
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- NULL, $test['tag'], $test['aad']));
+ '', $test['tag'], $test['aad']));
// failed because no AAD
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
$test['iv'], $test['tag']));
// no IV
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- NULL, $test['tag'], $test['aad']));
+ '', $test['tag'], $test['aad']));
// IV too long
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
}
// Empty IV error
-var_dump(openssl_encrypt('data', $method, 'password', 0, NULL, $tag, ''));
+var_dump(openssl_encrypt('data', $method, 'password', 0, '', $tag, ''));
// Test setting different IV length and tag length
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 10), $tag, '', 14));
}
// Empty IV error
-var_dump(openssl_encrypt('data', $method, 'password', 0, NULL, $tag, ''));
+var_dump(openssl_encrypt('data', $method, 'password', 0, '', $tag, ''));
// Failing to retrieve tag (max is 16 bytes)
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 32), $tag, '', 20));
}
// Empty IV error
-var_dump(openssl_encrypt('data', $method, 'password', 0, NULL, $tag, ''));
+var_dump(openssl_encrypt('data', $method, 'password', 0, '', $tag, ''));
// Failing to retrieve tag (must be at most 16 bytes)
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 12), $tag, '', 20));
var_dump(strcmp($output, $a));
var_dump(strcmp($output, $output2));
-var_dump(strcmp($output, $output3));
-var_dump(strcmp($output, $output4)); // different
-var_dump(strcmp($output, $output5)); // different
+var_dump(strcmp($output, $output4));
+var_dump($output3);
+var_dump($output5);
?>
--EXPECTF--
bool(true)
int(0)
int(0)
int(%d)
-int(0)
-int(%d)
+NULL
+NULL
var_dump($db->getAttribute(PDO::ATTR_DEFAULT_STR_PARAM) === PDO::PARAM_STR_NATL);
?>
---EXPECT--
+--EXPECTF--
string(3) "'1'"
string(2) "''"
string(4) "'42'"
+
+Deprecated: PDO::quote(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
string(2) "''"
string(4) "''''"
string(5) "'foo'"
--FILE--
<?php
$phar = __DIR__ . '/files/stuboflength1041.phar';
-foreach (new RecursiveIteratorIterator(new Phar($phar, null, 'stuboflength1041.phar')) as $item) {
+foreach (new RecursiveIteratorIterator(new Phar($phar, alias: 'stuboflength1041.phar')) as $item) {
var_dump($item->getFileName());
}
?>
$sFile = tempnam(__DIR__, 'test77022');
var_dump(decoct(stat($sFile)['mode']));
-foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $mode => $ext) {
+foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $format => $ext) {
clearstatcache();
- $phar = new PharData(__DIR__ . '/test77022.' . $ext, null, null, $mode);
+ $phar = new PharData(__DIR__ . '/test77022.' . $ext, format: $format);
$phar->addFile($sFile, 'test-file-phar');
$phar->addFromString("test-from-string", 'test-file-phar');
$phar->extractTo(__DIR__);
string(6) "100600"
string(6) "100644"
string(6) "100600"
-string(6) "100644"
\ No newline at end of file
+string(6) "100644"
chmod(__DIR__ . '/test79082/test79082-testfile', 0644);
chmod(__DIR__ . '/test79082/test79082-testfile2', 0400);
-foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $mode => $ext) {
+foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $format => $ext) {
clearstatcache();
- $phar = new PharData(__DIR__ . '/test79082.' . $ext, null, null, $mode);
+ $phar = new PharData(__DIR__ . '/test79082.' . $ext, format: $format);
$phar->buildFromIterator(new \RecursiveDirectoryIterator(__DIR__ . '/test79082', \FilesystemIterator::SKIP_DOTS), __DIR__ . '/test79082');
$phar->extractTo(__DIR__);
var_dump(decoct(stat(__DIR__ . '/test79082-testfile')['mode']));
unlink(__DIR__ . '/test79082-testfile');
unlink(__DIR__ . '/test79082-testfile2');
}
-foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $mode => $ext) {
+foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $format => $ext) {
clearstatcache();
- $phar = new PharData(__DIR__ . '/test79082-d.' . $ext, null, null, $mode);
+ $phar = new PharData(__DIR__ . '/test79082-d.' . $ext, format: $format);
$phar->buildFromDirectory(__DIR__ . '/test79082');
$phar->extractTo(__DIR__);
var_dump(decoct(stat(__DIR__ . '/test79082-testfile')['mode']));
if (empty($ulen)) $ulen = strlen($cont);
if (empty($clen)) $clen = strlen($comp);
if (empty($crc32))$crc32= crc32((binary)$cont);
- if (isset($meta)) $meta = serialize($meta);
+ $meta = isset($meta) ? serialize($meta) : "";
// write manifest entry
$manifest .= pack('V', strlen($name)) . (binary)$name;
--FILE--
<?php
-var_dump(posix_initgroups(NULL, NULL));
+var_dump(posix_initgroups('', 0));
?>
--EXPECT--
--FILE--
<?php
-var_dump(posix_mknod(NULL, NULL, NULL, NULL));
+var_dump(posix_mknod('', 0, 0, 0));
?>
--EXPECT--
+++ /dev/null
---TEST--
-posix_mknod(): Basic tests
---SKIPIF--
-<?php
-if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
-if (!function_exists('posix_mknod')) die('skip posix_mknod() not found');
-?>
---FILE--
-<?php
-echo "Basic test of POSIX posix_mknod function\n";
-var_dump(posix_mknod(NULL, NULL, NULL, NULL));
-
-?>
-===DONE====
---EXPECT--
-Basic test of POSIX posix_mknod function
-bool(false)
-===DONE====
$p = pspell_new_config($cfg);
var_dump(pspell_check($p, 'theoasis'));
-var_dump(pspell_config_runtogether($cfg, NULL))
-
?>
--EXPECT--
bool(true)
---
bool(true)
bool(true)
-bool(true)
readline_add_history('foo');
readline_add_history('');
readline_add_history(1);
-readline_add_history(NULL);
readline_write_history($name);
var_dump(file_get_contents($name));
readline_add_history('foo');
readline_add_history('');
readline_add_history(1);
-readline_add_history(NULL);
readline_write_history($name);
var_dump(file_get_contents($name));
?>
--EXPECT--
-string(21) "_HiStOrY_V2_
+string(20) "_HiStOrY_V2_
foo
1
-
"
var_dump(readline_add_history('foo'));
var_dump(readline_list_history());
-var_dump(readline_add_history(NULL));
+var_dump(readline_add_history(''));
var_dump(readline_list_history());
var_dump(readline_clear_history());
readline_add_history('foo');
readline_add_history('');
readline_add_history(1);
-readline_add_history(NULL);
readline_write_history($name);
var_dump(file_get_contents($name));
?>
--EXPECT--
-string(8) "foo
+string(7) "foo
1
-
"
}
?>
---EXPECT--
+--EXPECTF--
ReflectionClass::__construct() expects exactly 1 argument, 0 given
+
+Deprecated: ReflectionClass::__construct(): Passing null to parameter #1 ($objectOrClass) of type object|string is deprecated in %s on line %d
Class "" does not exist
Class "1" does not exist
Class "1" does not exist
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->getConstant(null));
var_dump($rc->getConstant(1));
var_dump($rc->getConstant(1.5));
var_dump($rc->getConstant(true));
bool(false)
bool(false)
bool(false)
-bool(false)
?>
---EXPECT--
+--EXPECTF--
Check invalid params:
ReflectionClass::getMethod() expects exactly 1 argument, 0 given
ReflectionClass::getMethod() expects exactly 1 argument, 2 given
+
+Deprecated: ReflectionClass::getMethod(): Passing null to parameter #1 ($name) of type string is deprecated in %s on line %d
Method C::() does not exist
Method C::1() does not exist
Method C::1.5() does not exist
echo $e->getMessage() . "\n";
}
?>
---EXPECT--
+--EXPECTF--
Check invalid params:
ReflectionClass::getProperty() expects exactly 1 argument, 0 given
ReflectionClass::getProperty() expects exactly 1 argument, 2 given
+
+Deprecated: ReflectionClass::getProperty(): Passing null to parameter #1 ($name) of type string is deprecated in %s on line %d
Property C::$ does not exist
Property C::$1 does not exist
Property C::$1.5 does not exist
?>
---EXPECT--
+--EXPECTF--
ReflectionClass::getStaticPropertyValue() expects at most 2 arguments, 3 given
ReflectionClass::getStaticPropertyValue() expects at least 1 argument, 0 given
+
+Deprecated: ReflectionClass::getStaticPropertyValue(): Passing null to parameter #1 ($name) of type string is deprecated in %s on line %d
Property C::$ does not exist
string(3) "def"
ReflectionClass::getStaticPropertyValue(): Argument #1 ($name) must be of type string, array given
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasConstant(null));
var_dump($rc->hasConstant(1));
var_dump($rc->hasConstant(1.5));
var_dump($rc->hasConstant(true));
bool(false)
bool(false)
bool(false)
-bool(false)
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasMethod(null));
var_dump($rc->hasMethod(1));
var_dump($rc->hasMethod(1.5));
var_dump($rc->hasMethod(true));
bool(false)
bool(false)
bool(false)
-bool(false)
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasProperty(null));
var_dump($rc->hasProperty(1));
var_dump($rc->hasProperty(1.5));
var_dump($rc->hasProperty(true));
bool(false)
bool(false)
bool(false)
-bool(false)
echo $e->getMessage() . "\n";
}
?>
---EXPECT--
+--EXPECTF--
Does A implement A?
- Using object argument: A is not an interface
- Using string argument: A is not an interface
Test bad arguments:
ReflectionClass::implementsInterface() expects exactly 1 argument, 0 given
ReflectionClass::implementsInterface() expects exactly 1 argument, 2 given
+
+Deprecated: ReflectionClass::implementsInterface(): Passing null to parameter #1 ($interface) of type ReflectionClass|string is deprecated in %s on line %d
Interface "" does not exist
Interface "ThisClassDoesNotExist" does not exist
Interface "2" does not exist
echo $e->getMessage() . "\n";
}
?>
---EXPECT--
+--EXPECTF--
Test bad arguments:
ReflectionClass::isSubclassOf() expects exactly 1 argument, 0 given
ReflectionClass::isSubclassOf() expects exactly 1 argument, 2 given
+
+Deprecated: ReflectionClass::isSubclassOf(): Passing null to parameter #1 ($class) of type ReflectionClass|string is deprecated in %s on line %d
Class "" does not exist
Class "ThisClassDoesNotExist" does not exist
Class "2" does not exist
?>
---EXPECT--
+--EXPECTF--
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 3 given
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 0 given
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 1 given
+
+Deprecated: ReflectionClass::setStaticPropertyValue(): Passing null to parameter #1 ($name) of type string is deprecated in %s on line %d
Class C does not have a property named
Class C does not have a property named 1.5
ReflectionClass::setStaticPropertyValue(): Argument #1 ($name) must be of type string, array given
echo $e->getMessage() . "\n";
}
?>
---EXPECT--
+--EXPECTF--
Test bad arguments:
ReflectionClass::isSubclassOf() expects exactly 1 argument, 0 given
ReflectionClass::isSubclassOf() expects exactly 1 argument, 2 given
+
+Deprecated: ReflectionClass::isSubclassOf(): Passing null to parameter #1 ($class) of type ReflectionClass|string is deprecated in %s on line %d
Class "" does not exist
Class "ThisClassDoesNotExist" does not exist
Class "2" does not exist
$sh->open($savePath, $sessionName);
$sh->write("foo", "bar");
-var_dump($sh->read(@$id));
+var_dump($sh->read(""));
?>
--EXPECTF--
Warning: SessionHandler::open(): Session is not active in %s on line 10
}
// Warning outputs: Unable to attach or create shared memory segment
-var_dump(shmop_open(null, 'a', 0644, 1024));
+var_dump(shmop_open(0, 'a', 0644, 1024));
// Shared memory segment size must be greater than zero
try {
- shmop_open(null, 'a', 0644, 1024);
+ shmop_open(0, 'a', 0644, 1024);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
--FILE--
<?php
-var_dump(socket_create_pair(AF_INET, null, null, $sockets));
+var_dump(socket_create_pair(AF_INET, 0, 0, $sockets));
try {
- var_dump(socket_create_pair(31337, null, null, $sockets));
+ var_dump(socket_create_pair(31337, 0, 0, $sockets));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
--FILE--
<?php
-var_dump(socket_create_pair(AF_INET, null, null, $sockets));
+var_dump(socket_create_pair(AF_INET, 0, 0, $sockets));
try {
- var_dump(socket_create_pair(31337, null, null, $sockets));
+ var_dump(socket_create_pair(31337, 0, 0, $sockets));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
$a = 'test';
sodium_memzero($a);
if ($a !== 'test') {
- echo strlen($a);
+ var_dump($a);
} else {
echo $a;
}
?>
--EXPECT--
-0
+NULL
+
bool(true)
bool(false)
string(22) "0000810102030405060708"
print_r( $array );
?>
---EXPECT--
+--EXPECTF--
+Deprecated: SplFixedArray::__construct(): Passing null to parameter #1 ($size) of type int is deprecated in %s on line %d
SplFixedArray Object
(
)
$fixed_array->setSize(null);
var_dump($fixed_array);
?>
---EXPECT--
+--EXPECTF--
+Deprecated: SplFixedArray::setSize(): Passing null to parameter #1 ($size) of type int is deprecated in %s on line %d
object(SplFixedArray)#1 (0) {
}
--TEST--
-Check that SplObjectStorage::unserialize doesn't throws exception when NULL passed
+Check that SplObjectStorage::unserialize doesn't throws exception when empty string passed
--CREDITS--
PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
--FILE--
$s = new SplObjectStorage();
try {
- $s->unserialize(NULL);
+ $s->unserialize('');
} catch(UnexpectedValueException $e) {
echo $e->getMessage();
}
$x = new splfileinfo(__FILE__);
try {
- $x->openFile(NULL, NULL, []);
+ $x->openFile("", false, []);
} catch (TypeError $e) { }
var_dump($x->getPathName());
var_dump($ai2->key());
/* testing RecursiveArrayIterator */
-$ao3 = new ArrayObject(array(), NULL, 'RecursiveArrayIterator');
+$ao3 = new ArrayObject(array(), 0, 'RecursiveArrayIterator');
$ai3 = $ao3->getIterator();
var_dump($ai3->getChildren());
-$ao4 = new ArrayObject(array(1, 2), NULL, 'RecursiveArrayIterator');
+$ao4 = new ArrayObject(array(1, 2), 0, 'RecursiveArrayIterator');
$ai4 = $ao4->getIterator();
$ai4->next();
// Cache
$it = new ArrayIterator();
$it2 = new CachingIterator($it, CachingIterator::FULL_CACHE);
-$it2[] = $it2;
+$it2['x'] = $it2;
$it2->next();
// Recursive cache
$it = new RecursiveArrayIterator();
$it2 = new RecursiveCachingIterator($it, CachingIterator::FULL_CACHE);
-$it2[] = $it2;
+$it2['x'] = $it2;
$it2->next();
// Append
$iter = new RecursiveIteratorIterator(
new RecursiveArrayIterator($nestedArraysAndStrings));
foreach($iter as $leaf){ $flat[] = $leaf; }
- return join(null, $flat);
+ return join('', $flat);
}
$noRefs = [[[['some']]],[' nested '],"items"];
+++ /dev/null
---TEST--
-SPL: FixedArray: Testing setSize() with NULL
---FILE--
-<?php
-
-$a = new SplFixedArray(100);
-
-$a->setSize(NULL);
-
-print "ok\n";
-
-?>
---EXPECT--
-ok
<?php
try {
- $a = new SplFixedArray(NULL);
+ $a = new SplFixedArray(0);
echo $a[0]++;
} catch (Exception $e) {
echo $e->getMessage();
NULL
===3===
NULL
+
+Deprecated: CachingIterator::offsetExists(): Passing null to parameter #1 ($key) of type string is deprecated in %s on line %d
bool(false)
+Deprecated: CachingIterator::offsetGet(): Passing null to parameter #1 ($key) of type string is deprecated in %s on line %d
+
Warning: Undefined array key "" in %s on line %d
NULL
===4===
int(1)
===3===
NULL
+
+Deprecated: CachingIterator::offsetExists(): Passing null to parameter #1 ($key) of type string is deprecated in %s on line %d
bool(false)
+Deprecated: CachingIterator::offsetGet(): Passing null to parameter #1 ($key) of type string is deprecated in %s on line %d
+
Warning: Undefined array key "" in %s on line %d
NULL
===4===
$array = array('foo', 'bar', 'baz');
$iterator = new ArrayIterator($array);
-$regexIterator = new RegexIterator($iterator, "/f/", null, RegexIterator::USE_KEY);
+$regexIterator = new RegexIterator($iterator, "/f/", RegexIterator::MATCH, RegexIterator::USE_KEY);
var_dump($regexIterator->getFlags() === RegexIterator::USE_KEY);
<?php
require_once(__DIR__ . '/new_db.inc');
var_dump($db->busyTimeout(0));
-var_dump($db->busyTimeout(null));
var_dump($db->busyTimeout(-1000));
var_dump($db->busyTimeout(1000));
$db->close();
bool(true)
bool(true)
bool(true)
-bool(true)
echo "*** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***\n";
-$input = array(0, 1, -1, 10, 100, 1000, null);
+$input = array(0, 1, -1, 10, 100, 1000);
// using built-in function 'is_int' as 'callback'
var_dump( array_filter($input, 'is_int') );
[5]=>
int(1000)
}
-array(7) {
+array(6) {
[0]=>
int(0)
[1]=>
int(100)
[5]=>
int(1000)
- [6]=>
- NULL
}
array_filter(): Argument #2 ($callback) must be a valid callback, function "echo" not found or invalid function name
array_filter(): Argument #2 ($callback) must be a valid callback, function "exit" not found or invalid function name
2,
TRUE,
FALSE,
- NULL,
];
foreach ($modes as $mode) {
count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE
int(0)
int(0)
-int(0)
}
}
?>
---EXPECT--
+--EXPECTF--
*** Testing error conditions ***
-- Testing ( (low < high) && (step = 0) ) --
-- Testing Invalid steps --
range(): Argument #3 ($step) must be of type int|float, string given
+
+Deprecated: range(): Passing null to parameter #3 ($step) of type int|float is deprecated in %s on line %d
range(): Argument #3 ($step) must not exceed the specified range
range(): Argument #3 ($step) must not exceed the specified range
range(): Argument #3 ($step) must be of type int|float, string given
echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n";
echo "\n*** testing file info ***";
-stat_fn(NULL);
stat_fn(false);
stat_fn('');
stat_fn(' ');
stat_fn('|');
-echo "\n*** testing touch ***";
-var_dump(touch(NULL));
+echo "\n*** testing touch ***\n";
var_dump(touch(false));
var_dump(touch(''));
-- File modification time is =>
-- inode change time is =>
--- File '' --
--- File access time is =>
--- File modification time is =>
--- inode change time is =>
-
-- File ' ' --
-- File access time is =>
Warning: fileatime(): stat failed for in %s on line %d
Warning: filectime(): stat failed for | in %s on line %d
-*** testing touch ***bool(false)
+*** testing touch ***
bool(false)
bool(false)
echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n";
echo "\n*** testing touch ***\n";
-$a = touch(NULL);
$b = touch(false);
$c = touch('');
$d = touch(' ');
var_dump($e);
echo "\n*** testing file info ***";
-stat_fn(NULL);
stat_fn(false);
stat_fn('');
stat_fn(' ');
*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***
*** testing touch ***
-bool(false)
+
+Warning: Undefined variable $a in %s on line %d
+NULL
bool(false)
bool(false)
bool(true)
-- File modification time is =>
-- inode change time is =>
--- File '' --
--- File access time is =>
--- File modification time is =>
--- inode change time is =>
-
-- File ' ' --
-- File access time is => %d
-- File modification time is => %d
/* paths with shortcut home dir char, with suffix variation */
array("C:\\temp\\bar"),
array("C:\\temp\\bar", ""),
- array("C:\\temp\\bar", NULL),
array("C:\\temp\\bar", ' '),
array("C:\\temp\\bar.tar", ".tar"),
array("C:\\temp\\bar.tar", "~"),
array("C:\\temp\\bar.tar\\", "~"),
array("C:\\temp\\bar.tar\\", ""),
- array("C:\\temp\\bar.tar", NULL),
array("C:\\temp\\bar.tar", ''),
array("C:\\temp\\bar.tar", " "),
array("\\bar.zip\\", "\\bar.zip\\"),
array(" ", " "),
array(' ', ' '),
- array(NULL, NULL),
/* path with spaces */
array(" "),
/* empty paths */
array(""),
array(''),
- array(NULL)
);
function check_basename( $path_arrays ) {
string(3) "bar"
--Iteration 5--
-string(3) "bar"
+string(7) "bar.tar"
--Iteration 6--
string(7) "bar.tar"
string(7) "bar.tar"
--Iteration 10--
-string(7) "bar.tar"
+string(4) "10.5"
--Iteration 11--
-string(7) "bar.tar"
+string(2) "10"
--Iteration 12--
string(4) "10.5"
string(2) "10"
--Iteration 14--
-string(4) "10.5"
+string(2) "10"
--Iteration 15--
-string(2) "10"
+string(4) "10.5"
--Iteration 16--
-string(2) "10"
+string(4) "10.5"
--Iteration 17--
-string(4) "10.5"
+string(6) "10.zip"
--Iteration 18--
-string(4) "10.5"
+string(1) "0"
--Iteration 19--
-string(6) "10.zip"
+string(1) "0"
--Iteration 20--
-string(1) "0"
+string(7) "bar.zip"
--Iteration 21--
-string(1) "0"
+string(7) "bar.zip"
--Iteration 22--
string(7) "bar.zip"
--Iteration 23--
-string(7) "bar.zip"
+string(1) " "
--Iteration 24--
-string(7) "bar.zip"
+string(1) " "
--Iteration 25--
string(1) " "
string(0) ""
--Iteration 28--
-string(1) " "
-
---Iteration 29--
-string(1) " "
-
---Iteration 30--
-string(0) ""
-
---Iteration 31--
-string(0) ""
-
---Iteration 32--
string(0) ""
Done
/* empty paths */
"",
'',
- NULL,
);
foreach ($file_paths as $file_path) {
string(1) " "
string(0) ""
string(0) ""
-string(0) ""
/* empty paths */
"",
'',
- NULL,
);
foreach ($file_paths as $file_path) {
string(1) " "
string(0) ""
string(0) ""
-string(0) ""
--FILE--
<?php
-$ini = parse_ini_string('ini="ini;raw"', null, INI_SCANNER_RAW);
+$ini = parse_ini_string('ini="ini;raw"', false, INI_SCANNER_RAW);
var_dump($ini['ini']);
-$ini = parse_ini_string('ini="ini;raw', null, INI_SCANNER_RAW);
+$ini = parse_ini_string('ini="ini;raw', false, INI_SCANNER_RAW);
var_dump($ini['ini']);
-$ini = parse_ini_string('ini=ini;raw', null, INI_SCANNER_RAW);
+$ini = parse_ini_string('ini=ini;raw', false, INI_SCANNER_RAW);
var_dump($ini['ini']);
-$ini = parse_ini_string('ini=ini"raw', null, INI_SCANNER_RAW);
+$ini = parse_ini_string('ini=ini"raw', false, INI_SCANNER_RAW);
var_dump($ini['ini']);
-$ini = parse_ini_string("ini=\r\niniraw", null, INI_SCANNER_RAW);
+$ini = parse_ini_string("ini=\r\niniraw", false, INI_SCANNER_RAW);
var_dump($ini['ini']);
?>
--EXPECT--
$tmp_empty_file = __FILE__ . ".tmp";
file_put_contents($tmp_empty_file, "");
-var_dump(file_get_contents($tmp_empty_file, NULL, NULL, NULL, 10));
+var_dump(file_get_contents($tmp_empty_file, false, NULL, 0, 10));
unlink($tmp_empty_file);
?>
--EXPECT--
--FILE--
<?php
try {
- chgrp("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", null);
+ chgrp("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", 0);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
?>
--FILE--
<?php
-chown("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", NULL);
+chown("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", 0);
echo "ALIVE\n";
?>
--EXPECTF--
echo $e->getMessage() . \PHP_EOL;
}
-echo 'fgetcsv() with delimiter as NULL' . \PHP_EOL;
+echo 'fgetcsv() with delimiter as empty string' . \PHP_EOL;
try {
- var_dump( fgetcsv($file_handle, $length, NULL, $enclosure) );
+ var_dump( fgetcsv($file_handle, $length, '', $enclosure) );
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
-echo 'fgetcsv() with enclosure as NULL' . \PHP_EOL;
+echo 'fgetcsv() with enclosure as empty string' . \PHP_EOL;
try {
- var_dump( fgetcsv($file_handle, $length, $delimiter, NULL) );
+ var_dump( fgetcsv($file_handle, $length, $delimiter, '') );
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
-echo 'fgetcsv() with delimiter & enclosure as NULL' . \PHP_EOL;
+echo 'fgetcsv() with delimiter & enclosure as empty string' . \PHP_EOL;
try {
- var_dump( fgetcsv($file_handle, $length, NULL, NULL) );
+ var_dump( fgetcsv($file_handle, $length, '', '') );
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
fgetcsv(): Argument #2 ($length) must be a greater than or equal to 0
fgetcsv(): Argument #2 ($length) must be a greater than or equal to 0
fgetcsv(): Argument #2 ($length) must be a greater than or equal to 0
-fgetcsv() with delimiter as NULL
+fgetcsv() with delimiter as empty string
fgetcsv(): Argument #3 ($separator) must be a single character
-fgetcsv() with enclosure as NULL
+fgetcsv() with enclosure as empty string
fgetcsv(): Argument #4 ($enclosure) must be a single character
-fgetcsv() with delimiter & enclosure as NULL
+fgetcsv() with delimiter & enclosure as empty string
fgetcsv(): Argument #3 ($separator) must be a single character
<?php
echo "*** Testing file_exists() : usage variations ***\n";
-var_dump(file_exists(NULL));
var_dump(file_exists(false));
var_dump(file_exists(''));
var_dump(file_exists(' '));
bool(false)
bool(false)
bool(false)
-bool(false)
Done
"-1" => -1,
"TRUE" => TRUE,
"FALSE" => FALSE,
- "NULL" => NULL,
"\"\"" => "",
"\" \"" => " ",
"\\0" => "\0",
-- Filename: FALSE --
ValueError: Path cannot be empty
--- Filename: NULL --
-ValueError: Path cannot be empty
-
-- Filename: "" --
ValueError: Path cannot be empty
-1,
TRUE,
FALSE,
- NULL,
"",
" ",
"\0",
-- Iteration 3 --
ValueError: Path cannot be empty
-- Iteration 4 --
-ValueError: Path cannot be empty
--- Iteration 5 --
Warning: file_get_contents( ): Failed to open stream: No such file or directory in %s on line %d
bool(false)
--- Iteration 6 --
+-- Iteration 5 --
ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes
--- Iteration 7 --
+-- Iteration 6 --
TypeError: file_get_contents(): Argument #1 ($filename) must be of type string, array given
--- Iteration 8 --
+-- Iteration 7 --
Warning: file_get_contents(/no/such/file/dir): Failed to open stream: No such file or directory in %s on line %d
bool(false)
--- Iteration 9 --
+-- Iteration 8 --
Warning: file_get_contents(php/php): Failed to open stream: No such file or directory in %s on line %d
bool(false)
$newpath = "";
set_include_path($newpath);
runtest();
-set_include_path(null);
+set_include_path("");
runtest();
set_include_path(";; ; ;c:\\rubbish");
runtest();
"-1" => -1,
"TRUE" => TRUE,
"FALSE" => FALSE,
- "NULL" => NULL,
"\"\"" => "",
"\" \"" => " ",
"\\0" => "\0",
-- Filename: FALSE --
ValueError: Path cannot be empty
--- Filename: NULL --
-ValueError: Path cannot be empty
-
-- Filename: "" --
ValueError: Path cannot be empty
-1,
TRUE,
FALSE,
- NULL,
"",
" ",
//this one also generates a java message rather than our own so we don't replicate php message
-- Iteration 3 --
ValueError: Path cannot be empty
-- Iteration 4 --
-ValueError: Path cannot be empty
--- Iteration 5 --
9 bytes written to: ' '
--- Iteration 6 --
+-- Iteration 5 --
ValueError: file_put_contents(): Argument #1 ($filename) must not contain any null bytes
--- Iteration 7 --
+-- Iteration 6 --
TypeError: file_put_contents(): Argument #1 ($filename) must be of type string, array given
--- Iteration 8 --
+-- Iteration 7 --
Warning: file_put_contents(%sdir): Failed to open stream: %s in %s on line %d
Failed to write data to: '%sir'
--- Iteration 9 --
+-- Iteration 8 --
Warning: file_put_contents(%sphp): Failed to open stream: %s in %s on line %d
Failed to write data to: '%sphp'
"",
TRUE,
FALSE,
- NULL,
/* scalars */
1234,
Warning: filegroup(): stat failed for 1 in %s on line %d
bool(false)
bool(false)
-bool(false)
Warning: filegroup(): stat failed for 1234 in %s on line %d
bool(false)
"",
TRUE,
FALSE,
- NULL,
/* scalars */
1234,
Warning: fileinode(): stat failed for 1 in %s on line %d
bool(false)
bool(false)
-bool(false)
Warning: fileinode(): stat failed for 1234 in %s on line %d
bool(false)
"",
TRUE,
FALSE,
- NULL,
/* scalars */
1234,
Warning: fileowner(): stat failed for 1 in %s on line %d
bool(false)
bool(false)
-bool(false)
Warning: fileowner(): stat failed for 1234 in %s on line %d
bool(false)
"",
TRUE,
FALSE,
- NULL,
/* scalars */
1234,
Warning: fileperms(): stat failed for 1 in %s on line %d
bool(false)
bool(false)
-bool(false)
Warning: fileperms(): stat failed for 1234 in %s on line %d
bool(false)
echo "*** Testing filesize(): usage variations ***\n";
/* null, false, "", " " */
-var_dump( filesize(NULL) );
var_dump( filesize(false) );
var_dump( filesize('') );
var_dump( filesize(' ') );
*** Testing filesize(): usage variations ***
bool(false)
bool(false)
-bool(false)
Warning: filesize(): stat failed for in %s on line %d
bool(false)
echo "*** Testing flock() fun with file and dir ***\n";
-$lock_file = preg_replace("~\.phpt?$~", null, __FILE__);
+$lock_file = preg_replace("~\.phpt?$~", '', __FILE__);
$file_handle = fopen($lock_file, "w");
var_dump(flock($file_handle, LOCK_SH|LOCK_NB));
fclose($file_handle);
unlink($lock_file);
-$lock_dir = sprintf("%s.dir", preg_replace("~\.phpt?$~", null, __FILE__));
+$lock_dir = sprintf("%s.dir", preg_replace("~\.phpt?$~", '', __FILE__));
mkdir($lock_dir);
$dir_handle = opendir($lock_dir);
0,
LOCK_NB,
FALSE,
- NULL,
array(1,2,3),
array(),
"string",
--- Iteration 2 ---
flock(): Argument #2 ($operation) must be one of LOCK_SH, LOCK_EX, or LOCK_UN
--- Iteration 3 ---
-flock(): Argument #2 ($operation) must be one of LOCK_SH, LOCK_EX, or LOCK_UN
+flock(): Argument #2 ($operation) must be of type int, array given
--- Iteration 4 ---
flock(): Argument #2 ($operation) must be of type int, array given
--- Iteration 5 ---
-flock(): Argument #2 ($operation) must be of type int, array given
+flock(): Argument #2 ($operation) must be of type int, string given
--- Iteration 6 ---
flock(): Argument #2 ($operation) must be of type int, string given
--- Iteration 7 ---
flock(): Argument #2 ($operation) must be of type int, string given
---- Iteration 8 ---
-flock(): Argument #2 ($operation) must be of type int, string given
flock(): supplied resource is not a valid stream resource
echo "*** Testing flock() fun with the various operation and
wouldblock values ***\n";
-$file = preg_replace("~\.phpt?$~", null, __FILE__);
+$file = preg_replace("~\.phpt?$~", '', __FILE__);
$fp = fopen($file, "w");
/* array of operations */
var_dump( fnmatch("string", "string") );
var_dump( fnmatch(TRUE, TRUE) );
var_dump( fnmatch(FALSE, FALSE) );
-var_dump( fnmatch(NULL, NULL) );
echo "\n*** Done ***\n";
?>
bool(true)
bool(true)
bool(true)
-bool(true)
*** Done ***
echo "\n--- With NULL ---\n";
$null_arr = array(
- NULL,
- null,
"",
"\0",
"string",
--- With NULL ---
-- Iteration 0 --
bool(true)
-bool(true)
-bool(true)
fnmatch(): Argument #2 ($filename) must not contain any null bytes
bool(false)
bool(false)
-- Iteration 1 --
-bool(true)
-bool(true)
-bool(true)
-fnmatch(): Argument #2 ($filename) must not contain any null bytes
-bool(false)
-bool(false)
--- Iteration 2 --
-bool(true)
-bool(true)
-bool(true)
-fnmatch(): Argument #2 ($filename) must not contain any null bytes
-bool(false)
-bool(false)
--- Iteration 3 --
-fnmatch(): Argument #1 ($pattern) must not contain any null bytes
fnmatch(): Argument #1 ($pattern) must not contain any null bytes
fnmatch(): Argument #1 ($pattern) must not contain any null bytes
fnmatch(): Argument #1 ($pattern) must not contain any null bytes
fnmatch(): Argument #1 ($pattern) must not contain any null bytes
-fnmatch(): Argument #1 ($pattern) must not contain any null bytes
--- Iteration 4 --
-bool(false)
-bool(false)
+-- Iteration 2 --
bool(false)
fnmatch(): Argument #2 ($filename) must not contain any null bytes
bool(true)
bool(false)
--- Iteration 5 --
-bool(false)
-bool(false)
+-- Iteration 3 --
bool(false)
fnmatch(): Argument #2 ($filename) must not contain any null bytes
bool(false)
+++ /dev/null
---TEST--
-Test fputcsv() : usage variations - with delimiter as NULL
---FILE--
-<?php
-/* Testing fputcsv() to write to a file when delimiter is NULL */
-
-echo "*** Testing fputcsv() : with delimiter as NULL ***\n";
-
-/* the array is with three elements in it. Each element should be read as
- 1st element is delimiter, 2nd element is enclosure
- and 3rd element is csv fields
-*/
-$csv_lists = array (
- array(',', '"', array('water','fruit') ),
- array(',', '"', array('"water","fruit') ),
- array(',', '"', array('"water","fruit"') ),
- array(' ', '^', array('^water^ ^fruit^')),
- array(':', '&', array('&water&:&fruit&')),
- array('=', '=', array('=water===fruit=')),
- array('-', '-', array('-water--fruit-air')),
- array('-', '-', array('-water---fruit---air-')),
- array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
-
-);
-$file_path = __DIR__;
-$filename = "$file_path/fputcsv_variation2.tmp";
-
-$file_modes = array ("r+", "r+b", "r+t",
- "a+", "a+b", "a+t",
- "w+", "w+b", "w+t",
- "x+", "x+b", "x+t");
-
-$loop_counter = 1;
-foreach ($csv_lists as $csv_list) {
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
-
- echo "\n-- file opened in $file_modes[$mode_counter] --\n";
- // create the file and add the content with has csv fields
- if ( strstr($file_modes[$mode_counter], "r") ) {
- $file_handle = fopen($filename, "w");
- } else {
- $file_handle = fopen($filename, $file_modes[$mode_counter] );
- }
- if ( !$file_handle ) {
- echo "Error: failed to create file $filename!\n";
- exit();
- }
- $delimiter = $csv_list[0];
- $enclosure = $csv_list[1];
- $csv_field = $csv_list[2];
-
- // write to a file in csv format
- try {
- var_dump( fputcsv($file_handle, $csv_field, NULL, $enclosure) );
- } catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
- }
- // check the file pointer position and eof
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
- //close the file
- fclose($file_handle);
-
- // print the file contents
- var_dump( file_get_contents($filename) );
-
- //delete file
- unlink($filename);
- } //end of mode loop
-} // end of foreach
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fputcsv() : with delimiter as NULL ***
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-Done
+++ /dev/null
---TEST--
-Test fputcsv() : usage variations - with enclosure as NULL
---FILE--
-<?php
-/* Testing fputcsv() to write to a file when enclosure is NULL */
-
-echo "*** Testing fputcsv() : with enclosure as NULL ***\n";
-
-/* the array is with three elements in it. Each element should be read as
- 1st element is delimiter, 2nd element is enclosure
- and 3rd element is csv fields
-*/
-$csv_lists = array (
- array(',', '"', array('water','fruit') ),
- array(',', '"', array('"water","fruit') ),
- array(',', '"', array('"water","fruit"') ),
- array(' ', '^', array('^water^ ^fruit^')),
- array(':', '&', array('&water&:&fruit&')),
- array('=', '=', array('=water===fruit=')),
- array('-', '-', array('-water--fruit-air')),
- array('-', '-', array('-water---fruit---air-')),
- array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
-
-);
-$file_path = __DIR__;
-$filename = "$file_path/fputcsv_variation3.tmp";
-
-$file_modes = array ("r+", "r+b", "r+t",
- "a+", "a+b", "a+t",
- "w+", "w+b", "w+t",
- "x+", "x+b", "x+t");
-
-$loop_counter = 1;
-foreach ($csv_lists as $csv_list) {
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
-
- echo "\n-- file opened in $file_modes[$mode_counter] --\n";
- // create the file and add the content with has csv fields
- if ( strstr($file_modes[$mode_counter], "r") ) {
- $file_handle = fopen($filename, "w");
- } else {
- $file_handle = fopen($filename, $file_modes[$mode_counter] );
- }
- if ( !$file_handle ) {
- echo "Error: failed to create file $filename!\n";
- exit();
- }
- $delimiter = $csv_list[0];
- $enclosure = $csv_list[1];
- $csv_field = $csv_list[2];
-
- // write to a file in csv format
- try {
- var_dump( fputcsv($file_handle, $csv_field, $delimiter, NULL) );
- } catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
- }
- // check the file pointer position and eof
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
- //close the file
- fclose($file_handle);
-
- // print the file contents
- var_dump( file_get_contents($filename) );
-
- //delete file
- unlink($filename);
- } //end of mode loop
-} // end of foreach
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fputcsv() : with enclosure as NULL ***
-
--- file opened in r+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #4 ($enclosure) must be a single character
-int(0)
-bool(false)
-string(0) ""
-Done
+++ /dev/null
---TEST--
-Test fputcsv() : usage variations - with delimiter and enclosure as NULL
---FILE--
-<?php
-/* Testing fputcsv() to write to a file when delimiter and enclosure is NULL */
-
-echo "*** Testing fputcsv() : with delimiter and enclosure as NULL ***\n";
-
-/* the array is with three elements in it. Each element should be read as
- 1st element is delimiter, 2nd element is enclosure
- and 3rd element is csv fields
-*/
-$csv_lists = array (
- array(',', '"', array('water','fruit') ),
- array(',', '"', array('"water","fruit') ),
- array(',', '"', array('"water","fruit"') ),
- array(' ', '^', array('^water^ ^fruit^')),
- array(':', '&', array('&water&:&fruit&')),
- array('=', '=', array('=water===fruit=')),
- array('-', '-', array('-water--fruit-air')),
- array('-', '-', array('-water---fruit---air-')),
- array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
-
-);
-$file_path = __DIR__;
-$filename = "$file_path/fputcsv_variation4.tmp";
-
-$file_modes = array ("r+", "r+b", "r+t",
- "a+", "a+b", "a+t",
- "w+", "w+b", "w+t",
- "x+", "x+b", "x+t");
-
-$loop_counter = 1;
-foreach ($csv_lists as $csv_list) {
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
-
- echo "\n-- file opened in $file_modes[$mode_counter] --\n";
- // create the file and add the content with has csv fields
- if ( strstr($file_modes[$mode_counter], "r") ) {
- $file_handle = fopen($filename, "w");
- } else {
- $file_handle = fopen($filename, $file_modes[$mode_counter] );
- }
- if ( !$file_handle ) {
- echo "Error: failed to create file $filename!\n";
- exit();
- }
- $delimiter = $csv_list[0];
- $enclosure = $csv_list[1];
- $csv_field = $csv_list[2];
-
- // write to a file in csv format
- try {
- var_dump( fputcsv($file_handle, $csv_field, NULL, NULL) );
- } catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
- }
- // check the file pointer position and eof
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
- //close the file
- fclose($file_handle);
-
- // print the file contents
- var_dump( file_get_contents($filename) );
-
- //delete file
- unlink($filename);
- } //end of mode loop
-} // end of foreach
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fputcsv() : with delimiter and enclosure as NULL ***
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in r+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in a+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in w+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+ --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+b --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-
--- file opened in x+t --
-fputcsv(): Argument #3 ($separator) must be a single character
-int(0)
-bool(false)
-string(0) ""
-Done
fclose($file_handle);
// different invalid format strings
-$invalid_formats = array( $undefined_var,
- "%", "%h", "%.", "%d%m"
- );
+$invalid_formats = array("", "%", "%h", "%.", "%d%m");
// looping to use various invalid formats with fscanf()
$filename = "$file_path/fscanf_error.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Testing fscanf() for error conditions ***
fscanf(): supplied resource is not a valid File-Handle resource
Different numbers of variable names and field specifiers
-
-Warning: Undefined variable $undefined_var in %s on line %d
array(0) {
}
Bad scan conversion character "
<?php
$path = __DIR__;
-ini_set('open_basedir', NULL);
+ini_set('open_basedir', '');
var_dump(glob("$path/*.none"));
var_dump(glob("$path/?.none"));
-2.34555,
TRUE,
FALSE,
- NULL,
" ",
/* scalars */
bool(false)
bool(false)
bool(false)
-bool(false)
-2.34555,
TRUE,
FALSE,
- NULL,
" ",
- @$file_handle
);
/* loop through to test each element in the above array
is an executable file */
bool(false)
bool(false)
bool(false)
-bool(false)
-bool(false)
Done
echo "*** Testing is_readable(): usage variations ***\n";
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle);
-
echo "\n*** Testing is_readable() on miscellaneous filenames ***\n";
$misc_files = array(
0,
-2.34555,
TRUE,
FALSE,
- NULL,
" ",
- @$file_handle
);
/* loop through to test each element in the above array
is a readable file */
bool(false)
bool(false)
bool(false)
-bool(false)
-bool(false)
Done
-2.34555,
TRUE,
FALSE,
- NULL,
" ",
- @$file_handle
);
/* loop through to test each element in the above array
is a writable file */
bool(false)
bool(false)
bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
--FILE--
<?php
echo "*** testing stat ***\n";
-var_dump(stat(NULL));
var_dump(stat(false));
var_dump(stat(''));
var_dump(stat(' '));
var_dump(stat('|'));
echo "*** testing lstat ***\n";
-var_dump(lstat(NULL));
var_dump(lstat(false));
var_dump(lstat(''));
var_dump(lstat(' '));
*** testing stat ***
bool(false)
bool(false)
-bool(false)
Warning: stat(): stat failed for in %s on line %d
bool(false)
*** testing lstat ***
bool(false)
bool(false)
-bool(false)
Warning: lstat(): Lstat failed for in %s on line %d
bool(false)
<?php
echo "*** Testing pathinfo() with miscellaneous input arguments ***\n";
-$fp = fopen(__FILE__, "r");
-unset($fp);
-
class object_temp {
public $url_var = "www.foo.com";
var $html_var = "/var/html/testdir/example.html";
"",
'',
- /* pathname as NULL */
- NULL,
- null,
-
- /* filename as resource */
- $fp,
-
/* pathname as members of object */
$obj->url_var,
$obj->html_var,
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing pathinfo() with miscellaneous input arguments ***
-
-Warning: Undefined variable $fp in %s on line %d
-- Iteration 1 --
array(3) {
["dirname"]=>
string(0) ""
string(0) ""
-- Iteration 13 --
-array(2) {
- ["basename"]=>
- string(0) ""
- ["filename"]=>
- string(0) ""
-}
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
--- Iteration 14 --
-array(2) {
- ["basename"]=>
- string(0) ""
- ["filename"]=>
- string(0) ""
-}
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
--- Iteration 15 --
-array(2) {
- ["basename"]=>
- string(0) ""
- ["filename"]=>
- string(0) ""
-}
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
--- Iteration 16 --
array(4) {
["dirname"]=>
string(1) "."
string(11) "www.foo.com"
string(3) "com"
string(7) "www.foo"
--- Iteration 17 --
+-- Iteration 14 --
array(4) {
["dirname"]=>
string(17) "/var/html/testdir"
string(12) "example.html"
string(4) "html"
string(7) "example"
--- Iteration 18 --
+-- Iteration 15 --
array(3) {
["dirname"]=>
string(12) "/testdir/foo"
string(4) "test"
string(0) ""
string(4) "test"
--- Iteration 19 --
+-- Iteration 16 --
array(4) {
["dirname"]=>
string(4) "/foo"
string(12) "symlink.link"
string(4) "link"
string(7) "symlink"
--- Iteration 20 --
+-- Iteration 17 --
array(3) {
["dirname"]=>
string(1) "."
string(5) "12345"
string(0) ""
string(5) "12345"
--- Iteration 21 --
+-- Iteration 18 --
array(4) {
["dirname"]=>
string(1) "."
string(15) "www.example.com"
string(3) "com"
string(11) "www.example"
--- Iteration 22 --
+-- Iteration 19 --
array(3) {
["dirname"]=>
string(12) "/testdir/foo"
string(4) "test"
string(0) ""
string(4) "test"
--- Iteration 23 --
+-- Iteration 20 --
array(4) {
["dirname"]=>
string(6) "../foo"
string(9) "test.link"
string(4) "link"
string(4) "test"
--- Iteration 24 --
+-- Iteration 21 --
array(4) {
["dirname"]=>
string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6"
string(8) "test.tmp"
string(3) "tmp"
string(4) "test"
--- Iteration 25 --
+-- Iteration 22 --
array(4) {
["dirname"]=>
string(1) "."
echo "\n-- Testing readfile() with invalid arguments --\n";
// invalid arguments
-try {
- var_dump( readfile(NULL) ); // NULL as $filename
-} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
-}
try {
var_dump( readfile('') ); // empty string as $filename
} catch (\ValueError $e) {
-- Testing readfile() with invalid arguments --
Path cannot be empty
Path cannot be empty
-Path cannot be empty
-- Testing readfile() with non-existent file --
"-1" => -1,
"TRUE" => TRUE,
"FALSE" => FALSE,
- "NULL" => NULL,
"\"\"" => "",
"\" \"" => " ",
"\\0" => "\0",
-- Filename: FALSE --
ValueError: Path cannot be empty
--- Filename: NULL --
-ValueError: Path cannot be empty
-
-- Filename: "" --
ValueError: Path cannot be empty
/* empty linkname */
"",
'',
- NULL,
- null
);
for($loop_counter = 0; $loop_counter < count($link_string); $loop_counter++) {
echo "-- Iteration";
string(%d) "%s"
-- Iteration4 --
-Warning: readlink(): %s in %s on line %d
-bool(false)
-string(%d) "%s"
--- Iteration5 --
-
-Warning: readlink(): %s in %s on line %d
-bool(false)
-string(%d) "%s"
--- Iteration6 --
-
Warning: readlink(): %s in %s on line %d
bool(false)
string(%d) "%s"
"",
TRUE,
FALSE,
- NULL,
/* scalars */
1234,
Warning: readlink(): %s in %s on line %d
bool(false)
-
-Warning: readlink(): %s in %s on line %d
-bool(false)
/* empty filename */
"",
'',
- NULL,
- null
);
for($loop_counter = 0; $loop_counter < count($file_string); $loop_counter++) {
echo "-- Iteration";
string(%d) "%s"
-- Iteration4 --
string(%d) "%s"
--- Iteration5 --
-string(%d) "%s"
--- Iteration6 --
-string(%d) "%s"
Done
/* empty filename */
"",
'',
- NULL,
- null
);
for($loop_counter = 0; $loop_counter < count($file_string); $loop_counter++) {
echo "-- Iteration";
string(%d) "%s"
-- Iteration4 --
string(%d) "%s"
--- Iteration5 --
-string(%d) "%s"
--- Iteration6 --
-string(%d) "%s"
Done
-1, /* -1 is just a valid filename on windows */
TRUE, /* 1 as well, (string)TRUE > "1" */
FALSE,
- NULL,
"", // I think both p8 and php are wrong on the messages here
//p8 generates different messages to php, php is probably wrong
//php has either "File Exists" or "Permission Denied".
Warning: rename(,%safile.tmp): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d
bool(false)
--- 3 testing '' NULL --
+-- 3 testing '' string --
Warning: rename(%safile.tmp,): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d
bool(false)
Warning: rename(,%safile.tmp): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d
bool(false)
--- 4 testing '' string --
-
-Warning: rename(%safile.tmp,): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d
-bool(false)
-
-Warning: rename(,%safile.tmp): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d
-bool(false)
--- 5 testing ' ' string --
+-- 4 testing ' ' string --
Warning: rename(%s): The filename, directory name, or volume label syntax is incorrect (code: 123) in %srename_variation13-win32.php on line %d
bool(false)
Warning: rename(%s): The filename, directory name, or volume label syntax is incorrect (code: 123) in %srename_variation13-win32.php on line %d
bool(false)
--- 6 testing '/no/such/file/dir' string --
+-- 5 testing '/no/such/file/dir' string --
Warning: rename(%safile.tmp,/no/such/file/dir): The system cannot find the path specified (code: 3) in %srename_variation13-win32.php on line %d
bool(false)
Warning: rename(/no/such/file/dir,%safile.tmp): The system cannot find the path specified (code: 3) in %srename_variation13-win32.php on line %d
bool(false)
--- 7 testing 'php/php' string --
+-- 6 testing 'php/php' string --
Warning: rename(%safile.tmp,php/php): The system cannot find the path specified (code: 3) in %srename_variation13-win32.php on line %d
bool(false)
-1,
TRUE,
FALSE,
- NULL,
"",
" ",
Warning: rename(%s/renameVar13/afile.tmp,): %s in %s on line %d
bool(false)
-Warning: rename(,%s/renameVar13/afile.tmp): %s in %s on line %d
-bool(false)
--- testing '' --
-
-Warning: rename(%s/renameVar13/afile.tmp,): %s in %s on line %d
-bool(false)
-
Warning: rename(,%s/renameVar13/afile.tmp): %s in %s on line %d
bool(false)
-- testing ' ' --
echo "*** Testing symlink() for error conditions ***\n";
//invalid arguments
-var_dump( symlink(NULL, $linkname) ); // NULL as filename
var_dump( symlink('', $linkname) ); // empty string as filename
var_dump( symlink(false, $linkname) ); // boolean false as filename
-var_dump( symlink($filename, NULL) ); // NULL as linkname
var_dump( symlink($filename, '') ); // '' as linkname
var_dump( symlink($filename, false) ); // false as linkname
echo "\n*** Testing linkinfo() for error conditions ***\n";
//invalid arguments
-var_dump( linkinfo(NULL) ); // NULL as linkname
var_dump( linkinfo('') ); // empty string as linkname
var_dump( linkinfo(false) ); // boolean false as linkname
Warning: symlink(): %s in %s on line %d
bool(false)
-Warning: symlink(): %s in %s on line %d
-bool(false)
-
-Warning: symlink(): %s in %s on line %d
-bool(false)
-
*** Testing linkinfo() for error conditions ***
Warning: linkinfo(): %s in %s on line %d
int(-1)
-Warning: linkinfo(): %s in %s on line %d
-int(-1)
-
Warning: linkinfo(): %s in %s on line %d
int(-1)
Done
echo "*** Testing link() for error conditions ***\n";
//invalid arguments
-var_dump( link(NULL, $linkname) ); // NULL as filename
var_dump( link('', $linkname) ); // empty string as filename
var_dump( link(' ', $linkname) ); // space as filename
var_dump( link(false, $linkname) ); // boolean false as filename
-var_dump( link($filename, NULL) ); // NULL as linkname
var_dump( link($filename, '') ); // '' as linkname
var_dump( link($filename, false) ); // false as linkname
echo "\n*** Testing is_link() for error conditions ***\n";
//invalid arguments
-var_dump( is_link(NULL) ); // NULL as linkname
var_dump( is_link('') ); // empty string as linkname
var_dump( is_link(' ') ); // space as linkname
var_dump( is_link(false) ); // boolean false as linkname
Warning: link(): No such file or directory in %s on line %d
bool(false)
-Warning: link(): No such file or directory in %s on line %d
-bool(false)
-
-Warning: link(): No such file or directory in %s on line %d
-bool(false)
-
*** Testing is_link() for error conditions ***
bool(false)
bool(false)
bool(false)
bool(false)
-bool(false)
Done
-1,
TRUE,
FALSE,
- NULL,
"",
" ",
"\0",
true,
true,
true,
- true,
false,
/* prefix with path separator of a non existing directory*/
-- Iteration 3 --
OK
-- Iteration 4 --
-OK
--- Iteration 5 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation3-win32.php on line %d
Failed, not created in the correct directory %s vs %s
0
--- Iteration 6 --
+-- Iteration 5 --
tempnam(): Argument #2 ($prefix) must not contain any null bytes
--- Iteration 7 --
+-- Iteration 6 --
tempnam(): Argument #2 ($prefix) must be of type string, array given
--- Iteration 8 --
+-- Iteration 7 --
OK
--- Iteration 9 --
+-- Iteration 8 --
OK
-1,
TRUE,
FALSE,
- NULL,
"",
" ",
"\0",
File permissions are => 100600
File created in => directory specified
-- Iteration 5 --
-File name is => %s/%s
-File permissions are => 100600
-File created in => directory specified
--- Iteration 6 --
tempnam(): Argument #2 ($prefix) must not contain any null bytes
--- Iteration 7 --
+-- Iteration 6 --
tempnam(): Argument #2 ($prefix) must be of type string, array given
--- Iteration 8 --
+-- Iteration 7 --
File name is => %s/dir%s
File permissions are => 100600
File created in => directory specified
--- Iteration 9 --
+-- Iteration 8 --
File name is => %s/php%s
File permissions are => 100600
File created in => directory specified
-1,
TRUE,
FALSE,
- NULL,
"",
" ",
"\0",
File permissions are => 100666
File created in => temp dir
-- Iteration 4 --
-File name is => %s%et%s
-File permissions are => 100666
-File created in => temp dir
--- Iteration 5 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d
File name is => %s%et%s
File permissions are => 100666
File created in => temp dir
--- Iteration 6 --
+-- Iteration 5 --
tempnam(): Argument #1 ($directory) must not contain any null bytes
--- Iteration 7 --
+-- Iteration 6 --
tempnam(): Argument #1 ($directory) must be of type string, array given
--- Iteration 8 --
+-- Iteration 7 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d
File name is => %s%et%s
File permissions are => 100666
File created in => temp dir
--- Iteration 9 --
+-- Iteration 8 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d
File name is => %s%et%s
-1,
TRUE,
FALSE,
- NULL,
"",
" ",
"\0",
File permissions are => 100600
File created in => temp dir
-- Iteration 4 --
-File name is => %s%etempnam_variation3.tmp%s
-File permissions are => 100600
-File created in => temp dir
--- Iteration 5 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d
File name is => %s%etempnam_variation3.tmp%s
File permissions are => 100600
File created in => temp dir
--- Iteration 6 --
+-- Iteration 5 --
tempnam(): Argument #1 ($directory) must not contain any null bytes
--- Iteration 7 --
+-- Iteration 6 --
tempnam(): Argument #1 ($directory) must be of type string, array given
--- Iteration 8 --
+-- Iteration 7 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d
File name is => %s/tempnam_variation3.tmp%s
File permissions are => 100600
File created in => temp dir
--- Iteration 9 --
+-- Iteration 8 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d
File name is => %s/tempnam_variation3.tmp%s
var_dump( unlink('') ); // $filename as empty string
var_dump( file_exists('') ); // confirm file doesn't exist
-var_dump( unlink(NULL) ); // $filename as NULL
-var_dump( file_exists(NULL) ); // confirm file doesn't exist
-
var_dump( unlink(false) ); // $filename as boolean false
var_dump( file_exists(false) ); // confirm file doesn't exist
bool(false)
bool(false)
-Warning: unlink(): %s in %s on line %d
-bool(false)
-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
var_dump( unlink('') ); // $filename as empty string
var_dump( file_exists('') ); // confirm file doesn't exist
-var_dump( unlink(NULL) ); // $filename as NULL
-var_dump( file_exists(NULL) ); // confirm file doesn't exist
-
var_dump( unlink(false) ); // $filename as boolean false
var_dump( file_exists(false) ); // confirm file doesn't exist
bool(false)
bool(false)
-Warning: unlink(): %s in %s on line %d
-bool(false)
-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
var_dump( unlink('') ); // $filename as empty string
var_dump( file_exists('') ); // confirm file doesn't exist
-var_dump( unlink(NULL) ); // $filename as NULL
-var_dump( file_exists(NULL) ); // confirm file doesn't exist
-
var_dump( unlink(false) ); // $filename as boolean false
var_dump( file_exists(false) ); // confirm file doesn't exist
bool(false)
bool(false)
-Warning: unlink(): %s in %s on line %d
-bool(false)
-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
$foo = $d . '\\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726f6c6c65725c457863657074696f6e436f6e74726f6c6c657223676574416e64436c65616e4f7574707574427566666572696e67405b416e6e6f745d5d5b.doctrinecache.data';
$bar = $d . '\\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726f6c6c65725c457863657074696f6e436f6e74726f6c6c657223676574416e64436c65616e4f7574707574427566666572696e67405b416e6e6f745d5d5b315d.doctrinecache.data';
-mkdir($d, NULL, true);
+mkdir($d, 0777, true);
foreach (array($foo, $bar) as $f) {
touch($f);
echo "*** Testing escapeshellarg() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
// heredoc string
$heredoc = <<<EOT
abc
1.234567E-2,
.5,
- // null data
-/*11*/ NULL,
- null,
-
// boolean data
/*13*/ true,
false,
/*17*/ "",
'',
- // undefined data
-/*19*/ @$undefined_var,
-
- // unset data
-/*20*/ @$unset_var,
-
);
// loop through each element of $inputs to check the behaviour of escapeshellarg()
string(5) ""0.5""
-- Iteration 11 --
-string(2) """"
+string(3) ""1""
-- Iteration 12 --
string(2) """"
string(2) """"
-- Iteration 15 --
-string(3) ""1""
-
--- Iteration 16 --
-string(2) """"
-
--- Iteration 17 --
-string(2) """"
-
--- Iteration 18 --
-string(2) """"
-
--- Iteration 19 --
string(2) """"
--- Iteration 20 --
+-- Iteration 16 --
string(2) """"
echo "*** Testing escapeshellarg() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
// heredoc string
$heredoc = <<<EOT
abc
1.234567E-2,
.5,
- // null data
-/*11*/ NULL,
- null,
-
// boolean data
/*13*/ true,
false,
// empty data
/*17*/ "",
'',
-
- // undefined data
-/*19*/ @$undefined_var,
-
- // unset data
-/*20*/ @$unset_var,
-
);
// loop through each element of $inputs to check the behaviour of escapeshellarg()
string(5) "'0.5'"
-- Iteration 11 --
-string(2) "''"
+string(3) "'1'"
-- Iteration 12 --
string(2) "''"
string(2) "''"
-- Iteration 15 --
-string(3) "'1'"
-
--- Iteration 16 --
-string(2) "''"
-
--- Iteration 17 --
-string(2) "''"
-
--- Iteration 18 --
-string(2) "''"
-
--- Iteration 19 --
string(2) "''"
--- Iteration 20 --
+-- Iteration 16 --
string(2) "''"
+++ /dev/null
---TEST--
-Test function get_cfg_var() by substituting argument 1 with emptyUnsetUndefNull values.
---CREDITS--
-Francesco Fullone ff@ideato.it
-#PHPTestFest Cesena Italia on 2009-06-20
---INI--
-session.use_cookies=0
-session.serialize_handler=php
-session.save_handler=files
---FILE--
-<?php
-
-
-echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
-
-
-
-$unset_var = 10;
-unset($unset_var);
-
-$variation_array = array(
- 'unset var' => @$unset_var,
- 'undefined var' => @$undefined_var,
- 'empty string DQ' => "",
- 'empty string SQ' => '',
- 'uppercase NULL' => NULL,
- 'lowercase null' => null
- );
-
-
-foreach ( $variation_array as $var ) {
- var_dump(get_cfg_var( $var ) );
-}
-?>
---EXPECT--
-*** Test substituting argument 1 with emptyUnsetUndefNull values ***
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
+++ /dev/null
---TEST--
-Test function getservbyname() by substituting argument 2 with emptyUnsetUndefNull values.
---FILE--
-<?php
-
-
-echo "*** Test substituting argument 2 with emptyUnsetUndefNull values ***\n";
-
-$service = "www";
-
-
-$unset_var = 10;
-unset($unset_var);
-
-$variation_array = array(
- 'unset var' => @$unset_var,
- 'undefined var' => @$undefined_var,
- 'empty string DQ' => "",
- 'empty string SQ' => '',
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
- );
-
-
-foreach ( $variation_array as $var ) {
- var_dump(getservbyname( $service, $var ) );
-}
-?>
---EXPECT--
-*** Test substituting argument 2 with emptyUnsetUndefNull values ***
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
+++ /dev/null
---TEST--
-Test function getservbyname() by substituting argument 1 with emptyUnsetUndefNull values.
---FILE--
-<?php
-
-
-echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
-
-$protocol = "tcp";
-
-
-$unset_var = 10;
-unset($unset_var);
-
-$variation_array = array(
- 'unset var' => @$unset_var,
- 'undefined var' => @$undefined_var,
- 'empty string DQ' => "",
- 'empty string SQ' => '',
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
- );
-
-
-foreach ( $variation_array as $var ) {
- var_dump(getservbyname( $var , $protocol ) );
-}
-?>
---EXPECT--
-*** Test substituting argument 1 with emptyUnsetUndefNull values ***
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
?>
--FILE--
<?php
- var_dump(getservbyport( -1, "tcp" ));
- var_dump(getservbyport( 80, "ppp" ));
- var_dump(getservbyport( null, null));
- var_dump(getservbyport( 2, 2));
- var_dump(getservbyport( "80", "tcp"));
-
+var_dump(getservbyport( -1, "tcp" ));
+var_dump(getservbyport( 80, "ppp" ));
+var_dump(getservbyport( 2, 2));
+var_dump(getservbyport( "80", "tcp"));
?>
--EXPECTF--
bool(false)
bool(false)
bool(false)
-bool(false)
string(%d) "%s"
echo "\nuniqid() without a prefix\n";
var_dump(uniqid());
-var_dump(uniqid(null, true));
-var_dump(uniqid(null, false));
+var_dump(uniqid('', true));
+var_dump(uniqid('', false));
echo "\n\n";
echo "uniqid() with a prefix\n";
99999,
"99999",
10.5e2,
- null,
true,
false
);
string(27) "1050%s.%s"
string(17) "1050%s"
-string(13) "%s"
-string(23) "%s.%s"
-string(13) "%s"
-
string(14) "1%s"
string(24) "1%s.%s"
string(14) "1%s"
string(13) "%s"
string(23) "%s.%s"
string(13) "%s"
-
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(1000000, NULL));
+ var_dump(image_type_to_extension(1000000, false));
var_dump(image_type_to_extension(0));
?>
Done
var_dump($res);
}
?>
---EXPECT--
+--EXPECTF--
*** Testing abs() : basic functionality ***
int(23)
int(23)
float(23.45)
float(23.45)
float(23.45)
+
+Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
int(0)
int(1)
int(0)
fclose($fp);
?>
---EXPECT--
+--EXPECTF--
*** Testing abs() : usage variations ***
-- Iteration 1 --
+
+Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
int(0)
-- Iteration 2 --
+
+Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
int(0)
-- Iteration 3 --
abs(): Argument #1 ($num) must be of type int|float, classA given
-- Iteration 14 --
+
+Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
int(0)
-- Iteration 15 --
+
+Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
int(0)
-- Iteration 16 --
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(NAN)
float(NAN)
float(NAN)
-float(1.5707963267948966)
float(0)
float(1.5707963267948966)
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(3.8475627390640357)
float(3.8475627390640357)
float(7.600902209541989)
-float(NAN)
float(0)
float(NAN)
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(NAN)
float(NAN)
float(NAN)
-float(0)
float(1.5707963267948966)
float(0)
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(3.848471992)
float(3.848471992)
float(7.60090271)
-float(0)
float(0.881373587)
float(0)
"23",
"23.45",
"2.345e1",
- null,
true,
false);
"23",
"23.45",
"2.345e1",
- null,
true,
false);
Y:23 X:23 float(0.78539816339745)
Y:23 X:23.45 float(0.77571063007847)
Y:23 X:2.345e1 float(0.77571063007847)
-Y:23 X: float(1.5707963267949)
Y:23 X:1 float(1.5273454314034)
Y:23 X: float(1.5707963267949)
Y:-23 X:23 float(-0.78539816339745)
Y:-23 X:23 float(-0.78539816339745)
Y:-23 X:23.45 float(-0.77571063007847)
Y:-23 X:2.345e1 float(-0.77571063007847)
-Y:-23 X: float(-1.5707963267949)
Y:-23 X:1 float(-1.5273454314034)
Y:-23 X: float(-1.5707963267949)
Y:23.45 X:23 float(0.79508569671643)
Y:23.45 X:23 float(0.79508569671643)
Y:23.45 X:23.45 float(0.78539816339745)
Y:23.45 X:2.345e1 float(0.78539816339745)
-Y:23.45 X: float(1.5707963267949)
Y:23.45 X:1 float(1.5281782247706)
Y:23.45 X: float(1.5707963267949)
Y:-23.45 X:23 float(-0.79508569671643)
Y:-23.45 X:23 float(-0.79508569671643)
Y:-23.45 X:23.45 float(-0.78539816339745)
Y:-23.45 X:2.345e1 float(-0.78539816339745)
-Y:-23.45 X: float(-1.5707963267949)
Y:-23.45 X:1 float(-1.5281782247706)
Y:-23.45 X: float(-1.5707963267949)
Y:23 X:23 float(0.78539816339745)
Y:23 X:23 float(0.78539816339745)
Y:23 X:23.45 float(0.77571063007847)
Y:23 X:2.345e1 float(0.77571063007847)
-Y:23 X: float(1.5707963267949)
Y:23 X:1 float(1.5273454314034)
Y:23 X: float(1.5707963267949)
Y:23 X:23 float(0.78539816339745)
Y:23 X:23 float(0.78539816339745)
Y:23 X:23.45 float(0.77571063007847)
Y:23 X:2.345e1 float(0.77571063007847)
-Y:23 X: float(1.5707963267949)
Y:23 X:1 float(1.5273454314034)
Y:23 X: float(1.5707963267949)
Y:23 X:23 float(0.78539816339745)
Y:23 X:23 float(0.78539816339745)
Y:23 X:23.45 float(0.77571063007847)
Y:23 X:2.345e1 float(0.77571063007847)
-Y:23 X: float(1.5707963267949)
Y:23 X:1 float(1.5273454314034)
Y:23 X: float(1.5707963267949)
Y:23.45 X:23 float(0.79508569671643)
Y:23.45 X:23 float(0.79508569671643)
Y:23.45 X:23.45 float(0.78539816339745)
Y:23.45 X:2.345e1 float(0.78539816339745)
-Y:23.45 X: float(1.5707963267949)
Y:23.45 X:1 float(1.5281782247706)
Y:23.45 X: float(1.5707963267949)
Y:2.345e1 X:23 float(0.79508569671643)
Y:2.345e1 X:23 float(0.79508569671643)
Y:2.345e1 X:23.45 float(0.78539816339745)
Y:2.345e1 X:2.345e1 float(0.78539816339745)
-Y:2.345e1 X: float(1.5707963267949)
Y:2.345e1 X:1 float(1.5281782247706)
Y:2.345e1 X: float(1.5707963267949)
-Y: X:23 float(0)
-Y: X:-23 float(3.1415926535898)
-Y: X:23.45 float(0)
-Y: X:-23.45 float(3.1415926535898)
-Y: X:23 float(0)
-Y: X:23 float(0)
-Y: X:23 float(0)
-Y: X:23.45 float(0)
-Y: X:2.345e1 float(0)
-Y: X: float(0)
-Y: X:1 float(0)
-Y: X: float(0)
Y:1 X:23 float(0.043450895391531)
Y:1 X:-23 float(3.0981417581983)
Y:1 X:23.45 float(0.042618102024328)
Y:1 X:23 float(0.043450895391531)
Y:1 X:23.45 float(0.042618102024328)
Y:1 X:2.345e1 float(0.042618102024328)
-Y:1 X: float(1.5707963267949)
Y:1 X:1 float(0.78539816339745)
Y:1 X: float(1.5707963267949)
Y: X:23 float(0)
Y: X:23 float(0)
Y: X:23.45 float(0)
Y: X:2.345e1 float(0)
-Y: X: float(0)
Y: X:1 float(0)
Y: X: float(0)
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(1.528178224770569)
float(1.528178224770569)
float(1.5697963271282298)
-float(0)
float(0.7853981633974483)
float(0)
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(NAN)
float(NAN)
float(NAN)
-float(0)
float(INF)
float(0)
<?php
echo "*** Testing base_convert() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
// heredoc string
$heredoc = <<<EOT
abc
1.234567E-2,
.5,
- // null data
-/*11*/ NULL,
- null,
-
// boolean data
/*13*/ true,
false,
'abcxyz',
$heredoc,
- // undefined data
-/*23*/ @$undefined_var,
-
- // unset data
-/*24*/ @$unset_var,
-
// resource variable
/*25*/ $fp
);
string(1) "5"
-- Iteration 11 --
-string(1) "0"
+string(1) "1"
-- Iteration 12 --
string(1) "0"
string(1) "0"
-- Iteration 15 --
-string(1) "1"
+string(1) "0"
-- Iteration 16 --
string(1) "0"
-- Iteration 17 --
-string(1) "0"
-
--- Iteration 18 --
-string(1) "0"
-
--- Iteration 19 --
base_convert(): Argument #1 ($num) must be of type string, array given
--- Iteration 20 --
+-- Iteration 18 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
string(1) "0"
--- Iteration 21 --
+-- Iteration 19 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
string(1) "0"
--- Iteration 22 --
+-- Iteration 20 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
string(1) "0"
--- Iteration 23 --
-string(1) "0"
-
--- Iteration 24 --
-string(1) "0"
-
--- Iteration 25 --
+-- Iteration 21 --
base_convert(): Argument #1 ($num) must be of type string, resource given
011237,
true,
false,
- null);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = bindec($values[$i]);
int(0)
int(1)
int(0)
-int(0)
011237,
true,
false,
- null);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = bindec($values[$i]);
int(0)
int(1)
int(0)
-int(0)
--FILE--
<?php
echo "*** Testing bindec() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*10*/ NULL,
- null,
-
// boolean data
/*12*/ true,
false,
'abcxyz',
$heredoc,
- // undefined data
-/*22*/ @$undefined_var,
-
- // unset data
-/*23*/ @$unset_var,
-
// resource variable
/*24*/ $fp
);
int(0)
-- Iteration 10 --
-int(0)
+int(1)
-- Iteration 11 --
int(0)
int(0)
-- Iteration 14 --
-int(1)
+int(0)
-- Iteration 15 --
int(0)
-- Iteration 16 --
-int(0)
-
--- Iteration 17 --
-int(0)
-
--- Iteration 18 --
bindec(): Argument #1 ($binary_string) must be of type string, array given
--- Iteration 19 --
+-- Iteration 17 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(0)
--- Iteration 20 --
+-- Iteration 18 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(0)
--- Iteration 21 --
+-- Iteration 19 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(0)
--- Iteration 22 --
-int(0)
-
--- Iteration 23 --
-int(0)
-
--- Iteration 24 --
+-- Iteration 20 --
bindec(): Argument #1 ($binary_string) must be of type string, resource given
--FILE--
<?php
echo "*** Testing bindec() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*10*/ NULL,
- null,
-
// boolean data
/*12*/ true,
false,
'abcxyz',
$heredoc,
- // undefined data
-/*22*/ @$undefined_var,
-
- // unset data
-/*23*/ @$unset_var,
-
// resource variable
/*24*/ $fp
);
int(0)
-- Iteration 10 --
-int(0)
+int(1)
-- Iteration 11 --
int(0)
int(0)
-- Iteration 14 --
-int(1)
+int(0)
-- Iteration 15 --
int(0)
-- Iteration 16 --
-int(0)
-
--- Iteration 17 --
-int(0)
-
--- Iteration 18 --
bindec(): Argument #1 ($binary_string) must be of type string, array given
--- Iteration 19 --
+-- Iteration 17 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(0)
--- Iteration 20 --
+-- Iteration 18 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(0)
--- Iteration 21 --
+-- Iteration 19 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(0)
--- Iteration 22 --
-int(0)
-
--- Iteration 23 --
-int(0)
-
--- Iteration 24 --
+-- Iteration 20 --
bindec(): Argument #1 ($binary_string) must be of type string, resource given
}
?>
---EXPECT--
+--EXPECTF--
*** Testing ceil() : basic functionality ***
float(0)
float(0)
float(39)
float(1)
float(0)
+
+Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
};
fclose($fp);
?>
---EXPECT--
+--EXPECTF--
*** Testing ceil() : usage variations ***
-- Iteration 1 --
+
+Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 2 --
+
+Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 3 --
ceil(): Argument #1 ($num) must be of type int|float, classA given
-- Iteration 14 --
+
+Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 15 --
+
+Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 16 --
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(-0.1117112391)
float(-0.1117112391)
float(0.5623790763)
-float(1)
float(0.5403023059)
float(1)
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(7641446995)
float(7641446995)
float(INF)
-float(1)
float(1.543080635)
float(1)
"0x5F",
true,
false,
- null,
);
foreach ($values as $value) {
decbin(): Argument #1 ($num) must be of type int, string given
string(1) "1"
string(1) "0"
-string(1) "0"
--FILE--
<?php
echo "*** Testing decbin() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*12*/ NULL,
- null,
-
// boolean data
/*14*/ true,
false,
// object data
/*24*/ new classA(),
- // undefined data
-/*25*/ @$undefined_var,
-
- // unset data
-/*26*/ @$unset_var,
-
// resource variable
/*27*/ $fp
);
string(1) "0"
-- Iteration 12 --
-string(1) "0"
+string(1) "1"
-- Iteration 13 --
string(1) "0"
string(1) "0"
-- Iteration 16 --
-string(1) "1"
+decbin(): Argument #1 ($num) must be of type int, string given
-- Iteration 17 --
-string(1) "0"
+decbin(): Argument #1 ($num) must be of type int, string given
-- Iteration 18 --
-decbin(): Argument #1 ($num) must be of type int, string given
+decbin(): Argument #1 ($num) must be of type int, array given
-- Iteration 19 --
decbin(): Argument #1 ($num) must be of type int, string given
-- Iteration 20 --
-decbin(): Argument #1 ($num) must be of type int, array given
+decbin(): Argument #1 ($num) must be of type int, string given
-- Iteration 21 --
decbin(): Argument #1 ($num) must be of type int, string given
-- Iteration 22 --
-decbin(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 23 --
-decbin(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 24 --
decbin(): Argument #1 ($num) must be of type int, classA given
--- Iteration 25 --
-string(1) "0"
-
--- Iteration 26 --
-string(1) "0"
-
--- Iteration 27 --
+-- Iteration 23 --
decbin(): Argument #1 ($num) must be of type int, resource given
--FILE--
<?php
echo "*** Testing decbin() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*12*/ NULL,
- null,
-
// boolean data
/*14*/ true,
false,
// object data
/*24*/ new classA(),
- // undefined data
-/*25*/ @$undefined_var,
-
- // unset data
-/*26*/ @$unset_var,
-
// resource variable
/*27*/ $fp
);
string(1) "0"
-- Iteration 12 --
-string(1) "0"
+string(1) "1"
-- Iteration 13 --
string(1) "0"
string(1) "0"
-- Iteration 16 --
-string(1) "1"
+decbin(): Argument #1 ($num) must be of type int, string given
-- Iteration 17 --
-string(1) "0"
+decbin(): Argument #1 ($num) must be of type int, string given
-- Iteration 18 --
-decbin(): Argument #1 ($num) must be of type int, string given
+decbin(): Argument #1 ($num) must be of type int, array given
-- Iteration 19 --
decbin(): Argument #1 ($num) must be of type int, string given
-- Iteration 20 --
-decbin(): Argument #1 ($num) must be of type int, array given
+decbin(): Argument #1 ($num) must be of type int, string given
-- Iteration 21 --
decbin(): Argument #1 ($num) must be of type int, string given
-- Iteration 22 --
-decbin(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 23 --
-decbin(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 24 --
decbin(): Argument #1 ($num) must be of type int, classA given
--- Iteration 25 --
-string(1) "0"
-
--- Iteration 26 --
-string(1) "0"
-
--- Iteration 27 --
+-- Iteration 23 --
decbin(): Argument #1 ($num) must be of type int, resource given
"0x5F",
true,
false,
- null,
);
foreach ($values as $value) {
dechex(): Argument #1 ($num) must be of type int, string given
string(1) "1"
string(1) "0"
-string(1) "0"
--FILE--
<?php
echo "*** Testing dechex() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*12*/ NULL,
- null,
-
// boolean data
/*14*/ true,
false,
// object data
/*24*/ new classA(),
- // undefined data
-/*25*/ @$undefined_var,
-
- // unset data
-/*26*/ @$unset_var,
-
// resource variable
/*27*/ $fp
);
string(1) "0"
-- Iteration 12 --
-string(1) "0"
+string(1) "1"
-- Iteration 13 --
string(1) "0"
string(1) "0"
-- Iteration 16 --
-string(1) "1"
+dechex(): Argument #1 ($num) must be of type int, string given
-- Iteration 17 --
-string(1) "0"
+dechex(): Argument #1 ($num) must be of type int, string given
-- Iteration 18 --
-dechex(): Argument #1 ($num) must be of type int, string given
+dechex(): Argument #1 ($num) must be of type int, array given
-- Iteration 19 --
dechex(): Argument #1 ($num) must be of type int, string given
-- Iteration 20 --
-dechex(): Argument #1 ($num) must be of type int, array given
+dechex(): Argument #1 ($num) must be of type int, string given
-- Iteration 21 --
dechex(): Argument #1 ($num) must be of type int, string given
-- Iteration 22 --
-dechex(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 23 --
-dechex(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 24 --
dechex(): Argument #1 ($num) must be of type int, classA given
--- Iteration 25 --
-string(1) "0"
-
--- Iteration 26 --
-string(1) "0"
-
--- Iteration 27 --
+-- Iteration 23 --
dechex(): Argument #1 ($num) must be of type int, resource given
--FILE--
<?php
echo "*** Testing dechex() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*12*/ NULL,
- null,
-
// boolean data
/*14*/ true,
false,
// object data
/*24*/ new classA(),
- // undefined data
-/*25*/ @$undefined_var,
-
- // unset data
-/*26*/ @$unset_var,
-
// resource variable
/*27*/ $fp
);
string(1) "0"
-- Iteration 12 --
-string(1) "0"
+string(1) "1"
-- Iteration 13 --
string(1) "0"
string(1) "0"
-- Iteration 16 --
-string(1) "1"
+dechex(): Argument #1 ($num) must be of type int, string given
-- Iteration 17 --
-string(1) "0"
+dechex(): Argument #1 ($num) must be of type int, string given
-- Iteration 18 --
-dechex(): Argument #1 ($num) must be of type int, string given
+dechex(): Argument #1 ($num) must be of type int, array given
-- Iteration 19 --
dechex(): Argument #1 ($num) must be of type int, string given
-- Iteration 20 --
-dechex(): Argument #1 ($num) must be of type int, array given
+dechex(): Argument #1 ($num) must be of type int, string given
-- Iteration 21 --
dechex(): Argument #1 ($num) must be of type int, string given
-- Iteration 22 --
-dechex(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 23 --
-dechex(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 24 --
dechex(): Argument #1 ($num) must be of type int, classA given
--- Iteration 25 --
-string(1) "0"
-
--- Iteration 26 --
-string(1) "0"
-
--- Iteration 27 --
+-- Iteration 23 --
dechex(): Argument #1 ($num) must be of type int, resource given
"0x5F",
true,
false,
- null,
);
foreach ($values as $value) {
decoct(): Argument #1 ($num) must be of type int, string given
string(1) "1"
string(1) "0"
-string(1) "0"
--FILE--
<?php
echo "*** Testing decoct() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*12*/ NULL,
- null,
-
// boolean data
/*14*/ true,
false,
// object data
/*24*/ new classA(),
- // undefined data
-/*25*/ @$undefined_var,
-
- // unset data
-/*26*/ @$unset_var,
-
// resource variable
/*27*/ $fp
);
string(1) "0"
-- Iteration 12 --
-string(1) "0"
+string(1) "1"
-- Iteration 13 --
string(1) "0"
string(1) "0"
-- Iteration 16 --
-string(1) "1"
+decoct(): Argument #1 ($num) must be of type int, string given
-- Iteration 17 --
-string(1) "0"
+decoct(): Argument #1 ($num) must be of type int, string given
-- Iteration 18 --
-decoct(): Argument #1 ($num) must be of type int, string given
+decoct(): Argument #1 ($num) must be of type int, array given
-- Iteration 19 --
decoct(): Argument #1 ($num) must be of type int, string given
-- Iteration 20 --
-decoct(): Argument #1 ($num) must be of type int, array given
+decoct(): Argument #1 ($num) must be of type int, string given
-- Iteration 21 --
decoct(): Argument #1 ($num) must be of type int, string given
-- Iteration 22 --
-decoct(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 23 --
-decoct(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 24 --
decoct(): Argument #1 ($num) must be of type int, classA given
--- Iteration 25 --
-string(1) "0"
-
--- Iteration 26 --
-string(1) "0"
-
--- Iteration 27 --
+-- Iteration 23 --
decoct(): Argument #1 ($num) must be of type int, resource given
--FILE--
<?php
echo "*** Testing decoct() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*12*/ NULL,
- null,
-
// boolean data
/*14*/ true,
false,
// object data
/*24*/ new classA(),
- // undefined data
-/*25*/ @$undefined_var,
-
- // unset data
-/*26*/ @$unset_var,
-
// resource variable
/*27*/ $fp
);
string(1) "0"
-- Iteration 12 --
-string(1) "0"
+string(1) "1"
-- Iteration 13 --
string(1) "0"
string(1) "0"
-- Iteration 16 --
-string(1) "1"
+decoct(): Argument #1 ($num) must be of type int, string given
-- Iteration 17 --
-string(1) "0"
+decoct(): Argument #1 ($num) must be of type int, string given
-- Iteration 18 --
-decoct(): Argument #1 ($num) must be of type int, string given
+decoct(): Argument #1 ($num) must be of type int, array given
-- Iteration 19 --
decoct(): Argument #1 ($num) must be of type int, string given
-- Iteration 20 --
-decoct(): Argument #1 ($num) must be of type int, array given
+decoct(): Argument #1 ($num) must be of type int, string given
-- Iteration 21 --
decoct(): Argument #1 ($num) must be of type int, string given
-- Iteration 22 --
-decoct(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 23 --
-decoct(): Argument #1 ($num) must be of type int, string given
-
--- Iteration 24 --
decoct(): Argument #1 ($num) must be of type int, classA given
--- Iteration 25 --
-string(1) "0"
-
--- Iteration 26 --
-string(1) "0"
-
--- Iteration 27 --
+-- Iteration 23 --
decoct(): Argument #1 ($num) must be of type int, resource given
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(0.40927970959267024)
float(0.40927970959267024)
float(17.453292519943293)
-float(0)
float(0.017453292519943295)
float(0)
"039",
true,
false,
- null,
);
$iterator = 1;
-- Iteration 11 --
float(1)
-
--- Iteration 12 --
-float(1)
"039",
true,
false,
- null,
);
// loop through each element of $values to check the behaviour of expm1()
-- Iteration 11 --
float(0)
-
--- Iteration 12 --
-float(0)
};
?>
---EXPECT--
+--EXPECTF--
*** Testing floor() : basic functionality ***
-- floor 0 --
float(0)
-- floor --
+
+Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
};
fclose($fp);
?>
---EXPECT--
+--EXPECTF--
*** Testing floor() : usage variations ***
-- Iteration 1 --
+
+Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 2 --
+
+Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 3 --
floor(): Argument #1 ($num) must be of type int|float, classA given
-- Iteration 14 --
+
+Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 15 --
+
+Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 16 --
"234",
"234.5",
"23.45e1",
- null,
true,
false);
"2",
"2.3",
"2.3e1",
- null,
true,
false);
for ($i = 0; $i < count($values1); $i++) {
float(0)
float(1.700000000000018)
float(4)
-float(NAN)
float(0)
float(NAN)
float(-0)
float(-1.700000000000018)
float(-4)
-float(NAN)
float(-0)
float(NAN)
float(0.5)
float(2.200000000000018)
float(4.5)
-float(NAN)
float(0.5)
float(NAN)
float(-0.5)
float(-2.200000000000018)
float(-4.5)
-float(NAN)
float(-0.5)
float(NAN)
float(0)
float(1.700000000000018)
float(4)
-float(NAN)
float(0)
float(NAN)
float(0)
float(1.700000000000018)
float(4)
-float(NAN)
float(0)
float(NAN)
float(0)
float(1.700000000000018)
float(4)
-float(NAN)
float(0)
float(NAN)
float(0.5)
float(2.200000000000018)
float(4.5)
-float(NAN)
float(0.5)
float(NAN)
float(0.5)
float(2.200000000000018)
float(4.5)
-float(NAN)
float(0.5)
float(NAN)
iteration 9
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(0)
-float(NAN)
-float(0)
-float(NAN)
-
-iteration 10
float(1)
float(1)
float(1)
float(1)
float(1)
float(1)
-float(NAN)
float(0)
float(NAN)
-iteration 11
+iteration 10
float(0)
float(0)
float(0)
float(0)
float(0)
float(0)
-float(NAN)
float(0)
float(NAN)
'011237',
true,
false,
- null);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = hexdec($values[$i]);
var_dump($res);
int(70199)
int(1)
int(0)
-int(0)
'011237',
true,
false,
- null);
+ );
foreach($values as $value) {
echo "\n-- hexdec $value --\n";
-- hexdec --
int(0)
-
--- hexdec --
-int(0)
--FILE--
<?php
echo "*** Testing hexdec() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*12*/ NULL,
- null,
-
// boolean data
/*14*/ true,
false,
'abcxyz',
$heredoc,
- // undefined data
-/*24*/ @$undefined_var,
-
- // unset data
-/*25*/ @$unset_var,
-
// resource variable
/*26*/ $fp
);
int(5)
-- Iteration 12 --
-int(0)
+int(1)
-- Iteration 13 --
int(0)
int(0)
-- Iteration 16 --
-int(1)
+int(0)
-- Iteration 17 --
int(0)
-- Iteration 18 --
-int(0)
-
--- Iteration 19 --
-int(0)
-
--- Iteration 20 --
hexdec(): Argument #1 ($hex_string) must be of type string, array given
--- Iteration 21 --
+-- Iteration 19 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(2748)
--- Iteration 22 --
+-- Iteration 20 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(2748)
--- Iteration 23 --
+-- Iteration 21 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(2748)
--- Iteration 24 --
-int(0)
-
--- Iteration 25 --
-int(0)
-
--- Iteration 26 --
+-- Iteration 22 --
hexdec(): Argument #1 ($hex_string) must be of type string, resource given
--FILE--
<?php
echo "*** Testing hexdec() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*12*/ NULL,
- null,
-
// boolean data
/*14*/ true,
false,
'abcxyz',
$heredoc,
- // undefined data
-/*24*/ @$undefined_var,
-
- // unset data
-/*25*/ @$unset_var,
-
// resource variable
/*26*/ $fp
);
int(5)
-- Iteration 12 --
-int(0)
+int(1)
-- Iteration 13 --
int(0)
int(0)
-- Iteration 16 --
-int(1)
+int(0)
-- Iteration 17 --
int(0)
-- Iteration 18 --
-int(0)
-
--- Iteration 19 --
-int(0)
-
--- Iteration 20 --
hexdec(): Argument #1 ($hex_string) must be of type string, array given
--- Iteration 21 --
+-- Iteration 19 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(2748)
--- Iteration 22 --
+-- Iteration 20 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(2748)
--- Iteration 23 --
+-- Iteration 21 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(2748)
--- Iteration 24 --
-int(0)
-
--- Iteration 25 --
-int(0)
-
--- Iteration 26 --
+-- Iteration 22 --
hexdec(): Argument #1 ($hex_string) must be of type string, resource given
"23",
"23.45",
"2.345e1",
- null,
true,
false);
"33",
"43.45",
"1.345e1",
- null,
true,
false);
Y:23 X:1.345e1 float(26.6439955712352)
-Y:23 X: float(23)
-
Y:23 X:1 float(23.0217288664427)
Y:23 X: float(23)
Y:-23 X:1.345e1 float(26.6439955712352)
-Y:-23 X: float(23)
-
Y:-23 X:1 float(23.0217288664427)
Y:-23 X: float(23)
Y:23.45 X:1.345e1 float(27.033405260899)
-Y:23.45 X: float(23.45)
-
Y:23.45 X:1 float(23.4713122769052)
Y:23.45 X: float(23.45)
Y:-23.45 X:1.345e1 float(27.033405260899)
-Y:-23.45 X: float(23.45)
-
Y:-23.45 X:1 float(23.4713122769052)
Y:-23.45 X: float(23.45)
Y:23 X:1.345e1 float(26.6439955712352)
-Y:23 X: float(23)
-
Y:23 X:1 float(23.0217288664427)
Y:23 X: float(23)
Y:23 X:1.345e1 float(26.6439955712352)
-Y:23 X: float(23)
-
Y:23 X:1 float(23.0217288664427)
Y:23 X: float(23)
Y:23 X:1.345e1 float(26.6439955712352)
-Y:23 X: float(23)
-
Y:23 X:1 float(23.0217288664427)
Y:23 X: float(23)
Y:23.45 X:1.345e1 float(27.033405260899)
-Y:23.45 X: float(23.45)
-
Y:23.45 X:1 float(23.4713122769052)
Y:23.45 X: float(23.45)
Y:2.345e1 X:1.345e1 float(27.033405260899)
-Y:2.345e1 X: float(23.45)
-
Y:2.345e1 X:1 float(23.4713122769052)
Y:2.345e1 X: float(23.45)
-Y: X:33 float(33)
-
-Y: X:-33 float(33)
-
-Y: X:33.45 float(33.45)
-
-Y: X:-33.45 float(33.45)
-
-Y: X:39 float(39)
-
-Y: X:31 float(31)
-
-Y: X:33 float(33)
-
-Y: X:43.45 float(43.45)
-
-Y: X:1.345e1 float(13.45)
-
-Y: X: float(0)
-
-Y: X:1 float(1)
-
-Y: X: float(0)
-
Y:1 X:33 float(33.0151480384384)
Y:1 X:-33 float(33.0151480384384)
Y:1 X:1.345e1 float(13.4871234887206)
-Y:1 X: float(1)
-
Y:1 X:1 float(1.4142135623731)
Y:1 X: float(1)
Y: X:1.345e1 float(13.45)
-Y: X: float(0)
-
Y: X:1 float(1)
Y: X: float(0)
"234",
"234.5",
"23.45e1",
- null,
true,
false,
pow(0, -2),
bool(true)
bool(true)
bool(true)
-bool(true)
bool(false)
bool(false)
"234",
"234.5",
"23.45e1",
- null,
true,
false,
pow(0, -2),
bool(false)
bool(false)
bool(false)
-bool(false)
bool(true)
bool(false)
"234",
"234.5",
"23.45e1",
- null,
true,
false,
pow(0, -2),
bool(false)
bool(false)
bool(false)
-bool(false)
bool(true)
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(1.3701428470511021)
float(1.3701428470511021)
float(3)
-float(-INF)
float(0)
float(-INF)
"23",
"23.45",
"2.345e1",
- null,
true,
false);
-- log1p 2.345e1 --
float(3.196630215920881)
--- log1p --
-float(0)
-
-- log1p 1 --
float(0.6931471805599453)
"23",
"23.45",
"2.345e1",
- null,
true,
false);
float(3.1354942159291497)
float(3.1548704948922883)
float(3.1548704948922883)
-float(-INF)
float(0)
float(-INF)
float(2.2617809780285065)
float(2.275758008814007)
float(2.275758008814007)
-float(-INF)
float(0)
float(-INF)
echo "\nNon-numeric cases\n";
$min = array(true,
false,
- null,
"10",
"10.5");
Non-numeric cases
PASSED range min = 1 max = 100
PASSED range min = 0 max = 100
-PASSED range min = 0 max = 100
PASSED range min = 10 max = 100
PASSED range min = 10 max = 100
var_dump(mt_srand("500E3"));
var_dump(mt_srand(true));
var_dump(mt_srand(false));
-var_dump(mt_srand(NULL));
?>
--EXPECT--
NULL
NULL
NULL
NULL
-NULL
"123456789",
"123.456789",
"12.3456789e1",
- null,
true,
false);
}
?>
--EXPECT--
- number_format tests.....default
+number_format tests.....default
string(5) "1,235"
string(6) "-1,235"
string(10) "12,346,578"
string(11) "123,456,789"
string(3) "123"
string(3) "123"
-string(1) "0"
string(1) "1"
string(1) "0"
string(14) "123,456,789.00"
string(6) "123.46"
string(6) "123.46"
-string(4) "0.00"
string(4) "1.00"
string(4) "0.00"
string(14) "123 456 789.00"
string(6) "123.46"
string(6) "123.46"
-string(4) "0.00"
string(4) "1.00"
string(4) "0.00"
string(14) "123 456 789,00"
string(6) "123,46"
string(6) "123,46"
-string(4) "0,00"
string(4) "1,00"
string(4) "0,00"
"123456789",
"123.456789",
"12.3456789e1",
- null,
true,
false);
}
?>
--EXPECT--
- number_format tests.....multiple character decimal point
+number_format tests.....multiple character decimal point
string(13) "1 234·57"
string(14) "-1 234·57"
string(18) "12 346 578·00"
string(19) "123 456 789·00"
string(11) "123·46"
string(11) "123·46"
-string(9) "0·00"
string(9) "1·00"
string(9) "0·00"
string(28) "123 456 789.00"
string(6) "123.46"
string(6) "123.46"
-string(4) "0.00"
string(4) "1.00"
string(4) "0.00"
string(33) "123 456 789·00"
string(11) "123·46"
string(11) "123·46"
-string(9) "0·00"
string(9) "1·00"
string(9) "0·00"
31.1013e5,
true,
false,
- null);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = octdec($values[$i]);
int(823384)
int(1)
int(0)
-int(0)
31.1013e5,
true,
false,
- null);
+ );
for ($i = 0; $i < count($values); $i++) {
$res = octdec($values[$i]);
int(823384)
int(1)
int(0)
-int(0)
--FILE--
<?php
echo "*** Testing octdec() : usage variations ***\n";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
// heredoc string
$heredoc = <<<EOT
12.3456789000E-10,
.5,
- // null data
-/*12*/ NULL,
- null,
-
// boolean data
/*14*/ true,
false,
'abcxyz',
$heredoc,
- // undefined data
-/*24*/ @$undefined_var,
-
- // unset data
-/*25*/ @$unset_var,
-
// resource variable
/*26*/ $fp
);
int(5)
-- Iteration 12 --
-int(0)
+int(1)
-- Iteration 13 --
int(0)
int(0)
-- Iteration 16 --
-int(1)
+int(0)
-- Iteration 17 --
int(0)
-- Iteration 18 --
-int(0)
-
--- Iteration 19 --
-int(0)
-
--- Iteration 20 --
octdec(): Argument #1 ($octal_string) must be of type string, array given
--- Iteration 21 --
+-- Iteration 19 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(0)
--- Iteration 22 --
+-- Iteration 20 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(0)
--- Iteration 23 --
+-- Iteration 21 --
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
int(0)
--- Iteration 24 --
-int(0)
-
--- Iteration 25 --
-int(0)
-
--- Iteration 26 --
+-- Iteration 22 --
octdec(): Argument #1 ($octal_string) must be of type string, resource given
---Done---
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(1343.5860295817804)
float(1343.5860295817804)
float(57295.77951308232)
-float(0)
float(57.29577951308232)
float(0)
echo "\nNon-numeric cases\n";
$min = array(true,
false,
- null,
"10",
"10.5");
Non-numeric cases
PASSED range min = 1 max = 100
PASSED range min = 0 max = 100
-PASSED range min = 0 max = 100
PASSED range min = 10 max = 100
PASSED range min = 10 max = 100
"04",
"3.6",
"2.1e1",
- null,
true,
false);
...with precision 04-> float(123456789)
...with precision 3.6-> float(123456789)
...with precision 2.1e1-> float(123456789)
-...with precision -> float(123456789)
...with precision 1-> float(123456789)
...with precision -> float(123456789)
round: 123.456789
...with precision 04-> float(123.4568)
...with precision 3.6-> float(123.457)
...with precision 2.1e1-> float(123.456789)
-...with precision -> float(123)
...with precision 1-> float(123.5)
...with precision -> float(123)
round: -4.5679123
...with precision 04-> float(-4.5679)
...with precision 3.6-> float(-4.568)
...with precision 2.1e1-> float(-4.5679123)
-...with precision -> float(-5)
...with precision 1-> float(-4.6)
...with precision -> float(-5)
round: 12300
...with precision 04-> float(12300)
...with precision 3.6-> float(12300)
...with precision 2.1e1-> float(12300)
-...with precision -> float(12300)
...with precision 1-> float(12300)
...with precision -> float(12300)
round: -4567
...with precision 04-> float(-4567)
...with precision 3.6-> float(-4567)
...with precision 2.1e1-> float(-4567)
-...with precision -> float(-4567)
...with precision 1-> float(-4567)
...with precision -> float(-4567)
round: 2311527
...with precision 04-> float(2311527)
...with precision 3.6-> float(2311527)
...with precision 2.1e1-> float(2311527)
-...with precision -> float(2311527)
...with precision 1-> float(2311527)
...with precision -> float(2311527)
round: 14680063
...with precision 04-> float(14680063)
...with precision 3.6-> float(14680063)
...with precision 2.1e1-> float(14680063)
-...with precision -> float(14680063)
...with precision 1-> float(14680063)
...with precision -> float(14680063)
round: 1.234567
...with precision 04-> float(1.2346)
...with precision 3.6-> float(1.235)
...with precision 2.1e1-> float(1.234567)
-...with precision -> float(1)
...with precision 1-> float(1.2)
...with precision -> float(1)
round: 2.3456789e8
...with precision 04-> float(234567890)
...with precision 3.6-> float(234567890)
...with precision 2.1e1-> float(234567890)
-...with precision -> float(234567890)
...with precision 1-> float(234567890)
...with precision -> float(234567890)
};
fclose($fp);
?>
---EXPECT--
+--EXPECTF--
*** Testing round() : usage variations ***
-- Iteration 1 --
float(0.5)
-- Iteration 11 --
+
+Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 12 --
+
+Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 13 --
round(): Argument #1 ($num) must be of type int|float, classA given
-- Iteration 24 --
+
+Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 25 --
+
+Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
float(0)
-- Iteration 26 --
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(-0.9937407102)
float(-0.9937407102)
float(0.8268795405)
-float(0)
float(0.8414709848)
float(0)
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(7641446995)
float(7641446995)
float(INF)
-float(0)
float(1.175201194)
float(0)
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(4.8425200051213)
float(4.8425200051213)
float(31.622776601683793)
-float(0)
float(1)
float(0)
var_dump(srand("500E3"));
var_dump(srand(true));
var_dump(srand(false));
-var_dump(srand(NULL));
?>
--EXPECT--
*** Testing srand() : basic functionality ***
NULL
NULL
NULL
-NULL
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(8.895619796)
float(8.895619796)
float(1.470324156)
-float(0)
float(1.557407725)
float(0)
"23.45",
"2.345e1",
"1000",
- null,
true,
false);
float(1)
float(1)
float(1)
-float(0)
float(0.7615941559557649)
float(0)
echo "OK!";
?>
---EXPECT--
+--EXPECTF--
bool(false)
bool(false)
bool(false)
bool(true)
+
+Deprecated: password_verify(): Passing null to parameter #2 ($hash) of type string is deprecated in %s on line %d
bool(false)
bool(true)
bool(false)
/* paths with shortcut home dir char, with suffix variation */
array("~/home/user/bar"),
array("~/home/user/bar", ""),
- array("~/home/user/bar", NULL),
array("~/home/user/bar", ' '),
array("~/home/user/bar.tar", ".tar"),
array("~/home/user/bar.tar", "~"),
array("~/home/user/bar.tar/", "~"),
array("~/home/user/bar.tar/", ""),
- array("~/home/user/bar.tar", NULL),
array("~/home/user/bar.tar", ''),
array("~/home/user/bar.tar", " "),
array("hostname:/home/user/My Pics.gz/", "Pics.gz"),
array("hostname:/home/user/My Pics.gz/", ".gz"),
array("hostname:/home/user/My Pics.gz/"),
- array("hostname:/home/user/My Pics.gz/", NULL),
array("hostname:/home/user/My Pics.gz/", ' '),
array("hostname:/home/user/My Pics.gz/", ''),
array("hostname:/home/user/My Pics.gz/", "My Pics.gz"),
array("/bar.gz/", "/bar.gz/"),
array(" ", " "),
array(' ', ' '),
- array(NULL, NULL),
/* path with spaces */
array(" "),
/* empty paths */
array(""),
array(''),
- array(NULL),
);
function check_basename( $path_arrays ) {
string(3) "bar"
--Iteration 5--
-string(3) "bar"
+string(7) "bar.tar"
--Iteration 6--
string(7) "bar.tar"
string(7) "bar.tar"
--Iteration 12--
-string(7) "bar.tar"
+string(1) "t"
--Iteration 13--
-string(7) "bar.tar"
+string(7) "tbar.gz"
--Iteration 14--
-string(1) "t"
+string(7) "tbar.gz"
--Iteration 15--
string(7) "tbar.gz"
string(7) "tbar.gz"
--Iteration 17--
-string(7) "tbar.gz"
+string(10) "My Pics.gz"
--Iteration 18--
-string(7) "tbar.gz"
+string(10) "My Pics.gz"
--Iteration 19--
-string(10) "My Pics.gz"
+string(3) "My "
--Iteration 20--
-string(10) "My Pics.gz"
+string(7) "My Pics"
--Iteration 21--
-string(3) "My "
+string(10) "My Pics.gz"
--Iteration 22--
-string(7) "My Pics"
+string(10) "My Pics.gz"
--Iteration 23--
string(10) "My Pics.gz"
string(10) "My Pics.gz"
--Iteration 25--
-string(10) "My Pics.gz"
+string(4) "10.5"
--Iteration 26--
-string(10) "My Pics.gz"
+string(2) "10"
--Iteration 27--
-string(10) "My Pics.gz"
+string(4) "10.5"
--Iteration 28--
-string(4) "10.5"
+string(2) "10"
--Iteration 29--
string(2) "10"
string(4) "10.5"
--Iteration 31--
-string(2) "10"
+string(4) "10.5"
--Iteration 32--
-string(2) "10"
+string(5) "10.gz"
--Iteration 33--
-string(4) "10.5"
+string(1) "0"
--Iteration 34--
-string(4) "10.5"
+string(1) "0"
--Iteration 35--
-string(5) "10.gz"
+string(6) "bar.gz"
--Iteration 36--
-string(1) "0"
+string(6) "bar.gz"
--Iteration 37--
-string(1) "0"
+string(6) "bar.gz"
--Iteration 38--
-string(6) "bar.gz"
+string(1) " "
--Iteration 39--
-string(6) "bar.gz"
+string(1) " "
--Iteration 40--
-string(6) "bar.gz"
+string(1) " "
--Iteration 41--
string(1) " "
--Iteration 42--
-string(1) " "
-
---Iteration 43--
string(0) ""
---Iteration 44--
-string(1) " "
-
---Iteration 45--
-string(1) " "
-
---Iteration 46--
-string(0) ""
-
---Iteration 47--
-string(0) ""
-
---Iteration 48--
+--Iteration 43--
string(0) ""
Done
Bug #20934 (html_entity_decode() crash when "" is passed)
--FILE--
<?php
- var_dump(html_entity_decode(NULL));
- var_dump(html_entity_decode(""));
+var_dump(html_entity_decode(""));
?>
--EXPECT--
string(0) ""
-string(0) ""
var_dump(parse_ini_string('a='.PHP_EOL));
var_dump(parse_ini_string('a=b '));
var_dump(parse_ini_string(''));
-var_dump(parse_ini_string(NULL));
var_dump(parse_ini_string("\0"));
?>
}
array(0) {
}
-array(0) {
-}
var_dump ( chop("chop test \t\0 ") ); /* without second Argument */
var_dump ( chop("chop test " , "") ); /* no characters in second Argument */
- var_dump ( chop("chop test ", NULL) ); /* with NULL as second Argument */
var_dump ( chop("chop test ", true) ); /* with boolean value as second Argument */
var_dump ( chop("chop test ", " ") ); /* with single space as second Argument */
var_dump ( chop("chop test \t\n\r\0\x0B", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */
string(9) "chop test"
string(12) "chop test "
string(17) "chop test "
-string(17) "chop test "
string(9) "chop test"
string(10) "chop test "
string(9) "chop test"
echo "*** Testing chr() function: with unexpected inputs for 'ascii' argument ***\n";
-//get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
//defining a class
class sample {
public function __toString() {
false,
TRUE,
FALSE,
-
- // null values
-/*15*/ NULL,
- null,
-
- // undefined variable
-/*19*/ @$undefined_var,
-
- // unset variable
-/*20*/ @$unset_var
);
// loop through with each element of the $inputs array to test chr() function
string(2) "01"
-- Iteration 11 --
string(2) "00"
--- Iteration 12 --
-string(2) "00"
--- Iteration 13 --
-string(2) "00"
--- Iteration 14 --
-string(2) "00"
--- Iteration 15 --
-string(2) "00"
/* empty path */
"",
'',
- NULL,
- null
);
function check_dirname( $paths ) {
--Iteration 22 --
string\(0\) ""
-
---Iteration 23 --
-string\(0\) ""
-
---Iteration 24 --
-string\(0\) ""
Done
/* giving arguments as NULL */
echo "\n*** Testing htmlentities() with NULL as first,second and third argument ***\n";
-var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", NULL, 'cp1252') );
var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", ENT_QUOTES, NULL) ); /* UTF-8 assumed */
var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", ENT_NOQUOTES, NULL) ); /* UTF-8 assumed */
var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", ENT_COMPAT, NULL) ); /* UTF-8 assumed */
-var_dump( htmlentities(NULL, NULL, NULL) );
/* giving long string to check for proper memory re-allocation */
echo "\n*** Checking for proper memory allocation with long string ***\n";
string(16) "6368722832353529"
*** Testing htmlentities() with NULL as first,second and third argument ***
-string(42) "‚†™Ÿ€‚\81"
-string(0) ""
string(0) ""
string(0) ""
string(0) ""
/* giving NULL as the argument */
echo "\n*** Testing htmlspecialchars() with NULL as first, second and third argument ***\n";
-var_dump( htmlspecialchars("<br>", NULL, 'iso-8859-1') );
var_dump( htmlspecialchars("<br>", ENT_NOQUOTES, NULL) );
var_dump( htmlspecialchars("<br>", ENT_QUOTES, NULL) );
var_dump( htmlspecialchars("<br>", ENT_COMPAT, NULL) );
-var_dump( htmlspecialchars(NULL, NULL, NULL) );
/* giving long string to check for proper memory re-allocation */
echo "\n*** Checking a long string for proper memory allocation ***\n";
string(10) "<br>"
string(10) "<br>"
string(10) "<br>"
-string(10) "<br>"
-string(0) ""
*** Checking a long string for proper memory allocation ***
string(187) "<br>Testing<p>New file.</p><p><br>File <b><i><u>WORKS!!!</i></u></b></p><br><p>End of file!!!</p>"
// initialize all required variables
$pieces = array("element1", "element2");
-// get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
// get a resource variable
$fp = fopen(__FILE__, "r");
"",
'',
- // null values
- NULL,
- null,
-
// resource variable
$fp,
-
- // undefined variable
- @$undefined_var,
-
- // unset variable
- @$unset_var
);
-- Iteration 21 --
string(16) "element1element2"
-- Iteration 22 --
-string(16) "element1element2"
--- Iteration 23 --
-string(16) "element1element2"
--- Iteration 24 --
join(): Argument #1 ($separator) must be of type array|string, resource given
--- Iteration 25 --
-string(16) "element1element2"
--- Iteration 26 --
-string(16) "element1element2"
Done
echo "\n *** Output for Normal Behaviour ***\n";
var_dump ( ltrim(" \t\0 ltrim test") ); /* without second Argument */
var_dump ( ltrim(" ltrim test" , "") ); /* no characters in second Argument */
- var_dump ( ltrim(" ltrim test", NULL) ); /* with NULL as second Argument */
var_dump ( ltrim(" ltrim test", true) ); /* with boolean value as second Argument */
var_dump ( ltrim(" ltrim test", " ") ); /* with single space as second Argument */
var_dump ( ltrim("\t\n\r\0\x0B ltrim test", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */
var_dump ( ltrim("@$#ltrim test", "#@$") ); /* with some special characters as second Argument */
- echo "\n *** Output for scalar argument) ***\n";
- var_dump( ltrim( 12345 ) ); /* Scalar argument */
-
- echo "\n *** Output for NULL argument) ***\n";
- var_dump( ltrim(NULL) ); /* NULL Argument */
+echo "\n *** Output for scalar argument) ***\n";
+var_dump( ltrim( 12345 ) ); /* Scalar argument */
echo "\nDone\n";
string(10) "ltrim test"
string(13) " ltrim test"
string(18) " ltrim test"
-string(18) " ltrim test"
string(10) "ltrim test"
string(11) " ltrim test"
string(10) "ltrim test"
*** Output for scalar argument) ***
string(5) "12345"
- *** Output for NULL argument) ***
-string(0) ""
-
Done
<?php
var_dump(nl2br("test"));
var_dump(nl2br(""));
- var_dump(nl2br(NULL));
var_dump(nl2br("\r\n"));
var_dump(nl2br("\n"));
var_dump(nl2br("\r"));
--EXPECT--
string(4) "test"
string(0) ""
-string(0) ""
string(8) "<br />
"
string(7) "<br />
"123456789",
"123.456789",
"12.3456789e1",
- null,
true,
false);
string(11) "123,456,789"
string(3) "123"
string(3) "123"
-string(1) "0"
string(1) "1"
string(1) "0"
string(14) "123,456,789.00"
string(6) "123.46"
string(6) "123.46"
-string(4) "0.00"
string(4) "1.00"
string(4) "0.00"
string(14) "123 456 789.00"
string(6) "123.46"
string(6) "123.46"
-string(4) "0.00"
string(4) "1.00"
string(4) "0.00"
string(14) "123 456 789,00"
string(6) "123,46"
string(6) "123,46"
-string(4) "0,00"
string(4) "1,00"
string(4) "0,00"
echo "\n*** Output for scalar argument ***\n";
printf(3);
-/* NULL argument */
-echo "\n*** Output for NULL as argument ***\n";
-printf(NULL);
-
-
/* Float type variations */
$counter = 1;
Error found: 5 arguments are required, 3 given
*** Output for scalar argument ***
3
-*** Output for NULL as argument ***
-
*** Output for float type ***
echo "\n*** Output for scalar argument ***\n";
printf(3);
-/* NULL argument */
-echo "\n*** Output for NULL as argument ***\n";
-printf(NULL);
-
-
/* Float type variations */
$counter = 1;
Error found: 5 arguments are required, 3 given
*** Output for scalar argument ***
3
-*** Output for NULL as argument ***
-
*** Output for float type ***
+++ /dev/null
---TEST--
-Test printf() function : usage variations - unexpected values for format argument
---FILE--
-<?php
-/*
-* Testing printf() : with different unexpected values for format argument other than the strings
-*/
-
-echo "*** Testing printf() : with unexpected values for format argument ***\n";
-
-// initialing required variables
-$arg1 = "second arg";
-$arg2 = "third arg";
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// declaring class
-class sample
-{
- public function __toString() {
- return "Object";
- }
-}
-
-// creating a file resource
-$file_handle = fopen(__FILE__, 'r');
-
-//array of values to iterate over
-$values = array(
-
- // int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // float data
-/*5*/ 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
-
- // array data
-/*10*/ array(),
- array(0),
- array(1),
- array(1, 2),
- array('color' => 'red', 'item' => 'pen'),
-
- // null data
-/*15*/ NULL,
- null,
-
- // boolean data
-/*17*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
-/*21*/ "",
- '',
-
- // object data
-/*23*/ new sample(),
-
- // undefined data
-/*24*/ @$undefined_var,
-
- // unset data
-/*25*/ @$unset_var,
-
- // resource data
-/*26*/ $file_handle
-);
-
-// loop through each element of the array for format
-
-$count = 1;
-foreach($values as $value) {
- echo "\n-- Iteration $count --\n";
-
- // with default argument
- try {
- $result = printf($value);
- echo "\n";
- var_dump($result);
- } catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
- }
-
- // with two arguments
- try {
- $result = printf($value, $arg1);
- echo "\n";
- var_dump($result);
- } catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
- }
-
- // with three arguments
- try {
- $result = printf($value, $arg1, $arg2);
- echo "\n";
- var_dump($result);
- } catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
- }
-
- $count++;
-};
-
-// close the resource
-fclose($file_handle);
-
-?>
---EXPECT--
-*** Testing printf() : with unexpected values for format argument ***
-
--- Iteration 1 --
-0
-int(1)
-0
-int(1)
-0
-int(1)
-
--- Iteration 2 --
-1
-int(1)
-1
-int(1)
-1
-int(1)
-
--- Iteration 3 --
-12345
-int(5)
-12345
-int(5)
-12345
-int(5)
-
--- Iteration 4 --
--2345
-int(5)
--2345
-int(5)
--2345
-int(5)
-
--- Iteration 5 --
-10.5
-int(4)
-10.5
-int(4)
-10.5
-int(4)
-
--- Iteration 6 --
--10.5
-int(5)
--10.5
-int(5)
--10.5
-int(5)
-
--- Iteration 7 --
-101234567000
-int(12)
-101234567000
-int(12)
-101234567000
-int(12)
-
--- Iteration 8 --
-1.07654321E-9
-int(13)
-1.07654321E-9
-int(13)
-1.07654321E-9
-int(13)
-
--- Iteration 9 --
-0.5
-int(3)
-0.5
-int(3)
-0.5
-int(3)
-
--- Iteration 10 --
-printf(): Argument #1 ($format) must be of type string, array given
-printf(): Argument #1 ($format) must be of type string, array given
-printf(): Argument #1 ($format) must be of type string, array given
-
--- Iteration 11 --
-printf(): Argument #1 ($format) must be of type string, array given
-printf(): Argument #1 ($format) must be of type string, array given
-printf(): Argument #1 ($format) must be of type string, array given
-
--- Iteration 12 --
-printf(): Argument #1 ($format) must be of type string, array given
-printf(): Argument #1 ($format) must be of type string, array given
-printf(): Argument #1 ($format) must be of type string, array given
-
--- Iteration 13 --
-printf(): Argument #1 ($format) must be of type string, array given
-printf(): Argument #1 ($format) must be of type string, array given
-printf(): Argument #1 ($format) must be of type string, array given
-
--- Iteration 14 --
-printf(): Argument #1 ($format) must be of type string, array given
-printf(): Argument #1 ($format) must be of type string, array given
-printf(): Argument #1 ($format) must be of type string, array given
-
--- Iteration 15 --
-
-int(0)
-
-int(0)
-
-int(0)
-
--- Iteration 16 --
-
-int(0)
-
-int(0)
-
-int(0)
-
--- Iteration 17 --
-1
-int(1)
-1
-int(1)
-1
-int(1)
-
--- Iteration 18 --
-
-int(0)
-
-int(0)
-
-int(0)
-
--- Iteration 19 --
-1
-int(1)
-1
-int(1)
-1
-int(1)
-
--- Iteration 20 --
-
-int(0)
-
-int(0)
-
-int(0)
-
--- Iteration 21 --
-
-int(0)
-
-int(0)
-
-int(0)
-
--- Iteration 22 --
-
-int(0)
-
-int(0)
-
-int(0)
-
--- Iteration 23 --
-Object
-int(6)
-Object
-int(6)
-Object
-int(6)
-
--- Iteration 24 --
-
-int(0)
-
-int(0)
-
-int(0)
-
--- Iteration 25 --
-
-int(0)
-
-int(0)
-
-int(0)
-
--- Iteration 26 --
-printf(): Argument #1 ($format) must be of type string, resource given
-printf(): Argument #1 ($format) must be of type string, resource given
-printf(): Argument #1 ($format) must be of type string, resource given
var_dump(quoted_printable_encode("test"));
var_dump(quoted_printable_encode(1));
-var_dump(quoted_printable_encode(NULL));
var_dump(quoted_printable_encode(false));
echo "Done\n";
string(4) "test"
string(1) "1"
string(0) ""
-string(0) ""
Done
bool(false)
-- NULL as filename --
+
+Deprecated: sha1_file(): Passing null to parameter #1 ($filename) of type string is deprecated in %s on line %d
Path cannot be empty
-- Hexadecimal Output for Empty file as Argument --
$arg1 = "second arg";
$arg2 = "third arg";
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
// declaring class
class sample
{
array(1, 2),
array('color' => 'red', 'item' => 'pen'),
- // null data
- NULL,
- null,
-
// boolean data
true,
false,
// object data
new sample(),
- // undefined data
- @$undefined_var,
-
- // unset data
- @$unset_var,
-
// resource data
$file_handle
);
sprintf(): Argument #1 ($format) must be of type string, array given
-- Iteration 15 --
-string(0) ""
-string(0) ""
-string(0) ""
+string(1) "1"
+string(1) "1"
+string(1) "1"
-- Iteration 16 --
string(0) ""
string(0) ""
-- Iteration 19 --
-string(1) "1"
-string(1) "1"
-string(1) "1"
-
--- Iteration 20 --
-string(0) ""
-string(0) ""
-string(0) ""
-
--- Iteration 21 --
string(0) ""
string(0) ""
string(0) ""
--- Iteration 22 --
+-- Iteration 20 --
string(0) ""
string(0) ""
string(0) ""
--- Iteration 23 --
+-- Iteration 21 --
string(6) "Object"
string(6) "Object"
string(6) "Object"
--- Iteration 24 --
-string(0) ""
-string(0) ""
-string(0) ""
-
--- Iteration 25 --
-string(0) ""
-string(0) ""
-string(0) ""
-
--- Iteration 26 --
+-- Iteration 22 --
sprintf(): Argument #1 ($format) must be of type string, resource given
sprintf(): Argument #1 ($format) must be of type string, resource given
sprintf(): Argument #1 ($format) must be of type string, resource given
print "-----\n";
var_dump(str_getcsv('" "" "', ' '));
print "-----\n";
-var_dump(str_getcsv(NULL));
-print "-----\n";
var_dump(str_getcsv(''));
print "-----\n";
NULL
}
-----
-array(1) {
- [0]=>
- NULL
-}
------
$input_strings = array(
"variation", // normal string
"", // empty string
- NULL, // NULL
true, // boolean
15, // numeric
15.55, // numeric
echo "\n#### error conditions ####\n";
-echo "\n--- padding string as null ---\n";
-
-try {
- str_pad($input_string, 12, NULL);
-} catch (\ValueError $e) {
- echo $e->getMessage() . "\n";
-}
+echo "\n--- empty padding string ---\n";
try {
str_pad($input_string, 12, "");
string(16) "================"
string(16) "================"
string(16) "================"
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
-string(9) " "
-string(9) "========="
-string(9) "========="
-string(9) "========="
-string(9) "========="
-string(10) " "
-string(10) "=========="
-string(10) "=========="
-string(10) "=========="
-string(10) "=========="
-string(16) " "
-string(16) "================"
-string(16) "================"
-string(16) "================"
-string(16) "================"
string(1) "1"
string(1) "1"
string(1) "1"
#### error conditions ####
---- padding string as null ---
-str_pad(): Argument #3 ($pad_string) must be a non-empty string
+--- empty padding string ---
str_pad(): Argument #3 ($pad_string) must be a non-empty string
str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH
-- Iteration 8 --
+Deprecated: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated in %s on line %d
+
Warning: Array to string conversion in %s on line %d
array(12) {
[0]=>
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, ""));
+var_dump(str_word_count($str2, 0, "04"));
+var_dump(str_word_count($str2, 0, "01"));
+var_dump(str_word_count($str2, 0, "014"));
+var_dump(str_word_count($str2, 0, ""));
var_dump(str_word_count($str2, 1, "04"));
var_dump(str_word_count($str2, 1, "01"));
var_dump(str_word_count($str2, 1, "014"));
//nulls
"\0",
- NULL,
- null,
//boolean false
FALSE,
int(0)
int(13)
-- Iteration 15 --
-int(0)
-int(14)
--- Iteration 16 --
-int(0)
-int(15)
--- Iteration 17 --
int(10)
int(47)
--- Iteration 18 --
+-- Iteration 16 --
int(12)
bool(false)
--- Iteration 19 --
+-- Iteration 17 --
int(11)
bool(false)
--- Iteration 20 --
+-- Iteration 18 --
int(13)
bool(false)
--- Iteration 21 --
+-- Iteration 19 --
int(14)
bool(false)
--- Iteration 22 --
+-- Iteration 20 --
int(16)
bool(false)
--- Iteration 23 --
+-- Iteration 21 --
int(17)
bool(false)
--- Iteration 24 --
+-- Iteration 22 --
int(20)
bool(false)
--- Iteration 25 --
+-- Iteration 23 --
int(22)
-bool(false)
--- Iteration 26 --
+int(22)
+-- Iteration 24 --
int(23)
-bool(false)
--- Iteration 27 --
+int(23)
+-- Iteration 25 --
int(24)
-bool(false)
--- Iteration 28 --
+int(24)
+-- Iteration 26 --
int(25)
-bool(false)
--- Iteration 29 --
+int(25)
+-- Iteration 27 --
bool(false)
bool(false)
--- Iteration 30 --
+-- Iteration 28 --
int(27)
-bool(false)
--- Iteration 31 --
+int(27)
+-- Iteration 29 --
int(28)
-bool(false)
--- Iteration 32 --
+int(28)
+-- Iteration 30 --
int(29)
-bool(false)
--- Iteration 33 --
+int(29)
+-- Iteration 31 --
int(31)
-bool(false)
--- Iteration 34 --
+int(31)
+-- Iteration 32 --
int(30)
bool(false)
--- Iteration 35 --
+-- Iteration 33 --
int(32)
-bool(false)
--- Iteration 36 --
+int(32)
+-- Iteration 34 --
int(33)
-bool(false)
--- Iteration 37 --
+int(33)
+-- Iteration 35 --
int(33)
bool(false)
--- Iteration 38 --
+-- Iteration 36 --
int(39)
int(39)
--- Iteration 39 --
+-- Iteration 37 --
int(15)
int(48)
--- Iteration 40 --
+-- Iteration 38 --
int(15)
int(48)
--- Iteration 41 --
+-- Iteration 39 --
int(51)
int(51)
--- Iteration 42 --
+-- Iteration 40 --
int(51)
int(51)
--- Iteration 43 --
+-- Iteration 41 --
bool(false)
bool(false)
--- Iteration 44 --
+-- Iteration 42 --
int(0)
bool(false)
*** Done ***
+++ /dev/null
---TEST--
-Test stripos() function : usage variations - unexpected inputs for 'needle' argument
---FILE--
-<?php
-/* Test stripos() function with unexpected inputs for 'needle' and
- * an expected type of input for 'haystack' argument
-*/
-
-echo "*** Testing stripos() function with unexpected values for needle ***\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");
-
-$haystack = "string 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource";
-
-// array with different values
-$needles = array (
-
- // integer values
- 0,
- 1,
- 12345,
- -2345,
-
- // float values
- 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-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 'needle' array to check the working of stripos()
-$counter = 1;
-for($index = 0; $index < count($needles); $index ++) {
- echo "\n-- Iteration $counter --\n";
- try {
- var_dump( stripos($haystack, $needles[$index]) );
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- $counter ++;
-}
-
-fclose($file_handle); //closing the file handle
-
-echo "*** Done ***";
-?>
---EXPECT--
-*** Testing stripos() function with unexpected values for needle ***
-
--- Iteration 1 --
-int(7)
-
--- Iteration 2 --
-int(9)
-
--- Iteration 3 --
-bool(false)
-
--- Iteration 4 --
-bool(false)
-
--- Iteration 5 --
-int(16)
-
--- Iteration 6 --
-int(21)
-
--- Iteration 7 --
-bool(false)
-
--- Iteration 8 --
-bool(false)
-
--- Iteration 9 --
-int(17)
-
--- Iteration 10 --
-stripos(): Argument #2 ($needle) must be of type string, array given
-
--- Iteration 11 --
-stripos(): Argument #2 ($needle) must be of type string, array given
-
--- Iteration 12 --
-stripos(): Argument #2 ($needle) must be of type string, array given
-
--- Iteration 13 --
-stripos(): Argument #2 ($needle) must be of type string, array given
-
--- Iteration 14 --
-stripos(): Argument #2 ($needle) must be of type string, array given
-
--- Iteration 15 --
-int(9)
-
--- Iteration 16 --
-int(0)
-
--- Iteration 17 --
-int(9)
-
--- Iteration 18 --
-int(0)
-
--- Iteration 19 --
-int(64)
-
--- Iteration 20 --
-int(0)
-
--- Iteration 21 --
-int(0)
-
--- Iteration 22 --
-int(0)
-
--- Iteration 23 --
-int(0)
-
--- Iteration 24 --
-stripos(): Argument #2 ($needle) must be of type string, resource given
-
--- Iteration 25 --
-int(0)
-
--- Iteration 26 --
-int(0)
-*** Done ***
+++ /dev/null
---TEST--
-Test stripos() function : usage variations - unexpected inputs for 'haystack' and 'needle' arguments
---FILE--
-<?php
-/* Test stripos() function with unexpected inputs for 'haystack' and 'needle' arguments */
-
-echo "*** Testing stripos() function with unexpected values for haystack and needle ***\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 stripos()
-$counter = 1;
-for($index = 0; $index < count($values); $index ++) {
- echo "-- Iteration $counter --\n";
- $haystack = $values[$index];
- try {
- var_dump( stripos($values[$index], $values[$index]) );
- } catch (Error $e) {
- echo get_class($e) . ": " . $e->getMessage(), "\n";
- }
- try {
- var_dump( stripos($values[$index], $values[$index], 1) );
- } catch (Error $e) {
- echo get_class($e) . ": " . $e->getMessage(), "\n";
- }
- $counter ++;
-}
-
-echo "*** Done ***";
-?>
---EXPECT--
-*** Testing stripos() function with unexpected values for haystack and needle ***
--- Iteration 1 --
-int(0)
-bool(false)
--- Iteration 2 --
-int(0)
-bool(false)
--- Iteration 3 --
-int(0)
-bool(false)
--- Iteration 4 --
-int(0)
-bool(false)
--- Iteration 5 --
-int(0)
-bool(false)
--- Iteration 6 --
-int(0)
-bool(false)
--- Iteration 7 --
-int(0)
-bool(false)
--- Iteration 8 --
-int(0)
-bool(false)
--- Iteration 9 --
-int(0)
-bool(false)
--- Iteration 10 --
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 11 --
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 12 --
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 13 --
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 14 --
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 15 --
-int(0)
-bool(false)
--- Iteration 16 --
-int(0)
-ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 17 --
-int(0)
-bool(false)
--- Iteration 18 --
-int(0)
-ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 19 --
-int(0)
-bool(false)
--- Iteration 20 --
-int(0)
-ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 21 --
-int(0)
-ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 22 --
-int(0)
-ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 23 --
-int(0)
-ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 24 --
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, resource given
-TypeError: stripos(): Argument #1 ($haystack) must be of type string, resource given
--- Iteration 25 --
-int(0)
-ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 26 --
-int(0)
-ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-*** Done ***
//nulls
'\0',
- NULL,
- null,
//boolean false
FALSE,
int(0)
int(13)
-- Iteration 15 --
-int(0)
int(14)
--- Iteration 16 --
-int(0)
-int(15)
--- Iteration 17 --
int(14)
-int(51)
--- Iteration 18 --
+-- Iteration 16 --
int(16)
-bool(false)
--- Iteration 19 --
+int(16)
+-- Iteration 17 --
int(15)
bool(false)
--- Iteration 20 --
+-- Iteration 18 --
int(17)
-bool(false)
--- Iteration 21 --
+int(17)
+-- Iteration 19 --
int(18)
-bool(false)
--- Iteration 22 --
+int(18)
+-- Iteration 20 --
int(20)
-bool(false)
--- Iteration 23 --
+int(20)
+-- Iteration 21 --
int(21)
-bool(false)
--- Iteration 24 --
+int(21)
+-- Iteration 22 --
int(24)
int(24)
--- Iteration 25 --
+-- Iteration 23 --
int(26)
int(26)
--- Iteration 26 --
+-- Iteration 24 --
int(27)
int(27)
--- Iteration 27 --
+-- Iteration 25 --
int(28)
int(28)
--- Iteration 28 --
+-- Iteration 26 --
int(29)
int(29)
--- Iteration 29 --
+-- Iteration 27 --
bool(false)
bool(false)
--- Iteration 30 --
+-- Iteration 28 --
bool(false)
bool(false)
--- Iteration 31 --
+-- Iteration 29 --
int(31)
int(31)
--- Iteration 32 --
+-- Iteration 30 --
int(32)
int(32)
--- Iteration 33 --
+-- Iteration 31 --
int(33)
int(33)
--- Iteration 34 --
+-- Iteration 32 --
int(35)
int(35)
--- Iteration 35 --
+-- Iteration 33 --
int(34)
int(34)
--- Iteration 36 --
+-- Iteration 34 --
int(36)
int(36)
--- Iteration 37 --
+-- Iteration 35 --
int(37)
int(37)
--- Iteration 38 --
+-- Iteration 36 --
int(37)
int(37)
--- Iteration 39 --
+-- Iteration 37 --
int(43)
int(43)
--- Iteration 40 --
+-- Iteration 38 --
int(52)
int(52)
--- Iteration 41 --
+-- Iteration 39 --
int(19)
bool(false)
--- Iteration 42 --
+-- Iteration 40 --
int(58)
int(58)
--- Iteration 43 --
+-- Iteration 41 --
bool(false)
bool(false)
--- Iteration 44 --
+-- Iteration 42 --
bool(false)
bool(false)
--- Iteration 45 --
+-- Iteration 43 --
bool(false)
bool(false)
--- Iteration 46 --
+-- Iteration 44 --
int(0)
bool(false)
*** Done ***
+++ /dev/null
---TEST--
-Test stripos() function : usage variations - empty heredoc string for 'haystack' argument
---FILE--
-<?php
-/* Test stripos() function by passing empty heredoc string for haystack
- * and with various needles & offsets
-*/
-
-echo "*** Testing stripos() function: with heredoc strings ***\n";
-echo "-- With empty heredoc string --\n";
-$empty_string = <<<EOD
-EOD;
-var_dump( stripos($empty_string, "") );
-
-try {
- stripos($empty_string, "", 1);
-} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
-}
-var_dump( stripos($empty_string, FALSE) );
-var_dump( stripos($empty_string, NULL) );
-
-echo "*** Done ***";
-?>
---EXPECT--
-*** Testing stripos() function: with heredoc strings ***
--- With empty heredoc string --
-int(0)
-stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-int(0)
-int(0)
-*** Done ***
echo "*** Testing stristr() function: with unexpected inputs for 'needle' argument ***\n";
-//get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
//defining a class
class sample {
public function __toString() {
TRUE,
FALSE,
- // null values
-/*15*/ NULL,
- null,
-
// objects
/*17*/ new sample(),
// resource
/*18*/ $file_handle,
-
- // undefined variable
-/*19*/ @$undefined_var,
-
- // unset variable
-/*20*/ @$unset_var
);
//defining '$pad_length' argument
-- Iteration 14 --
string(11) "Hello World"
-- Iteration 15 --
-string(11) "Hello World"
--- Iteration 16 --
-string(11) "Hello World"
--- Iteration 17 --
bool(false)
--- Iteration 18 --
+-- Iteration 16 --
stristr(): Argument #2 ($needle) must be of type string, resource given
--- Iteration 19 --
-string(11) "Hello World"
--- Iteration 20 --
-string(11) "Hello World"
+++ /dev/null
---TEST--
-Test strrchr() function : usage variations - unexpected inputs for needle
---FILE--
-<?php
-/* Test strrchr() function: with unexpected inputs for needle
- * and expected type for haystack
-*/
-
-echo "*** Testing strrchr() function with unexpected inputs for needle ***\n";
-
-// get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
-// declaring a class
-class sample {
- public function __toString() {
- return "object";
- }
-}
-
-//getting the resource
-$file_handle = fopen(__FILE__, "r");
-
-$haystacks = array (
- //integer numeric strings
- "0",
- "1",
- "2",
- "-2",
-
- //float numeric strings
- "10.5",
- "-10.5",
- "10.5e10",
- "10.6E-10",
- ".5",
-
- //regular strings
- "array",
- "a",
- "r",
- "y",
- "ay",
- "true",
- "false",
- "TRUE",
- "FALSE",
- "NULL",
- "null",
- "object",
-
- //empty string
- "",
- '',
-
- //resource variable in string form
- "\$file_handle",
-
- //undefined variable in string form
- @"$undefined_var",
- @"$unset_var"
-);
-
-// array with different values
-$needles = array (
-
- // integer values
- 0,
- 1,
- 12345,
- -2345,
-
- // float values
- 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
-
- // array values
- array(),
- array(0),
- array(1),
- array(1, 2),
- array('color' => 'red', 'item' => 'pen'),
-
- // boolean values
- true,
- false,
- TRUE,
- FALSE,
-
- // null values
- NULL,
- null,
-
- // objects
- new sample(),
-
- // empty string
- "",
- '',
-
- // resource
- $file_handle,
-
- // undefined variable
- @$undefined_var,
-
- // unset variable
- @$unset_var
-);
-
-// loop through each element of the array and check the working of strrchr()
-$count = 1;
-for($index = 0; $index < count($haystacks); $index++) {
- echo "-- Iteration $count --\n";
- try {
- var_dump( strrchr($haystacks[$index], $needles[$index]) );
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- $count ++;
-}
-
-fclose($file_handle); //closing the file handle
-
-echo "*** Done ***";
-?>
---EXPECT--
-*** Testing strrchr() function with unexpected inputs for needle ***
--- Iteration 1 --
-string(1) "0"
--- Iteration 2 --
-string(1) "1"
--- Iteration 3 --
-bool(false)
--- Iteration 4 --
-string(2) "-2"
--- Iteration 5 --
-string(4) "10.5"
--- Iteration 6 --
-string(5) "-10.5"
--- Iteration 7 --
-string(2) "10"
--- Iteration 8 --
-string(2) "10"
--- Iteration 9 --
-bool(false)
--- Iteration 10 --
-strrchr(): Argument #2 ($needle) must be of type string, array given
--- Iteration 11 --
-strrchr(): Argument #2 ($needle) must be of type string, array given
--- Iteration 12 --
-strrchr(): Argument #2 ($needle) must be of type string, array given
--- Iteration 13 --
-strrchr(): Argument #2 ($needle) must be of type string, array given
--- Iteration 14 --
-strrchr(): Argument #2 ($needle) must be of type string, array given
--- Iteration 15 --
-bool(false)
--- Iteration 16 --
-bool(false)
--- Iteration 17 --
-bool(false)
--- Iteration 18 --
-bool(false)
--- Iteration 19 --
-bool(false)
--- Iteration 20 --
-bool(false)
--- Iteration 21 --
-string(6) "object"
--- Iteration 22 --
-bool(false)
--- Iteration 23 --
-bool(false)
--- Iteration 24 --
-strrchr(): Argument #2 ($needle) must be of type string, resource given
--- Iteration 25 --
-bool(false)
--- Iteration 26 --
-bool(false)
-*** Done ***
+++ /dev/null
---TEST--
-Test strrchr() function : usage variations - unexpected inputs for haystack and needle
---FILE--
-<?php
-/* Test strrchr() function with unexpected inputs for haystack and needle */
-
-echo "*** Testing strrchr() function: with unexpected inputs for haystack and needle ***\n";
-
-// get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
-// declaring 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.1234567e10,
- 10.7654321E-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 strrchr()
-$counter = 1;
-for($index = 0; $index < count($values); $index ++) {
- echo "-- Iteration $counter --\n";
- try {
- var_dump( strrchr($values[$index], $values[$index]) );
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- $counter ++;
-}
-
-fclose($file_handle); //closing the file handle
-
-echo "*** Done ***";
-?>
---EXPECT--
-*** Testing strrchr() function: with unexpected inputs for haystack and needle ***
--- Iteration 1 --
-string(1) "0"
--- Iteration 2 --
-string(1) "1"
--- Iteration 3 --
-string(5) "12345"
--- Iteration 4 --
-string(5) "-2345"
--- Iteration 5 --
-string(4) "10.5"
--- Iteration 6 --
-string(5) "-10.5"
--- Iteration 7 --
-string(10) "1234567000"
--- Iteration 8 --
-string(4) "1E-9"
--- Iteration 9 --
-string(3) "0.5"
--- Iteration 10 --
-strrchr(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 11 --
-strrchr(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 12 --
-strrchr(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 13 --
-strrchr(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 14 --
-strrchr(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 15 --
-string(1) "1"
--- Iteration 16 --
-bool(false)
--- Iteration 17 --
-string(1) "1"
--- Iteration 18 --
-bool(false)
--- Iteration 19 --
-string(6) "object"
--- Iteration 20 --
-bool(false)
--- Iteration 21 --
-bool(false)
--- Iteration 22 --
-bool(false)
--- Iteration 23 --
-bool(false)
--- Iteration 24 --
-strrchr(): Argument #1 ($haystack) must be of type string, resource given
--- Iteration 25 --
-bool(false)
--- Iteration 26 --
-bool(false)
-*** Done ***
//nulls
'\0',
- NULL,
- null,
//boolean false
FALSE,
bool(false)
-- Iteration 15 --
-bool(false)
+string(1) " "
-- Iteration 16 --
-bool(false)
+string(47) "$&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
-- Iteration 17 --
string(1) " "
-- Iteration 18 --
-string(47) "$&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+string(46) "&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
-- Iteration 19 --
-string(1) " "
+string(45) "!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
-- Iteration 20 --
-string(46) "&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+string(43) "%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
-- Iteration 21 --
-string(45) "!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+string(5) "\101 "
-- Iteration 22 --
-string(43) "%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+string(39) "()*+-./:;<=>?@hello123456he \x234 \101 "
-- Iteration 23 --
-string(5) "\101 "
+string(37) "*+-./:;<=>?@hello123456he \x234 \101 "
-- Iteration 24 --
-string(39) "()*+-./:;<=>?@hello123456he \x234 \101 "
+string(36) "+-./:;<=>?@hello123456he \x234 \101 "
-- Iteration 25 --
-string(37) "*+-./:;<=>?@hello123456he \x234 \101 "
+string(35) "-./:;<=>?@hello123456he \x234 \101 "
-- Iteration 26 --
-string(36) "+-./:;<=>?@hello123456he \x234 \101 "
+string(34) "./:;<=>?@hello123456he \x234 \101 "
-- Iteration 27 --
-string(35) "-./:;<=>?@hello123456he \x234 \101 "
+string(34) "./:;<=>?@hello123456he \x234 \101 "
-- Iteration 28 --
-string(34) "./:;<=>?@hello123456he \x234 \101 "
+string(32) ":;<=>?@hello123456he \x234 \101 "
-- Iteration 29 --
-string(34) "./:;<=>?@hello123456he \x234 \101 "
+string(31) ";<=>?@hello123456he \x234 \101 "
-- Iteration 30 --
-string(32) ":;<=>?@hello123456he \x234 \101 "
+string(30) "<=>?@hello123456he \x234 \101 "
-- Iteration 31 --
-string(31) ";<=>?@hello123456he \x234 \101 "
+string(28) ">?@hello123456he \x234 \101 "
-- Iteration 32 --
-string(30) "<=>?@hello123456he \x234 \101 "
+string(29) "=>?@hello123456he \x234 \101 "
-- Iteration 33 --
-string(28) ">?@hello123456he \x234 \101 "
+string(27) "?@hello123456he \x234 \101 "
-- Iteration 34 --
-string(29) "=>?@hello123456he \x234 \101 "
+string(26) "@hello123456he \x234 \101 "
-- Iteration 35 --
-string(27) "?@hello123456he \x234 \101 "
+string(26) "@hello123456he \x234 \101 "
-- Iteration 36 --
-string(26) "@hello123456he \x234 \101 "
+string(2) "1 "
-- Iteration 37 --
-string(26) "@hello123456he \x234 \101 "
+string(5) "\101 "
-- Iteration 38 --
-string(2) "1 "
+string(44) "#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
-- Iteration 39 --
string(5) "\101 "
-- Iteration 40 --
-string(44) "#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
-
--- Iteration 41 --
-string(5) "\101 "
-
--- Iteration 42 --
bool(false)
--- Iteration 43 --
+-- Iteration 41 --
string(7) "4 \101 "
--- Iteration 44 --
+-- Iteration 42 --
string(7) "4 \101 "
--- Iteration 45 --
+-- Iteration 43 --
string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
*** Done ***
+++ /dev/null
---TEST--
-Test strrchr() function : usage variations - empty heredoc string for 'haystack'
---FILE--
-<?php
-/* Test strrchr() function by passing empty heredoc string for haystack
- * and with various needles
-*/
-
-echo "*** Testing strrchr() function: with heredoc strings ***\n";
-$empty_str = <<<EOD
-EOD;
-
-$needles = array(
- "",
- '',
- FALSE,
- NULL,
- "\0",
- $empty_str //needle as haystack
-);
-
-//loop through to test strrchr() with each needle
-foreach($needles as $needle) {
- var_dump( strrchr($empty_str, $needle) );
-}
-echo "*** Done ***";
-?>
---EXPECT--
-*** Testing strrchr() function: with heredoc strings ***
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-*** Done ***
strrev() function
--FILE--
<?php
- $i = 0;
- $str = '';
+$i = 0;
+$str = '';
- while ($i<256) {
- $str .= chr($i++);
- }
+while ($i<256) {
+ $str .= chr($i++);
+}
- var_dump(md5(strrev($str)));
- var_dump(strrev(NULL));
- var_dump(strrev(""));
+var_dump(md5(strrev($str)));
+var_dump(strrev(""));
?>
--EXPECT--
string(32) "ec6df70f2569891eae50321a9179eb82"
string(0) ""
-string(0) ""
//nulls
/*11*/ "\0",
- NULL,
- null,
//boolean false
/*14*/ FALSE,
int(44)
int(43)
-- Iteration 15 --
-int(44)
-int(44)
-int(44)
int(43)
--- Iteration 16 --
-int(44)
-int(44)
-int(44)
-int(43)
--- Iteration 17 --
int(43)
int(43)
int(43)
-int(43)
--- Iteration 18 --
+-- Iteration 16 --
int(12)
int(12)
bool(false)
int(12)
--- Iteration 19 --
+-- Iteration 17 --
int(11)
int(11)
bool(false)
int(11)
--- Iteration 20 --
+-- Iteration 18 --
int(13)
int(13)
bool(false)
int(13)
--- Iteration 21 --
+-- Iteration 19 --
int(14)
int(14)
bool(false)
int(14)
--- Iteration 22 --
+-- Iteration 20 --
int(17)
int(17)
bool(false)
int(17)
--- Iteration 23 --
+-- Iteration 21 --
int(20)
int(20)
int(20)
int(20)
--- Iteration 24 --
+-- Iteration 22 --
int(22)
int(22)
int(22)
int(22)
--- Iteration 25 --
+-- Iteration 23 --
int(21)
int(21)
int(21)
int(21)
--- Iteration 26 --
+-- Iteration 24 --
int(23)
int(23)
int(23)
int(23)
--- Iteration 27 --
+-- Iteration 25 --
int(24)
int(24)
int(24)
int(24)
--- Iteration 28 --
+-- Iteration 26 --
int(24)
int(24)
int(24)
int(24)
--- Iteration 29 --
+-- Iteration 27 --
int(30)
int(30)
int(30)
int(30)
--- Iteration 30 --
+-- Iteration 28 --
int(39)
int(39)
int(39)
int(39)
--- Iteration 31 --
+-- Iteration 29 --
int(39)
int(39)
int(39)
int(39)
--- Iteration 32 --
+-- Iteration 30 --
int(42)
int(42)
int(42)
int(42)
--- Iteration 33 --
+-- Iteration 31 --
int(42)
int(42)
int(42)
int(42)
--- Iteration 34 --
+-- Iteration 32 --
bool(false)
bool(false)
bool(false)
bool(false)
--- Iteration 35 --
+-- Iteration 33 --
int(0)
bool(false)
bool(false)
//nulls
/*11*/ '\0',
- NULL,
- null,
//boolean false
/*14*/ FALSE,
int(54)
int(53)
-- Iteration 15 --
-int(54)
-int(54)
-int(54)
-int(53)
--- Iteration 16 --
-int(54)
-int(54)
-int(54)
-int(53)
--- Iteration 17 --
int(53)
int(53)
int(53)
int(53)
--- Iteration 18 --
+-- Iteration 16 --
int(16)
int(16)
bool(false)
int(16)
--- Iteration 19 --
+-- Iteration 17 --
int(15)
int(15)
bool(false)
int(15)
--- Iteration 20 --
+-- Iteration 18 --
int(17)
int(17)
bool(false)
int(17)
--- Iteration 21 --
+-- Iteration 19 --
int(18)
int(18)
bool(false)
int(18)
--- Iteration 22 --
+-- Iteration 20 --
int(21)
int(21)
int(21)
int(21)
--- Iteration 23 --
+-- Iteration 21 --
int(24)
int(24)
int(24)
int(24)
--- Iteration 24 --
+-- Iteration 22 --
int(26)
int(26)
int(26)
int(26)
--- Iteration 25 --
+-- Iteration 23 --
int(25)
int(25)
int(25)
int(25)
--- Iteration 26 --
+-- Iteration 24 --
int(27)
int(27)
int(27)
int(27)
--- Iteration 27 --
+-- Iteration 25 --
int(28)
int(28)
int(28)
int(28)
--- Iteration 28 --
+-- Iteration 26 --
int(28)
int(28)
int(28)
int(28)
--- Iteration 29 --
+-- Iteration 27 --
int(34)
int(34)
int(34)
int(34)
--- Iteration 30 --
+-- Iteration 28 --
int(43)
int(43)
int(43)
int(43)
--- Iteration 31 --
+-- Iteration 29 --
int(19)
int(19)
bool(false)
int(19)
--- Iteration 32 --
+-- Iteration 30 --
int(49)
int(49)
int(49)
int(49)
--- Iteration 33 --
+-- Iteration 31 --
bool(false)
bool(false)
bool(false)
bool(false)
--- Iteration 34 --
+-- Iteration 32 --
bool(false)
bool(false)
bool(false)
bool(false)
--- Iteration 35 --
+-- Iteration 33 --
bool(false)
bool(false)
bool(false)
bool(false)
--- Iteration 36 --
+-- Iteration 34 --
int(0)
bool(false)
bool(false)
+++ /dev/null
---TEST--
-Test strrpos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments
---FILE--
-<?php
-/* Test strrpos() function by passing double quoted strings for 'haystack' & 'needle' arguments */
-
-echo "*** Testing strrpos() function: with double quoted strings ***\n";
-$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 ";
-$needle = array(
- //regular strings
- "l",
- "L",
- "HELLO",
- "hEllo",
-
- //escape characters
- "\t",
- "\T", //invalid input
- " ",
- "\n",
- "\N", //invalid input
- "
-", //new line
-
- //nulls
- "\0",
- NULL,
- null,
-
- //boolean false
- FALSE,
- false,
-
- //empty string
- "",
-
- //special chars
- " ",
- "$",
- " $",
- "&",
- "!#",
- "()",
- "<=>",
- ">",
- "=>",
- "?",
- "@",
- "@hEllo",
-
- "12345", //decimal numeric string
- "\x23", //hexadecimal numeric string
- "#", //respective ASCII char of \x23
- "\101", //octal numeric string
- "A", //respective ASCII char of \101
- "456HEE", //numerics + chars
- $haystack //haystack as needle
-);
-
-/* loop through to get the position of the needle in haystack string */
-$count = 1;
-for($index=0; $index<count($needle); $index++) {
- echo "-- Iteration $count --\n";
- var_dump( strrpos($haystack, $needle[$index]) );
- var_dump( strrpos($haystack, $needle[$index], $index) );
- $count++;
-}
-echo "*** Done ***";
-?>
---EXPECT--
-*** Testing strrpos() function: with double quoted strings ***
--- Iteration 1 --
-int(28)
-int(28)
--- Iteration 2 --
-bool(false)
-bool(false)
--- Iteration 3 --
-bool(false)
-bool(false)
--- Iteration 4 --
-bool(false)
-bool(false)
--- Iteration 5 --
-int(6)
-int(6)
--- Iteration 6 --
-bool(false)
-bool(false)
--- Iteration 7 --
-bool(false)
-bool(false)
--- Iteration 8 --
-int(9)
-int(9)
--- Iteration 9 --
-bool(false)
-bool(false)
--- Iteration 10 --
-int(9)
-int(9)
--- Iteration 11 --
-int(8)
-bool(false)
--- Iteration 12 --
-int(44)
-int(44)
--- Iteration 13 --
-int(44)
-int(44)
--- Iteration 14 --
-int(44)
-int(44)
--- Iteration 15 --
-int(44)
-int(44)
--- Iteration 16 --
-int(44)
-int(44)
--- Iteration 17 --
-int(43)
-int(43)
--- Iteration 18 --
-int(12)
-bool(false)
--- Iteration 19 --
-int(11)
-bool(false)
--- Iteration 20 --
-int(13)
-bool(false)
--- Iteration 21 --
-int(14)
-bool(false)
--- Iteration 22 --
-int(17)
-bool(false)
--- Iteration 23 --
-int(20)
-bool(false)
--- Iteration 24 --
-int(22)
-bool(false)
--- Iteration 25 --
-int(21)
-bool(false)
--- Iteration 26 --
-int(23)
-bool(false)
--- Iteration 27 --
-int(24)
-bool(false)
--- Iteration 28 --
-bool(false)
-bool(false)
--- Iteration 29 --
-int(30)
-int(30)
--- Iteration 30 --
-int(39)
-int(39)
--- Iteration 31 --
-int(39)
-int(39)
--- Iteration 32 --
-int(42)
-int(42)
--- Iteration 33 --
-int(42)
-int(42)
--- Iteration 34 --
-bool(false)
-bool(false)
--- Iteration 35 --
-int(0)
-bool(false)
-*** Done ***
+++ /dev/null
---TEST--
-Test strrpos() function : usage variations - unexpected inputs for 'needle' argument
---FILE--
-<?php
-/* Test strrpos() function with unexpected inputs for 'needle' and
- * an expected type of input for 'haystack' argument
-*/
-
-echo "*** Testing strrpos() function with unexpected values for needle ***\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");
-
-$haystack = "string 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource";
-
-// array with different values
-$needles = array (
-
- // integer values
- 0,
- 1,
- 12345,
- -2345,
-
- // float values
- 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-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 'needle' array to check the working of strrpos()
-$counter = 1;
-for($index = 0; $index < count($needles); $index ++) {
- echo "-- Iteration $counter --\n";
- try {
- var_dump( strrpos($haystack, $needles[$index]) );
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
- }
- $counter ++;
-}
-
-fclose($file_handle); //closing the file handle
-
-echo "*** Done ***";
-?>
---EXPECT--
-*** Testing strrpos() function with unexpected values for needle ***
--- Iteration 1 --
-int(42)
--- Iteration 2 --
-int(41)
--- Iteration 3 --
-bool(false)
--- Iteration 4 --
-bool(false)
--- Iteration 5 --
-int(27)
--- Iteration 6 --
-int(21)
--- Iteration 7 --
-bool(false)
--- Iteration 8 --
-bool(false)
--- Iteration 9 --
-int(28)
--- Iteration 10 --
-strrpos(): Argument #2 ($needle) must be of type string, array given
--- Iteration 11 --
-strrpos(): Argument #2 ($needle) must be of type string, array given
--- Iteration 12 --
-strrpos(): Argument #2 ($needle) must be of type string, array given
--- Iteration 13 --
-strrpos(): Argument #2 ($needle) must be of type string, array given
--- Iteration 14 --
-strrpos(): Argument #2 ($needle) must be of type string, array given
--- Iteration 15 --
-int(41)
--- Iteration 16 --
-int(87)
--- Iteration 17 --
-int(41)
--- Iteration 18 --
-int(87)
--- Iteration 19 --
-int(64)
--- Iteration 20 --
-int(87)
--- Iteration 21 --
-int(87)
--- Iteration 22 --
-int(87)
--- Iteration 23 --
-int(87)
--- Iteration 24 --
-strrpos(): Argument #2 ($needle) must be of type string, resource given
--- Iteration 25 --
-int(87)
--- Iteration 26 --
-int(87)
-*** Done ***
+++ /dev/null
---TEST--
-Test strrpos() function : usage variations - unexpected inputs for 'haystack' and 'needle' arguments
---FILE--
-<?php
-/* Test strrpos() function with unexpected inputs for 'haystack' and 'needle' arguments */
-
-echo "*** Testing strrpos() function with unexpected values for haystack and needle ***\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";
- $haystack = $values[$index];
- try {
- var_dump( strrpos($values[$index], $values[$index]) );
- } catch (Error $e) {
- echo get_class($e) . ": " . $e->getMessage(), "\n";
- }
-
- try {
- var_dump( strrpos($values[$index], $values[$index], 1) );
- } catch (Error $e) {
- echo get_class($e) . ": " . $e->getMessage(), "\n";
- }
- $counter ++;
-}
-
-echo "*** Done ***";
-?>
---EXPECT--
-*** Testing strrpos() function with unexpected values for haystack and needle ***
--- Iteration 1 --
-int(0)
-bool(false)
--- Iteration 2 --
-int(0)
-bool(false)
--- Iteration 3 --
-int(0)
-bool(false)
--- Iteration 4 --
-int(0)
-bool(false)
--- Iteration 5 --
-int(0)
-bool(false)
--- Iteration 6 --
-int(0)
-bool(false)
--- Iteration 7 --
-int(0)
-bool(false)
--- Iteration 8 --
-int(0)
-bool(false)
--- Iteration 9 --
-int(0)
-bool(false)
--- Iteration 10 --
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 11 --
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 12 --
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 13 --
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 14 --
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given
--- Iteration 15 --
-int(0)
-bool(false)
--- Iteration 16 --
-int(0)
-ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 17 --
-int(0)
-bool(false)
--- Iteration 18 --
-int(0)
-ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 19 --
-int(0)
-bool(false)
--- Iteration 20 --
-int(0)
-ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 21 --
-int(0)
-ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 22 --
-int(0)
-ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 23 --
-int(0)
-ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 24 --
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, resource given
-TypeError: strrpos(): Argument #1 ($haystack) must be of type string, resource given
--- Iteration 25 --
-int(0)
-ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
--- Iteration 26 --
-int(0)
-ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-*** Done ***
//nulls
'\0',
- NULL,
- null,
//boolean false
FALSE,
int(54)
int(54)
-- Iteration 15 --
-int(54)
-int(54)
--- Iteration 16 --
-int(54)
-int(54)
--- Iteration 17 --
int(53)
int(53)
--- Iteration 18 --
+-- Iteration 16 --
int(16)
-bool(false)
--- Iteration 19 --
+int(16)
+-- Iteration 17 --
int(15)
bool(false)
--- Iteration 20 --
+-- Iteration 18 --
int(17)
-bool(false)
--- Iteration 21 --
+int(17)
+-- Iteration 19 --
int(18)
-bool(false)
--- Iteration 22 --
+int(18)
+-- Iteration 20 --
int(21)
int(21)
--- Iteration 23 --
+-- Iteration 21 --
int(24)
int(24)
--- Iteration 24 --
+-- Iteration 22 --
int(26)
int(26)
--- Iteration 25 --
+-- Iteration 23 --
int(25)
int(25)
--- Iteration 26 --
+-- Iteration 24 --
int(27)
int(27)
--- Iteration 27 --
+-- Iteration 25 --
int(28)
int(28)
--- Iteration 28 --
+-- Iteration 26 --
bool(false)
bool(false)
--- Iteration 29 --
+-- Iteration 27 --
int(34)
int(34)
--- Iteration 30 --
+-- Iteration 28 --
int(43)
int(43)
--- Iteration 31 --
+-- Iteration 29 --
int(19)
bool(false)
--- Iteration 32 --
+-- Iteration 30 --
int(49)
int(49)
--- Iteration 33 --
+-- Iteration 31 --
bool(false)
bool(false)
--- Iteration 34 --
+-- Iteration 32 --
bool(false)
bool(false)
--- Iteration 35 --
+-- Iteration 33 --
bool(false)
bool(false)
--- Iteration 36 --
+-- Iteration 34 --
int(0)
bool(false)
*** Done ***
echo $exception->getMessage() . "\n";
}
var_dump( strrpos($empty_string, FALSE) );
-var_dump( strrpos($empty_string, NULL) );
echo "*** Done ***";
?>
int(0)
strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
int(0)
-int(0)
*** Done ***
$str_arr = array(
"",
'',
- NULL,
- null,
FALSE,
false,
$heredoc_str
-- Iteration 5 --
string(0) ""
string(0) ""
--- Iteration 6 --
-string(0) ""
-string(0) ""
--- Iteration 7 --
-string(0) ""
-string(0) ""
*** Done ***
echo "*** Testing strtr() function: with unexpected inputs for 'from' ***\n";
-//get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
//defining a class
class sample {
public function __toString() {
// resource
/*17*/ $file_handle,
-
- // undefined variable
-/*18*/ @$undefined_var,
-
- // unset variable
-/*19*/ @$unset_var
);
//defining 'to' argument
fclose($file_handle); //closing the file handle
?>
---EXPECT--
+--EXPECTF--
*** Testing strtr() function: with unexpected inputs for 'from' ***
-- Iteration 1 --
string(6) "a12atm"
-- Iteration 13 --
string(6) "012atm"
-- Iteration 14 --
+
+Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d
string(6) "012atm"
-- Iteration 15 --
+
+Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d
string(6) "012atm"
-- Iteration 16 --
string(6) "012ttm"
-- Iteration 17 --
strtr(): Argument #2 ($from) must be of type array|string, resource given
--- Iteration 18 --
-string(6) "012atm"
--- Iteration 19 --
-string(6) "012atm"
echo "*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***\n";
-//get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
//defining a class
class sample {
public function __toString() {
// resource
$file_handle,
-
- // undefined variable
- @$undefined_var,
-
- // unset variable
- @$unset_var
);
// loop through with each element of the $replace_pairs array to test strtr() function
echo "*** Done ***";
?>
---EXPECT--
+--EXPECTF--
*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***
-- Iteration 1 --
strtr(): Argument #2 ($from) must be of type array, string given
-- Iteration 14 --
+
+Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d
strtr(): Argument #2 ($from) must be of type array, string given
-- Iteration 15 --
+
+Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d
strtr(): Argument #2 ($from) must be of type array, string given
-- Iteration 16 --
-- Iteration 17 --
strtr(): Argument #2 ($from) must be of type array|string, resource given
-
--- Iteration 18 --
-strtr(): Argument #2 ($from) must be of type array, string given
-
--- Iteration 19 --
-strtr(): Argument #2 ($from) must be of type array, string given
*** Done ***
var_dump( substr_count($str, "t", "5") );
var_dump( substr_count($str, "t", "5", "10") );
-echo "\n-- 3rd or 4th arg as NULL --\n";
-var_dump( substr_count($str, "I", NULL) );
-var_dump( substr_count($str, "i", NULL, 10) );
-
echo "\n-- overlapped substrings --\n";
var_dump( substr_count("abcabcabcabcabc", "abca") );
var_dump( substr_count("abcabcabcabcabc", "abca", 2) );
int(1)
int(1)
--- 3rd or 4th arg as NULL --
-int(0)
-int(2)
-
-- overlapped substrings --
int(2)
int(2)
+++ /dev/null
---TEST--
-Test vprintf() function : usage variations - unexpected values for the format argument
---FILE--
-<?php
-/*
- * Test vprintf() when different unexpected format strings are passed to
- * the '$format' argument of the function
-*/
-
-echo "*** Testing vprintf() : with unexpected values for format argument ***\n";
-
-// initialising the required variables
-$args = array(1, 2);
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// declaring a class
-class sample
-{
- public function __toString() {
- return "object";
- }
-}
-
-// Defining resource
-$file_handle = fopen(__FILE__, 'r');
-
-
-//array of values to iterate over
-$values = array(
-
- // int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // float data
-/*5*/ 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
-
- // array data
-/*10*/ array(),
- array(0),
- array(1),
- array(1,2),
- array('color' => 'red', 'item' => 'pen'),
-
- // null data
-/*15*/ NULL,
- null,
-
- // boolean data
-/*17*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
-/*21*/ "",
- '',
-
- // object data
-/*23*/ new sample(),
-
- // undefined data
-/*24*/ @$undefined_var,
-
- // unset data
-/*25*/ @$unset_var,
-
- // resource data
-/*26*/ $file_handle
-);
-
-// loop through each element of the array for format
-
-$counter = 1;
-foreach($values as $value) {
- echo "\n -- Iteration $counter --\n";
- try {
- $result = vprintf($value, $args);
- echo "\n";
- var_dump($result);
- } catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
- }
-
- $counter++;
-}
-
-// closing the resource
-fclose($file_handle);
-
-?>
---EXPECT--
-*** Testing vprintf() : with unexpected values for format argument ***
-
- -- Iteration 1 --
-0
-int(1)
-
- -- Iteration 2 --
-1
-int(1)
-
- -- Iteration 3 --
-12345
-int(5)
-
- -- Iteration 4 --
--2345
-int(5)
-
- -- Iteration 5 --
-10.5
-int(4)
-
- -- Iteration 6 --
--10.5
-int(5)
-
- -- Iteration 7 --
-101234567000
-int(12)
-
- -- Iteration 8 --
-1.07654321E-9
-int(13)
-
- -- Iteration 9 --
-0.5
-int(3)
-
- -- Iteration 10 --
-vprintf(): Argument #1 ($format) must be of type string, array given
-
- -- Iteration 11 --
-vprintf(): Argument #1 ($format) must be of type string, array given
-
- -- Iteration 12 --
-vprintf(): Argument #1 ($format) must be of type string, array given
-
- -- Iteration 13 --
-vprintf(): Argument #1 ($format) must be of type string, array given
-
- -- Iteration 14 --
-vprintf(): Argument #1 ($format) must be of type string, array given
-
- -- Iteration 15 --
-
-int(0)
-
- -- Iteration 16 --
-
-int(0)
-
- -- Iteration 17 --
-1
-int(1)
-
- -- Iteration 18 --
-
-int(0)
-
- -- Iteration 19 --
-1
-int(1)
-
- -- Iteration 20 --
-
-int(0)
-
- -- Iteration 21 --
-
-int(0)
-
- -- Iteration 22 --
-
-int(0)
-
- -- Iteration 23 --
-object
-int(6)
-
- -- Iteration 24 --
-
-int(0)
-
- -- Iteration 25 --
-
-int(0)
-
- -- Iteration 26 --
-vprintf(): Argument #1 ($format) must be of type string, resource given
<?php
unlink(__DIR__.'/015-get-errors.xml');
?>
---EXPECT--
+--EXPECTF--
+Deprecated: XMLReader::getAttributeNs(): Passing null to parameter #2 ($namespace) of type string is deprecated in %s on line %d
XMLReader::getAttributeNs(): Argument #2 ($namespace) cannot be empty
ns1:num: 1
<?php
unlink(__DIR__.'/015-move-errors.xml');
?>
---EXPECT--
+--EXPECTF--
+Deprecated: XMLReader::moveToAttributeNs(): Passing null to parameter #2 ($namespace) of type string is deprecated in %s on line %d
XMLReader::moveToAttributeNs(): Argument #2 ($namespace) cannot be empty
$xw->openMemory();
$xw->startDocument(NULL, "UTF-8");
$xw->startDtd("root");
-$xw->writeDtdEntity("c", NULL, 0, "-//W3C//TEXT copyright//EN", "http://www.w3.org/xmlspec/copyright.xml");
+$xw->writeDtdEntity("c", "", 0, "-//W3C//TEXT copyright//EN", "http://www.w3.org/xmlspec/copyright.xml");
$xw->endDtd();
$xw->startElement("root");
$xw->endDocument();
+++ /dev/null
---TEST--
-Test function gzfile() by substituting argument 1 with emptyUnsetUndefNull values.
---SKIPIF--
-<?php
-if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
-?>
---FILE--
-<?php
-
-
-$use_include_path = false;
-
-
-$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 ) {
- try {
- var_dump(gzfile( $var , $use_include_path ) );
- } catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
- }
-}
-?>
---EXPECT--
-Path cannot be empty
-Path cannot be empty
-Path cannot be empty
-Path cannot be empty
-Path cannot be empty
-Path cannot be empty
+++ /dev/null
---TEST--
-Test function readgzfile() by substituting argument 1 with emptyUnsetUndefNull values.
---SKIPIF--
-<?php
-if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
-?>
---FILE--
-<?php
-
-
-$use_include_path = false;
-
-
-$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 ) {
- try {
- var_dump(readgzfile( $var , $use_include_path ) );
- } catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
- }
-}
-?>
---EXPECT--
-Path cannot be empty
-Path cannot be empty
-Path cannot be empty
-Path cannot be empty
-Path cannot be empty
-Path cannot be empty
// Parallel testing
global $workerID;
- if (!$workerID) {
+ if (!$workerID && isset($line_length)) {
// Write over the last line to avoid random trailing chars on next echo
echo str_repeat(" ", $line_length), "\r";
}