mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Fix tests expecting specific resource IDs
When Wincache or APC are installed, the resource IDs are not the same. This is because Wincache takes a few resource objects for itself. As a result, these tests become false positives. On Windows boxes, the microtime precision is not granular enough to reliably register a difference if two calls to uniqid() are made concurrently. This is a fix to the uniqid() test to avoid the false positive when run on Windows machines. Also, added a test to exercise the 'more_entropy' variant of uniqid().
This commit is contained in:
parent
41eaac3491
commit
50377b5bf2
@ -24,6 +24,6 @@ Warning: feof(): wrapper::stream_eof is not implemented! Assuming EOF in %s on l
|
|||||||
Fatal error: Uncaught exception 'Exception' in %s:%d
|
Fatal error: Uncaught exception 'Exception' in %s:%d
|
||||||
Stack trace:
|
Stack trace:
|
||||||
#0 [internal function]: wrapper->stream_eof()
|
#0 [internal function]: wrapper->stream_eof()
|
||||||
#1 %s(%d): feof(Resource id #6)
|
#1 %s(%d): feof(Resource id #%d)
|
||||||
#2 {main}
|
#2 {main}
|
||||||
thrown in %s on line %d
|
thrown in %s on line %d
|
||||||
|
@ -231,6 +231,6 @@ string(12) "Hello World!"
|
|||||||
-- Iteration 24 --
|
-- Iteration 24 --
|
||||||
|
|
||||||
Warning: session_name() expects parameter 1 to be string, resource given in %s on line %d
|
Warning: session_name() expects parameter 1 to be string, resource given in %s on line %d
|
||||||
resource(5) of type (stream)
|
resource(%d) of type (stream)
|
||||||
NULL
|
NULL
|
||||||
Done
|
Done
|
Binary file not shown.
@ -76,7 +76,7 @@ bool(false)
|
|||||||
Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d
|
Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Warning: fclose(): 5 is not a valid stream resource in %s on line %d
|
Warning: fclose(): %d is not a valid stream resource in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d
|
Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d
|
||||||
@ -85,7 +85,7 @@ bool(false)
|
|||||||
Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d
|
Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Warning: feof(): 5 is not a valid stream resource in %s on line %d
|
Warning: feof(): %d is not a valid stream resource in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Warning: feof() expects parameter 1 to be resource, string given in %s on line %d
|
Warning: feof() expects parameter 1 to be resource, string given in %s on line %d
|
||||||
|
@ -98,7 +98,7 @@ bool(false)
|
|||||||
Warning: fgetss() expects parameter 1 to be resource, object given in %s on line %d
|
Warning: fgetss() expects parameter 1 to be resource, object given in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
-- Testing fgetss() with closed/unset file handle --
|
-- Testing fgetss() with closed/unset file handle --
|
||||||
Warning: fgetss(): 5 is not a valid stream resource in %s on line %d
|
Warning: fgetss(): %d is not a valid stream resource in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Warning: fgetss() expects parameter 1 to be resource, null given in %s on line %d
|
Warning: fgetss() expects parameter 1 to be resource, null given in %s on line %d
|
||||||
|
@ -114,7 +114,7 @@ Warning: ftruncate() expects parameter 1 to be resource, object given in %s on l
|
|||||||
bool(false)
|
bool(false)
|
||||||
-- Testing ftruncate() with closed/unset file handle --
|
-- Testing ftruncate() with closed/unset file handle --
|
||||||
|
|
||||||
Warning: ftruncate(): 5 is not a valid stream resource in %s on line %d
|
Warning: ftruncate(): %d is not a valid stream resource in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
int(36)
|
int(36)
|
||||||
|
|
||||||
|
@ -157,8 +157,8 @@ float(-5000000)
|
|||||||
*** Testing floatval() on non floating types ***
|
*** Testing floatval() on non floating types ***
|
||||||
float(-2147483648)
|
float(-2147483648)
|
||||||
float(2147483648)
|
float(2147483648)
|
||||||
float(5)
|
float(%d)
|
||||||
float(6)
|
float(%d)
|
||||||
float(0)
|
float(0)
|
||||||
float(1)
|
float(1)
|
||||||
float(-1300)
|
float(-1300)
|
||||||
@ -175,8 +175,8 @@ float(0)
|
|||||||
*** Testing doubleval() on non floating types ***
|
*** Testing doubleval() on non floating types ***
|
||||||
float(-2147483648)
|
float(-2147483648)
|
||||||
float(2147483648)
|
float(2147483648)
|
||||||
float(5)
|
float(%d)
|
||||||
float(6)
|
float(%d)
|
||||||
float(0)
|
float(0)
|
||||||
float(1)
|
float(1)
|
||||||
float(-1300)
|
float(-1300)
|
||||||
|
@ -232,11 +232,11 @@ int(0)
|
|||||||
string(7) "integer"
|
string(7) "integer"
|
||||||
-- Iteration 12 --
|
-- Iteration 12 --
|
||||||
bool(true)
|
bool(true)
|
||||||
int(5)
|
int(%d)
|
||||||
string(7) "integer"
|
string(7) "integer"
|
||||||
-- Iteration 13 --
|
-- Iteration 13 --
|
||||||
bool(true)
|
bool(true)
|
||||||
int(6)
|
int(%d)
|
||||||
string(7) "integer"
|
string(7) "integer"
|
||||||
-- Iteration 14 --
|
-- Iteration 14 --
|
||||||
8: Object of class point could not be converted to int
|
8: Object of class point could not be converted to int
|
||||||
@ -291,11 +291,11 @@ int(0)
|
|||||||
string(7) "integer"
|
string(7) "integer"
|
||||||
-- Iteration 12 --
|
-- Iteration 12 --
|
||||||
bool(true)
|
bool(true)
|
||||||
int(5)
|
int(%d)
|
||||||
string(7) "integer"
|
string(7) "integer"
|
||||||
-- Iteration 13 --
|
-- Iteration 13 --
|
||||||
bool(true)
|
bool(true)
|
||||||
int(6)
|
int(%d)
|
||||||
string(7) "integer"
|
string(7) "integer"
|
||||||
-- Iteration 14 --
|
-- Iteration 14 --
|
||||||
8: Object of class point could not be converted to int
|
8: Object of class point could not be converted to int
|
||||||
@ -350,11 +350,11 @@ float(0)
|
|||||||
string(6) "double"
|
string(6) "double"
|
||||||
-- Iteration 12 --
|
-- Iteration 12 --
|
||||||
bool(true)
|
bool(true)
|
||||||
float(5)
|
float(%d)
|
||||||
string(6) "double"
|
string(6) "double"
|
||||||
-- Iteration 13 --
|
-- Iteration 13 --
|
||||||
bool(true)
|
bool(true)
|
||||||
float(6)
|
float(%d)
|
||||||
string(6) "double"
|
string(6) "double"
|
||||||
-- Iteration 14 --
|
-- Iteration 14 --
|
||||||
8: Object of class point could not be converted to double
|
8: Object of class point could not be converted to double
|
||||||
@ -409,11 +409,11 @@ float(0)
|
|||||||
string(6) "double"
|
string(6) "double"
|
||||||
-- Iteration 12 --
|
-- Iteration 12 --
|
||||||
bool(true)
|
bool(true)
|
||||||
float(5)
|
float(%d)
|
||||||
string(6) "double"
|
string(6) "double"
|
||||||
-- Iteration 13 --
|
-- Iteration 13 --
|
||||||
bool(true)
|
bool(true)
|
||||||
float(6)
|
float(%d)
|
||||||
string(6) "double"
|
string(6) "double"
|
||||||
-- Iteration 14 --
|
-- Iteration 14 --
|
||||||
8: Object of class point could not be converted to double
|
8: Object of class point could not be converted to double
|
||||||
@ -610,12 +610,12 @@ string(6) "string"
|
|||||||
-- Iteration 12 --
|
-- Iteration 12 --
|
||||||
2: settype(): Cannot convert to resource type
|
2: settype(): Cannot convert to resource type
|
||||||
bool(false)
|
bool(false)
|
||||||
resource(5) of type (stream)
|
resource(%d) of type (stream)
|
||||||
string(8) "resource"
|
string(8) "resource"
|
||||||
-- Iteration 13 --
|
-- Iteration 13 --
|
||||||
2: settype(): Cannot convert to resource type
|
2: settype(): Cannot convert to resource type
|
||||||
bool(false)
|
bool(false)
|
||||||
resource(6) of type (stream)
|
resource(%d) of type (stream)
|
||||||
string(8) "resource"
|
string(8) "resource"
|
||||||
-- Iteration 14 --
|
-- Iteration 14 --
|
||||||
2: settype(): Cannot convert to resource type
|
2: settype(): Cannot convert to resource type
|
||||||
@ -716,14 +716,14 @@ string(5) "array"
|
|||||||
bool(true)
|
bool(true)
|
||||||
array(1) {
|
array(1) {
|
||||||
[0]=>
|
[0]=>
|
||||||
resource(5) of type (stream)
|
resource(%d) of type (stream)
|
||||||
}
|
}
|
||||||
string(5) "array"
|
string(5) "array"
|
||||||
-- Iteration 13 --
|
-- Iteration 13 --
|
||||||
bool(true)
|
bool(true)
|
||||||
array(1) {
|
array(1) {
|
||||||
[0]=>
|
[0]=>
|
||||||
resource(6) of type (stream)
|
resource(%d) of type (stream)
|
||||||
}
|
}
|
||||||
string(5) "array"
|
string(5) "array"
|
||||||
-- Iteration 14 --
|
-- Iteration 14 --
|
||||||
@ -824,14 +824,14 @@ string(6) "object"
|
|||||||
bool(true)
|
bool(true)
|
||||||
object(stdClass)#2 (1) {
|
object(stdClass)#2 (1) {
|
||||||
["scalar"]=>
|
["scalar"]=>
|
||||||
resource(5) of type (stream)
|
resource(%d) of type (stream)
|
||||||
}
|
}
|
||||||
string(6) "object"
|
string(6) "object"
|
||||||
-- Iteration 13 --
|
-- Iteration 13 --
|
||||||
bool(true)
|
bool(true)
|
||||||
object(stdClass)#2 (1) {
|
object(stdClass)#2 (1) {
|
||||||
["scalar"]=>
|
["scalar"]=>
|
||||||
resource(6) of type (stream)
|
resource(%d) of type (stream)
|
||||||
}
|
}
|
||||||
string(6) "object"
|
string(6) "object"
|
||||||
-- Iteration 14 --
|
-- Iteration 14 --
|
||||||
@ -893,11 +893,11 @@ string(6) "string"
|
|||||||
string(6) "string"
|
string(6) "string"
|
||||||
-- Iteration 12 --
|
-- Iteration 12 --
|
||||||
bool(true)
|
bool(true)
|
||||||
string(14) "Resource id #5"
|
string(14) "Resource id #%d"
|
||||||
string(6) "string"
|
string(6) "string"
|
||||||
-- Iteration 13 --
|
-- Iteration 13 --
|
||||||
bool(true)
|
bool(true)
|
||||||
string(14) "Resource id #6"
|
string(14) "Resource id #%d"
|
||||||
string(6) "string"
|
string(6) "string"
|
||||||
-- Iteration 14 --
|
-- Iteration 14 --
|
||||||
bool(true)
|
bool(true)
|
||||||
|
@ -1484,13 +1484,13 @@ object_class Object
|
|||||||
*** Testing print_r() on resources ***
|
*** Testing print_r() on resources ***
|
||||||
|
|
||||||
-- Iteration 1 --
|
-- Iteration 1 --
|
||||||
Resource id #5
|
Resource id #%d
|
||||||
Resource id #5
|
Resource id #%d
|
||||||
Resource id #5
|
Resource id #%d
|
||||||
-- Iteration 2 --
|
-- Iteration 2 --
|
||||||
Resource id #6
|
Resource id #%d
|
||||||
Resource id #6
|
Resource id #%d
|
||||||
Resource id #6
|
Resource id #%d
|
||||||
*** Testing print_r() on different combinations of scalar
|
*** Testing print_r() on different combinations of scalar
|
||||||
and non-scalar variables ***
|
and non-scalar variables ***
|
||||||
|
|
||||||
|
@ -279,9 +279,9 @@ string(0) ""
|
|||||||
-- Iteration 1 --
|
-- Iteration 1 --
|
||||||
string(6) "Object"
|
string(6) "Object"
|
||||||
-- Iteration 2 --
|
-- Iteration 2 --
|
||||||
string(14) "Resource id #5"
|
string(14) "Resource id #%d"
|
||||||
-- Iteration 3 --
|
-- Iteration 3 --
|
||||||
string(14) "Resource id #6"
|
string(14) "Resource id #%d"
|
||||||
-- Iteration 4 --
|
-- Iteration 4 --
|
||||||
|
|
||||||
Notice: Array to string conversion in %sstrval.php on line %d
|
Notice: Array to string conversion in %sstrval.php on line %d
|
||||||
|
@ -105,9 +105,9 @@ int(0)
|
|||||||
bool(true)
|
bool(true)
|
||||||
int(0)
|
int(0)
|
||||||
bool(true)
|
bool(true)
|
||||||
int(5)
|
int(%d)
|
||||||
bool(true)
|
bool(true)
|
||||||
int(6)
|
int(%d)
|
||||||
string(54) "Object of class stdClass could not be converted to int"
|
string(54) "Object of class stdClass could not be converted to int"
|
||||||
bool(true)
|
bool(true)
|
||||||
int(%d)
|
int(%d)
|
||||||
@ -128,9 +128,9 @@ float(0)
|
|||||||
bool(true)
|
bool(true)
|
||||||
float(0)
|
float(0)
|
||||||
bool(true)
|
bool(true)
|
||||||
float(5)
|
float(%d)
|
||||||
bool(true)
|
bool(true)
|
||||||
float(6)
|
float(%d)
|
||||||
string(57) "Object of class stdClass could not be converted to double"
|
string(57) "Object of class stdClass could not be converted to double"
|
||||||
bool(true)
|
bool(true)
|
||||||
float(%d)
|
float(%d)
|
||||||
|
@ -844,9 +844,9 @@ object(object_class)#13 (8) {
|
|||||||
|
|
||||||
*** Testing var_dump() on resources ***
|
*** Testing var_dump() on resources ***
|
||||||
-- Iteration 1 --
|
-- Iteration 1 --
|
||||||
resource(5) of type (stream)
|
resource(%d) of type (stream)
|
||||||
-- Iteration 2 --
|
-- Iteration 2 --
|
||||||
resource(6) of type (stream)
|
resource(%d) of type (stream)
|
||||||
|
|
||||||
*** Testing var_dump() on different combinations of scalar
|
*** Testing var_dump() on different combinations of scalar
|
||||||
and non-scalar variables ***
|
and non-scalar variables ***
|
||||||
@ -1227,9 +1227,9 @@ array(4) {
|
|||||||
}
|
}
|
||||||
array(2) {
|
array(2) {
|
||||||
[0]=>
|
[0]=>
|
||||||
resource(5) of type (stream)
|
resource(%d) of type (stream)
|
||||||
[1]=>
|
[1]=>
|
||||||
resource(6) of type (stream)
|
resource(%d) of type (stream)
|
||||||
}
|
}
|
||||||
array(9) {
|
array(9) {
|
||||||
[0]=>
|
[0]=>
|
||||||
|
Binary file not shown.
@ -177,9 +177,23 @@ if ($ss == "\$'") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo "Testing uniqid: ";
|
echo "Testing uniqid(true): ";
|
||||||
|
$str = "prefix";
|
||||||
|
$ui1 = uniqid($str, true);
|
||||||
|
$ui2 = uniqid($str, true);
|
||||||
|
|
||||||
|
$len = 29;
|
||||||
|
|
||||||
|
if (strlen($ui1) == strlen($ui2) && strlen($ui1) == $len && $ui1 != $ui2) {
|
||||||
|
echo("passed\n");
|
||||||
|
} else {
|
||||||
|
echo("failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Testing uniqid(false): ";
|
||||||
$str = "prefix";
|
$str = "prefix";
|
||||||
$ui1 = uniqid($str);
|
$ui1 = uniqid($str);
|
||||||
|
usleep( 1 );
|
||||||
$ui2 = uniqid($str);
|
$ui2 = uniqid($str);
|
||||||
|
|
||||||
$len = strncasecmp(PHP_OS, 'CYGWIN', 6) ? 19 : 29;
|
$len = strncasecmp(PHP_OS, 'CYGWIN', 6) ? 19 : 29;
|
||||||
@ -207,4 +221,5 @@ Testing ufirst: passed
|
|||||||
Testing strtr: passed
|
Testing strtr: passed
|
||||||
Testing addslashes: passed
|
Testing addslashes: passed
|
||||||
Testing stripslashes: passed
|
Testing stripslashes: passed
|
||||||
Testing uniqid: passed
|
Testing uniqid(true): passed
|
||||||
|
Testing uniqid(false): passed
|
||||||
|
Loading…
Reference in New Issue
Block a user