diff options
Diffstat (limited to 'ext')
119 files changed, 4958 insertions, 4958 deletions
diff --git a/ext/curl/tests/curl_version_error.phpt b/ext/curl/tests/curl_version_error.phpt index a9b80c55be..39f99a0fad 100644 --- a/ext/curl/tests/curl_version_error.phpt +++ b/ext/curl/tests/curl_version_error.phpt @@ -1,28 +1,28 @@ ---TEST--
-Test curl_version() function : error conditions
---SKIPIF--
-<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
---FILE--
-<?php
-
-/* Prototype : array curl_version ([ int $age ] )
- * Description: Returns information about the cURL version.
- * Source code: ext/curl/interface.c
-*/
-
-echo "*** Testing curl_version() : error conditions ***\n";
-
-echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( curl_version(1, $extra_arg) );
-
-?>
-===Done===
---EXPECTF--
-*** Testing curl_version() : error conditions ***
-
--- Testing curl_version() function with more than expected no. of arguments --
-
-Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-===Done===
+--TEST-- +Test curl_version() function : error conditions +--SKIPIF-- +<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?> +--FILE-- +<?php + +/* Prototype : array curl_version ([ int $age ] ) + * Description: Returns information about the cURL version. + * Source code: ext/curl/interface.c +*/ + +echo "*** Testing curl_version() : error conditions ***\n"; + +echo "\n-- Testing curl_version() function with more than expected no. of arguments --\n"; +$extra_arg = 10; +var_dump( curl_version(1, $extra_arg) ); + +?> +===Done=== +--EXPECTF-- +*** Testing curl_version() : error conditions *** + +-- Testing curl_version() function with more than expected no. of arguments -- + +Warning: curl_version() expects at most 1 parameter, 2 given in %s on line %d +NULL +===Done=== diff --git a/ext/curl/tests/curl_version_variation1.phpt b/ext/curl/tests/curl_version_variation1.phpt index 65f5e69acb..7c0106cb6a 100644 --- a/ext/curl/tests/curl_version_variation1.phpt +++ b/ext/curl/tests/curl_version_variation1.phpt @@ -1,159 +1,159 @@ ---TEST--
-Test curl_version() function : usage variations - test values for $ascii argument
---SKIPIF--
-<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded");
-if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?>
---FILE--
-<?php
-
-/* Prototype : array curl_version ([ int $age ] )
- * Description: Returns information about the cURL version.
- * Source code: ext/curl/interface.c
-*/
-
-echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n";
-
-//get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
-//defining a class
-class sample {
- public function __toString() {
- return "sample object";
- }
-}
-
-//getting the resource
-$file_handle = fopen(__FILE__, "r");
-
-// array with different values for $input
-$inputs = array (
-
- // integer values
- 0,
- 1,
- 255,
- 256,
- PHP_INT_MAX,
- -PHP_INT_MAX,
-
- // float values
- 10.5,
- -20.5,
- 10.1234567e10,
-
- // array values
- array(),
- array(0),
- array(1, 2),
-
- //string values
- "ABC",
- 'abc',
- "2abc",
-
- // boolean values
- true,
- false,
- TRUE,
- FALSE,
-
- // null values
- NULL,
- null,
-
- // objects
- new sample(),
-
- // resource
- $file_handle,
-
- // undefined variable
- @$undefined_var,
-
- // unset variable
- @$unset_var
-);
-
-// loop through with each element of the $inputs array to test curl_version() function
-$count = 1;
-foreach($inputs as $input) {
- echo "-- Iteration $count --\n";
- var_dump( is_array(curl_version($input)) );
- $count ++;
-}
-
-fclose($file_handle); //closing the file handle
-
-?>
-===Done===
---EXPECTF--
-*** Testing curl_version() function: with unexpected inputs for 'age' argument ***
--- Iteration 1 --
-bool(true)
--- Iteration 2 --
-bool(true)
--- Iteration 3 --
-bool(true)
--- Iteration 4 --
-bool(true)
--- Iteration 5 --
-bool(true)
--- Iteration 6 --
-bool(true)
--- Iteration 7 --
-bool(true)
--- Iteration 8 --
-bool(true)
--- Iteration 9 --
-bool(true)
--- Iteration 10 --
-
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
-bool(false)
--- Iteration 11 --
-
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
-bool(false)
--- Iteration 12 --
-
-Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d
-bool(false)
--- Iteration 13 --
-
-Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
-bool(false)
--- Iteration 14 --
-
-Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d
-bool(false)
--- Iteration 15 --
-
-Notice: A non well formed numeric value encountered in %s on line %d
-bool(true)
--- Iteration 16 --
-bool(true)
--- Iteration 17 --
-bool(true)
--- Iteration 18 --
-bool(true)
--- Iteration 19 --
-bool(true)
--- Iteration 20 --
-bool(true)
--- Iteration 21 --
-bool(true)
--- Iteration 22 --
-
-Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d
-bool(false)
--- Iteration 23 --
-
-Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d
-bool(false)
--- Iteration 24 --
-bool(true)
--- Iteration 25 --
-bool(true)
-===Done===
+--TEST-- +Test curl_version() function : usage variations - test values for $ascii argument +--SKIPIF-- +<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); +if (PHP_INT_SIZE != 8) die('skip 64-bit only'); ?> +--FILE-- +<?php + +/* Prototype : array curl_version ([ int $age ] ) + * Description: Returns information about the cURL version. + * Source code: ext/curl/interface.c +*/ + +echo "*** Testing curl_version() function: with unexpected inputs for 'age' argument ***\n"; + +//get an unset variable +$unset_var = 'string_val'; +unset($unset_var); + +//defining a class +class sample { + public function __toString() { + return "sample object"; + } +} + +//getting the resource +$file_handle = fopen(__FILE__, "r"); + +// array with different values for $input +$inputs = array ( + + // integer values + 0, + 1, + 255, + 256, + PHP_INT_MAX, + -PHP_INT_MAX, + + // float values + 10.5, + -20.5, + 10.1234567e10, + + // array values + array(), + array(0), + array(1, 2), + + //string values + "ABC", + 'abc', + "2abc", + + // boolean values + true, + false, + TRUE, + FALSE, + + // null values + NULL, + null, + + // objects + new sample(), + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop through with each element of the $inputs array to test curl_version() function +$count = 1; +foreach($inputs as $input) { + echo "-- Iteration $count --\n"; + var_dump( is_array(curl_version($input)) ); + $count ++; +} + +fclose($file_handle); //closing the file handle + +?> +===Done=== +--EXPECTF-- +*** Testing curl_version() function: with unexpected inputs for 'age' argument *** +-- Iteration 1 -- +bool(true) +-- Iteration 2 -- +bool(true) +-- Iteration 3 -- +bool(true) +-- Iteration 4 -- +bool(true) +-- Iteration 5 -- +bool(true) +-- Iteration 6 -- +bool(true) +-- Iteration 7 -- +bool(true) +-- Iteration 8 -- +bool(true) +-- Iteration 9 -- +bool(true) +-- Iteration 10 -- + +Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: curl_version() expects parameter 1 to be integer, array given in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: curl_version() expects parameter 1 to be integer, string given in %s on line %d +bool(false) +-- Iteration 15 -- + +Notice: A non well formed numeric value encountered in %s on line %d +bool(true) +-- Iteration 16 -- +bool(true) +-- Iteration 17 -- +bool(true) +-- Iteration 18 -- +bool(true) +-- Iteration 19 -- +bool(true) +-- Iteration 20 -- +bool(true) +-- Iteration 21 -- +bool(true) +-- Iteration 22 -- + +Warning: curl_version() expects parameter 1 to be integer, object given in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: curl_version() expects parameter 1 to be integer, resource given in %s on line %d +bool(false) +-- Iteration 24 -- +bool(true) +-- Iteration 25 -- +bool(true) +===Done=== diff --git a/ext/filter/tests/bug47435.phpt b/ext/filter/tests/bug47435.phpt index 957a00194a..9388679ebb 100644 --- a/ext/filter/tests/bug47435.phpt +++ b/ext/filter/tests/bug47435.phpt @@ -1,36 +1,36 @@ ---TEST--
-Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6)
---SKIPIF--
-<?php if (!extension_loaded("filter")) die("skip"); ?>
---FILE--
-<?php
-var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE));
-var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
-var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE));
-?>
---EXPECT--
-string(7) "FC00::1"
-bool(false)
-string(2) "::"
-bool(false)
-string(3) "::1"
-bool(false)
-string(10) "fe8:5:6::1"
-bool(false)
-string(12) "2001:0db8::1"
-bool(false)
-string(5) "5f::1"
-bool(false)
-string(7) "3ff3::1"
-bool(false)
+--TEST-- +Bug #47435 (FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE don't work with ipv6) +--SKIPIF-- +<?php if (!extension_loaded("filter")) die("skip"); ?> +--FILE-- +<?php +var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); +var_dump(filter_var("FC00::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE)); +var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); +var_dump(filter_var("::", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); +var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); +var_dump(filter_var("::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); +var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); +var_dump(filter_var("fe8:5:6::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); +var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); +var_dump(filter_var("2001:0db8::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); +var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); +var_dump(filter_var("5f::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); +var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); +var_dump(filter_var("3ff3::1", FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE)); +?> +--EXPECT-- +string(7) "FC00::1" +bool(false) +string(2) "::" +bool(false) +string(3) "::1" +bool(false) +string(10) "fe8:5:6::1" +bool(false) +string(12) "2001:0db8::1" +bool(false) +string(5) "5f::1" +bool(false) +string(7) "3ff3::1" +bool(false) diff --git a/ext/filter/tests/bug49274.phpt b/ext/filter/tests/bug49274.phpt index c87e6be1c7..2adc6ed977 100644 --- a/ext/filter/tests/bug49274.phpt +++ b/ext/filter/tests/bug49274.phpt @@ -1,10 +1,10 @@ ---TEST--
-#49274, fatal error when an object does not implement toString
---SKIPIF--
-<?php if (!extension_loaded("filter")) die("skip"); ?>
---FILE--
-<?php
-var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL));
-?>
---EXPECTF--
-bool(false)
+--TEST-- +#49274, fatal error when an object does not implement toString +--SKIPIF-- +<?php if (!extension_loaded("filter")) die("skip"); ?> +--FILE-- +<?php +var_dump(filter_var(new stdClass, FILTER_VALIDATE_EMAIL)); +?> +--EXPECTF-- +bool(false) diff --git a/ext/gd/tests/bug42434.phpt b/ext/gd/tests/bug42434.phpt index bc0790ede4..9067500090 100644 --- a/ext/gd/tests/bug42434.phpt +++ b/ext/gd/tests/bug42434.phpt @@ -1,27 +1,27 @@ ---TEST--
-Bug #42434 (ImageLine w/ antialias = 1px shorter)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) {
- die('skip gd extension not available');
-}
-if (!GD_BUNDLED) die("skip requires bundled GD library\n");
-?>
---FILE--
-<?php
-$im = imagecreatetruecolor(10, 2);
-imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF);
-
-imageantialias($im, true);
-imageline($im, 0, 0, 10, 0, 0x000000);
-
-if (imagecolorat($im, 9, 0) == 0x000000) {
- echo 'DONE';
-} else {
- echo 'Bugged';
-}
-
-imagedestroy($im);
-?>
---EXPECTF--
+--TEST-- +Bug #42434 (ImageLine w/ antialias = 1px shorter) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) { + die('skip gd extension not available'); +} +if (!GD_BUNDLED) die("skip requires bundled GD library\n"); +?> +--FILE-- +<?php +$im = imagecreatetruecolor(10, 2); +imagefilledrectangle($im, 0, 0, 10, 2, 0xFFFFFF); + +imageantialias($im, true); +imageline($im, 0, 0, 10, 0, 0x000000); + +if (imagecolorat($im, 9, 0) == 0x000000) { + echo 'DONE'; +} else { + echo 'Bugged'; +} + +imagedestroy($im); +?> +--EXPECTF-- DONE
\ No newline at end of file diff --git a/ext/gd/tests/bug47946.phpt b/ext/gd/tests/bug47946.phpt index c84508509c..aeea7fb324 100644 --- a/ext/gd/tests/bug47946.phpt +++ b/ext/gd/tests/bug47946.phpt @@ -1,51 +1,51 @@ ---TEST--
-Bug #47946 (ImageConvolution overwrites background)
---DESCRIPTION--
-The expected image has black pixel artifacts, what is another issue, though
-(perhaps #40158).
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-function array_flatten($array)
-{
- $tempArray = array();
-
- foreach ($array as $value) {
- if (is_array($value)) {
- $tempArray = array_merge($tempArray, array_flatten($value));
- } else {
- $tempArray[] = $value;
- }
- }
-
- return $tempArray;
-}
-
-function makeFilter($resource, $matrix, $offset = 1.0)
-{
- $divisor = array_sum(array_flatten($matrix));
- if ($divisor == 0) {
- $divisor = .01;
- }
- return imageconvolution($resource, $matrix, $divisor, $offset);
-}
-
-$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));
-
-$im = imagecreatetruecolor(40, 40);
-imagealphablending($im, false);
-imagefilledrectangle($im, 0, 0, 39, 39, 0x7fffffff);
-imagefilledellipse($im, 19, 19, 20, 20, 0x00ff00);
-imagesavealpha($im, true);
-makeFilter($im, $edgeMatrix);
-
-require_once __DIR__ . '/func.inc';
-test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im);
-?>
-===DONE===
---EXPECT--
-The images are equal.
-===DONE===
+--TEST-- +Bug #47946 (ImageConvolution overwrites background) +--DESCRIPTION-- +The expected image has black pixel artifacts, what is another issue, though +(perhaps #40158). +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +?> +--FILE-- +<?php +function array_flatten($array) +{ + $tempArray = array(); + + foreach ($array as $value) { + if (is_array($value)) { + $tempArray = array_merge($tempArray, array_flatten($value)); + } else { + $tempArray[] = $value; + } + } + + return $tempArray; +} + +function makeFilter($resource, $matrix, $offset = 1.0) +{ + $divisor = array_sum(array_flatten($matrix)); + if ($divisor == 0) { + $divisor = .01; + } + return imageconvolution($resource, $matrix, $divisor, $offset); +} + +$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1)); + +$im = imagecreatetruecolor(40, 40); +imagealphablending($im, false); +imagefilledrectangle($im, 0, 0, 39, 39, 0x7fffffff); +imagefilledellipse($im, 19, 19, 20, 20, 0x00ff00); +imagesavealpha($im, true); +makeFilter($im, $edgeMatrix); + +require_once __DIR__ . '/func.inc'; +test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im); +?> +===DONE=== +--EXPECT-- +The images are equal. +===DONE=== diff --git a/ext/gd/tests/bug52070.phpt b/ext/gd/tests/bug52070.phpt index acf56e6b5b..d44a527479 100644 --- a/ext/gd/tests/bug52070.phpt +++ b/ext/gd/tests/bug52070.phpt @@ -1,25 +1,25 @@ ---TEST--
-Bug #52070 (imagedashedline() - dashed line sometimes is not visible)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-$im = imagecreate(1200, 800);
-$background_color = imagecolorallocate($im, 40, 40, 40);
-$color = imagecolorallocate($im, 255, 255, 255);
-imagedashedline($im, 800, 400, 300, 400, $color);
-imagedashedline($im, 800, 400, 300, 800, $color);
-imagedashedline($im, 800, 400, 400, 800, $color);
-imagedashedline($im, 800, 400, 500, 800, $color);
-imagedashedline($im, 800, 400, 600, 800, $color);
-imagedashedline($im, 800, 400, 700, 800, $color);
-imagedashedline($im, 800, 400, 800, 800, $color);
-include_once __DIR__ . '/func.inc';
-test_image_equals_file(__DIR__ . '/bug52070.png', $im);
-?>
-===DONE===
---EXPECT--
-The images are equal.
-===DONE===
+--TEST-- +Bug #52070 (imagedashedline() - dashed line sometimes is not visible) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +?> +--FILE-- +<?php +$im = imagecreate(1200, 800); +$background_color = imagecolorallocate($im, 40, 40, 40); +$color = imagecolorallocate($im, 255, 255, 255); +imagedashedline($im, 800, 400, 300, 400, $color); +imagedashedline($im, 800, 400, 300, 800, $color); +imagedashedline($im, 800, 400, 400, 800, $color); +imagedashedline($im, 800, 400, 500, 800, $color); +imagedashedline($im, 800, 400, 600, 800, $color); +imagedashedline($im, 800, 400, 700, 800, $color); +imagedashedline($im, 800, 400, 800, 800, $color); +include_once __DIR__ . '/func.inc'; +test_image_equals_file(__DIR__ . '/bug52070.png', $im); +?> +===DONE=== +--EXPECT-- +The images are equal. +===DONE=== diff --git a/ext/gd/tests/bug53156.phpt b/ext/gd/tests/bug53156.phpt index 9e1fec8798..ceb37c13c4 100644 --- a/ext/gd/tests/bug53156.phpt +++ b/ext/gd/tests/bug53156.phpt @@ -1,60 +1,60 @@ ---TEST--
-Bug #53156 (imagerectangle problem with point ordering)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) {
- die("skip test requires GD 2.3 or newer");
-}
-?>
---FILE--
-<?php
-function draw_and_check_pixel($x, $y)
-{
- global $img, $black, $red;
-
- echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-';
- imagesetpixel($img, $x, $y, $red);
-}
-
-function draw_and_check_rectangle($x1, $y1, $x2, $y2)
-{
- global $img, $black;
-
- echo 'Rectangle: ';
- imagerectangle($img, $x1, $y1, $x2, $y2, $black);
- $x = ($x1 + $x2) / 2;
- $y = ($y1 + $y2) / 2;
- draw_and_check_pixel($x, $y1);
- draw_and_check_pixel($x1, $y);
- draw_and_check_pixel($x, $y2);
- draw_and_check_pixel($x2, $y);
- echo PHP_EOL;
-}
-
-$img = imagecreate(110, 210);
-$bgnd = imagecolorallocate($img, 255, 255, 255);
-$black = imagecolorallocate($img, 0, 0, 0);
-$red = imagecolorallocate($img, 255, 0, 0);
-
-draw_and_check_rectangle( 10, 10, 50, 50);
-draw_and_check_rectangle( 50, 60, 10, 100);
-draw_and_check_rectangle( 50, 150, 10, 110);
-draw_and_check_rectangle( 10, 200, 50, 160);
-imagesetthickness($img, 4);
-draw_and_check_rectangle( 60, 10, 100, 50);
-draw_and_check_rectangle(100, 60, 60, 100);
-draw_and_check_rectangle(100, 150, 60, 110);
-draw_and_check_rectangle( 60, 200, 100, 160);
-
-//imagepng($img, __DIR__ . '/bug53156.png'); // debug
-?>
---EXPECT--
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
-Rectangle: ++++
+--TEST-- +Bug #53156 (imagerectangle problem with point ordering) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3', '<')) { + die("skip test requires GD 2.3 or newer"); +} +?> +--FILE-- +<?php +function draw_and_check_pixel($x, $y) +{ + global $img, $black, $red; + + echo (imagecolorat($img, $x, $y) === $black) ? '+' : '-'; + imagesetpixel($img, $x, $y, $red); +} + +function draw_and_check_rectangle($x1, $y1, $x2, $y2) +{ + global $img, $black; + + echo 'Rectangle: '; + imagerectangle($img, $x1, $y1, $x2, $y2, $black); + $x = ($x1 + $x2) / 2; + $y = ($y1 + $y2) / 2; + draw_and_check_pixel($x, $y1); + draw_and_check_pixel($x1, $y); + draw_and_check_pixel($x, $y2); + draw_and_check_pixel($x2, $y); + echo PHP_EOL; +} + +$img = imagecreate(110, 210); +$bgnd = imagecolorallocate($img, 255, 255, 255); +$black = imagecolorallocate($img, 0, 0, 0); +$red = imagecolorallocate($img, 255, 0, 0); + +draw_and_check_rectangle( 10, 10, 50, 50); +draw_and_check_rectangle( 50, 60, 10, 100); +draw_and_check_rectangle( 50, 150, 10, 110); +draw_and_check_rectangle( 10, 200, 50, 160); +imagesetthickness($img, 4); +draw_and_check_rectangle( 60, 10, 100, 50); +draw_and_check_rectangle(100, 60, 60, 100); +draw_and_check_rectangle(100, 150, 60, 110); +draw_and_check_rectangle( 60, 200, 100, 160); + +//imagepng($img, __DIR__ . '/bug53156.png'); // debug +?> +--EXPECT-- +Rectangle: ++++ +Rectangle: ++++ +Rectangle: ++++ +Rectangle: ++++ +Rectangle: ++++ +Rectangle: ++++ +Rectangle: ++++ +Rectangle: ++++ diff --git a/ext/gd/tests/bug72494.phpt b/ext/gd/tests/bug72494.phpt index f21de6ca3b..4cca9aec8e 100644 --- a/ext/gd/tests/bug72494.phpt +++ b/ext/gd/tests/bug72494.phpt @@ -1,15 +1,15 @@ ---TEST--
-Bug #72494 (imagecropauto out-of-bounds access)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-$im = imagecreate(10,10);
-imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
-?>
-===DONE===
---EXPECTF--
-Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
-===DONE===
+--TEST-- +Bug #72494 (imagecropauto out-of-bounds access) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +?> +--FILE-- +<?php +$im = imagecreate(10,10); +imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337); +?> +===DONE=== +--EXPECTF-- +Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d +===DONE=== diff --git a/ext/gd/tests/bug73272.phpt b/ext/gd/tests/bug73272.phpt index 3bb710cdc7..ccee8d6e67 100644 --- a/ext/gd/tests/bug73272.phpt +++ b/ext/gd/tests/bug73272.phpt @@ -1,24 +1,24 @@ ---TEST--
-Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
-
-$src = imagecreatetruecolor(100, 100);
-imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
-imageellipse($src, 49,49, 40,40, 0x000000);
-
-imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
-imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
-$dst = imagerotate($src, 60, 0xFFFFFF);
-
-test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
-?>
-===DONE===
---EXPECT--
-The images are equal.
-===DONE===
+--TEST-- +Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation()) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +?> +--FILE-- +<?php +require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc'; + +$src = imagecreatetruecolor(100, 100); +imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF); +imageellipse($src, 49,49, 40,40, 0x000000); + +imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR); +imagescale($src, 200, 200, IMG_BILINEAR_FIXED); +$dst = imagerotate($src, 60, 0xFFFFFF); + +test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst); +?> +===DONE=== +--EXPECT-- +The images are equal. +===DONE=== diff --git a/ext/gd/tests/bug73279.phpt b/ext/gd/tests/bug73279.phpt index e6c6709039..aba91f0d3a 100644 --- a/ext/gd/tests/bug73279.phpt +++ b/ext/gd/tests/bug73279.phpt @@ -1,20 +1,20 @@ ---TEST--
-Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
- die('skip only for bundled libgd or external libgd >= 2.2.4');
-}
-?>
---FILE--
-<?php
-$src = imagecreate(100, 100);
-imagecolorallocate($src, 255, 255, 255);
-$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
-printf("color: %x\n", imagecolorat($dst, 99, 99));
-?>
-===DONE===
---EXPECT--
-color: ffffff
-===DONE===
+--TEST-- +Bug #73279 (Integer overflow in gdImageScaleBilinearPalette()) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) { + die('skip only for bundled libgd or external libgd >= 2.2.4'); +} +?> +--FILE-- +<?php +$src = imagecreate(100, 100); +imagecolorallocate($src, 255, 255, 255); +$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED); +printf("color: %x\n", imagecolorat($dst, 99, 99)); +?> +===DONE=== +--EXPECT-- +color: ffffff +===DONE=== diff --git a/ext/gd/tests/bug73279_old.phpt b/ext/gd/tests/bug73279_old.phpt index 0cbbec34f2..810b15201f 100644 --- a/ext/gd/tests/bug73279_old.phpt +++ b/ext/gd/tests/bug73279_old.phpt @@ -1,22 +1,22 @@ ---TEST--
-Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
- die('skip only for external libgd < 2.2.4');
-}
-?>
---FILE--
-<?php
-$src = imagecreate(100, 100);
-imagecolorallocate($src, 255, 255, 255);
-$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
-printf("color: %x\n", imagecolorat($dst, 99, 99));
-?>
-===DONE===
---XFAIL--
-Bug #330 has not yet been fixed
---EXPECT--
-color: ffffff
-===DONE===
+--TEST-- +Bug #73279 (Integer overflow in gdImageScaleBilinearPalette()) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) { + die('skip only for external libgd < 2.2.4'); +} +?> +--FILE-- +<?php +$src = imagecreate(100, 100); +imagecolorallocate($src, 255, 255, 255); +$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED); +printf("color: %x\n", imagecolorat($dst, 99, 99)); +?> +===DONE=== +--XFAIL-- +Bug #330 has not yet been fixed +--EXPECT-- +color: ffffff +===DONE=== diff --git a/ext/gd/tests/bug73968.phpt b/ext/gd/tests/bug73968.phpt index fd17fe26ba..2211840f58 100644 --- a/ext/gd/tests/bug73968.phpt +++ b/ext/gd/tests/bug73968.phpt @@ -1,15 +1,15 @@ ---TEST--
-Bug #73968 (Premature failing of XBM reading)
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
-var_dump($im);
-?>
-===DONE===
---EXPECTF--
-resource(%d) of type (gd)
-===DONE===
+--TEST-- +Bug #73968 (Premature failing of XBM reading) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +?> +--FILE-- +<?php +$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm'); +var_dump($im); +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (gd) +===DONE=== diff --git a/ext/gd/tests/func.inc b/ext/gd/tests/func.inc index 708fccd3d1..1928ff696a 100644 --- a/ext/gd/tests/func.inc +++ b/ext/gd/tests/func.inc @@ -1,148 +1,148 @@ -<?php
-
-function get_gd_version()
-{
- return GD_VERSION;
-}
-
-function get_php_info()
-{
- ob_start();
- phpinfo();
- $info = ob_get_contents();
- ob_end_clean();
-
- return $info;
-}
-
-function get_freetype_version()
-{
- $version = 0;
-
- if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
-
- return $version;
-}
-
-function get_libjpeg_version()
-{
- $version = 0;
-
- if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
-
- return $version;
-}
-
-function get_libpng_version()
-{
- $version = 0;
-
- if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
-
- return $version;
-}
-
-function get_libxpm_version()
-{
- $version = 0;
-
- if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
-
- return $version;
-}
-
-/**
- * Tests that an in-memory image equals a PNG file.
- *
- * It checks for equal image sizes, and whether any pixels are different.
- * The textual result is printed, so the EXPECT section should contain the line
- * "The images are equal."
- *
- * If the PNG file does not exists, or the images are not equal, a diagnostic
- * message is printed, and the actual file is stored right beside the temporary
- * .php test file with the extension .out.png, to be able to manually inspect
- * the result.
- *
- * @param string $filename
- * @param resource $actual
- * @return void
- */
-function test_image_equals_file($filename, $actual)
-{
- if (!file_exists($filename)) {
- echo "The expected image does not exist.\n";
- save_actual_image($actual);
- return;
- }
- $actual = test_to_truecolor($actual);
- $expected = imagecreatefrompng($filename);
- $expected = test_to_truecolor($expected);
- $exp_x = imagesx($expected);
- $exp_y = imagesy($expected);
- $act_x = imagesx($actual);
- $act_y = imagesy($actual);
- if ($exp_x != $act_x || $exp_y != $act_y) {
- echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";
- save_actual_image($actual);
- return;
- }
- $pixels_changed = 0;
- for ($y = 0; $y < $exp_y; $y++) {
- for ($x = 0; $x < $exp_x; $x ++) {
- $exp_c = imagecolorat($expected, $x, $y);
- $act_c = imagecolorat($actual, $x, $y);
- if ($exp_c != $act_c) {
- $pixels_changed++;
- }
- }
- }
- if (!$pixels_changed) {
- echo "The images are equal.\n";
- } else {
- echo "The images differ in {$pixels_changed} pixels.\n";
- save_actual_image($actual);
- }
-}
-
-/**
- * Returns the truecolor version of an image.
- *
- * @param resource $image
- * @return resource
- */
-function test_to_truecolor($image)
-{
- if (imageistruecolor($image)) {
- return $image;
- } else {
- $width = imagesx($image);
- $height = imagesy($image);
- $result = imagecreatetruecolor($width, $height);
- imagecopy($result, $image, 0,0, 0,0, $width, $height);
- return $result;
- }
-}
-
-/**
- * Saves an actual image to disk.
- *
- * The image is saved right beside the temporary .php test file with the
- * extension .out.png.
- *
- * @param resource $image
- * @return void
- */
-function save_actual_image($image)
-{
- $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
- $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
- imagepng($image, $filename);
-}
+<?php + +function get_gd_version() +{ + return GD_VERSION; +} + +function get_php_info() +{ + ob_start(); + phpinfo(); + $info = ob_get_contents(); + ob_end_clean(); + + return $info; +} + +function get_freetype_version() +{ + $version = 0; + + if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) { + $version = $match[1]; + } + + return $version; +} + +function get_libjpeg_version() +{ + $version = 0; + + if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) { + $version = $match[1]; + } + + return $version; +} + +function get_libpng_version() +{ + $version = 0; + + if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) { + $version = $match[1]; + } + + return $version; +} + +function get_libxpm_version() +{ + $version = 0; + + if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) { + $version = $match[1]; + } + + return $version; +} + +/** + * Tests that an in-memory image equals a PNG file. + * + * It checks for equal image sizes, and whether any pixels are different. + * The textual result is printed, so the EXPECT section should contain the line + * "The images are equal." + * + * If the PNG file does not exists, or the images are not equal, a diagnostic + * message is printed, and the actual file is stored right beside the temporary + * .php test file with the extension .out.png, to be able to manually inspect + * the result. + * + * @param string $filename + * @param resource $actual + * @return void + */ +function test_image_equals_file($filename, $actual) +{ + if (!file_exists($filename)) { + echo "The expected image does not exist.\n"; + save_actual_image($actual); + return; + } + $actual = test_to_truecolor($actual); + $expected = imagecreatefrompng($filename); + $expected = test_to_truecolor($expected); + $exp_x = imagesx($expected); + $exp_y = imagesy($expected); + $act_x = imagesx($actual); + $act_y = imagesy($actual); + if ($exp_x != $act_x || $exp_y != $act_y) { + echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n"; + save_actual_image($actual); + return; + } + $pixels_changed = 0; + for ($y = 0; $y < $exp_y; $y++) { + for ($x = 0; $x < $exp_x; $x ++) { + $exp_c = imagecolorat($expected, $x, $y); + $act_c = imagecolorat($actual, $x, $y); + if ($exp_c != $act_c) { + $pixels_changed++; + } + } + } + if (!$pixels_changed) { + echo "The images are equal.\n"; + } else { + echo "The images differ in {$pixels_changed} pixels.\n"; + save_actual_image($actual); + } +} + +/** + * Returns the truecolor version of an image. + * + * @param resource $image + * @return resource + */ +function test_to_truecolor($image) +{ + if (imageistruecolor($image)) { + return $image; + } else { + $width = imagesx($image); + $height = imagesy($image); + $result = imagecreatetruecolor($width, $height); + imagecopy($result, $image, 0,0, 0,0, $width, $height); + return $result; + } +} + +/** + * Saves an actual image to disk. + * + * The image is saved right beside the temporary .php test file with the + * extension .out.png. + * + * @param resource $image + * @return void + */ +function save_actual_image($image) +{ + $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']); + $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png"; + imagepng($image, $filename); +} diff --git a/ext/gd/tests/imagecrop_auto-ext.phpt b/ext/gd/tests/imagecrop_auto-ext.phpt index 60291a69c0..f37b3ca8e2 100644 --- a/ext/gd/tests/imagecrop_auto-ext.phpt +++ b/ext/gd/tests/imagecrop_auto-ext.phpt @@ -1,85 +1,85 @@ ---TEST--
-Testing imagecropauto()
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
-if (GD_BUNDLED) die('skip requires external libgd');
-?>
---FILE--
-<?php
-
-echo "TC IMG_CROP_DEFAULT\n";
-$im = imagecreatetruecolor(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_DEFAULT\n";
-$im = imagecreate(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "TC IMG_CROP_SIDES\n";
-$im = imagecreatetruecolor(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_SIDES\n";
-$im = imagecreate(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "TC IMG_CROP_BLACK\n";
-$im = imagecreatetruecolor(50, 50);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_BLACK\n";
-$im = imagecreate(50, 50);
-$bgd = imagecolorallocate($im, 0, 0, 0);
-$b = imagecolorallocate($im, 0, 0, 255);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "IMG_CROP_THRESHOLD\n";
-$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
-$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
-imagepng($im_crop, __DIR__ . "/crop_threshold.png");
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-@unlink(__DIR__ . "/crop_threshold.png");
-?>
---EXPECT--
-TC IMG_CROP_DEFAULT
-int(99)
-int(99)
-Palette IMG_CROP_DEFAULT
-int(99)
-int(99)
-TC IMG_CROP_SIDES
-int(11)
-int(11)
-Palette IMG_CROP_SIDES
-int(11)
-int(11)
-TC IMG_CROP_BLACK
-int(11)
-int(11)
-Palette IMG_CROP_BLACK
-int(11)
-int(11)
-IMG_CROP_THRESHOLD
-int(240)
-int(134)
+--TEST-- +Testing imagecropauto() +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' ); +if (GD_BUNDLED) die('skip requires external libgd'); +?> +--FILE-- +<?php + +echo "TC IMG_CROP_DEFAULT\n"; +$im = imagecreatetruecolor(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "Palette IMG_CROP_DEFAULT\n"; +$im = imagecreate(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "TC IMG_CROP_SIDES\n"; +$im = imagecreatetruecolor(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_SIDES); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "Palette IMG_CROP_SIDES\n"; +$im = imagecreate(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_SIDES); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "TC IMG_CROP_BLACK\n"; +$im = imagecreatetruecolor(50, 50); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_BLACK); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "Palette IMG_CROP_BLACK\n"; +$im = imagecreate(50, 50); +$bgd = imagecolorallocate($im, 0, 0, 0); +$b = imagecolorallocate($im, 0, 0, 255); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_BLACK); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "IMG_CROP_THRESHOLD\n"; +$im = imagecreatefrompng(__DIR__ . "/logo_noise.png"); +$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0); +imagepng($im_crop, __DIR__ . "/crop_threshold.png"); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +@unlink(__DIR__ . "/crop_threshold.png"); +?> +--EXPECT-- +TC IMG_CROP_DEFAULT +int(99) +int(99) +Palette IMG_CROP_DEFAULT +int(99) +int(99) +TC IMG_CROP_SIDES +int(11) +int(11) +Palette IMG_CROP_SIDES +int(11) +int(11) +TC IMG_CROP_BLACK +int(11) +int(11) +Palette IMG_CROP_BLACK +int(11) +int(11) +IMG_CROP_THRESHOLD +int(240) +int(134) diff --git a/ext/gd/tests/imagecrop_auto.phpt b/ext/gd/tests/imagecrop_auto.phpt index 8a0f79d324..07f6b8ae4c 100644 --- a/ext/gd/tests/imagecrop_auto.phpt +++ b/ext/gd/tests/imagecrop_auto.phpt @@ -1,85 +1,85 @@ ---TEST--
-Testing imagecropauto()
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' );
-if (!GD_BUNDLED) die('skip requires bundled libgd');
-?>
---FILE--
-<?php
-
-echo "TC IMG_CROP_DEFAULT\n";
-$im = imagecreatetruecolor(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_DEFAULT\n";
-$im = imagecreate(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_DEFAULT);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "TC IMG_CROP_SIDES\n";
-$im = imagecreatetruecolor(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_SIDES\n";
-$im = imagecreate(99, 99);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_SIDES);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "TC IMG_CROP_BLACK\n";
-$im = imagecreatetruecolor(50, 50);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "Palette IMG_CROP_BLACK\n";
-$im = imagecreate(50, 50);
-$bgd = imagecolorallocate($im, 0, 0, 0);
-$b = imagecolorallocate($im, 0, 0, 255);
-imagefilledrectangle($im, 20, 20, 30, 30, 0xff);
-$im_crop = imagecropauto($im, IMG_CROP_BLACK);
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-echo "IMG_CROP_THRESHOLD\n";
-$im = imagecreatefrompng(__DIR__ . "/logo_noise.png");
-$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
-imagepng($im_crop, __DIR__ . "/crop_threshold.png");
-var_dump(imagesx($im_crop));
-var_dump(imagesy($im_crop));
-
-@unlink(__DIR__ . "/crop_threshold.png");
-?>
---EXPECT--
-TC IMG_CROP_DEFAULT
-int(11)
-int(11)
-Palette IMG_CROP_DEFAULT
-int(11)
-int(11)
-TC IMG_CROP_SIDES
-int(11)
-int(11)
-Palette IMG_CROP_SIDES
-int(11)
-int(11)
-TC IMG_CROP_BLACK
-int(11)
-int(11)
-Palette IMG_CROP_BLACK
-int(11)
-int(11)
-IMG_CROP_THRESHOLD
-int(240)
-int(134)
+--TEST-- +Testing imagecropauto() +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') || !function_exists('imagecrop')) die( 'skip GD imagecropauto not present; skipping test' ); +if (!GD_BUNDLED) die('skip requires bundled libgd'); +?> +--FILE-- +<?php + +echo "TC IMG_CROP_DEFAULT\n"; +$im = imagecreatetruecolor(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "Palette IMG_CROP_DEFAULT\n"; +$im = imagecreate(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_DEFAULT); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "TC IMG_CROP_SIDES\n"; +$im = imagecreatetruecolor(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_SIDES); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "Palette IMG_CROP_SIDES\n"; +$im = imagecreate(99, 99); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_SIDES); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "TC IMG_CROP_BLACK\n"; +$im = imagecreatetruecolor(50, 50); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_BLACK); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "Palette IMG_CROP_BLACK\n"; +$im = imagecreate(50, 50); +$bgd = imagecolorallocate($im, 0, 0, 0); +$b = imagecolorallocate($im, 0, 0, 255); +imagefilledrectangle($im, 20, 20, 30, 30, 0xff); +$im_crop = imagecropauto($im, IMG_CROP_BLACK); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +echo "IMG_CROP_THRESHOLD\n"; +$im = imagecreatefrompng(__DIR__ . "/logo_noise.png"); +$im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0); +imagepng($im_crop, __DIR__ . "/crop_threshold.png"); +var_dump(imagesx($im_crop)); +var_dump(imagesy($im_crop)); + +@unlink(__DIR__ . "/crop_threshold.png"); +?> +--EXPECT-- +TC IMG_CROP_DEFAULT +int(11) +int(11) +Palette IMG_CROP_DEFAULT +int(11) +int(11) +TC IMG_CROP_SIDES +int(11) +int(11) +Palette IMG_CROP_SIDES +int(11) +int(11) +TC IMG_CROP_BLACK +int(11) +int(11) +Palette IMG_CROP_BLACK +int(11) +int(11) +IMG_CROP_THRESHOLD +int(240) +int(134) diff --git a/ext/gd/tests/imageellipse_error8.phpt b/ext/gd/tests/imageellipse_error8.phpt index 3fefb56bde..d02b97eec3 100644 --- a/ext/gd/tests/imageellipse_error8.phpt +++ b/ext/gd/tests/imageellipse_error8.phpt @@ -1,21 +1,21 @@ ---TEST--
-Testing wrong param passing imageellipse() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-
-// Create a image
-$image = imagecreatetruecolor( 400, 300 );
-
-// try to draw a white ellipse
-imageellipse( $image, 200, 150, 300, 200 );
-
-?>
---EXPECTF--
+--TEST-- +Testing wrong param passing imageellipse() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-20 +--SKIPIF-- +<?php +if ( ! extension_loaded("gd") ) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php + +// Create a image +$image = imagecreatetruecolor( 400, 300 ); + +// try to draw a white ellipse +imageellipse( $image, 200, 150, 300, 200 ); + +?> +--EXPECTF-- Warning: imageellipse() expects exactly 6 parameters, %d given in %s on line %d diff --git a/ext/gd/tests/imagefilltoborder_error7.phpt b/ext/gd/tests/imagefilltoborder_error7.phpt index aeb7d82620..f3313e11f4 100644 --- a/ext/gd/tests/imagefilltoborder_error7.phpt +++ b/ext/gd/tests/imagefilltoborder_error7.phpt @@ -1,26 +1,26 @@ ---TEST--
-Testing wrong param passing imagefilltoborder() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded("gd")) die("skip GD not present; skipping test");
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
-
-// Draw an ellipse to fill with a black border
-imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
-
-// Try to fill border
-imagefilltoborder( $image, 50, 50 );
-
-?>
---EXPECTF--
+--TEST-- +Testing wrong param passing imagefilltoborder() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-30 +--SKIPIF-- +<?php +if ( ! extension_loaded("gd")) die("skip GD not present; skipping test"); +?> +--FILE-- +<?php +// Create a image +$image = imagecreatetruecolor( 100, 100 ); + +// Draw a rectangle +imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) ); + +// Draw an ellipse to fill with a black border +imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) ); + +// Try to fill border +imagefilltoborder( $image, 50, 50 ); + +?> +--EXPECTF-- Warning: imagefilltoborder() expects exactly 5 parameters, %d given in %s on line %d diff --git a/ext/gd/tests/imageflip.phpt b/ext/gd/tests/imageflip.phpt index a326e0a2ba..f4660940a2 100644 --- a/ext/gd/tests/imageflip.phpt +++ b/ext/gd/tests/imageflip.phpt @@ -1,30 +1,30 @@ ---TEST--
-Testing imageflip() of GD library
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-
-$im = imagecreatetruecolor( 99, 99 );
-
-imagesetpixel($im, 0, 0, 0xFF);
-imagesetpixel($im, 0, 98, 0x00FF00);
-imagesetpixel($im, 98, 0, 0xFF0000);
-imagesetpixel($im, 98, 98, 0x0000FF);
-
-imageflip($im, IMG_FLIP_HORIZONTAL);
-imageflip($im, IMG_FLIP_VERTICAL);
-imageflip($im, IMG_FLIP_BOTH);
-
-var_dump(dechex(imagecolorat($im, 0, 0)));
-var_dump(dechex(imagecolorat($im, 0, 98)));
-var_dump(dechex(imagecolorat($im, 98, 0)));
-var_dump(dechex(imagecolorat($im, 98, 98)));
-?>
---EXPECT--
-string(2) "ff"
-string(4) "ff00"
-string(6) "ff0000"
+--TEST-- +Testing imageflip() of GD library +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') || !function_exists('imageflip')) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php + +$im = imagecreatetruecolor( 99, 99 ); + +imagesetpixel($im, 0, 0, 0xFF); +imagesetpixel($im, 0, 98, 0x00FF00); +imagesetpixel($im, 98, 0, 0xFF0000); +imagesetpixel($im, 98, 98, 0x0000FF); + +imageflip($im, IMG_FLIP_HORIZONTAL); +imageflip($im, IMG_FLIP_VERTICAL); +imageflip($im, IMG_FLIP_BOTH); + +var_dump(dechex(imagecolorat($im, 0, 0))); +var_dump(dechex(imagecolorat($im, 0, 98))); +var_dump(dechex(imagecolorat($im, 98, 0))); +var_dump(dechex(imagecolorat($im, 98, 98))); +?> +--EXPECT-- +string(2) "ff" +string(4) "ff00" +string(6) "ff0000" string(2) "ff"
\ No newline at end of file diff --git a/ext/gd/tests/imagerectangle_basic.phpt b/ext/gd/tests/imagerectangle_basic.phpt index 507d715326..d23cbdfe79 100644 --- a/ext/gd/tests/imagerectangle_basic.phpt +++ b/ext/gd/tests/imagerectangle_basic.phpt @@ -1,22 +1,22 @@ ---TEST--
-Testing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
-
-include_once __DIR__ . '/func.inc';
-test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image);
-?>
---EXPECT--
-The images are equal.
+--TEST-- +Testing imagerectangle() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-30 +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php +// Create a image +$image = imagecreatetruecolor( 100, 100 ); + +// Draw a rectangle +imagerectangle( $image, 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) ); + +include_once __DIR__ . '/func.inc'; +test_image_equals_file(__DIR__ . '/imagerectangle_basic.png', $image); +?> +--EXPECT-- +The images are equal. diff --git a/ext/gd/tests/imagerectangle_error1.phpt b/ext/gd/tests/imagerectangle_error1.phpt index 2b4235e854..3b9e8d3f0c 100644 --- a/ext/gd/tests/imagerectangle_error1.phpt +++ b/ext/gd/tests/imagerectangle_error1.phpt @@ -1,19 +1,19 @@ ---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
-?>
---EXPECTF--
+--TEST-- +Testing wrong param passing imagerectangle() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-30 +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php +// Create a image +$image = imagecreatetruecolor( 100, 100 ); + +// Draw a rectangle +imagerectangle( 'wrong param', 0, 0, 50, 50, imagecolorallocate($image, 255, 255, 255) ); +?> +--EXPECTF-- Warning: imagerectangle() expects parameter 1 to be resource, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error2.phpt b/ext/gd/tests/imagerectangle_error2.phpt index 5fc1914ad0..63525d2cb7 100644 --- a/ext/gd/tests/imagerectangle_error2.phpt +++ b/ext/gd/tests/imagerectangle_error2.phpt @@ -1,19 +1,19 @@ ---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a resource
-$image = tmpfile();
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50, 2 );
-?>
---EXPECTF--
+--TEST-- +Testing wrong param passing imagerectangle() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-30 +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php +// Create a resource +$image = tmpfile(); + +// Draw a rectangle +imagerectangle( $image, 0, 0, 50, 50, 2 ); +?> +--EXPECTF-- Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d
\ No newline at end of file diff --git a/ext/gd/tests/imagerectangle_error3.phpt b/ext/gd/tests/imagerectangle_error3.phpt index eceab1e99b..350ee1bf82 100644 --- a/ext/gd/tests/imagerectangle_error3.phpt +++ b/ext/gd/tests/imagerectangle_error3.phpt @@ -1,19 +1,19 @@ ---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) );
-?>
---EXPECTF--
+--TEST-- +Testing wrong param passing imagerectangle() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-30 +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php +// Create a image +$image = imagecreatetruecolor( 100, 100 ); + +// Draw a rectangle +imagerectangle( $image, 'wrong param', 0, 50, 50, imagecolorallocate($image, 255, 255, 255) ); +?> +--EXPECTF-- Warning: imagerectangle() expects parameter 2 to be integer, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error4.phpt b/ext/gd/tests/imagerectangle_error4.phpt index 5d8e1cecac..4c448dc027 100644 --- a/ext/gd/tests/imagerectangle_error4.phpt +++ b/ext/gd/tests/imagerectangle_error4.phpt @@ -1,19 +1,19 @@ ---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) );
-?>
---EXPECTF--
+--TEST-- +Testing wrong param passing imagerectangle() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-30 +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php +// Create a image +$image = imagecreatetruecolor( 100, 100 ); + +// Draw a rectangle +imagerectangle( $image, 0, 'wrong param', 50, 50, imagecolorallocate($image, 255, 255, 255) ); +?> +--EXPECTF-- Warning: imagerectangle() expects parameter 3 to be integer, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error5.phpt b/ext/gd/tests/imagerectangle_error5.phpt index df9c457d6f..fa9486e3de 100644 --- a/ext/gd/tests/imagerectangle_error5.phpt +++ b/ext/gd/tests/imagerectangle_error5.phpt @@ -1,19 +1,19 @@ ---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) );
-?>
---EXPECTF--
+--TEST-- +Testing wrong param passing imagerectangle() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-30 +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php +// Create a image +$image = imagecreatetruecolor( 100, 100 ); + +// Draw a rectangle +imagerectangle( $image, 0, 0, 'wrong param', 50, imagecolorallocate($image, 255, 255, 255) ); +?> +--EXPECTF-- Warning: imagerectangle() expects parameter 4 to be integer, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error6.phpt b/ext/gd/tests/imagerectangle_error6.phpt index a91c6bbc0c..1523a9ec57 100644 --- a/ext/gd/tests/imagerectangle_error6.phpt +++ b/ext/gd/tests/imagerectangle_error6.phpt @@ -1,19 +1,19 @@ ---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) );
-?>
---EXPECTF--
+--TEST-- +Testing wrong param passing imagerectangle() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-30 +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php +// Create a image +$image = imagecreatetruecolor( 100, 100 ); + +// Draw a rectangle +imagerectangle( $image, 0, 0, 50, 'wrong param', imagecolorallocate($image, 255, 255, 255) ); +?> +--EXPECTF-- Warning: imagerectangle() expects parameter 5 to be integer, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error7.phpt b/ext/gd/tests/imagerectangle_error7.phpt index f819da6e6c..ee6326feff 100644 --- a/ext/gd/tests/imagerectangle_error7.phpt +++ b/ext/gd/tests/imagerectangle_error7.phpt @@ -1,19 +1,19 @@ ---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50, 'wrong param' );
-?>
---EXPECTF--
+--TEST-- +Testing wrong param passing imagerectangle() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-30 +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php +// Create a image +$image = imagecreatetruecolor( 100, 100 ); + +// Draw a rectangle +imagerectangle( $image, 0, 0, 50, 50, 'wrong param' ); +?> +--EXPECTF-- Warning: imagerectangle() expects parameter 6 to be integer, %s given in %s on line %d diff --git a/ext/gd/tests/imagerectangle_error8.phpt b/ext/gd/tests/imagerectangle_error8.phpt index 361de69cde..cb0746e492 100644 --- a/ext/gd/tests/imagerectangle_error8.phpt +++ b/ext/gd/tests/imagerectangle_error8.phpt @@ -1,19 +1,19 @@ ---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50 );
-?>
---EXPECTF--
+--TEST-- +Testing wrong param passing imagerectangle() of GD library +--CREDITS-- +Ivan Rosolen <contato [at] ivanrosolen [dot] com> +#testfest PHPSP on 2009-06-30 +--SKIPIF-- +<?php +if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); +?> +--FILE-- +<?php +// Create a image +$image = imagecreatetruecolor( 100, 100 ); + +// Draw a rectangle +imagerectangle( $image, 0, 0, 50, 50 ); +?> +--EXPECTF-- Warning: imagerectangle() expects exactly 6 parameters, %d given in %s on line %d diff --git a/ext/gd/tests/test_image_equals_file_palette.phpt b/ext/gd/tests/test_image_equals_file_palette.phpt index 130fa43202..0cfea7f415 100644 --- a/ext/gd/tests/test_image_equals_file_palette.phpt +++ b/ext/gd/tests/test_image_equals_file_palette.phpt @@ -1,42 +1,42 @@ ---TEST--
-test_image_equals_file(): comparing palette images
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
-
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 255, 255, 255);
-$red = imagecolorallocate($im, 255, 0, 0);
-imagefilledrectangle($im, 3,3, 7,7, $red);
-
-$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png';
-imagepng($im, $filename);
-
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 255, 255, 255);
-$blue = imagecolorallocate($im, 0, 0, 255);
-imagefilledrectangle($im, 3,3, 7,7, $blue);
-
-test_image_equals_file($filename, $im);
-
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 255, 255, 255);
-imagecolorallocate($im, 0, 0, 0);
-$red = imagecolorallocate($im, 255, 0, 0);
-imagefilledrectangle($im, 3,3, 7,7, $red);
-
-test_image_equals_file($filename, $im);
-?>
-===DONE===
---EXPECT--
-The images differ in 25 pixels.
-The images are equal.
-===DONE===
---CLEAN--
-<?php
-unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
-?>
+--TEST-- +test_image_equals_file(): comparing palette images +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +?> +--FILE-- +<?php +require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc'; + +$im = imagecreate(10, 10); +imagecolorallocate($im, 255, 255, 255); +$red = imagecolorallocate($im, 255, 0, 0); +imagefilledrectangle($im, 3,3, 7,7, $red); + +$filename = __DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png'; +imagepng($im, $filename); + +$im = imagecreate(10, 10); +imagecolorallocate($im, 255, 255, 255); +$blue = imagecolorallocate($im, 0, 0, 255); +imagefilledrectangle($im, 3,3, 7,7, $blue); + +test_image_equals_file($filename, $im); + +$im = imagecreate(10, 10); +imagecolorallocate($im, 255, 255, 255); +imagecolorallocate($im, 0, 0, 0); +$red = imagecolorallocate($im, 255, 0, 0); +imagefilledrectangle($im, 3,3, 7,7, $red); + +test_image_equals_file($filename, $im); +?> +===DONE=== +--EXPECT-- +The images differ in 25 pixels. +The images are equal. +===DONE=== +--CLEAN-- +<?php +unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png'); +?> diff --git a/ext/gd/tests/webp_basic.phpt b/ext/gd/tests/webp_basic.phpt index 55436741db..593e43c807 100644 --- a/ext/gd/tests/webp_basic.phpt +++ b/ext/gd/tests/webp_basic.phpt @@ -1,38 +1,38 @@ ---TEST--
-imagewebp() and imagecreatefromwebp() - basic test
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
- die("skip test requires GD 2.2.0 or higher");
-}
-if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp'))
- die('skip WebP support not available');
-?>
---FILE--
-<?php
-require_once __DIR__ . '/similarity.inc';
-
-$filename = __DIR__ . '/webp_basic.webp';
-
-$im1 = imagecreatetruecolor(75, 75);
-$white = imagecolorallocate($im1, 255, 255, 255);
-$red = imagecolorallocate($im1, 255, 0, 0);
-$green = imagecolorallocate($im1, 0, 255, 0);
-$blue = imagecolorallocate($im1, 0, 0, 255);
-imagefilledrectangle($im1, 0, 0, 74, 74, $white);
-imageline($im1, 3, 3, 71, 71, $red);
-imageellipse($im1, 18, 54, 36, 36, $green);
-imagerectangle($im1, 41, 3, 71, 33, $blue);
-imagewebp($im1, $filename);
-
-$im2 = imagecreatefromwebp($filename);
-imagewebp($im2, $filename);
-var_dump(calc_image_dissimilarity($im1, $im2) < 10e5);
-?>
---CLEAN--
-<?php
-@unlink(__DIR__ . '/webp_basic.webp');
-?>
---EXPECT--
-bool(true)
+--TEST-- +imagewebp() and imagecreatefromwebp() - basic test +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) { + die("skip test requires GD 2.2.0 or higher"); +} +if (!function_exists('imagewebp') || !function_exists('imagecreatefromwebp')) + die('skip WebP support not available'); +?> +--FILE-- +<?php +require_once __DIR__ . '/similarity.inc'; + +$filename = __DIR__ . '/webp_basic.webp'; + +$im1 = imagecreatetruecolor(75, 75); +$white = imagecolorallocate($im1, 255, 255, 255); +$red = imagecolorallocate($im1, 255, 0, 0); +$green = imagecolorallocate($im1, 0, 255, 0); +$blue = imagecolorallocate($im1, 0, 0, 255); +imagefilledrectangle($im1, 0, 0, 74, 74, $white); +imageline($im1, 3, 3, 71, 71, $red); +imageellipse($im1, 18, 54, 36, 36, $green); +imagerectangle($im1, 41, 3, 71, 33, $blue); +imagewebp($im1, $filename); + +$im2 = imagecreatefromwebp($filename); +imagewebp($im2, $filename); +var_dump(calc_image_dissimilarity($im1, $im2) < 10e5); +?> +--CLEAN-- +<?php +@unlink(__DIR__ . '/webp_basic.webp'); +?> +--EXPECT-- +bool(true) diff --git a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt index 324e229de5..618fcdb0d4 100644 --- a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt +++ b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt @@ -31,4 +31,4 @@ int(0) int(0) int(0) int(1) -==DONE==
+==DONE== diff --git a/ext/intl/tests/calendar_getNow_basic.phpt b/ext/intl/tests/calendar_getNow_basic.phpt index 2df112d7b2..3f1c2488b3 100644 --- a/ext/intl/tests/calendar_getNow_basic.phpt +++ b/ext/intl/tests/calendar_getNow_basic.phpt @@ -20,4 +20,4 @@ var_dump(abs($time * 1000 - $proc_now) < 2000); --EXPECT-- bool(true) bool(true) -==DONE==
+==DONE== diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt index 998e74bc01..ac437f962b 100644 --- a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt +++ b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt @@ -23,4 +23,4 @@ bool(true) int(6) bool(true) int(5) -==DONE==
+==DONE== diff --git a/ext/intl/tests/dateformat_formatObject_calendar.phpt b/ext/intl/tests/dateformat_formatObject_calendar.phpt index 9365387ce6..b2b08f362d 100644 --- a/ext/intl/tests/dateformat_formatObject_calendar.phpt +++ b/ext/intl/tests/dateformat_formatObject_calendar.phpt @@ -1,41 +1,41 @@ ---TEST--
-IntlDateFormatter::formatObject(): IntlCalendar tests
---SKIPIF--
-<?php
-if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
-<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-ini_set("intl.default_locale", "pt_PT");
-ini_set("date.timezone", "Europe/Lisbon");
-
-$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon
-echo IntlDateFormatter::formatObject($cal), "\n";
-echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
-echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n";
-echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
-echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
-
-$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00');
-echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n";
-
-$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil');
-$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.);
-echo IntlDateFormatter::formatObject($cal), "\n";
-echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
-
-?>
-==DONE==
-
---EXPECTF--
-01/01/2012 00:00:00
-Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
-Jan 1, 2012 12:00:00 AM
-1/1/12 12:00:00 AM Western European %STime
-Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
-Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
-06/02/1433 00:00:00
-Sunday, Safar 6, 1433 12:00:00 AM Western European %STime
-==DONE==
-
+--TEST-- +IntlDateFormatter::formatObject(): IntlCalendar tests +--SKIPIF-- +<?php +if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> +<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?> +--FILE-- +<?php +ini_set("intl.error_level", E_WARNING); +ini_set("intl.default_locale", "pt_PT"); +ini_set("date.timezone", "Europe/Lisbon"); + +$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00'); //Europe/Lisbon +echo IntlDateFormatter::formatObject($cal), "\n"; +echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n"; +echo IntlDateFormatter::formatObject($cal, null, "en-US"), "\n"; +echo IntlDateFormatter::formatObject($cal, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n"; +echo IntlDateFormatter::formatObject($cal, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n"; + +$cal = IntlCalendar::fromDateTime('2012-01-01 05:00:00+03:00'); +echo datefmt_format_object($cal, IntlDateFormatter::FULL), "\n"; + +$cal = IntlCalendar::createInstance(null,'en-US@calendar=islamic-civil'); +$cal->setTime(strtotime('2012-01-01 00:00:00')*1000.); +echo IntlDateFormatter::formatObject($cal), "\n"; +echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n"; + +?> +==DONE== + +--EXPECTF-- +01/01/2012 00:00:00 +Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental +Jan 1, 2012 12:00:00 AM +1/1/12 12:00:00 AM Western European %STime +Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon) +Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00 +06/02/1433 00:00:00 +Sunday, Safar 6, 1433 12:00:00 AM Western European %STime +==DONE== + diff --git a/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt b/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt index d59c635a7d..688ccc31bf 100644 --- a/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt +++ b/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt @@ -1,10 +1,10 @@ ---TEST--
-IntlDateFormatter::formatObject(): IntlCalendar tests
---SKIPIF--
-<?php
+--TEST-- +IntlDateFormatter::formatObject(): IntlCalendar tests +--SKIPIF-- +<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> <?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?> ---FILE--
+--FILE-- <?php ini_set("intl.error_level", E_WARNING); ini_set("intl.default_locale", "pt_PT"); @@ -27,8 +27,8 @@ echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\ ?> ==DONE== -
---EXPECTF--
+ +--EXPECTF-- 01/01/2012, 00:00:00 Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental Jan 1, 2012, 12:00:00 AM diff --git a/ext/intl/tests/dateformat_formatObject_datetime.phpt b/ext/intl/tests/dateformat_formatObject_datetime.phpt index 2c9e1e33be..a2cba4c76b 100644 --- a/ext/intl/tests/dateformat_formatObject_datetime.phpt +++ b/ext/intl/tests/dateformat_formatObject_datetime.phpt @@ -1,34 +1,34 @@ ---TEST--
-IntlDateFormatter::formatObject(): DateTime tests
---SKIPIF--
-<?php
-if (!extension_loaded('intl')) die('skip intl extension not enabled') ?>
-<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?>
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-ini_set("intl.default_locale", "pt_PT");
-ini_set("date.timezone", "Europe/Lisbon");
-
-$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon
-echo IntlDateFormatter::formatObject($dt), "\n";
-echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
-echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n";
-echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n";
-echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n";
-
-$dt = new DateTime('2012-01-01 05:00:00+03:00');
-echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
-
-?>
-==DONE==
-
---EXPECTF--
-01/01/2012 00:00:00
-Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
-Jan 1, 2012 12:00:00 AM
-1/1/12 12:00:00 AM Western European %STime
-Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
-Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
-==DONE==
-
+--TEST-- +IntlDateFormatter::formatObject(): DateTime tests +--SKIPIF-- +<?php +if (!extension_loaded('intl')) die('skip intl extension not enabled') ?> +<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') >= 0) die('skip for ICU < 50.1.2'); ?> +--FILE-- +<?php +ini_set("intl.error_level", E_WARNING); +ini_set("intl.default_locale", "pt_PT"); +ini_set("date.timezone", "Europe/Lisbon"); + +$dt = new DateTime('2012-01-01 00:00:00'); //Europe/Lisbon +echo IntlDateFormatter::formatObject($dt), "\n"; +echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n"; +echo IntlDateFormatter::formatObject($dt, null, "en-US"), "\n"; +echo IntlDateFormatter::formatObject($dt, array(IntlDateFormatter::SHORT, IntlDateFormatter::FULL), "en-US"), "\n"; +echo IntlDateFormatter::formatObject($dt, 'E y-MM-d HH,mm,ss.SSS v', "en-US"), "\n"; + +$dt = new DateTime('2012-01-01 05:00:00+03:00'); +echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n"; + +?> +==DONE== + +--EXPECTF-- +01/01/2012 00:00:00 +Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental +Jan 1, 2012 12:00:00 AM +1/1/12 12:00:00 AM Western European %STime +Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon) +Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00 +==DONE== + diff --git a/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt b/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt index b4e59f5b7e..567a7eb849 100644 --- a/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt +++ b/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt @@ -1,10 +1,10 @@ ---TEST--
-IntlDateFormatter::formatObject(): DateTime tests
---SKIPIF--
-<?php
+--TEST-- +IntlDateFormatter::formatObject(): DateTime tests +--SKIPIF-- +<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> <?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0 || version_compare(INTL_ICU_VERSION, '52.1') >= 0) die('skip for ICU >= 51.2 and < 52.1'); ?> ---FILE--
+--FILE-- <?php ini_set("intl.error_level", E_WARNING); ini_set("intl.default_locale", "pt_PT"); @@ -22,8 +22,8 @@ echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n"; ?> ==DONE== -
---EXPECTF--
+ +--EXPECTF-- 01/01/2012, 00:00:00 Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental Jan 1, 2012, 12:00:00 AM diff --git a/ext/intl/tests/dateformat_formatObject_error.phpt b/ext/intl/tests/dateformat_formatObject_error.phpt index 7aaf69e54e..221602d135 100644 --- a/ext/intl/tests/dateformat_formatObject_error.phpt +++ b/ext/intl/tests/dateformat_formatObject_error.phpt @@ -1,10 +1,10 @@ ---TEST--
-IntlDateFormatter::formatObject(): error conditions
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
+--TEST-- +IntlDateFormatter::formatObject(): error conditions +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- <?php ini_set("intl.error_level", E_WARNING); ini_set("intl.default_locale", "pt_PT"); @@ -30,8 +30,8 @@ var_dump(IntlDateFormatter::formatObject($cal, "YYYY", array())); ?> ==DONE== -
---EXPECTF--
+ +--EXPECTF-- Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d bool(false) @@ -71,4 +71,4 @@ bool(false) Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d bool(false) ==DONE== -
+ diff --git a/ext/intl/tests/resourcebundle.build b/ext/intl/tests/resourcebundle.build index 6a7eeae5eb..560dc8fb45 100644 --- a/ext/intl/tests/resourcebundle.build +++ b/ext/intl/tests/resourcebundle.build @@ -1,33 +1,33 @@ -<?php
-// THIS SCRIPT WILL REBUILD ResourceBundle bundles from source files
-
-// DEFINE YOUR ICU TOOLS PATH HERE
-define("ICU_DIR", "C:/PROJECTS/ICU40/BIN/");
-
-$here = dirname(__FILE__);
-
-$dir = new GlobIterator("$here/_files/*.txt", FilesystemIterator::KEY_AS_FILENAME);
-
-foreach($dir as $file) {
- passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle ".$file->getFileName());
-}
-
-$dir = new GlobIterator("$here/_files/resourcebundle/*.res", FilesystemIterator::KEY_AS_FILENAME);
-foreach($dir as $file) {
- if($file->getFileName() == "res_index.res") continue;
- $list[] = str_replace(".res", "", $file->getFileName());
-}
-
-$filelist = join(" {\"\"}\n", $list);
-$res_index = <<<END
-res_index:table(nofallback) {
- InstalledLocales {
-$filelist {""}
- }
-}
-END;
-file_put_contents("$here/_files/res_index.txt", $res_index);
-
-passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle res_index.txt");
-
+<?php +// THIS SCRIPT WILL REBUILD ResourceBundle bundles from source files + +// DEFINE YOUR ICU TOOLS PATH HERE +define("ICU_DIR", "C:/PROJECTS/ICU40/BIN/"); + +$here = dirname(__FILE__); + +$dir = new GlobIterator("$here/_files/*.txt", FilesystemIterator::KEY_AS_FILENAME); + +foreach($dir as $file) { + passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle ".$file->getFileName()); +} + +$dir = new GlobIterator("$here/_files/resourcebundle/*.res", FilesystemIterator::KEY_AS_FILENAME); +foreach($dir as $file) { + if($file->getFileName() == "res_index.res") continue; + $list[] = str_replace(".res", "", $file->getFileName()); +} + +$filelist = join(" {\"\"}\n", $list); +$res_index = <<<END +res_index:table(nofallback) { + InstalledLocales { +$filelist {""} + } +} +END; +file_put_contents("$here/_files/res_index.txt", $res_index); + +passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle res_index.txt"); + // passthru(ICU_DIR."icupkg -tl -a $here/rb.txt -s $here/_files -d $here/_files new $here/_files/resourcebundle.dat");
\ No newline at end of file diff --git a/ext/intl/tests/timezone_createDefault_basic.phpt b/ext/intl/tests/timezone_createDefault_basic.phpt index 1988d3b9e5..f8e3158cec 100644 --- a/ext/intl/tests/timezone_createDefault_basic.phpt +++ b/ext/intl/tests/timezone_createDefault_basic.phpt @@ -28,4 +28,4 @@ IntlTimeZone Object [rawOffset] => %i [currentOffset] => %i ) -==DONE==
+==DONE== diff --git a/ext/intl/tests/timezone_getCanonicalID_variant1.phpt b/ext/intl/tests/timezone_getCanonicalID_variant1.phpt index d600792d7c..182fe15b60 100644 --- a/ext/intl/tests/timezone_getCanonicalID_variant1.phpt +++ b/ext/intl/tests/timezone_getCanonicalID_variant1.phpt @@ -20,4 +20,4 @@ string(13) "Europe/Lisbon" bool(true) string(0) "" bool(false) -==DONE==
+==DONE== diff --git a/ext/intl/tests/timezone_getDisplayName_variant4.phpt b/ext/intl/tests/timezone_getDisplayName_variant4.phpt index 39e28892a4..c8379d34a0 100644 --- a/ext/intl/tests/timezone_getDisplayName_variant4.phpt +++ b/ext/intl/tests/timezone_getDisplayName_variant4.phpt @@ -32,4 +32,4 @@ string(5) "+0000" string(3) "GMT" string(3) "GMT" string(13) "Portugal Time" -==DONE==
+==DONE== diff --git a/ext/mbstring/tests/bug52981.phpt b/ext/mbstring/tests/bug52981.phpt index fe96a56f08..7dce14a7ad 100644 --- a/ext/mbstring/tests/bug52981.phpt +++ b/ext/mbstring/tests/bug52981.phpt @@ -1,23 +1,23 @@ ---TEST--
-Bug #52981 (Unicode properties are outdated (from Unicode 3.2))
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-function test($str)
-{
- $upper = mb_strtoupper($str, 'UTF-8');
- $len = strlen($upper);
- for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';
- echo "\n";
-}
-
-// OK
-test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001)
-// not OK
-test("\xE2\xB0\xB0"); // U+2C30 GLAGOLITIC SMALL LETTER AZU (added in 4.1.0, March 2005)
-test("\xD4\xA5"); // U+0525 CYRILLIC SMALL LETTER PE WITH DESCENDER (added in 5.2.0, October 2009)
---EXPECTF--
-f0 90 90 90
-e2 b0 80
-d4 a4
+--TEST-- +Bug #52981 (Unicode properties are outdated (from Unicode 3.2)) +--SKIPIF-- +<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> +--FILE-- +<?php +function test($str) +{ + $upper = mb_strtoupper($str, 'UTF-8'); + $len = strlen($upper); + for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' '; + echo "\n"; +} + +// OK +test("\xF0\x90\x90\xB8");// U+10438 DESERET SMALL LETTER H (added in 3.1.0, March 2001) +// not OK +test("\xE2\xB0\xB0"); // U+2C30 GLAGOLITIC SMALL LETTER AZU (added in 4.1.0, March 2005) +test("\xD4\xA5"); // U+0525 CYRILLIC SMALL LETTER PE WITH DESCENDER (added in 5.2.0, October 2009) +--EXPECTF-- +f0 90 90 90 +e2 b0 80 +d4 a4 diff --git a/ext/mbstring/tests/bug75944.phpt b/ext/mbstring/tests/bug75944.phpt index 81788d7196..cb66d4e230 100644 --- a/ext/mbstring/tests/bug75944.phpt +++ b/ext/mbstring/tests/bug75944.phpt @@ -1,13 +1,13 @@ ---TEST--
-Bug #75944 (wrong detection cp1251 encoding because of missing last cyrillic letter)
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-var_dump(mb_detect_encoding(chr(0xfe), array('CP-1251'))); // letter '?'
-var_dump(mb_detect_encoding(chr(0xff), array('CP-1251'))); // letter '?'
-?>
---EXPECT--
-string(12) "Windows-1251"
-string(12) "Windows-1251"
-
+--TEST-- +Bug #75944 (wrong detection cp1251 encoding because of missing last cyrillic letter) +--SKIPIF-- +<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> +--FILE-- +<?php +var_dump(mb_detect_encoding(chr(0xfe), array('CP-1251'))); // letter '?' +var_dump(mb_detect_encoding(chr(0xff), array('CP-1251'))); // letter '?' +?> +--EXPECT-- +string(12) "Windows-1251" +string(12) "Windows-1251" + diff --git a/ext/mcrypt/tests/bug55169.phpt b/ext/mcrypt/tests/bug55169.phpt index 25d5febe06..dcd6ee40e1 100644 --- a/ext/mcrypt/tests/bug55169.phpt +++ b/ext/mcrypt/tests/bug55169.phpt @@ -1,58 +1,58 @@ ---TEST--
-mcrypt_create_iv https://bugs.php.net/bug.php?id=55169
---CREDIT--
-Ryan Biesemeyer <ryan@yaauie.com>
---SKIPIF--
-<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
---FILE--
-<?php
-for( $i=1; $i<=64; $i = $i*2 ){
- echo 'Input: '. $i . PHP_EOL;
- $random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );
- echo ' Length: ' . strlen( $random ) . PHP_EOL;
- echo ' Hex: '. bin2hex( $random ) . PHP_EOL;
- echo PHP_EOL;
-}
-?>
---EXPECTF--
-Input: 1
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 1
- Hex: %x
-
-Input: 2
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 2
- Hex: %x
-
-Input: 4
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 4
- Hex: %x
-
-Input: 8
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 8
- Hex: %x
-
-Input: 16
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 16
- Hex: %x
-
-Input: 32
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 32
- Hex: %x
-
-Input: 64
-
-Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
- Length: 64
- Hex: %x
+--TEST-- +mcrypt_create_iv https://bugs.php.net/bug.php?id=55169 +--CREDIT-- +Ryan Biesemeyer <ryan@yaauie.com> +--SKIPIF-- +<?php if (!extension_loaded("mcrypt")) print "skip"; ?> +--FILE-- +<?php +for( $i=1; $i<=64; $i = $i*2 ){ + echo 'Input: '. $i . PHP_EOL; + $random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM ); + echo ' Length: ' . strlen( $random ) . PHP_EOL; + echo ' Hex: '. bin2hex( $random ) . PHP_EOL; + echo PHP_EOL; +} +?> +--EXPECTF-- +Input: 1 + +Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 + Length: 1 + Hex: %x + +Input: 2 + +Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 + Length: 2 + Hex: %x + +Input: 4 + +Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 + Length: 4 + Hex: %x + +Input: 8 + +Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 + Length: 8 + Hex: %x + +Input: 16 + +Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 + Length: 16 + Hex: %x + +Input: 32 + +Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 + Length: 32 + Hex: %x + +Input: 64 + +Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4 + Length: 64 + Hex: %x diff --git a/ext/mysqli/tests/bug53503.phpt b/ext/mysqli/tests/bug53503.phpt index 339fce7a8e..a34b7a3416 100644 --- a/ext/mysqli/tests/bug53503.phpt +++ b/ext/mysqli/tests/bug53503.phpt @@ -1,66 +1,66 @@ ---TEST--
-Bug #53503 (mysqli::query returns false after successful LOAD DATA query)
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once('skipifconnectfailure.inc');
-
-if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- die("skip Cannot connect to MySQL");
-
-include_once("local_infile_tools.inc");
-if ($msg = check_local_infile_support($link, $engine))
- die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
-
-mysqli_close($link);
-
-?>
---FILE--
-<?php
- require_once("connect.inc");
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
-
- if (!$link->query("DROP TABLE IF EXISTS test")) {
- printf("[002] [%d] %s\n", $link->errno, $link->error);
- }
-
- if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- }
-
- if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
- printf("[004] Failed to create CVS file\n");
-
- if (!$link->query("SELECT 1 FROM DUAL"))
- printf("[005] [%d] %s\n", $link->errno, $link->error);
-
- if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
- printf("[006] [%d] %s\n", $link->errno, $link->error);
- echo "bug";
- } else {
- echo "done";
- }
- $link->close();
-?>
---CLEAN--
-<?php
-require_once('connect.inc');
-
-if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-}
-
-if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-}
-
-$link->close();
-
-unlink('bug53503.data');
-?>
---EXPECT--
+--TEST-- +Bug #53503 (mysqli::query returns false after successful LOAD DATA query) +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifconnectfailure.inc'); + +if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + die("skip Cannot connect to MySQL"); + +include_once("local_infile_tools.inc"); +if ($msg = check_local_infile_support($link, $engine)) + die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error)); + +mysqli_close($link); + +?> +--FILE-- +<?php + require_once("connect.inc"); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + + if (!$link->query("DROP TABLE IF EXISTS test")) { + printf("[002] [%d] %s\n", $link->errno, $link->error); + } + + if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) { + printf("[003] [%d] %s\n", $link->errno, $link->error); + } + + if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n")) + printf("[004] Failed to create CVS file\n"); + + if (!$link->query("SELECT 1 FROM DUAL")) + printf("[005] [%d] %s\n", $link->errno, $link->error); + + if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) { + printf("[006] [%d] %s\n", $link->errno, $link->error); + echo "bug"; + } else { + echo "done"; + } + $link->close(); +?> +--CLEAN-- +<?php +require_once('connect.inc'); + +if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); +} + +if (!$link->query($link, 'DROP TABLE IF EXISTS test')) { + printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); +} + +$link->close(); + +unlink('bug53503.data'); +?> +--EXPECT-- done
\ No newline at end of file diff --git a/ext/mysqli/tests/bug55653.phpt b/ext/mysqli/tests/bug55653.phpt index f9cd297eba..1caff1a27a 100644 --- a/ext/mysqli/tests/bug55653.phpt +++ b/ext/mysqli/tests/bug55653.phpt @@ -1,36 +1,36 @@ ---TEST--
-Bug #55653 PS crash with libmysql when binding same variable as param and out
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once('skipifconnectfailure.inc');
-?>
---FILE--
-<?php
- require_once("connect.inc");
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
-
- $in_and_out = "a";
-
- if (!($stmt = $link->stmt_init()))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
-
- if (!($stmt->prepare("SELECT ?")) ||
- !($stmt->bind_param("s", $in_and_out)) ||
- !($stmt->execute()) ||
- !($stmt->bind_result($in_and_out)))
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
-
- if (!$stmt->fetch())
- printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
-
- if ("a" !== $in_and_out)
- printf("[005] Wrong result: '%s'\n", $in_and_out);
-
- echo "done!";
-?>
---EXPECT--
+--TEST-- +Bug #55653 PS crash with libmysql when binding same variable as param and out +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifconnectfailure.inc'); +?> +--FILE-- +<?php + require_once("connect.inc"); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + + $in_and_out = "a"; + + if (!($stmt = $link->stmt_init())) + printf("[002] [%d] %s\n", $link->errno, $link->error); + + if (!($stmt->prepare("SELECT ?")) || + !($stmt->bind_param("s", $in_and_out)) || + !($stmt->execute()) || + !($stmt->bind_result($in_and_out))) + printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); + + if (!$stmt->fetch()) + printf("[004] [%d] %s\n", $stmt->errno, $stmt->error); + + if ("a" !== $in_and_out) + printf("[005] Wrong result: '%s'\n", $in_and_out); + + echo "done!"; +?> +--EXPECT-- done!
\ No newline at end of file diff --git a/ext/mysqli/tests/bug55859.phpt b/ext/mysqli/tests/bug55859.phpt index ba6e9902b3..04467bce24 100644 --- a/ext/mysqli/tests/bug55859.phpt +++ b/ext/mysqli/tests/bug55859.phpt @@ -1,20 +1,20 @@ ---TEST--
-Bug #55859 mysqli->stat property access gives error
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once('skipifconnectfailure.inc');
-?>
---FILE--
-<?php
- require_once("connect.inc");
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- var_dump(soundex(mysqli_stat($link)) === soundex($link->stat));
- echo "done!";
-?>
---EXPECT--
-bool(true)
-done!
+--TEST-- +Bug #55859 mysqli->stat property access gives error +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifconnectfailure.inc'); +?> +--FILE-- +<?php + require_once("connect.inc"); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + var_dump(soundex(mysqli_stat($link)) === soundex($link->stat)); + echo "done!"; +?> +--EXPECT-- +bool(true) +done! diff --git a/ext/mysqli/tests/bug62046.phpt b/ext/mysqli/tests/bug62046.phpt index 31a7328b70..c8ad3c3675 100644 --- a/ext/mysqli/tests/bug62046.phpt +++ b/ext/mysqli/tests/bug62046.phpt @@ -1,40 +1,40 @@ ---TEST--
-Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once('skipifconnectfailure.inc');
-?>
---FILE--
-<?php
- require_once("connect.inc");
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
- printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (FALSE === $stmt->execute()) {
- printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- if (FALSE === $stmt->store_result()) {
- printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- $one = NULL;
- if (FALSE === $stmt->bind_result($one)) {
- printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- if (FALSE === $stmt->reset()) {
- printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- while ($stmt->fetch()) {
- var_dump($one);
- }
- $stmt->close();
- $link->close();
- echo "done!";
-?>
---EXPECT--
-int(42)
+--TEST-- +Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset() +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifconnectfailure.inc'); +?> +--FILE-- +<?php + require_once("connect.inc"); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + if (FALSE === ($stmt = $link->prepare('SELECT 42'))) { + printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } + if (FALSE === $stmt->execute()) { + printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error); + } + if (FALSE === $stmt->store_result()) { + printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); + } + $one = NULL; + if (FALSE === $stmt->bind_result($one)) { + printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); + } + if (FALSE === $stmt->reset()) { + printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error); + } + while ($stmt->fetch()) { + var_dump($one); + } + $stmt->close(); + $link->close(); + echo "done!"; +?> +--EXPECT-- +int(42) done!
\ No newline at end of file diff --git a/ext/mysqli/tests/bug62885.phpt b/ext/mysqli/tests/bug62885.phpt index 9fb0aa0f03..4d02475570 100644 --- a/ext/mysqli/tests/bug62885.phpt +++ b/ext/mysqli/tests/bug62885.phpt @@ -1,26 +1,26 @@ ---TEST--
-Bug #62885 (mysqli_poll - Segmentation fault)
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once("connect.inc");
-if (!$IS_MYSQLND) {
- die("skip mysqlnd only test");
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL);
-$tablica = array();
-$test1 = mysqli_poll($test2, $test3, $tablica, null);
-
-$test2 = array();
-$test2 = array();
-$test1 = mysqli_poll($test2, $test3, $tablica, null);
-echo "okey";
-?>
---EXPECTF--
-Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
-
-Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
-okey
+--TEST-- +Bug #62885 (mysqli_poll - Segmentation fault) +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once("connect.inc"); +if (!$IS_MYSQLND) { + die("skip mysqlnd only test"); +} +?> +--FILE-- +<?php +error_reporting(E_ALL); +$tablica = array(); +$test1 = mysqli_poll($test2, $test3, $tablica, null); + +$test2 = array(); +$test2 = array(); +$test1 = mysqli_poll($test2, $test3, $tablica, null); +echo "okey"; +?> +--EXPECTF-- +Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d + +Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d +okey diff --git a/ext/pcre/tests/bug69864.phpt b/ext/pcre/tests/bug69864.phpt index cf7ba5b72e..09a00d896f 100644 --- a/ext/pcre/tests/bug69864.phpt +++ b/ext/pcre/tests/bug69864.phpt @@ -1,42 +1,42 @@ ---TEST--
-Bug #69864 (Segfault in preg_replace_callback)
---SKIPIF--
-<?php
-if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-?>
---FILE--
-<?php
-/* CAUTION: this test will most likely fail with valgrind until --smc-check=all is used. */
-
-const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c
-
-var_dump(preg_replace_callback('/a/', function($m) {
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
- preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
- }
- return 'b';
-}, 'aa'));
-var_dump(preg_replace_callback('/a/', function($m) {
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
- preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???');
- }
- return 'b';
-}, 'aa'));
-var_dump(preg_replace_callback('/a/', function($m) {
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
- preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???');
- }
- return 'b';
-}, 'aa'));
-var_dump(preg_replace_callback('/a/', function($m) {
- for ($i = 0; $i < PREG_CACHE_SIZE; $i++) {
- preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']);
- }
- return 'b';
-}, 'aa'));
-?>
---EXPECT--
-string(2) "bb"
-string(2) "bb"
-string(2) "bb"
-string(2) "bb"
+--TEST-- +Bug #69864 (Segfault in preg_replace_callback) +--SKIPIF-- +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +?> +--FILE-- +<?php +/* CAUTION: this test will most likely fail with valgrind until --smc-check=all is used. */ + +const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c + +var_dump(preg_replace_callback('/a/', function($m) { + for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { + preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???'); + } + return 'b'; +}, 'aa')); +var_dump(preg_replace_callback('/a/', function($m) { + for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { + preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???'); + } + return 'b'; +}, 'aa')); +var_dump(preg_replace_callback('/a/', function($m) { + for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { + preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???'); + } + return 'b'; +}, 'aa')); +var_dump(preg_replace_callback('/a/', function($m) { + for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { + preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']); + } + return 'b'; +}, 'aa')); +?> +--EXPECT-- +string(2) "bb" +string(2) "bb" +string(2) "bb" +string(2) "bb" diff --git a/ext/pcre/tests/bug73612.phpt b/ext/pcre/tests/bug73612.phpt index 707e10bce6..210e706bfb 100644 --- a/ext/pcre/tests/bug73612.phpt +++ b/ext/pcre/tests/bug73612.phpt @@ -1,27 +1,27 @@ ---TEST--
-Bug #73612 (preg_*() may leak memory)
---FILE--
-<?php
-$obj = new stdClass;
-$obj->obj = $obj;
-preg_match('/./', 'x', $obj);
-
-$obj = new stdClass;
-$obj->obj = $obj;
-preg_replace('/./', '', 'x', -1, $obj);
-
-$obj = new stdClass;
-$obj->obj = $obj;
-preg_replace_callback('/./', 'count', 'x', -1, $obj);
-
-$obj = new stdClass;
-$obj->obj = $obj;
-preg_replace_callback_array(['/./' => 'count'], 'x', -1, $obj);
-
-$obj = new stdClass;
-$obj->obj = $obj;
-preg_filter('/./', '', 'x', -1, $obj);
-?>
-===DONE===
---EXPECT--
-===DONE===
+--TEST-- +Bug #73612 (preg_*() may leak memory) +--FILE-- +<?php +$obj = new stdClass; +$obj->obj = $obj; +preg_match('/./', 'x', $obj); + +$obj = new stdClass; +$obj->obj = $obj; +preg_replace('/./', '', 'x', -1, $obj); + +$obj = new stdClass; +$obj->obj = $obj; +preg_replace_callback('/./', 'count', 'x', -1, $obj); + +$obj = new stdClass; +$obj->obj = $obj; +preg_replace_callback_array(['/./' => 'count'], 'x', -1, $obj); + +$obj = new stdClass; +$obj->obj = $obj; +preg_filter('/./', '', 'x', -1, $obj); +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt index fb7e9a9d0a..4528213f11 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt @@ -1,33 +1,33 @@ ---TEST--
-PDO_MYSQL: Defining a connection charset in the DSN
---SKIPIF--
-<?php
-require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
-require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-MySQLPDOTest::skip();
-?>
---FILE--
-<?php
- require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-
- /* Connect to mysql to determine the current charset so we can diffinate it */
- $link = MySQLPDOTest::factory();
- $charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
-
- /* Make sure that we don't attempt to set the current character set to make this case useful */
- $new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
-
- /* Done with the original connection, create a second link to test the character set being defined */
- unset($link);
-
- $link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
- $conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
-
- if ($charset !== $conn_charset) {
- echo "done!\n";
- } else {
- echo "failed!\n";
- }
-?>
---EXPECTF--
-done!
+--TEST-- +PDO_MYSQL: Defining a connection charset in the DSN +--SKIPIF-- +<?php +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); +MySQLPDOTest::skip(); +?> +--FILE-- +<?php + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + + /* Connect to mysql to determine the current charset so we can diffinate it */ + $link = MySQLPDOTest::factory(); + $charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value; + + /* Make sure that we don't attempt to set the current character set to make this case useful */ + $new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1'); + + /* Done with the original connection, create a second link to test the character set being defined */ + unset($link); + + $link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset)); + $conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value; + + if ($charset !== $conn_charset) { + echo "done!\n"; + } else { + echo "failed!\n"; + } +?> +--EXPECTF-- +done! diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt index a88769b038..1c8a1eed8f 100755 --- a/ext/pgsql/tests/30nb_async_query_params.phpt +++ b/ext/pgsql/tests/30nb_async_query_params.phpt @@ -1,78 +1,78 @@ ---TEST--
-PostgreSQL non-blocking async query params
---SKIPIF--
-<?php
-include("skipif.inc");
-if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist');
-?>
---FILE--
-<?php
-
-include('config.inc');
-include('nonblocking.inc');
-
-$db = pg_connect($conn_str);
-
-$version = pg_version($db);
-if ($version['protocol'] < 3) {
- echo "OK";
- exit(0);
-}
-
-$db_socket = pg_socket($db);
-stream_set_blocking($db_socket, false);
-
-$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
-if ($sent === FALSE) {
- echo "pg_send_query_params() error\n";
-} elseif ($sent === 0) {
- nb_flush($db, $db_socket);
-}
-
-nb_consume($db, $db_socket);
-
-if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
-}
-if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
-}
-for ($i=0; $i < $rows; $i++) {
- pg_fetch_array($result, $i, PGSQL_NUM);
-}
-for ($i=0; $i < $rows; $i++) {
- pg_fetch_object($result);
-}
-for ($i=0; $i < $rows; $i++) {
- pg_fetch_row($result, $i);
-}
-for ($i=0; $i < $rows; $i++) {
- pg_fetch_result($result, $i, 0);
-}
-
-pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
-pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
-pg_field_name($result, 0);
-pg_field_num($result, $field_name);
-pg_field_size($result, 0);
-pg_field_type($result, 0);
-pg_field_prtlen($result, 0);
-pg_field_is_null($result, 0);
-
-$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
-
-if ($sent === FALSE) {
- echo "pg_send_query_params() error\n";
-} elseif ($sent === 0) {
- nb_flush($db, $db_socket);
-}
-
-pg_last_oid($result);
-pg_free_result($result);
-
-pg_close($db);
-
-echo "OK";
-?>
---EXPECT--
-OK
+--TEST-- +PostgreSQL non-blocking async query params +--SKIPIF-- +<?php +include("skipif.inc"); +if (!function_exists('pg_send_query_params')) die('skip function pg_send_query_params() does not exist'); +?> +--FILE-- +<?php + +include('config.inc'); +include('nonblocking.inc'); + +$db = pg_connect($conn_str); + +$version = pg_version($db); +if ($version['protocol'] < 3) { + echo "OK"; + exit(0); +} + +$db_socket = pg_socket($db); +stream_set_blocking($db_socket, false); + +$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)); +if ($sent === FALSE) { + echo "pg_send_query_params() error\n"; +} elseif ($sent === 0) { + nb_flush($db, $db_socket); +} + +nb_consume($db, $db_socket); + +if (!($result = pg_get_result($db))) { + echo "pg_get_result() error\n"; +} +if (!($rows = pg_num_rows($result))) { + echo "pg_num_rows() error\n"; +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_array($result, $i, PGSQL_NUM); +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_object($result); +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_row($result, $i); +} +for ($i=0; $i < $rows; $i++) { + pg_fetch_result($result, $i, 0); +} + +pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); +pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); +pg_field_name($result, 0); +pg_field_num($result, $field_name); +pg_field_size($result, 0); +pg_field_type($result, 0); +pg_field_prtlen($result, 0); +pg_field_is_null($result, 0); + +$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC")); + +if ($sent === FALSE) { + echo "pg_send_query_params() error\n"; +} elseif ($sent === 0) { + nb_flush($db, $db_socket); +} + +pg_last_oid($result); +pg_free_result($result); + +pg_close($db); + +echo "OK"; +?> +--EXPECT-- +OK diff --git a/ext/phar/tests/bug53872.phpt b/ext/phar/tests/bug53872.phpt index fd332fdf02..2fc55d9155 100644 --- a/ext/phar/tests/bug53872.phpt +++ b/ext/phar/tests/bug53872.phpt @@ -1,28 +1,28 @@ ---TEST--
-bug#53872 (internal corruption of phar)
---SKIPIF--
-<?php
-if (!extension_loaded("phar")) die("skip");
-if (!extension_loaded("zlib")) die("skip Test needs ext/zlib");
-?>
---INI--
-phar.readonly=0
---FILE--
-<?php
-$p=new Phar('bug53872-phar.phar');
-$p->buildFromDirectory(__DIR__ . "/bug53872/");
-$p->setStub('<?php __HALT_COMPILER();?\>');
-$p->compressFiles(Phar::GZ);
-
-print(file_get_contents('phar://bug53872-phar.phar/first.txt'));
-print(file_get_contents('phar://bug53872-phar.phar/second.txt'));
-print(file_get_contents('phar://bug53872-phar.phar/third.txt'));
-?>
---CLEAN--
-<?php
-unlink("bug53872-phar.phar");
-?>
---EXPECT--
-content of first.txt
-content of third.txt
-
+--TEST-- +bug#53872 (internal corruption of phar) +--SKIPIF-- +<?php +if (!extension_loaded("phar")) die("skip"); +if (!extension_loaded("zlib")) die("skip Test needs ext/zlib"); +?> +--INI-- +phar.readonly=0 +--FILE-- +<?php +$p=new Phar('bug53872-phar.phar'); +$p->buildFromDirectory(__DIR__ . "/bug53872/"); +$p->setStub('<?php __HALT_COMPILER();?\>'); +$p->compressFiles(Phar::GZ); + +print(file_get_contents('phar://bug53872-phar.phar/first.txt')); +print(file_get_contents('phar://bug53872-phar.phar/second.txt')); +print(file_get_contents('phar://bug53872-phar.phar/third.txt')); +?> +--CLEAN-- +<?php +unlink("bug53872-phar.phar"); +?> +--EXPECT-- +content of first.txt +content of third.txt + diff --git a/ext/phar/tests/phar_gobyebye-win32.phpt b/ext/phar/tests/phar_gobyebye-win32.phpt index 43c8c77823..526a8cbf91 100644 --- a/ext/phar/tests/phar_gobyebye-win32.phpt +++ b/ext/phar/tests/phar_gobyebye-win32.phpt @@ -1,48 +1,48 @@ ---TEST--
-Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d
---SKIPIF--
-<?php if (!extension_loaded("phar")) die("skip");
-if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows.");
-?>
---INI--
-phar.readonly=0
---FILE--
-<?php
-Phar::interceptFileFuncs();
-$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php';
-$pname = 'phar://' . $fname;
-file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");');
-file_put_contents($pname . '/foo/hi', '<?php
-include "' . addslashes($fname2) . '";
-readfile("foo/hi");
-fopen("foo/hi", "r");
-echo file_get_contents("foo/hi");
-var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi"));
-opendir("foo/hi");
-?>
-');
-include $pname . '/foo/hi';
-?>
-===DONE===
---CLEAN--
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
-<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
---EXPECTF--
-Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-
-Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-
-Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-
-Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-
-Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-
-Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-===DONE===
+--TEST-- +Phar: test edge cases of intercepted functions when the underlying phar archive has been unlinkArchive()d +--SKIPIF-- +<?php if (!extension_loaded("phar")) die("skip"); +if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows."); +?> +--INI-- +phar.readonly=0 +--FILE-- +<?php +Phar::interceptFileFuncs(); +$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; +$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.php'; +$pname = 'phar://' . $fname; +file_put_contents($fname2, '<?php Phar::unlinkArchive("' . addslashes($fname) . '");'); +file_put_contents($pname . '/foo/hi', '<?php +include "' . addslashes($fname2) . '"; +readfile("foo/hi"); +fopen("foo/hi", "r"); +echo file_get_contents("foo/hi"); +var_dump(is_file("foo/hi"),is_link("foo/hi"),is_dir("foo/hi"),file_exists("foo/hi"),stat("foo/hi")); +opendir("foo/hi"); +?> +'); +include $pname . '/foo/hi'; +?> +===DONE=== +--CLEAN-- +<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> +<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?> +--EXPECTF-- +Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d + +Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d + +Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d + +Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +Warning: opendir(foo/hi,foo/hi): The system cannot find the path specified. (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d + +Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d +===DONE=== diff --git a/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt b/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt index 5655d19972..942bea2dc2 100644 --- a/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt +++ b/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt @@ -1,76 +1,76 @@ ---TEST--
-ReflectionParameter class - canBePassedByValue() method.
---FILE--
-<?php
-
-function aux($fun) {
-
- $func = new ReflectionFunction($fun);
- $parameters = $func->getParameters();
- foreach($parameters as $parameter) {
- echo "Name: ", $parameter->getName(), "\n";
- echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n";
- echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n";
- echo "\n";
- }
-
-}
-
-echo "=> array_multisort:\n\n";
-
-aux('array_multisort');
-
-
-echo "=> sort:\n\n";
-
-aux('sort');
-
-echo "=> user function:\n\n";
-
-function ufunc(&$arg1, $arg2) {}
-
-aux('ufunc');
-
-echo "Done.\n";
-
-?>
---EXPECTF--
-=> array_multisort:
-
-Name: arr1
-Is passed by reference: yes
-Can be passed by value: yes
-
-Name: sort_order
-Is passed by reference: yes
-Can be passed by value: yes
-
-Name: sort_flags
-Is passed by reference: yes
-Can be passed by value: yes
-
-Name: arr2
-Is passed by reference: yes
-Can be passed by value: yes
-
-=> sort:
-
-Name: arg
-Is passed by reference: yes
-Can be passed by value: no
-
-Name: sort_flags
-Is passed by reference: no
-Can be passed by value: yes
-
-=> user function:
-
-Name: arg1
-Is passed by reference: yes
-Can be passed by value: no
-
-Name: arg2
-Is passed by reference: no
-Can be passed by value: yes
-
-Done.
+--TEST-- +ReflectionParameter class - canBePassedByValue() method. +--FILE-- +<?php + +function aux($fun) { + + $func = new ReflectionFunction($fun); + $parameters = $func->getParameters(); + foreach($parameters as $parameter) { + echo "Name: ", $parameter->getName(), "\n"; + echo "Is passed by reference: ", $parameter->isPassedByReference()?"yes":"no", "\n"; + echo "Can be passed by value: ", $parameter->canBePassedByValue()?"yes":"no", "\n"; + echo "\n"; + } + +} + +echo "=> array_multisort:\n\n"; + +aux('array_multisort'); + + +echo "=> sort:\n\n"; + +aux('sort'); + +echo "=> user function:\n\n"; + +function ufunc(&$arg1, $arg2) {} + +aux('ufunc'); + +echo "Done.\n"; + +?> +--EXPECTF-- +=> array_multisort: + +Name: arr1 +Is passed by reference: yes +Can be passed by value: yes + +Name: sort_order +Is passed by reference: yes +Can be passed by value: yes + +Name: sort_flags +Is passed by reference: yes +Can be passed by value: yes + +Name: arr2 +Is passed by reference: yes +Can be passed by value: yes + +=> sort: + +Name: arg +Is passed by reference: yes +Can be passed by value: no + +Name: sort_flags +Is passed by reference: no +Can be passed by value: yes + +=> user function: + +Name: arg1 +Is passed by reference: yes +Can be passed by value: no + +Name: arg2 +Is passed by reference: no +Can be passed by value: yes + +Done. diff --git a/ext/reflection/tests/ReflectionParameter_isDefault.phpt b/ext/reflection/tests/ReflectionParameter_isDefault.phpt index 657077093b..d8b4f0edc0 100644 --- a/ext/reflection/tests/ReflectionParameter_isDefault.phpt +++ b/ext/reflection/tests/ReflectionParameter_isDefault.phpt @@ -1,34 +1,34 @@ ---TEST--
-ReflectionParameter::isDefault()
---FILE--
-<?php
-class A {
-public $defprop;
-}
-$a = new A;
-$a->myprop = null;
-
-$ro = new ReflectionObject($a);
-$props = $ro->getProperties();
-$prop1 = $props[0];
-var_dump($prop1->isDefault());
-$prop2 = $props[1];
-var_dump($prop2->isDefault());
-
-var_dump($ro->getProperty('defprop')->isDefault());
-var_dump($ro->getProperty('myprop')->isDefault());
-
-$prop1 = new ReflectionProperty($a, 'defprop');
-$prop2 = new ReflectionProperty($a, 'myprop');
-var_dump($prop1->isDefault());
-var_dump($prop2->isDefault());
-?>
-==DONE==
---EXPECT--
-bool(true)
-bool(false)
-bool(true)
-bool(false)
-bool(true)
-bool(false)
-==DONE==
+--TEST-- +ReflectionParameter::isDefault() +--FILE-- +<?php +class A { +public $defprop; +} +$a = new A; +$a->myprop = null; + +$ro = new ReflectionObject($a); +$props = $ro->getProperties(); +$prop1 = $props[0]; +var_dump($prop1->isDefault()); +$prop2 = $props[1]; +var_dump($prop2->isDefault()); + +var_dump($ro->getProperty('defprop')->isDefault()); +var_dump($ro->getProperty('myprop')->isDefault()); + +$prop1 = new ReflectionProperty($a, 'defprop'); +$prop2 = new ReflectionProperty($a, 'myprop'); +var_dump($prop1->isDefault()); +var_dump($prop2->isDefault()); +?> +==DONE== +--EXPECT-- +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +==DONE== diff --git a/ext/session/mod_files.bat b/ext/session/mod_files.bat index 4ec9a49ca2..b6a8babae8 100644 --- a/ext/session/mod_files.bat +++ b/ext/session/mod_files.bat @@ -1,57 +1,57 @@ -@ECHO OFF
-SETLOCAL ENABLEDELAYEDEXPANSION
-
-IF _%1_==_AUTO_ (
- GOTO MakeDirs
-)
-
-IF _%2_==__ (
- ECHO Usage %0 ^<basedir^> ^<depth^> ^[^hash_bits^]
- ECHO.
- ECHO Where ^<basedir^> is the session directory
- ECHO ^<depth^> is the number of levels defined in session.save_path
- ECHO ^[hash_bits^] is the number of bits defined in session.hash_bits_per_character
- EXIT /B 1
-)
-
-SET /A Depth=%2 + 0 2>NUL
-IF /I %ERRORLEVEL% EQU 9167 GOTO DepthError
-IF _%Depth%_==__ GOTO DepthError
-IF /I %Depth% LEQ 0 GOTO DepthError
-
-IF _%3_==__ GOTO DefaultBits
-
-SET /A Bits=%3 + 0 2>NUL
-IF /I %ERRORLEVEL% EQU 9167 GOTO BitsError
-IF _%Bits%_==__ GOTO BitsError
-IF /I %Bits% LSS 4 GOTO BitsError
-IF /I %Bits% GTR 6 GOTO BitsError
-GOTO BitsSet
-
-:DefaultBits
-SET Bits=4
-:BitsSet
-
-SET HashChars=0 1 2 3 4 5 6 7 8 9 A B C D E F
-IF /I %Bits% GEQ 5 SET HashChars=!HashChars! G H I J K L M N O P Q R S T U V
-IF /I %Bits% GEQ 6 SET HashChars=!HashChars! W X Y Z - ,
-
-FOR %%A IN (%HashChars%) DO (
- ECHO Making %%A
- CALL "%~0" AUTO "%~1\%%~A" %Depth%
-)
-GOTO :EOF
-
-:MakeDirs
-MKDIR "%~2"
-SET /A ThisDepth=%3 - 1
-IF /I %ThisDepth% GTR 0 FOR %%A IN (%HashChars%) DO CALL "%~0" AUTO "%~2\%%~A" %ThisDepth%
-GOTO :EOF
-
-:DepthError
-ECHO ERROR: Invalid depth : %2
-EXIT /B 0
-
-:BitsError
-ECHO ERROR: Invalid hash_bits : %3
-EXIT /B 0
+@ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION + +IF _%1_==_AUTO_ ( + GOTO MakeDirs +) + +IF _%2_==__ ( + ECHO Usage %0 ^<basedir^> ^<depth^> ^[^hash_bits^] + ECHO. + ECHO Where ^<basedir^> is the session directory + ECHO ^<depth^> is the number of levels defined in session.save_path + ECHO ^[hash_bits^] is the number of bits defined in session.hash_bits_per_character + EXIT /B 1 +) + +SET /A Depth=%2 + 0 2>NUL +IF /I %ERRORLEVEL% EQU 9167 GOTO DepthError +IF _%Depth%_==__ GOTO DepthError +IF /I %Depth% LEQ 0 GOTO DepthError + +IF _%3_==__ GOTO DefaultBits + +SET /A Bits=%3 + 0 2>NUL +IF /I %ERRORLEVEL% EQU 9167 GOTO BitsError +IF _%Bits%_==__ GOTO BitsError +IF /I %Bits% LSS 4 GOTO BitsError +IF /I %Bits% GTR 6 GOTO BitsError +GOTO BitsSet + +:DefaultBits +SET Bits=4 +:BitsSet + +SET HashChars=0 1 2 3 4 5 6 7 8 9 A B C D E F +IF /I %Bits% GEQ 5 SET HashChars=!HashChars! G H I J K L M N O P Q R S T U V +IF /I %Bits% GEQ 6 SET HashChars=!HashChars! W X Y Z - , + +FOR %%A IN (%HashChars%) DO ( + ECHO Making %%A + CALL "%~0" AUTO "%~1\%%~A" %Depth% +) +GOTO :EOF + +:MakeDirs +MKDIR "%~2" +SET /A ThisDepth=%3 - 1 +IF /I %ThisDepth% GTR 0 FOR %%A IN (%HashChars%) DO CALL "%~0" AUTO "%~2\%%~A" %ThisDepth% +GOTO :EOF + +:DepthError +ECHO ERROR: Invalid depth : %2 +EXIT /B 0 + +:BitsError +ECHO ERROR: Invalid hash_bits : %3 +EXIT /B 0 diff --git a/ext/session/tests/bug36459.phpt b/ext/session/tests/bug36459.phpt index 66a4ac1cbc..c1b6456174 100644 --- a/ext/session/tests/bug36459.phpt +++ b/ext/session/tests/bug36459.phpt @@ -1,42 +1,42 @@ ---TEST--
-Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.use_trans_sid=1
-session.use_cookies=0
-session.use_only_cookies=0
-session.name=sid
---FILE--
-<?php
-error_reporting(E_ALL);
-
-session_start();
-
-# Do not remove \r from this tests, they are essential!
-?>
-<html>
- <head>
- <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
- </head>
- <body>
- <p>See source html code</p>
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2"
- style="font: normal 11pt Times New Roman">incorrect link</a><br />
- <br />
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" style="font: normal 11pt Times New Roman">correct link</a>
- </body>
-</html>
---EXPECTF--
-<html>
- <head>
- <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>
- </head>
- <body>
- <p>See source html code</p>
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s"
- style="font: normal 11pt Times New Roman">incorrect link</a><br />
- <br />
- <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" style="font: normal 11pt Times New Roman">correct link</a>
- </body>
-</html>
+--TEST-- +Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n) +--SKIPIF-- +<?php include('skipif.inc'); ?> +--INI-- +session.use_trans_sid=1 +session.use_cookies=0 +session.use_only_cookies=0 +session.name=sid +--FILE-- +<?php +error_reporting(E_ALL); + +session_start(); + +# Do not remove \r from this tests, they are essential! +?> +<html> + <head> + <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title> + </head> + <body> + <p>See source html code</p> + <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" + style="font: normal 11pt Times New Roman">incorrect link</a><br /> + <br /> + <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2" style="font: normal 11pt Times New Roman">correct link</a> + </body> +</html> +--EXPECTF-- +<html> + <head> + <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title> + </head> + <body> + <p>See source html code</p> + <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" + style="font: normal 11pt Times New Roman">incorrect link</a><br /> + <br /> + <a href="/b2w/www/ru/adm/pages/?action=prev&rec_id=8&pid=2&sid=%s" style="font: normal 11pt Times New Roman">correct link</a> + </body> +</html> diff --git a/ext/sockets/tests/bug51958.phpt b/ext/sockets/tests/bug51958.phpt index afccd6ce23..b4d75cec48 100644 --- a/ext/sockets/tests/bug51958.phpt +++ b/ext/sockets/tests/bug51958.phpt @@ -1,22 +1,22 @@ ---TEST--
-Bug #51958: socket_accept() fails on IPv6 server sockets
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('skip sockets extension not available.');
-}
-if (!defined('IPPROTO_IPV6')) {
- die('skip IPv6 not available.');
-}
-if (PHP_OS != "WINNT")
- die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN');
---FILE--
-<?php
-$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
-socket_bind($listenfd, "::1", 13579);
-socket_listen($listenfd);
-socket_set_nonblock($listenfd);
-$connfd = @socket_accept($listenfd);
-echo socket_last_error();
---EXPECT--
-10035
+--TEST-- +Bug #51958: socket_accept() fails on IPv6 server sockets +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('skip sockets extension not available.'); +} +if (!defined('IPPROTO_IPV6')) { + die('skip IPv6 not available.'); +} +if (PHP_OS != "WINNT") + die('skip test relies Winsock\'s error code for WSAEWOULDBLOCK/EAGAIN'); +--FILE-- +<?php +$listenfd = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP); +socket_bind($listenfd, "::1", 13579); +socket_listen($listenfd); +socket_set_nonblock($listenfd); +$connfd = @socket_accept($listenfd); +echo socket_last_error(); +--EXPECT-- +10035 diff --git a/ext/sockets/tests/mcast_ipv4_recv.phpt b/ext/sockets/tests/mcast_ipv4_recv.phpt index 8c90ae0b17..fc92563e84 100644 --- a/ext/sockets/tests/mcast_ipv4_recv.phpt +++ b/ext/sockets/tests/mcast_ipv4_recv.phpt @@ -1,197 +1,197 @@ ---TEST--
-Multicast support: IPv4 receive options
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('skip sockets extension not available.');
-}
-$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
-$br = socket_bind($s, '0.0.0.0', 3000);
-$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
- "group" => '224.0.0.23',
- "interface" => 'lo',
-));
-if ($so === false) {
- die('skip interface \'lo\' is unavailable.');
-}
-if (!defined("MCAST_BLOCK_SOURCE")) {
- die('skip source operations are unavailable');
-}
---FILE--
-<?php
-include __DIR__."/mcast_helpers.php.inc";
-$domain = AF_INET;
-$level = IPPROTO_IP;
-$interface = "lo";
-$mcastaddr = '224.0.0.23';
-$sblock = "127.0.0.1";
-
-echo "creating send socket bound to 127.0.0.1\n";
-$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
-$br = socket_bind($sends1, '127.0.0.1');
-var_dump($br);
-
-echo "creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to $mcastaddr\n";
-$sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP);
-var_dump($br);
-
-echo "creating receive socket\n";
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP);
-var_dump($s);
-$br = socket_bind($s, '0.0.0.0', 3000);
-var_dump($br);
-
-$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
-));
-var_dump($so);
-
-$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
-var_dump($r);
-
-$i = 0;
-checktimeout($s, 500);
-while (($str = socket_read($s, 3000)) !== FALSE) {
- $i++;
- echo "$i> ", $str, "\n";
-
-if ($i == 1) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
-}
-if ($i == 2) {
- echo "re-joining group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 3) {
- echo "blocking source\n";
- $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
-}
-if ($i == 4) {
- echo "unblocking source\n";
- $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 5) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
-}
-if ($i == 6) {
- echo "joining source group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 7) {
- echo "leaving source group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
-}
-if ($i == 8) {
-/* echo "rjsg\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);*/
- break;
-}
-
-}
---EXPECTF--
-creating send socket bound to 127.0.0.1
-bool(true)
-creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to 224.0.0.23
-bool(true)
-creating receive socket
-resource(%d) of type (Socket)
-bool(true)
-bool(true)
-int(14)
-1> initial packet
-leaving group
-bool(true)
-int(20)
-int(14)
-2> unicast packet
-re-joining group
-bool(true)
-int(42)
-int(12)
-3> mcast packet
-blocking source
-bool(true)
-int(31)
-int(14)
-4> unicast packet
-unblocking source
-bool(true)
-int(27)
-5> mcast packet from 127.0.0.1
-leaving group
-bool(true)
-int(20)
-int(14)
-6> unicast packet
-joining source group
-bool(true)
-int(27)
-7> mcast packet from 127.0.0.1
-leaving source group
-bool(true)
-int(20)
-int(14)
-8> unicast packet
+--TEST-- +Multicast support: IPv4 receive options +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('skip sockets extension not available.'); +} +$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); +$br = socket_bind($s, '0.0.0.0', 3000); +$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array( + "group" => '224.0.0.23', + "interface" => 'lo', +)); +if ($so === false) { + die('skip interface \'lo\' is unavailable.'); +} +if (!defined("MCAST_BLOCK_SOURCE")) { + die('skip source operations are unavailable'); +} +--FILE-- +<?php +include __DIR__."/mcast_helpers.php.inc"; +$domain = AF_INET; +$level = IPPROTO_IP; +$interface = "lo"; +$mcastaddr = '224.0.0.23'; +$sblock = "127.0.0.1"; + +echo "creating send socket bound to 127.0.0.1\n"; +$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP); +$br = socket_bind($sends1, '127.0.0.1'); +var_dump($br); + +echo "creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to $mcastaddr\n"; +$sends2 = socket_create($domain, SOCK_DGRAM, SOL_UDP); +var_dump($br); + +echo "creating receive socket\n"; +$s = socket_create($domain, SOCK_DGRAM, SOL_UDP); +var_dump($s); +$br = socket_bind($s, '0.0.0.0', 3000); +var_dump($br); + +$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, +)); +var_dump($so); + +$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000); +var_dump($r); + +$i = 0; +checktimeout($s, 500); +while (($str = socket_read($s, 3000)) !== FALSE) { + $i++; + echo "$i> ", $str, "\n"; + +if ($i == 1) { + echo "leaving group\n"; + $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); + $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000); + var_dump($r); +} +if ($i == 2) { + echo "re-joining group\n"; + $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + )); + var_dump($so); + $r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); + $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); +} +if ($i == 3) { + echo "blocking source\n"; + $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array( + "group" => $mcastaddr, + "interface" => $interface, + "source" => $sblock, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); + $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000); + var_dump($r); +} +if ($i == 4) { + echo "unblocking source\n"; + $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array( + "group" => $mcastaddr, + "interface" => $interface, + "source" => $sblock, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); +} +if ($i == 5) { + echo "leaving group\n"; + $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); + $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000); + var_dump($r); +} +if ($i == 6) { + echo "joining source group\n"; + $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + "source" => $sblock, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); +} +if ($i == 7) { + echo "leaving source group\n"; + $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + "source" => $sblock, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); + $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000); + var_dump($r); +} +if ($i == 8) { +/* echo "rjsg\n"; + $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + )); + var_dump($so);*/ + break; +} + +} +--EXPECTF-- +creating send socket bound to 127.0.0.1 +bool(true) +creating unbound socket and hoping the routing table causes an interface other than lo to be used for sending messages to 224.0.0.23 +bool(true) +creating receive socket +resource(%d) of type (Socket) +bool(true) +bool(true) +int(14) +1> initial packet +leaving group +bool(true) +int(20) +int(14) +2> unicast packet +re-joining group +bool(true) +int(42) +int(12) +3> mcast packet +blocking source +bool(true) +int(31) +int(14) +4> unicast packet +unblocking source +bool(true) +int(27) +5> mcast packet from 127.0.0.1 +leaving group +bool(true) +int(20) +int(14) +6> unicast packet +joining source group +bool(true) +int(27) +7> mcast packet from 127.0.0.1 +leaving source group +bool(true) +int(20) +int(14) +8> unicast packet diff --git a/ext/sockets/tests/mcast_ipv6_recv.phpt b/ext/sockets/tests/mcast_ipv6_recv.phpt index 61d1e8458f..6ff97b60d5 100644 --- a/ext/sockets/tests/mcast_ipv6_recv.phpt +++ b/ext/sockets/tests/mcast_ipv6_recv.phpt @@ -1,226 +1,226 @@ ---TEST--
-Multicast support: IPv6 receive options
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('skip sockets extension not available.');
-}
-if (!defined('IPPROTO_IPV6')) {
- die('skip IPv6 not available.');
-}
-$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
-if ($s === false) {
- die("skip unable to create socket");
-}
-$br = socket_bind($s, '::', 3000);
-/* On Linux, there is no route ff00::/8 by default on lo, which makes it
- * troublesome to send multicast traffic from lo, which we must since
- * we're dealing with interface-local traffic... */
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
-));
-if ($so === false) {
- die('skip unable to join multicast group on any interface.');
-}
-$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
-if ($r === false) {
- die('skip unable to send multicast packet.');
-}
-
-if (!defined("MCAST_JOIN_SOURCE_GROUP"))
- die('skip source operations are unavailable');
-
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
-));
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
- "source" => '2001::dead:beef',
-));
-if ($so === false) {
- die('skip protocol independent multicast API is unavailable.');
-}
-
---FILE--
-<?php
-include __DIR__."/mcast_helpers.php.inc";
-$domain = AF_INET6;
-$level = IPPROTO_IPV6;
-$interface = 0;
-$mcastaddr = 'ff01::114';
-$sblock = "?";
-
-echo "creating send socket\n";
-$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
-var_dump($sends1);
-
-echo "creating receive socket\n";
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
-var_dump($s);
-$br = socket_bind($s, '::0', 3000) or die("err");
-var_dump($br);
-
-$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
-)) or die("err");
-var_dump($so);
-
-$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
-var_dump($r);
-checktimeout($s, 500);
-$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
-var_dump($r, $str, $from);
-$sblock = $from;
-
-$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
-var_dump($r);
-
-$i = 0;
-checktimeout($s, 500);
-while (($str = socket_read($s, 3000)) !== FALSE) {
- $i++;
- echo "$i> ", $str, "\n";
-
-if ($i == 1) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
-}
-if ($i == 2) {
- echo "re-joining group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 3) {
- echo "blocking source\n";
- $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
-}
-if ($i == 4) {
- echo "unblocking source\n";
- $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 5) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
-}
-if ($i == 6) {
- echo "joining source group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 7) {
- echo "leaving source group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
-}
-if ($i == 8) {
- /*echo "joining source group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);*/
- break;
-}
-
-}
---EXPECTF--
-creating send socket
-resource(%d) of type (Socket)
-creating receive socket
-resource(%d) of type (Socket)
-bool(true)
-bool(true)
-int(14)
-int(14)
-string(14) "testing packet"
-string(%d) "%s"
-int(14)
-1> initial packet
-leaving group
-bool(true)
-int(20)
-int(14)
-2> unicast packet
-re-joining group
-bool(true)
-int(12)
-3> mcast packet
-blocking source
-bool(true)
-int(31)
-int(14)
-4> unicast packet
-unblocking source
-bool(true)
-int(12)
-5> mcast packet
-leaving group
-bool(true)
-int(20)
-int(14)
-6> unicast packet
-joining source group
-bool(true)
-int(32)
-7> mcast packet from desired source
-leaving source group
-bool(true)
-int(20)
-int(14)
-8> unicast packet
+--TEST-- +Multicast support: IPv6 receive options +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('skip sockets extension not available.'); +} +if (!defined('IPPROTO_IPV6')) { + die('skip IPv6 not available.'); +} +$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP); +if ($s === false) { + die("skip unable to create socket"); +} +$br = socket_bind($s, '::', 3000); +/* On Linux, there is no route ff00::/8 by default on lo, which makes it + * troublesome to send multicast traffic from lo, which we must since + * we're dealing with interface-local traffic... */ +$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array( + "group" => 'ff01::114', + "interface" => 0, +)); +if ($so === false) { + die('skip unable to join multicast group on any interface.'); +} +$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000); +if ($r === false) { + die('skip unable to send multicast packet.'); +} + +if (!defined("MCAST_JOIN_SOURCE_GROUP")) + die('skip source operations are unavailable'); + +$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array( + "group" => 'ff01::114', + "interface" => 0, +)); +$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array( + "group" => 'ff01::114', + "interface" => 0, + "source" => '2001::dead:beef', +)); +if ($so === false) { + die('skip protocol independent multicast API is unavailable.'); +} + +--FILE-- +<?php +include __DIR__."/mcast_helpers.php.inc"; +$domain = AF_INET6; +$level = IPPROTO_IPV6; +$interface = 0; +$mcastaddr = 'ff01::114'; +$sblock = "?"; + +echo "creating send socket\n"; +$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); +var_dump($sends1); + +echo "creating receive socket\n"; +$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); +var_dump($s); +$br = socket_bind($s, '::0', 3000) or die("err"); +var_dump($br); + +$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, +)) or die("err"); +var_dump($so); + +$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000); +var_dump($r); +checktimeout($s, 500); +$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort); +var_dump($r, $str, $from); +$sblock = $from; + +$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000); +var_dump($r); + +$i = 0; +checktimeout($s, 500); +while (($str = socket_read($s, 3000)) !== FALSE) { + $i++; + echo "$i> ", $str, "\n"; + +if ($i == 1) { + echo "leaving group\n"; + $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); + $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); + var_dump($r); +} +if ($i == 2) { + echo "re-joining group\n"; + $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); +} +if ($i == 3) { + echo "blocking source\n"; + $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array( + "group" => $mcastaddr, + "interface" => $interface, + "source" => $sblock, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); + $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); + var_dump($r); +} +if ($i == 4) { + echo "unblocking source\n"; + $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array( + "group" => $mcastaddr, + "interface" => $interface, + "source" => $sblock, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); +} +if ($i == 5) { + echo "leaving group\n"; + $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); + $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); + var_dump($r); +} +if ($i == 6) { + echo "joining source group\n"; + $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + "source" => $sblock, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); +} +if ($i == 7) { + echo "leaving source group\n"; + $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + "source" => $sblock, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); + $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); + var_dump($r); +} +if ($i == 8) { + /*echo "joining source group\n"; + $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + "source" => $sblock, + )); + var_dump($so);*/ + break; +} + +} +--EXPECTF-- +creating send socket +resource(%d) of type (Socket) +creating receive socket +resource(%d) of type (Socket) +bool(true) +bool(true) +int(14) +int(14) +string(14) "testing packet" +string(%d) "%s" +int(14) +1> initial packet +leaving group +bool(true) +int(20) +int(14) +2> unicast packet +re-joining group +bool(true) +int(12) +3> mcast packet +blocking source +bool(true) +int(31) +int(14) +4> unicast packet +unblocking source +bool(true) +int(12) +5> mcast packet +leaving group +bool(true) +int(20) +int(14) +6> unicast packet +joining source group +bool(true) +int(32) +7> mcast packet from desired source +leaving source group +bool(true) +int(20) +int(14) +8> unicast packet diff --git a/ext/sockets/tests/mcast_ipv6_recv_limited.phpt b/ext/sockets/tests/mcast_ipv6_recv_limited.phpt index fda099877d..9fd5459950 100644 --- a/ext/sockets/tests/mcast_ipv6_recv_limited.phpt +++ b/ext/sockets/tests/mcast_ipv6_recv_limited.phpt @@ -1,131 +1,131 @@ ---TEST--
-Multicast support: IPv6 receive options (limited)
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('skip sockets extension not available.');
-}
-if (!defined('IPPROTO_IPV6')) {
- die('skip IPv6 not available.');
-}
-$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP);
-$br = socket_bind($s, '::', 3000);
-/* On Linux, there is no route ff00::/8 by default on lo, which makes it
- * troublesome to send multicast traffic from lo, which we must since
- * we're dealing with interface-local traffic... */
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
-));
-if ($so === false) {
- die('skip unable to join multicast group on any interface.');
-}
-$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000);
-if ($r === false) {
- die('skip unable to send multicast packet.');
-}
-$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
-));
-if (defined("MCAST_JOIN_SOURCE_GROUP")) {
- $so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => 'ff01::114',
- "interface" => 0,
- "source" => '2001::dead:beef',
- ));
- if ($so !== false) {
- die('skip protocol independent multicast API is available.');
- }
-}
-
---FILE--
-<?php
-include __DIR__."/mcast_helpers.php.inc";
-$domain = AF_INET6;
-$level = IPPROTO_IPV6;
-$interface = 0;
-$mcastaddr = 'ff01::114';
-$sblock = "?";
-
-echo "creating send socket\n";
-$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
-var_dump($sends1);
-
-echo "creating receive socket\n";
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
-var_dump($s);
-$br = socket_bind($s, '::0', 3000) or die("err");
-var_dump($br);
-
-$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
-)) or die("err");
-var_dump($so);
-
-$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000);
-var_dump($r);
-checktimeout($s, 500);
-$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort);
-var_dump($r, $str, $from);
-$sblock = $from;
-
-$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000);
-var_dump($r);
-
-$i = 0;
-checktimeout($s, 500);
-while (($str = socket_read($s, 3000, 500)) !== FALSE) {
- $i++;
- echo "$i> ", $str, "\n";
-
-if ($i == 1) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
-}
-if ($i == 2) {
- echo "re-joining group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
-}
-if ($i == 3) {
- break;
-}
-
-}
---EXPECTF--
-creating send socket
-resource(%d) of type (Socket)
-creating receive socket
-resource(%d) of type (Socket)
-bool(true)
-bool(true)
-int(14)
-int(14)
-string(14) "testing packet"
-string(%d) "%s"
-int(14)
-1> initial packet
-leaving group
-bool(true)
-int(20)
-int(14)
-2> unicast packet
-re-joining group
-bool(true)
-int(12)
-3> mcast packet
+--TEST-- +Multicast support: IPv6 receive options (limited) +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('skip sockets extension not available.'); +} +if (!defined('IPPROTO_IPV6')) { + die('skip IPv6 not available.'); +} +$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP); +$br = socket_bind($s, '::', 3000); +/* On Linux, there is no route ff00::/8 by default on lo, which makes it + * troublesome to send multicast traffic from lo, which we must since + * we're dealing with interface-local traffic... */ +$so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_GROUP, array( + "group" => 'ff01::114', + "interface" => 0, +)); +if ($so === false) { + die('skip unable to join multicast group on any interface.'); +} +$r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000); +if ($r === false) { + die('skip unable to send multicast packet.'); +} +$so = socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array( + "group" => 'ff01::114', + "interface" => 0, +)); +if (defined("MCAST_JOIN_SOURCE_GROUP")) { + $so = socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array( + "group" => 'ff01::114', + "interface" => 0, + "source" => '2001::dead:beef', + )); + if ($so !== false) { + die('skip protocol independent multicast API is available.'); + } +} + +--FILE-- +<?php +include __DIR__."/mcast_helpers.php.inc"; +$domain = AF_INET6; +$level = IPPROTO_IPV6; +$interface = 0; +$mcastaddr = 'ff01::114'; +$sblock = "?"; + +echo "creating send socket\n"; +$sends1 = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); +var_dump($sends1); + +echo "creating receive socket\n"; +$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); +var_dump($s); +$br = socket_bind($s, '::0', 3000) or die("err"); +var_dump($br); + +$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, +)) or die("err"); +var_dump($so); + +$r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000); +var_dump($r); +checktimeout($s, 500); +$r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort); +var_dump($r, $str, $from); +$sblock = $from; + +$r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000); +var_dump($r); + +$i = 0; +checktimeout($s, 500); +while (($str = socket_read($s, 3000, 500)) !== FALSE) { + $i++; + echo "$i> ", $str, "\n"; + +if ($i == 1) { + echo "leaving group\n"; + $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); + $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); + var_dump($r); +} +if ($i == 2) { + echo "re-joining group\n"; + $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( + "group" => $mcastaddr, + "interface" => $interface, + )); + var_dump($so); + $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000); + var_dump($r); +} +if ($i == 3) { + break; +} + +} +--EXPECTF-- +creating send socket +resource(%d) of type (Socket) +creating receive socket +resource(%d) of type (Socket) +bool(true) +bool(true) +int(14) +int(14) +string(14) "testing packet" +string(%d) "%s" +int(14) +1> initial packet +leaving group +bool(true) +int(20) +int(14) +2> unicast packet +re-joining group +bool(true) +int(12) +3> mcast packet diff --git a/ext/sockets/tests/mcast_ipv6_send.phpt b/ext/sockets/tests/mcast_ipv6_send.phpt index f75bb09903..a9d6293fc9 100644 --- a/ext/sockets/tests/mcast_ipv6_send.phpt +++ b/ext/sockets/tests/mcast_ipv6_send.phpt @@ -1,70 +1,70 @@ ---TEST--
-Multicast support: IPv6 send options
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('skip sockets extension not available.');
-}
-if (!defined('IPPROTO_IPV6')) {
- die('skip IPv6 not available.');
-}
-$level = IPPROTO_IPV6;
-$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP) or die("skip Can not create socket");
-if (socket_set_option($s, $level, IPV6_MULTICAST_IF, 1) === false) {
- die("skip interface 1 either doesn't exist or has no ipv6 address");
-}
---FILE--
-<?php
-$domain = AF_INET6;
-$level = IPPROTO_IPV6;
-$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err");
-
-echo "Setting IPV6_MULTICAST_TTL\n";
-$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9);
-var_dump($r);
-$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS);
-var_dump($r);
-echo "\n";
-
-echo "Setting IPV6_MULTICAST_LOOP\n";
-$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0);
-var_dump($r);
-$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
-var_dump($r);
-$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1);
-var_dump($r);
-$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP);
-var_dump($r);
-echo "\n";
-
-echo "Setting IPV6_MULTICAST_IF\n";
-echo "interface 0:\n";
-$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0);
-var_dump($r);
-$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
-var_dump($r);
-echo "interface 1:\n";
-$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1);
-var_dump($r);
-$r = socket_get_option($s, $level, IPV6_MULTICAST_IF);
-var_dump($r);
-echo "\n";
-
---EXPECT--
-Setting IPV6_MULTICAST_TTL
-bool(true)
-int(9)
-
-Setting IPV6_MULTICAST_LOOP
-bool(true)
-int(0)
-bool(true)
-int(1)
-
-Setting IPV6_MULTICAST_IF
-interface 0:
-bool(true)
-int(0)
-interface 1:
-bool(true)
-int(1)
+--TEST-- +Multicast support: IPv6 send options +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('skip sockets extension not available.'); +} +if (!defined('IPPROTO_IPV6')) { + die('skip IPv6 not available.'); +} +$level = IPPROTO_IPV6; +$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP) or die("skip Can not create socket"); +if (socket_set_option($s, $level, IPV6_MULTICAST_IF, 1) === false) { + die("skip interface 1 either doesn't exist or has no ipv6 address"); +} +--FILE-- +<?php +$domain = AF_INET6; +$level = IPPROTO_IPV6; +$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); + +echo "Setting IPV6_MULTICAST_TTL\n"; +$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9); +var_dump($r); +$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS); +var_dump($r); +echo "\n"; + +echo "Setting IPV6_MULTICAST_LOOP\n"; +$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0); +var_dump($r); +$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP); +var_dump($r); +$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1); +var_dump($r); +$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP); +var_dump($r); +echo "\n"; + +echo "Setting IPV6_MULTICAST_IF\n"; +echo "interface 0:\n"; +$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0); +var_dump($r); +$r = socket_get_option($s, $level, IPV6_MULTICAST_IF); +var_dump($r); +echo "interface 1:\n"; +$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1); +var_dump($r); +$r = socket_get_option($s, $level, IPV6_MULTICAST_IF); +var_dump($r); +echo "\n"; + +--EXPECT-- +Setting IPV6_MULTICAST_TTL +bool(true) +int(9) + +Setting IPV6_MULTICAST_LOOP +bool(true) +int(0) +bool(true) +int(1) + +Setting IPV6_MULTICAST_IF +interface 0: +bool(true) +int(0) +interface 1: +bool(true) +int(1) diff --git a/ext/spl/tests/DirectoryIterator_getInode_basic.phpt b/ext/spl/tests/DirectoryIterator_getInode_basic.phpt index 4fd7e8da35..a6b128a222 100644 --- a/ext/spl/tests/DirectoryIterator_getInode_basic.phpt +++ b/ext/spl/tests/DirectoryIterator_getInode_basic.phpt @@ -1,19 +1,19 @@ ---TEST--
-SPL: Spl Directory Iterator test getInode
---CREDITS--
+--TEST-- +SPL: Spl Directory Iterator test getInode +--CREDITS-- Cesare D'Amico <cesare.damico@gruppovolta.it> Andrea Giorgini <agiorg@gmail.com> Filippo De Santis <fd@ideato.it> Daniel Londero <daniel.londero@gmail.com> Francesco Trucchia <ft@ideato.it> Jacopo Romei <jacopo@sviluppoagile.it> -#Test Fest Cesena (Italy) on 2009-06-20
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#Test Fest Cesena (Italy) on 2009-06-20 +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); +?> +--FILE-- +<?php //file mkdir('test_dir_ptfi'); @@ -24,6 +24,6 @@ var_dump(decoct($dirIterator->getInode())); --CLEAN-- <?php rmdir('test_dir_ptfi'); -?>
---EXPECTF--
+?> +--EXPECTF-- string(%d) "%d" diff --git a/ext/spl/tests/DirectoryIterator_getInode_error.phpt b/ext/spl/tests/DirectoryIterator_getInode_error.phpt index ba9014c690..570bb21fda 100644 --- a/ext/spl/tests/DirectoryIterator_getInode_error.phpt +++ b/ext/spl/tests/DirectoryIterator_getInode_error.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: Spl File Info test getInode
---CREDITS--
+--TEST-- +SPL: Spl File Info test getInode +--CREDITS-- Cesare D'Amico <cesare.damico@gruppovolta.it> Andrea Giorgini <agiorg@gmail.com> Filippo De Santis <fd@ideato.it> Daniel Londero <daniel.londero@gmail.com> Francesco Trucchia <ft@ideato.it> Jacopo Romei <jacopo@sviluppoagile.it> -#Test Fest Cesena (Italy) on 2009-06-20
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#Test Fest Cesena (Italy) on 2009-06-20 +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); +?> +--FILE-- +<?php //file $fileInfo = new SplFileInfo('not_existing'); var_dump($fileInfo->getInode()); ?> -
+ --EXPECTF-- Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for %s in %s Stack trace: diff --git a/ext/spl/tests/SplFileInfo_getGroup_error.phpt b/ext/spl/tests/SplFileInfo_getGroup_error.phpt index acfa6b99c5..79492e0e9c 100644 --- a/ext/spl/tests/SplFileInfo_getGroup_error.phpt +++ b/ext/spl/tests/SplFileInfo_getGroup_error.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: Spl File Info test getGroup
---CREDITS--
+--TEST-- +SPL: Spl File Info test getGroup +--CREDITS-- Cesare D'Amico <cesare.damico@gruppovolta.it> Andrea Giorgini <agiorg@gmail.com> Filippo De Santis <fd@ideato.it> Daniel Londero <daniel.londero@gmail.com> Francesco Trucchia <ft@ideato.it> Jacopo Romei <jacopo@sviluppoagile.it> -#Test Fest Cesena (Italy) on 2009-06-20
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#Test Fest Cesena (Italy) on 2009-06-20 +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); +?> +--FILE-- +<?php //file $fileInfo = new SplFileInfo('not_existing'); var_dump($fileInfo->getGroup()); ?> -
+ --EXPECTF-- Fatal error: Uncaught RuntimeException: SplFileInfo::getGroup(): stat failed for not_existing in %s Stack trace: diff --git a/ext/spl/tests/SplFileInfo_getInode_basic.phpt b/ext/spl/tests/SplFileInfo_getInode_basic.phpt index 380b865cd2..9ee2c6ee51 100644 --- a/ext/spl/tests/SplFileInfo_getInode_basic.phpt +++ b/ext/spl/tests/SplFileInfo_getInode_basic.phpt @@ -1,19 +1,19 @@ ---TEST--
-SPL: Spl File Info test getInode
---CREDITS--
+--TEST-- +SPL: Spl File Info test getInode +--CREDITS-- Cesare D'Amico <cesare.damico@gruppovolta.it> Andrea Giorgini <agiorg@gmail.com> Filippo De Santis <fd@ideato.it> Daniel Londero <daniel.londero@gmail.com> Francesco Trucchia <ft@ideato.it> Jacopo Romei <jacopo@sviluppoagile.it> -#Test Fest Cesena (Italy) on 2009-06-20
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#Test Fest Cesena (Italy) on 2009-06-20 +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); +?> +--FILE-- +<?php //file touch ('SplFileInfo_getInode_basic.txt'); @@ -25,6 +25,6 @@ var_dump($fileInfo->getInode() == $result); --CLEAN-- <?php unlink('SplFileInfo_getInode_basic.txt'); -?>
---EXPECTF--
+?> +--EXPECTF-- bool(true) diff --git a/ext/spl/tests/SplFileInfo_getInode_error.phpt b/ext/spl/tests/SplFileInfo_getInode_error.phpt index 31b5382336..c2b9803735 100644 --- a/ext/spl/tests/SplFileInfo_getInode_error.phpt +++ b/ext/spl/tests/SplFileInfo_getInode_error.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: Spl File Info test getPerms
---CREDITS--
+--TEST-- +SPL: Spl File Info test getPerms +--CREDITS-- Cesare D'Amico <cesare.damico@gruppovolta.it> Andrea Giorgini <agiorg@gmail.com> Filippo De Santis <fd@ideato.it> Daniel Londero <daniel.londero@gmail.com> Francesco Trucchia <ft@ideato.it> Jacopo Romei <jacopo@sviluppoagile.it> -#Test Fest Cesena (Italy) on 2009-06-20
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#Test Fest Cesena (Italy) on 2009-06-20 +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); +?> +--FILE-- +<?php //file $fileInfo = new SplFileInfo('not_existing'); var_dump($fileInfo->getInode()); ?> -
+ --EXPECTF-- Fatal error: Uncaught RuntimeException: SplFileInfo::getInode(): stat failed for not_existing in %s Stack trace: diff --git a/ext/spl/tests/SplFileInfo_getOwner_error.phpt b/ext/spl/tests/SplFileInfo_getOwner_error.phpt index f6b4b29195..073744aa00 100644 --- a/ext/spl/tests/SplFileInfo_getOwner_error.phpt +++ b/ext/spl/tests/SplFileInfo_getOwner_error.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: Spl File Info test getOwner
---CREDITS--
+--TEST-- +SPL: Spl File Info test getOwner +--CREDITS-- Cesare D'Amico <cesare.damico@gruppovolta.it> Andrea Giorgini <agiorg@gmail.com> Filippo De Santis <fd@ideato.it> Daniel Londero <daniel.londero@gmail.com> Francesco Trucchia <ft@ideato.it> Jacopo Romei <jacopo@sviluppoagile.it> -#Test Fest Cesena (Italy) on 2009-06-20
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#Test Fest Cesena (Italy) on 2009-06-20 +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); +?> +--FILE-- +<?php //file $fileInfo = new SplFileInfo('not_existing'); var_dump($fileInfo->getOwner()); ?> -
+ --EXPECTF-- Fatal error: Uncaught RuntimeException: SplFileInfo::getOwner(): stat failed for not_existing in %s Stack trace: diff --git a/ext/spl/tests/SplFileInfo_getPerms_basic.phpt b/ext/spl/tests/SplFileInfo_getPerms_basic.phpt index 53591f3417..af09907605 100644 --- a/ext/spl/tests/SplFileInfo_getPerms_basic.phpt +++ b/ext/spl/tests/SplFileInfo_getPerms_basic.phpt @@ -1,19 +1,19 @@ ---TEST--
-SPL: Spl File Info test getPerms
---CREDITS--
+--TEST-- +SPL: Spl File Info test getPerms +--CREDITS-- Cesare D'Amico <cesare.damico@gruppovolta.it> Andrea Giorgini <agiorg@gmail.com> Filippo De Santis <fd@ideato.it> Daniel Londero <daniel.londero@gmail.com> Francesco Trucchia <ft@ideato.it> Jacopo Romei <jacopo@sviluppoagile.it> -#Test Fest Cesena (Italy) on 2009-06-20
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#Test Fest Cesena (Italy) on 2009-06-20 +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); +?> +--FILE-- +<?php //file touch ('SplFileInfo_getPerms_basic.txt'); @@ -25,6 +25,6 @@ var_dump($fileInfo->getPerms() == 0100557); --CLEAN-- <?php unlink('SplFileInfo_getPerms_basic.txt'); -?>
---EXPECTF--
+?> +--EXPECTF-- bool(true) diff --git a/ext/spl/tests/SplFileInfo_getPerms_error.phpt b/ext/spl/tests/SplFileInfo_getPerms_error.phpt index 23b48de976..4b70c2635b 100644 --- a/ext/spl/tests/SplFileInfo_getPerms_error.phpt +++ b/ext/spl/tests/SplFileInfo_getPerms_error.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: Spl File Info test getPerms
---CREDITS--
+--TEST-- +SPL: Spl File Info test getPerms +--CREDITS-- Cesare D'Amico <cesare.damico@gruppovolta.it> Andrea Giorgini <agiorg@gmail.com> Filippo De Santis <fd@ideato.it> Daniel Londero <daniel.londero@gmail.com> Francesco Trucchia <ft@ideato.it> Jacopo Romei <jacopo@sviluppoagile.it> -#Test Fest Cesena (Italy) on 2009-06-20
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
+#Test Fest Cesena (Italy) on 2009-06-20 +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); +?> +--FILE-- +<?php //file $fileInfo = new SplFileInfo('not_existing'); var_dump($fileInfo->getPerms() == 0100557); ?> -
+ --EXPECTF-- Fatal error: Uncaught RuntimeException: SplFileInfo::getPerms(): stat failed for %s in %s Stack trace: diff --git a/ext/spl/tests/bug73629.phpt b/ext/spl/tests/bug73629.phpt index 5b6587c685..ee0b8a6fba 100644 --- a/ext/spl/tests/bug73629.phpt +++ b/ext/spl/tests/bug73629.phpt @@ -1,20 +1,20 @@ ---TEST--
-Bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags)
---FILE--
-<?php
-$q = new SplQueue();
-try {
- $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
-} catch (Exception $e) {
- echo 'unexpected exception: ' . $e->getMessage() . "\n";
-}
-try {
- $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
-} catch (Exception $e) {
- echo 'expected exception: ' . $e->getMessage() . "\n";
-}
-?>
-===DONE===
---EXPECTF--
-expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
-===DONE===
+--TEST-- +Bug #73629 (SplDoublyLinkedList::setIteratorMode masks intern flags) +--FILE-- +<?php +$q = new SplQueue(); +try { + $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO); +} catch (Exception $e) { + echo 'unexpected exception: ' . $e->getMessage() . "\n"; +} +try { + $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO); +} catch (Exception $e) { + echo 'expected exception: ' . $e->getMessage() . "\n"; +} +?> +===DONE=== +--EXPECTF-- +expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen +===DONE=== diff --git a/ext/spl/tests/bug74478.phpt b/ext/spl/tests/bug74478.phpt index da63984d5c..c384648466 100644 --- a/ext/spl/tests/bug74478.phpt +++ b/ext/spl/tests/bug74478.phpt @@ -1,62 +1,62 @@ ---TEST--
-Bug #74478: null coalescing operator failing with SplFixedArray
---FILE--
-<?php
-
-class MyFixedArray extends \SplFixedArray
-{
- public function offsetExists($name) {
- echo "offsetExists($name)\n";
- return parent::offsetExists($name);
- }
- public function offsetGet($name) {
- echo "offsetGet($name)\n";
- return parent::offsetGet($name);
- }
- public function offsetSet($name, $value) {
- echo "offsetSet($name)\n";
- return parent::offsetSet($name, $value);
- }
- public function offsetUnset($name) {
- echo "offsetUnset($name)\n";
- return parent::offsetUnset($name);
- }
-
-};
-
-$fixedData = new MyFixedArray(10);
-var_dump(isset($fixedData[0][1][2]));
-var_dump(isset($fixedData[0]->foo));
-var_dump($fixedData[0] ?? 42);
-var_dump($fixedData[0][1][2] ?? 42);
-
-$fixedData[0] = new MyFixedArray(10);
-$fixedData[0][1] = new MyFixedArray(10);
-var_dump(isset($fixedData[0][1][2]));
-var_dump($fixedData[0][1][2] ?? 42);
-
-?>
---EXPECT--
-offsetExists(0)
-bool(false)
-offsetExists(0)
-bool(false)
-offsetExists(0)
-int(42)
-offsetExists(0)
-int(42)
-offsetSet(0)
-offsetGet(0)
-offsetSet(1)
-offsetExists(0)
-offsetGet(0)
-offsetExists(1)
-offsetGet(1)
-offsetExists(2)
-bool(false)
-offsetExists(0)
-offsetGet(0)
-offsetExists(1)
-offsetGet(1)
-offsetExists(2)
+--TEST-- +Bug #74478: null coalescing operator failing with SplFixedArray +--FILE-- +<?php + +class MyFixedArray extends \SplFixedArray +{ + public function offsetExists($name) { + echo "offsetExists($name)\n"; + return parent::offsetExists($name); + } + public function offsetGet($name) { + echo "offsetGet($name)\n"; + return parent::offsetGet($name); + } + public function offsetSet($name, $value) { + echo "offsetSet($name)\n"; + return parent::offsetSet($name, $value); + } + public function offsetUnset($name) { + echo "offsetUnset($name)\n"; + return parent::offsetUnset($name); + } + +}; + +$fixedData = new MyFixedArray(10); +var_dump(isset($fixedData[0][1][2])); +var_dump(isset($fixedData[0]->foo)); +var_dump($fixedData[0] ?? 42); +var_dump($fixedData[0][1][2] ?? 42); + +$fixedData[0] = new MyFixedArray(10); +$fixedData[0][1] = new MyFixedArray(10); +var_dump(isset($fixedData[0][1][2])); +var_dump($fixedData[0][1][2] ?? 42); + +?> +--EXPECT-- +offsetExists(0) +bool(false) +offsetExists(0) +bool(false) +offsetExists(0) +int(42) +offsetExists(0) +int(42) +offsetSet(0) +offsetGet(0) +offsetSet(1) +offsetExists(0) +offsetGet(0) +offsetExists(1) +offsetGet(1) +offsetExists(2) +bool(false) +offsetExists(0) +offsetGet(0) +offsetExists(1) +offsetGet(1) +offsetExists(2) int(42)
\ No newline at end of file diff --git a/ext/spl/tests/iterator_069.phpt b/ext/spl/tests/iterator_069.phpt index e9b3177ed6..1ee44785b3 100644 --- a/ext/spl/tests/iterator_069.phpt +++ b/ext/spl/tests/iterator_069.phpt @@ -1,17 +1,17 @@ ---TEST--
-SPL: RecursiveIteratorIterator cannot be used with foreach by reference
---FILE--
-<?php
-
-$arr = array(array(1,2));
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-$recItIt = new RecursiveIteratorIterator($recArrIt);
-
-foreach ($recItIt as &$val) echo "$val\n";
-
-?>
---EXPECTF--
-Fatal error: An iterator cannot be used with foreach by reference in %s on line %d
+--TEST-- +SPL: RecursiveIteratorIterator cannot be used with foreach by reference +--FILE-- +<?php + +$arr = array(array(1,2)); +$arrOb = new ArrayObject($arr); + +$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); + +$recItIt = new RecursiveIteratorIterator($recArrIt); + +foreach ($recItIt as &$val) echo "$val\n"; + +?> +--EXPECTF-- +Fatal error: An iterator cannot be used with foreach by reference in %s on line %d diff --git a/ext/spl/tests/iterator_070.phpt b/ext/spl/tests/iterator_070.phpt index c45f08ec45..bbb518e074 100644 --- a/ext/spl/tests/iterator_070.phpt +++ b/ext/spl/tests/iterator_070.phpt @@ -1,20 +1,20 @@ ---TEST--
-SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free.
---FILE--
-<?php
-
-$array = array();
-$recArrIt = new RecursiveArrayIterator($array);
-
-$recItIt = new RecursiveIteratorIterator($recArrIt);
-
-var_dump($recItIt->beginIteration());
-var_dump($recItIt->endIteration());
-var_dump($recItIt->nextElement());
-
-?>
-
---EXPECTF--
-NULL
-NULL
+--TEST-- +SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free. +--FILE-- +<?php + +$array = array(); +$recArrIt = new RecursiveArrayIterator($array); + +$recItIt = new RecursiveIteratorIterator($recArrIt); + +var_dump($recItIt->beginIteration()); +var_dump($recItIt->endIteration()); +var_dump($recItIt->nextElement()); + +?> + +--EXPECTF-- +NULL +NULL NULL
\ No newline at end of file diff --git a/ext/spl/tests/iterator_071.phpt b/ext/spl/tests/iterator_071.phpt index 21ec7980ad..8370906abb 100644 --- a/ext/spl/tests/iterator_071.phpt +++ b/ext/spl/tests/iterator_071.phpt @@ -1,32 +1,32 @@ ---TEST--
-SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST
---FILE--
-<?php
-
-$arr = array(array(1,2),2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
-
- function nextelement() {
- echo __METHOD__."\n";
- }
-}
-
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);
-
-foreach ($recItIt as $key => $val) echo "$key\n";
-
-?>
---EXPECTF--
-MyRecursiveIteratorIterator::nextelement
-0
-MyRecursiveIteratorIterator::nextelement
-1
-MyRecursiveIteratorIterator::nextelement
-0
-MyRecursiveIteratorIterator::nextelement
+--TEST-- +SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST +--FILE-- +<?php + +$arr = array(array(1,2),2); +$arrOb = new ArrayObject($arr); + +$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); + +class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { + + function nextelement() { + echo __METHOD__."\n"; + } +} + + +$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST); + +foreach ($recItIt as $key => $val) echo "$key\n"; + +?> +--EXPECTF-- +MyRecursiveIteratorIterator::nextelement +0 +MyRecursiveIteratorIterator::nextelement +1 +MyRecursiveIteratorIterator::nextelement +0 +MyRecursiveIteratorIterator::nextelement 1
\ No newline at end of file diff --git a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt index c9e21b260e..7ed3b6eb34 100644 --- a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt @@ -1,36 +1,36 @@ ---TEST--
-SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next()
---FILE--
-<?php
-
-$arr = array(array(1,2),2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
-
- function beginchildren() {
- throw new Exception;
- }
-}
-
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
-
-var_dump($recItIt->next());
-
-$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
-
-var_dump($recItIt2->next());
-
-?>
---EXPECTF--
-NULL
-
-Fatal error: Uncaught Exception in %s
-Stack trace:
-#0 [internal function]: MyRecursiveIteratorIterator->beginchildren()
-#1 %s: RecursiveIteratorIterator->next()
-#2 {main}
- thrown in %s on line %d
+--TEST-- +SPL: RecursiveIteratorIterator - Exception thrown in beginchildren which should be handled in next() +--FILE-- +<?php + +$arr = array(array(1,2),2); +$arrOb = new ArrayObject($arr); + +$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); + +class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { + + function beginchildren() { + throw new Exception; + } +} + + +$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); + +var_dump($recItIt->next()); + +$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY); + +var_dump($recItIt2->next()); + +?> +--EXPECTF-- +NULL + +Fatal error: Uncaught Exception in %s +Stack trace: +#0 [internal function]: MyRecursiveIteratorIterator->beginchildren() +#1 %s: RecursiveIteratorIterator->next() +#2 {main} + thrown in %s on line %d diff --git a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt index cbf8136ab6..0e3c1c1439 100644 --- a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt @@ -1,36 +1,36 @@ ---TEST--
-SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next()
---FILE--
-<?php
-
-$arr = array(1,2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
-
- function callHasChildren() {
- throw new Exception;
- }
-}
-
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
-
-var_dump($recItIt->next());
-
-$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
-
-var_dump($recItIt2->next());
-
-?>
---EXPECTF--
-NULL
-
-Fatal error: Uncaught Exception in %s
-Stack trace:
-#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren()
-#1 %s: RecursiveIteratorIterator->next()
-#2 {main}
- thrown in %s on line %d
+--TEST-- +SPL: RecursiveIteratorIterator - Exception thrown in callHasChildren which should be handled in next() +--FILE-- +<?php + +$arr = array(1,2); +$arrOb = new ArrayObject($arr); + +$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); + +class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { + + function callHasChildren() { + throw new Exception; + } +} + + +$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); + +var_dump($recItIt->next()); + +$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY); + +var_dump($recItIt2->next()); + +?> +--EXPECTF-- +NULL + +Fatal error: Uncaught Exception in %s +Stack trace: +#0 [internal function]: MyRecursiveIteratorIterator->callHasChildren() +#1 %s: RecursiveIteratorIterator->next() +#2 {main} + thrown in %s on line %d diff --git a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt index 82d55cf0ce..32617bf108 100644 --- a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt @@ -1,42 +1,42 @@ ---TEST--
-SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next()
---FILE--
-<?php
-
-$arr = array(array(1,2));
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
-
- function endchildren() {
- throw new Exception;
- }
-}
-
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
-
-foreach ($recItIt as $val) echo "$val\n";
-
-$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
-
-echo "===NEXT LOOP===\n";
-
-foreach ($recItIt2 as $val) echo "$val\n";
-
-?>
---EXPECTF--
-1
-2
-===NEXT LOOP===
-1
-2
-
-Fatal error: Uncaught Exception in %s
-Stack trace:
-#0 [internal function]: MyRecursiveIteratorIterator->endchildren()
-#1 %s: RecursiveIteratorIterator->next()
-#2 {main}
- thrown in %s on line %d
+--TEST-- +SPL: RecursiveIteratorIterator - Exception thrown in endchildren which should be handled in next() +--FILE-- +<?php + +$arr = array(array(1,2)); +$arrOb = new ArrayObject($arr); + +$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); + +class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { + + function endchildren() { + throw new Exception; + } +} + + +$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); + +foreach ($recItIt as $val) echo "$val\n"; + +$recItIt2 = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY); + +echo "===NEXT LOOP===\n"; + +foreach ($recItIt2 as $val) echo "$val\n"; + +?> +--EXPECTF-- +1 +2 +===NEXT LOOP=== +1 +2 + +Fatal error: Uncaught Exception in %s +Stack trace: +#0 [internal function]: MyRecursiveIteratorIterator->endchildren() +#1 %s: RecursiveIteratorIterator->next() +#2 {main} + thrown in %s on line %d diff --git a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt index bb020fdff0..a2c0d2ea1b 100644 --- a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt +++ b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt @@ -1,36 +1,36 @@ ---TEST--
-SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next()
---FILE--
-<?php
-
-$arr = array(1,2);
-$arrOb = new ArrayObject($arr);
-
-$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
-
-class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
-
- function nextelement() {
- throw new Exception;
- }
-}
-
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
-
-var_dump($recItIt->next());
-
-$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY);
-
-var_dump($recItIt->next());
-
-?>
---EXPECTF--
-NULL
-
-Fatal error: Uncaught Exception in %s
-Stack trace:
-#0 [internal function]: MyRecursiveIteratorIterator->nextelement()
-#1 %s: RecursiveIteratorIterator->next()
-#2 {main}
- thrown in %s on line %d
+--TEST-- +SPL: RecursiveIteratorIterator - Exception thrown in nextelement which should be handled in next() +--FILE-- +<?php + +$arr = array(1,2); +$arrOb = new ArrayObject($arr); + +$recArrIt = new RecursiveArrayIterator($arrOb->getIterator()); + +class MyRecursiveIteratorIterator extends RecursiveIteratorIterator { + + function nextelement() { + throw new Exception; + } +} + + +$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD); + +var_dump($recItIt->next()); + +$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::LEAVES_ONLY); + +var_dump($recItIt->next()); + +?> +--EXPECTF-- +NULL + +Fatal error: Uncaught Exception in %s +Stack trace: +#0 [internal function]: MyRecursiveIteratorIterator->nextelement() +#1 %s: RecursiveIteratorIterator->next() +#2 {main} + thrown in %s on line %d diff --git a/ext/sqlite3/tests/bug73333.phpt b/ext/sqlite3/tests/bug73333.phpt index 7315751810..8634b67f76 100644 --- a/ext/sqlite3/tests/bug73333.phpt +++ b/ext/sqlite3/tests/bug73333.phpt @@ -1,26 +1,26 @@ ---TEST--
-Bug #73333 (2147483647 is fetched as string)
---SKIPIF--
-<?php
-if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
-?>
---FILE--
-<?php
-if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
-
-$db = new SQLite3(':memory:');
-$db->exec('CREATE TABLE foo (bar INT)');
-foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
- $db->exec("INSERT INTO foo VALUES ($value)");
-}
-
-$res = $db->query('SELECT bar FROM foo');
-while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
- echo gettype($row[0]), PHP_EOL;
-}
-?>
-===DONE===
---EXPECT--
-integer
-integer
-===DONE===
+--TEST-- +Bug #73333 (2147483647 is fetched as string) +--SKIPIF-- +<?php +if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available'); +?> +--FILE-- +<?php +if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1); + +$db = new SQLite3(':memory:'); +$db->exec('CREATE TABLE foo (bar INT)'); +foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) { + $db->exec("INSERT INTO foo VALUES ($value)"); +} + +$res = $db->query('SELECT bar FROM foo'); +while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) { + echo gettype($row[0]), PHP_EOL; +} +?> +===DONE=== +--EXPECT-- +integer +integer +===DONE=== diff --git a/ext/standard/tests/file/bug43353-win32.phpt b/ext/standard/tests/file/bug43353-win32.phpt index 2faabb92c0..76605d97a8 100644 --- a/ext/standard/tests/file/bug43353-win32.phpt +++ b/ext/standard/tests/file/bug43353-win32.phpt @@ -1,25 +1,25 @@ ---TEST--
-Bug #43353 wrong detection of 'data' wrapper
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != "WIN")
- die("skip Run only on Windows");
-?>
---INI--
-allow_url_fopen=1
---FILE--
-<?php
-
-var_dump(is_dir('file:///datafoo:test'));
-var_dump(is_dir('datafoo:test'));
-var_dump(file_get_contents('data:text/plain,foo'));
-var_dump(file_get_contents('datafoo:text/plain,foo'));
-
-?>
---EXPECTF--
-bool(false)
-bool(false)
-string(3) "foo"
-
-Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
-bool(false)
+--TEST-- +Bug #43353 wrong detection of 'data' wrapper +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != "WIN") + die("skip Run only on Windows"); +?> +--INI-- +allow_url_fopen=1 +--FILE-- +<?php + +var_dump(is_dir('file:///datafoo:test')); +var_dump(is_dir('datafoo:test')); +var_dump(file_get_contents('data:text/plain,foo')); +var_dump(file_get_contents('datafoo:text/plain,foo')); + +?> +--EXPECTF-- +bool(false) +bool(false) +string(3) "foo" + +Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s +bool(false) diff --git a/ext/standard/tests/file/bug49047.phpt b/ext/standard/tests/file/bug49047.phpt index 1ccc94e287..d0805a16fd 100644 --- a/ext/standard/tests/file/bug49047.phpt +++ b/ext/standard/tests/file/bug49047.phpt @@ -1,17 +1,17 @@ ---TEST--
-Test fopen() function : variation: interesting paths, no use include path
---FILE--
-<?php
-// fopen with interesting windows paths.
-$testdir = __DIR__ . '/bug47177.tmpdir';
-mkdir($testdir);
-$t = time() - 3600;
-touch($testdir, $t);
-clearstatcache();
-$t2 = filemtime($testdir);
-if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
-rmdir($testdir);
-echo "Ok.";
-?>
---EXPECTF--
-Ok.
+--TEST-- +Test fopen() function : variation: interesting paths, no use include path +--FILE-- +<?php +// fopen with interesting windows paths. +$testdir = __DIR__ . '/bug47177.tmpdir'; +mkdir($testdir); +$t = time() - 3600; +touch($testdir, $t); +clearstatcache(); +$t2 = filemtime($testdir); +if ($t2 != $t) echo "failed (got $t2, expecting $t)\n"; +rmdir($testdir); +echo "Ok."; +?> +--EXPECTF-- +Ok. diff --git a/ext/standard/tests/file/bug53241.phpt b/ext/standard/tests/file/bug53241.phpt index 685bf14620..7ccf2be109 100644 --- a/ext/standard/tests/file/bug53241.phpt +++ b/ext/standard/tests/file/bug53241.phpt @@ -1,23 +1,23 @@ ---TEST--
-Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
---SKIPIF--
-<?php
-/* unfortunately no standard function does a cast to FILE*, so we need
- * curl to test this */
-if (!extension_loaded("curl")) exit("skip curl extension not loaded");
---FILE--
-<?php
-$fn = __DIR__ . "/test.tmp";
-@unlink($fn);
-$fh = fopen($fn, 'xb');
-$ch = curl_init('http://www.yahoo.com/');
-var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
-echo "Done.\n";
---CLEAN--
-<?php
-$fn = __DIR__ . "/test.tmp";
-@unlink($fn);
-?>
---EXPECT--
-bool(true)
-Done.
+--TEST-- +Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode) +--SKIPIF-- +<?php +/* unfortunately no standard function does a cast to FILE*, so we need + * curl to test this */ +if (!extension_loaded("curl")) exit("skip curl extension not loaded"); +--FILE-- +<?php +$fn = __DIR__ . "/test.tmp"; +@unlink($fn); +$fh = fopen($fn, 'xb'); +$ch = curl_init('http://www.yahoo.com/'); +var_dump(curl_setopt($ch, CURLOPT_FILE, $fh)); +echo "Done.\n"; +--CLEAN-- +<?php +$fn = __DIR__ . "/test.tmp"; +@unlink($fn); +?> +--EXPECT-- +bool(true) +Done. diff --git a/ext/standard/tests/file/bug55124.phpt b/ext/standard/tests/file/bug55124.phpt index 1915b7f209..7938196dbc 100644 --- a/ext/standard/tests/file/bug55124.phpt +++ b/ext/standard/tests/file/bug55124.phpt @@ -1,18 +1,18 @@ ---TEST--
-Bug #55124 (recursive mkdir fails with current (dot) directory in path)
---FILE--
-<?php
-$old_dir_path = getcwd();
-chdir(__DIR__);
-mkdir('a/./b', 0755, true);
-if (is_dir('a/b')) {
- rmdir('a/b');
-}
-if (is_dir('./a')) {
- rmdir('a');
-}
-chdir($old_dir_path);
-echo "OK";
-?>
---EXPECT--
-OK
+--TEST-- +Bug #55124 (recursive mkdir fails with current (dot) directory in path) +--FILE-- +<?php +$old_dir_path = getcwd(); +chdir(__DIR__); +mkdir('a/./b', 0755, true); +if (is_dir('a/b')) { + rmdir('a/b'); +} +if (is_dir('./a')) { + rmdir('a'); +} +chdir($old_dir_path); +echo "OK"; +?> +--EXPECT-- +OK diff --git a/ext/standard/tests/file/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt index 8915bb833c..51dbac9c1e 100644 --- a/ext/standard/tests/file/bug60120.phpt +++ b/ext/standard/tests/file/bug60120.phpt @@ -1,74 +1,74 @@ ---TEST--
-Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048)
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip only for Windows');
-}
-$php = getenv('TEST_PHP_EXECUTABLE');
-if (!$php) {
- die("No php executable defined\n");
-}
-?>
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-$php = getenv('TEST_PHP_EXECUTABLE');
-if (!$php) {
- die("No php executable defined\n");
-}
-$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
-$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
-$stdin = str_repeat('*', 1024 * 16) . '!';
-$stdin = str_repeat('*', 2049 );
-
-$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
-$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
-
-foreach ($pipes as $pipe) {
- stream_set_blocking($pipe, false);
-}
-$writePipes = array($pipes[0]);
-$stdinLen = strlen($stdin);
-$stdinOffset = 0;
-
-unset($pipes[0]);
-
-while ($pipes || $writePipes) {
- $r = $pipes;
- $w = $writePipes;
- $e = null;
- $n = stream_select($r, $w, $e, 60);
-
- if (false === $n) {
- break;
- } elseif ($n === 0) {
- proc_terminate($process);
-
- }
- if ($w) {
- $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
- if (false !== $written) {
- $stdinOffset += $written;
- }
- if ($stdinOffset >= $stdinLen) {
- fclose($writePipes[0]);
- $writePipes = null;
- }
- }
-
- foreach ($r as $pipe) {
- $type = array_search($pipe, $pipes);
- $data = fread($pipe, 8192);
- if (false === $data || feof($pipe)) {
- fclose($pipe);
- unset($pipes[$type]);
- }
- }
-}
-echo "OK.";
-?>
---EXPECT--
-OK.
+--TEST-- +Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048) +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only for Windows'); +} +$php = getenv('TEST_PHP_EXECUTABLE'); +if (!$php) { + die("No php executable defined\n"); +} +?> +--FILE-- +<?php + +error_reporting(E_ALL); + +$php = getenv('TEST_PHP_EXECUTABLE'); +if (!$php) { + die("No php executable defined\n"); +} +$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"'; +$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')); +$stdin = str_repeat('*', 1024 * 16) . '!'; +$stdin = str_repeat('*', 2049 ); + +$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false)); +$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options); + +foreach ($pipes as $pipe) { + stream_set_blocking($pipe, false); +} +$writePipes = array($pipes[0]); +$stdinLen = strlen($stdin); +$stdinOffset = 0; + +unset($pipes[0]); + +while ($pipes || $writePipes) { + $r = $pipes; + $w = $writePipes; + $e = null; + $n = stream_select($r, $w, $e, 60); + + if (false === $n) { + break; + } elseif ($n === 0) { + proc_terminate($process); + + } + if ($w) { + $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192); + if (false !== $written) { + $stdinOffset += $written; + } + if ($stdinOffset >= $stdinLen) { + fclose($writePipes[0]); + $writePipes = null; + } + } + + foreach ($r as $pipe) { + $type = array_search($pipe, $pipes); + $data = fread($pipe, 8192); + if (false === $data || feof($pipe)) { + fclose($pipe); + unset($pipes[$type]); + } + } +} +echo "OK."; +?> +--EXPECT-- +OK. diff --git a/ext/standard/tests/file/rename_variation8-win32.phpt b/ext/standard/tests/file/rename_variation8-win32.phpt index 1d25a12e04..7be25949f6 100644 --- a/ext/standard/tests/file/rename_variation8-win32.phpt +++ b/ext/standard/tests/file/rename_variation8-win32.phpt @@ -1,70 +1,70 @@ ---TEST--
-Test rename() function: variation
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');
-?>
---FILE--
-<?php
-/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
- Description: Renames a file or directory
-*/
-
-echo "\n*** Testing rename() on non-existing file ***\n";
-$file_path = dirname(__FILE__);
-
-// try renaming a non existing file
-$src_name = $file_path."/non_existent_file.tmp";
-$dest_name = $file_path."/rename_variation8_new.tmp";
-var_dump( rename($src_name, $dest_name) );
-
-// ensure that $dest_name didn't get created
-var_dump( file_exists($src_name) ); // expecting false
-var_dump( file_exists($dest_name) ); // expecting false
-
-// rename a existing dir to new name
-echo "\n*** Testing rename() on existing directory ***\n";
-$dir_name = $file_path."/rename_basic_dir";
-mkdir($dir_name);
-$new_dir_name = $file_path."/rename_basic_dir1";
-var_dump( rename($dir_name, $new_dir_name) );
-//ensure that $new_dir_name got created
-var_dump( file_exists($dir_name) ); // expecting false
-var_dump( file_exists($new_dir_name) ); // expecting true
-
-// try to rename an non_existing dir
-echo "\n*** Testing rename() on non-existing directory ***\n";
-$non_existent_dir_name = $file_path."/non_existent_dir";
-$new_dir_name = "$file_path/rename_basic_dir2";
-var_dump( rename($non_existent_dir_name, $new_dir_name) );
-// ensure that $new_dir_name didn't get created
-var_dump( file_exists($non_existent_dir_name) ); // expecting flase
-var_dump( file_exists($new_dir_name) ); // expecting false
-
-echo "Done\n";
-?>
---CLEAN--
-<?php
-rmdir(dirname(__FILE__)."/rename_basic_dir1");
-?>
---EXPECTF--
-*** Testing rename() on non-existing file ***
-
-Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): The system cannot find the file specified. (code: 2) in %s on line %d
-bool(false)
-bool(false)
-bool(false)
-
-*** Testing rename() on existing directory ***
-bool(true)
-bool(false)
-bool(true)
-
-*** Testing rename() on non-existing directory ***
-
-Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): The system cannot find the file specified. (code: 2) in %s on line %d
-bool(false)
-bool(false)
-bool(false)
-Done
-
+--TEST-- +Test rename() function: variation +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows'); +?> +--FILE-- +<?php +/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] ); + Description: Renames a file or directory +*/ + +echo "\n*** Testing rename() on non-existing file ***\n"; +$file_path = dirname(__FILE__); + +// try renaming a non existing file +$src_name = $file_path."/non_existent_file.tmp"; +$dest_name = $file_path."/rename_variation8_new.tmp"; +var_dump( rename($src_name, $dest_name) ); + +// ensure that $dest_name didn't get created +var_dump( file_exists($src_name) ); // expecting false +var_dump( file_exists($dest_name) ); // expecting false + +// rename a existing dir to new name +echo "\n*** Testing rename() on existing directory ***\n"; +$dir_name = $file_path."/rename_basic_dir"; +mkdir($dir_name); +$new_dir_name = $file_path."/rename_basic_dir1"; +var_dump( rename($dir_name, $new_dir_name) ); +//ensure that $new_dir_name got created +var_dump( file_exists($dir_name) ); // expecting false +var_dump( file_exists($new_dir_name) ); // expecting true + +// try to rename an non_existing dir +echo "\n*** Testing rename() on non-existing directory ***\n"; +$non_existent_dir_name = $file_path."/non_existent_dir"; +$new_dir_name = "$file_path/rename_basic_dir2"; +var_dump( rename($non_existent_dir_name, $new_dir_name) ); +// ensure that $new_dir_name didn't get created +var_dump( file_exists($non_existent_dir_name) ); // expecting flase +var_dump( file_exists($new_dir_name) ); // expecting false + +echo "Done\n"; +?> +--CLEAN-- +<?php +rmdir(dirname(__FILE__)."/rename_basic_dir1"); +?> +--EXPECTF-- +*** Testing rename() on non-existing file *** + +Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): The system cannot find the file specified. (code: 2) in %s on line %d +bool(false) +bool(false) +bool(false) + +*** Testing rename() on existing directory *** +bool(true) +bool(false) +bool(true) + +*** Testing rename() on non-existing directory *** + +Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): The system cannot find the file specified. (code: 2) in %s on line %d +bool(false) +bool(false) +bool(false) +Done + diff --git a/ext/standard/tests/file/stream_enclosed.phpt b/ext/standard/tests/file/stream_enclosed.phpt index 9520ecce74..f487ed0744 100644 --- a/ext/standard/tests/file/stream_enclosed.phpt +++ b/ext/standard/tests/file/stream_enclosed.phpt @@ -1,20 +1,20 @@ ---TEST--
-Unexposed/leaked stream encloses another stream
---SKIPIF--
-<?php
-if (!function_exists('leak_variable')) die("skip only debug builds");
---FILE--
-<?php
-$s = fopen('php://temp/maxmemory=1024','wb+');
-
-$t = fopen('php://temp/maxmemory=1024','wb+');
-
-/* force conversion of inner stream to STDIO. */
-$i = 0;
-while ($i++ < 5000) {
- fwrite($t, str_repeat('a',1024));
-}
-
-leak_variable($s, true);
-leak_variable($t, true);
---EXPECT--
+--TEST-- +Unexposed/leaked stream encloses another stream +--SKIPIF-- +<?php +if (!function_exists('leak_variable')) die("skip only debug builds"); +--FILE-- +<?php +$s = fopen('php://temp/maxmemory=1024','wb+'); + +$t = fopen('php://temp/maxmemory=1024','wb+'); + +/* force conversion of inner stream to STDIO. */ +$i = 0; +while ($i++ < 5000) { + fwrite($t, str_repeat('a',1024)); +} + +leak_variable($s, true); +leak_variable($t, true); +--EXPECT-- diff --git a/ext/standard/tests/file/windows_links/bug48746.phpt b/ext/standard/tests/file/windows_links/bug48746.phpt index 5978e7f7f1..671c347a61 100644 --- a/ext/standard/tests/file/windows_links/bug48746.phpt +++ b/ext/standard/tests/file/windows_links/bug48746.phpt @@ -1,58 +1,58 @@ ---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$cmd = "mklink /?";
-$ret = @exec($cmd, $output, $return_val);
-if (count($output) == 0) {
- die("mklink.exe not found in PATH");
-}
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-mkdir($dirname, 0700, true);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /j mklink_junction directory", $output, $ret_val);
-var_dump(file_exists("directory"));
-var_dump(file_exists("mklink_junction"));
-var_dump(file_exists("mounted_volume"));
-var_dump(file_exists("$fullpath"));
-var_dump(is_dir("mklink_junction"));
-var_dump(is_dir("$fullpath"));
-var_dump(is_readable("mklink_junction"));
-var_dump(is_writeable("$fullpath"));
-chdir($old_dir);
-
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
+--TEST-- +Bug#48746 - Junction not working properly + +--CREDITS-- +Venkat Raman Don (don.raman@microsoft.com) + +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip windows only test'); +} +include_once __DIR__ . '/common.inc'; +$cmd = "mklink /?"; +$ret = @exec($cmd, $output, $return_val); +if (count($output) == 0) { + die("mklink.exe not found in PATH"); +} +?> +--FILE-- +<?php +include_once __DIR__ . '/common.inc'; +$mountvol = get_mountvol(); +$old_dir = __DIR__; +$dirname = __DIR__ . "\\mnt\\test\\directory"; +mkdir($dirname, 0700, true); +chdir(__DIR__ . "\\mnt\\test"); +$drive = substr(__DIR__, 0, 2); +$pathwithoutdrive = substr(__DIR__, 2); +$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val); +exec("mklink /j mounted_volume " . $ret, $output, $ret_val); +$fullpath = "mounted_volume" . $pathwithoutdrive; +exec("mklink /j mklink_junction directory", $output, $ret_val); +var_dump(file_exists("directory")); +var_dump(file_exists("mklink_junction")); +var_dump(file_exists("mounted_volume")); +var_dump(file_exists("$fullpath")); +var_dump(is_dir("mklink_junction")); +var_dump(is_dir("$fullpath")); +var_dump(is_readable("mklink_junction")); +var_dump(is_writeable("$fullpath")); +chdir($old_dir); + +rmdir(__DIR__ . "\\mnt\\test\\directory"); +rmdir(__DIR__ . "\\mnt\\test\\mklink_junction"); +rmdir(__DIR__ . "\\mnt\\test\\mounted_volume"); +rmdir(__DIR__ . "\\mnt\\test"); +rmdir(__DIR__ . "\\mnt"); + +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/ext/standard/tests/file/windows_links/bug48746_1.phpt b/ext/standard/tests/file/windows_links/bug48746_1.phpt index a4277a47a1..56764bcf5f 100644 --- a/ext/standard/tests/file/windows_links/bug48746_1.phpt +++ b/ext/standard/tests/file/windows_links/bug48746_1.phpt @@ -1,59 +1,59 @@ ---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$cmd = "mklink /?";
-$ret = @exec($cmd, $output, $return_val);
-if (count($output) == 0) {
- die("mklink.exe not found in PATH");
-}
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /j mklink_junction directory", $output, $ret_val);
-file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
-include_once "mklink_junction\\a.php";
-file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
-require "$fullpath\\mnt\\test\\directory\\b.php";
-file_put_contents("$fullpath\\mnt\\test\\mklink_junction\\c.php", "<?php echo \"I am included.\n\" ?>");
-require_once "$fullpath\\mnt\\test\\mklink_junction\\c.php";
-var_dump(is_file("mklink_junction\\a.php"));
-var_dump(is_file("$fullpath\\mnt\\test\\directory\\b.php"));
-var_dump(is_file("$fullpath\\mnt\\test\\mklink_junction\\c.php"));
-unlink("$fullpath\\mnt\\test\\directory\\b.php");
-unlink("$fullpath\\mnt\\test\\mklink_junction\\c.php");
-unlink("mklink_junction\\a.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-I am included.
-I am included.
-I am included.
-bool(true)
-bool(true)
-bool(true)
+--TEST-- +Bug#48746 - Junction not working properly + +--CREDITS-- +Venkat Raman Don (don.raman@microsoft.com) + +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip windows only test'); +} +include_once __DIR__ . '/common.inc'; +$cmd = "mklink /?"; +$ret = @exec($cmd, $output, $return_val); +if (count($output) == 0) { + die("mklink.exe not found in PATH"); +} +?> +--FILE-- +<?php +include_once __DIR__ . '/common.inc'; +$mountvol = get_mountvol(); +$old_dir = __DIR__; +$dirname = __DIR__ . "\\mnt\\test\\directory"; +exec("mkdir " . $dirname, $output, $ret_val); +chdir(__DIR__ . "\\mnt\\test"); +$drive = substr(__DIR__, 0, 2); +$pathwithoutdrive = substr(__DIR__, 2); +$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val); +exec("mklink /j mounted_volume " . $ret, $output, $ret_val); +$fullpath = "mounted_volume" . $pathwithoutdrive; +exec("mklink /j mklink_junction directory", $output, $ret_val); +file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>"); +include_once "mklink_junction\\a.php"; +file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>"); +require "$fullpath\\mnt\\test\\directory\\b.php"; +file_put_contents("$fullpath\\mnt\\test\\mklink_junction\\c.php", "<?php echo \"I am included.\n\" ?>"); +require_once "$fullpath\\mnt\\test\\mklink_junction\\c.php"; +var_dump(is_file("mklink_junction\\a.php")); +var_dump(is_file("$fullpath\\mnt\\test\\directory\\b.php")); +var_dump(is_file("$fullpath\\mnt\\test\\mklink_junction\\c.php")); +unlink("$fullpath\\mnt\\test\\directory\\b.php"); +unlink("$fullpath\\mnt\\test\\mklink_junction\\c.php"); +unlink("mklink_junction\\a.php"); +chdir($old_dir); +rmdir(__DIR__ . "\\mnt\\test\\directory"); +rmdir(__DIR__ . "\\mnt\\test\\mklink_junction"); +rmdir(__DIR__ . "\\mnt\\test\\mounted_volume"); +rmdir(__DIR__ . "\\mnt\\test"); +rmdir(__DIR__ . "\\mnt"); + +?> +--EXPECT-- +I am included. +I am included. +I am included. +bool(true) +bool(true) +bool(true) diff --git a/ext/standard/tests/file/windows_links/bug48746_2.phpt b/ext/standard/tests/file/windows_links/bug48746_2.phpt index 509610f8a4..9f2ff850b6 100644 --- a/ext/standard/tests/file/windows_links/bug48746_2.phpt +++ b/ext/standard/tests/file/windows_links/bug48746_2.phpt @@ -1,69 +1,69 @@ ---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
-if (strpos($ret, 'privilege')) {
- die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
-}
-unlink('bug48746_tmp.lnk');
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /j mklink_junction directory", $output, $ret_val);
-file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
-file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
-print_r(scandir("mklink_junction"));
-print_r(scandir("$fullpath\\mnt\\test\\directory"));
-print_r(scandir("$fullpath\\mnt\\test\\mklink_junction"));
-unlink("$fullpath\\mnt\\test\\directory\\b.php");
-unlink("mklink_junction\\a.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
+--TEST-- +Bug#48746 - Junction not working properly + +--CREDITS-- +Venkat Raman Don (don.raman@microsoft.com) + +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip windows only test'); +} +include_once __DIR__ . '/common.inc'; +$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out); +if (strpos($ret, 'privilege')) { + die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.'); +} +unlink('bug48746_tmp.lnk'); +?> +--FILE-- +<?php +include_once __DIR__ . '/common.inc'; +$mountvol = get_mountvol(); +$old_dir = __DIR__; +$dirname = __DIR__ . "\\mnt\\test\\directory"; +exec("mkdir " . $dirname, $output, $ret_val); +chdir(__DIR__ . "\\mnt\\test"); +$drive = substr(__DIR__, 0, 2); +$pathwithoutdrive = substr(__DIR__, 2); +$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val); +exec("mklink /j mounted_volume " . $ret, $output, $ret_val); +$fullpath = "mounted_volume" . $pathwithoutdrive; +exec("mklink /j mklink_junction directory", $output, $ret_val); +file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>"); +file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>"); +print_r(scandir("mklink_junction")); +print_r(scandir("$fullpath\\mnt\\test\\directory")); +print_r(scandir("$fullpath\\mnt\\test\\mklink_junction")); +unlink("$fullpath\\mnt\\test\\directory\\b.php"); +unlink("mklink_junction\\a.php"); +chdir($old_dir); +rmdir(__DIR__ . "\\mnt\\test\\directory"); +rmdir(__DIR__ . "\\mnt\\test\\mklink_junction"); +rmdir(__DIR__ . "\\mnt\\test\\mounted_volume"); +rmdir(__DIR__ . "\\mnt\\test"); +rmdir(__DIR__ . "\\mnt"); + +?> +--EXPECT-- +Array +( + [0] => . + [1] => .. + [2] => a.php + [3] => b.php +) +Array +( + [0] => . + [1] => .. + [2] => a.php + [3] => b.php +) +Array +( + [0] => . + [1] => .. + [2] => a.php + [3] => b.php +) diff --git a/ext/standard/tests/file/windows_links/bug48746_3.phpt b/ext/standard/tests/file/windows_links/bug48746_3.phpt index 98e81787b8..83bdea3a8c 100644 --- a/ext/standard/tests/file/windows_links/bug48746_3.phpt +++ b/ext/standard/tests/file/windows_links/bug48746_3.phpt @@ -1,50 +1,50 @@ ---TEST--
-Bug#48746 - Junction not working properly
-
---CREDITS--
-Venkat Raman Don (don.raman@microsoft.com)
-
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$ret = exec(get_junction().' /? 2>&1', $out);
-if (strpos($out[0], 'recognized')) {
- die('skip. junction.exe not found in PATH.');
-}
-
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$old_dir = __DIR__;
-$dirname = __DIR__ . "\\mnt\\test\\directory";
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-exec(get_junction()." junction directory", $output, $ret_val);
-file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");
-file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");
-include "junction/a.php";
-require_once "junction\\b.php";
-print_r(scandir("junction"));
-unlink("junction\\a.php");
-unlink("junction\\b.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\directory");
-rmdir(__DIR__ . "\\mnt\\test\\junction");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-I am included.
-I am included.
-Array
-(
- [0] => .
- [1] => ..
- [2] => a.php
- [3] => b.php
-)
+--TEST-- +Bug#48746 - Junction not working properly + +--CREDITS-- +Venkat Raman Don (don.raman@microsoft.com) + +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip windows only test'); +} +include_once __DIR__ . '/common.inc'; +$ret = exec(get_junction().' /? 2>&1', $out); +if (strpos($out[0], 'recognized')) { + die('skip. junction.exe not found in PATH.'); +} + +?> +--FILE-- +<?php +include_once __DIR__ . '/common.inc'; +$old_dir = __DIR__; +$dirname = __DIR__ . "\\mnt\\test\\directory"; +exec("mkdir " . $dirname, $output, $ret_val); +chdir(__DIR__ . "\\mnt\\test"); +exec(get_junction()." junction directory", $output, $ret_val); +file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>"); +file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>"); +include "junction/a.php"; +require_once "junction\\b.php"; +print_r(scandir("junction")); +unlink("junction\\a.php"); +unlink("junction\\b.php"); +chdir($old_dir); +rmdir(__DIR__ . "\\mnt\\test\\directory"); +rmdir(__DIR__ . "\\mnt\\test\\junction"); +rmdir(__DIR__ . "\\mnt\\test"); +rmdir(__DIR__ . "\\mnt"); + +?> +--EXPECT-- +I am included. +I am included. +Array +( + [0] => . + [1] => .. + [2] => a.php + [3] => b.php +) diff --git a/ext/standard/tests/file/windows_links/bug73962.phpt b/ext/standard/tests/file/windows_links/bug73962.phpt index 6d578386e6..9be48c7eeb 100644 --- a/ext/standard/tests/file/windows_links/bug73962.phpt +++ b/ext/standard/tests/file/windows_links/bug73962.phpt @@ -1,77 +1,77 @@ ---TEST--
-Bug #73962 bug with symlink related to cyrillic directory
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
-if (strpos($ret, 'privilege')) {
- die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
-}
-unlink('bug48746_tmp.lnk');
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = '"' . __DIR__ . "\\mnt\\test\\новая папка" . '"';
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /d mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /d mklink_symlink \"новая папка\"", $output, $ret_val);
-file_put_contents("mklink_symlink\\a.php", "<?php echo \"I am included.\n\" ?>");
-file_put_contents("$fullpath\\mnt\\test\\новая папка\\b.php", "<?php echo \"I am included.\n\" ?>");
-var_dump(scandir("mklink_symlink"));
-var_dump(scandir("$fullpath\\mnt\\test\\новая папка"));
-var_dump(scandir("$fullpath\\mnt\\test\\mklink_symlink"));
-var_dump(is_readable("$fullpath\\mnt\\test\\mklink_symlink\b.php"));
-unlink("$fullpath\\mnt\\test\\новая папка\\b.php");
-unlink("mklink_symlink\\a.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\новая папка");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_symlink");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-array(4) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
- [2]=>
- string(5) "a.php"
- [3]=>
- string(5) "b.php"
-}
-array(4) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
- [2]=>
- string(5) "a.php"
- [3]=>
- string(5) "b.php"
-}
-array(4) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
- [2]=>
- string(5) "a.php"
- [3]=>
- string(5) "b.php"
-}
-bool(true)
-
+--TEST-- +Bug #73962 bug with symlink related to cyrillic directory +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip windows only test'); +} +include_once __DIR__ . '/common.inc'; +$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out); +if (strpos($ret, 'privilege')) { + die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.'); +} +unlink('bug48746_tmp.lnk'); +?> +--FILE-- +<?php +include_once __DIR__ . '/common.inc'; +$mountvol = get_mountvol(); +$old_dir = __DIR__; +$dirname = '"' . __DIR__ . "\\mnt\\test\\новая папка" . '"'; +exec("mkdir " . $dirname, $output, $ret_val); +chdir(__DIR__ . "\\mnt\\test"); +$drive = substr(__DIR__, 0, 2); +$pathwithoutdrive = substr(__DIR__, 2); +$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val); +exec("mklink /d mounted_volume " . $ret, $output, $ret_val); +$fullpath = "mounted_volume" . $pathwithoutdrive; +exec("mklink /d mklink_symlink \"новая папка\"", $output, $ret_val); +file_put_contents("mklink_symlink\\a.php", "<?php echo \"I am included.\n\" ?>"); +file_put_contents("$fullpath\\mnt\\test\\новая папка\\b.php", "<?php echo \"I am included.\n\" ?>"); +var_dump(scandir("mklink_symlink")); +var_dump(scandir("$fullpath\\mnt\\test\\новая папка")); +var_dump(scandir("$fullpath\\mnt\\test\\mklink_symlink")); +var_dump(is_readable("$fullpath\\mnt\\test\\mklink_symlink\b.php")); +unlink("$fullpath\\mnt\\test\\новая папка\\b.php"); +unlink("mklink_symlink\\a.php"); +chdir($old_dir); +rmdir(__DIR__ . "\\mnt\\test\\новая папка"); +rmdir(__DIR__ . "\\mnt\\test\\mklink_symlink"); +rmdir(__DIR__ . "\\mnt\\test\\mounted_volume"); +rmdir(__DIR__ . "\\mnt\\test"); +rmdir(__DIR__ . "\\mnt"); + +?> +--EXPECT-- +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(5) "a.php" + [3]=> + string(5) "b.php" +} +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(5) "a.php" + [3]=> + string(5) "b.php" +} +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(5) "a.php" + [3]=> + string(5) "b.php" +} +bool(true) + diff --git a/ext/standard/tests/general_functions/bug50690.phpt b/ext/standard/tests/general_functions/bug50690.phpt index 4d9f0dc5ee..54198a1337 100644 --- a/ext/standard/tests/general_functions/bug50690.phpt +++ b/ext/standard/tests/general_functions/bug50690.phpt @@ -1,14 +1,14 @@ ---TEST--
-Bug #23650 (putenv() does not assign values when the value is one character)
---FILE--
-<?php
-putenv("foo=ab");
-putenv("bar=c");
-var_dump(getenv("foo"));
-var_dump(getenv("bar"));
-var_dump(getenv("thisvardoesnotexist"));
-?>
---EXPECT--
-string(2) "ab"
-string(1) "c"
-bool(false)
+--TEST-- +Bug #23650 (putenv() does not assign values when the value is one character) +--FILE-- +<?php +putenv("foo=ab"); +putenv("bar=c"); +var_dump(getenv("foo")); +var_dump(getenv("bar")); +var_dump(getenv("thisvardoesnotexist")); +?> +--EXPECT-- +string(2) "ab" +string(1) "c" +bool(false) diff --git a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt index 9e2e66c94c..544887129f 100644 --- a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt +++ b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt @@ -1,39 +1,39 @@ ---TEST--
-Test get_defined_constants() function : basic functionality
---FILE--
-<?php
-/* Prototype : array get_defined_constants ([ bool $categorize ] )
- * Description: Returns an associative array with the names of all the constants and their values
- * Source code: Zend/zend_builtin_functions.c
- */
-
-echo "*** Testing get_defined_constants() : basic functionality ***\n";
-
-var_dump(gettype(get_defined_constants(true)));
-var_dump(gettype(get_defined_constants()));
-
-$arr1 = get_defined_constants(false);
-$arr2 = get_defined_constants();
-var_dump(array_diff($arr1, $arr2));
-
-$n1 = count(get_defined_constants());
-define("USER_CONSTANT", "test");
-$arr2 = get_defined_constants();
-$n2 = count($arr2);
-
-if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) {
- echo "TEST PASSED\n";
-} else {
- echo "TEST FAILED\n";
-}
-
-?>
-===DONE===
---EXPECTF--
-*** Testing get_defined_constants() : basic functionality ***
-string(5) "array"
-string(5) "array"
-array(0) {
-}
-TEST PASSED
+--TEST-- +Test get_defined_constants() function : basic functionality +--FILE-- +<?php +/* Prototype : array get_defined_constants ([ bool $categorize ] ) + * Description: Returns an associative array with the names of all the constants and their values + * Source code: Zend/zend_builtin_functions.c + */ + +echo "*** Testing get_defined_constants() : basic functionality ***\n"; + +var_dump(gettype(get_defined_constants(true))); +var_dump(gettype(get_defined_constants())); + +$arr1 = get_defined_constants(false); +$arr2 = get_defined_constants(); +var_dump(array_diff($arr1, $arr2)); + +$n1 = count(get_defined_constants()); +define("USER_CONSTANT", "test"); +$arr2 = get_defined_constants(); +$n2 = count($arr2); + +if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) { + echo "TEST PASSED\n"; +} else { + echo "TEST FAILED\n"; +} + +?> +===DONE=== +--EXPECTF-- +*** Testing get_defined_constants() : basic functionality *** +string(5) "array" +string(5) "array" +array(0) { +} +TEST PASSED ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt index 4a8eceb24b..52b2136f5b 100644 --- a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt +++ b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt @@ -1,23 +1,23 @@ ---TEST--
-Test get_loaded_extensions() function : basic functionality
---FILE--
-<?php
-/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )
- * Description: Returns an array with the names of all modules compiled and loaded
- * Source code: Zend/zend_builtin_functions.c
- */
-
-echo "*** Testing get_loaded_extensions() : basic functionality ***\n";
-
-echo "Get loaded extensions\n";
-var_dump(get_loaded_extensions());
-
-?>
-===DONE===
---EXPECTF--
-*** Testing get_loaded_extensions() : basic functionality ***
-Get loaded extensions
-array(%d) {
-%a
-}
+--TEST-- +Test get_loaded_extensions() function : basic functionality +--FILE-- +<?php +/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] ) + * Description: Returns an array with the names of all modules compiled and loaded + * Source code: Zend/zend_builtin_functions.c + */ + +echo "*** Testing get_loaded_extensions() : basic functionality ***\n"; + +echo "Get loaded extensions\n"; +var_dump(get_loaded_extensions()); + +?> +===DONE=== +--EXPECTF-- +*** Testing get_loaded_extensions() : basic functionality *** +Get loaded extensions +array(%d) { +%a +} ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/general_functions/uniqid_error.phpt b/ext/standard/tests/general_functions/uniqid_error.phpt index 96084313c7..8f7f22d7d3 100644 --- a/ext/standard/tests/general_functions/uniqid_error.phpt +++ b/ext/standard/tests/general_functions/uniqid_error.phpt @@ -1,46 +1,46 @@ ---TEST--
-Test uniqid() function : error conditions
---FILE--
-<?php
-/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )
- * Description: Gets a prefixed unique identifier based on the current time in microseconds.
- * Source code: ext/standard/uniqid.c
-*/
-echo "*** Testing uniqid() : error conditions ***\n";
-
-echo "\n-- Testing uniqid() function with more than expected no. of arguments --\n";
-$prefix = null;
-$more_entropy = false;
-$extra_arg = false;
-var_dump(uniqid($prefix, $more_entropy, $extra_arg));
-
-echo "\n-- Testing uniqid() function with invalid values for \$prefix --\n";
-class class1{}
-$obj = new class1();
-$res = fopen(__FILE__, "r");
-$array = array(1,2,3);
-
-uniqid($array, false);
-uniqid($res, false);
-uniqid($obj, false);
-
-fclose($res);
-
-?>
-===DONE===
---EXPECTF--
-*** Testing uniqid() : error conditions ***
-
--- Testing uniqid() function with more than expected no. of arguments --
-
-Warning: uniqid() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
--- Testing uniqid() function with invalid values for $prefix --
-
-Warning: uniqid() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: uniqid() expects parameter 1 to be string, resource given in %s on line %d
-
-Warning: uniqid() expects parameter 1 to be string, object given in %s on line %d
+--TEST-- +Test uniqid() function : error conditions +--FILE-- +<?php +/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] ) + * Description: Gets a prefixed unique identifier based on the current time in microseconds. + * Source code: ext/standard/uniqid.c +*/ +echo "*** Testing uniqid() : error conditions ***\n"; + +echo "\n-- Testing uniqid() function with more than expected no. of arguments --\n"; +$prefix = null; +$more_entropy = false; +$extra_arg = false; +var_dump(uniqid($prefix, $more_entropy, $extra_arg)); + +echo "\n-- Testing uniqid() function with invalid values for \$prefix --\n"; +class class1{} +$obj = new class1(); +$res = fopen(__FILE__, "r"); +$array = array(1,2,3); + +uniqid($array, false); +uniqid($res, false); +uniqid($obj, false); + +fclose($res); + +?> +===DONE=== +--EXPECTF-- +*** Testing uniqid() : error conditions *** + +-- Testing uniqid() function with more than expected no. of arguments -- + +Warning: uniqid() expects at most 2 parameters, 3 given in %s on line %d +NULL + +-- Testing uniqid() function with invalid values for $prefix -- + +Warning: uniqid() expects parameter 1 to be string, array given in %s on line %d + +Warning: uniqid() expects parameter 1 to be string, resource given in %s on line %d + +Warning: uniqid() expects parameter 1 to be string, object given in %s on line %d ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/mail/bug73203.phpt b/ext/standard/tests/mail/bug73203.phpt index 6b3bf6618c..79615f31b5 100644 --- a/ext/standard/tests/mail/bug73203.phpt +++ b/ext/standard/tests/mail/bug73203.phpt @@ -1,24 +1,24 @@ ---TEST--
-Bug #73203 (passing additional_parameters causes mail to fail)
---DESCRIPTION--
-We're not really interested in testing mail() here, but it is currently the
-only function besides mb_send_mail() which allows to call php_escape_shell_cmd()
-with an empty string. Therefore we don't check the resulting email, but only
-verify that the call succeeds.
---INI--
-sendmail_path=cat >/dev/null
-mail.add_x_header = Off
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) === 'WIN') die('skip won\'t run on Windows');
-?>
---FILE--
-<?php
-var_dump(
- mail('test@example.com', 'subject', 'message', 'From: lala@example.com', '')
-);
-?>
-===DONE===
---EXPECT--
-bool(true)
-===DONE===
+--TEST-- +Bug #73203 (passing additional_parameters causes mail to fail) +--DESCRIPTION-- +We're not really interested in testing mail() here, but it is currently the +only function besides mb_send_mail() which allows to call php_escape_shell_cmd() +with an empty string. Therefore we don't check the resulting email, but only +verify that the call succeeds. +--INI-- +sendmail_path=cat >/dev/null +mail.add_x_header = Off +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) === 'WIN') die('skip won\'t run on Windows'); +?> +--FILE-- +<?php +var_dump( + mail('test@example.com', 'subject', 'message', 'From: lala@example.com', '') +); +?> +===DONE=== +--EXPECT-- +bool(true) +===DONE=== diff --git a/ext/standard/tests/network/gethostbyname_basic003.phpt b/ext/standard/tests/network/gethostbyname_basic003.phpt index 711490c413..2cb3d8d229 100644 --- a/ext/standard/tests/network/gethostbyname_basic003.phpt +++ b/ext/standard/tests/network/gethostbyname_basic003.phpt @@ -1,18 +1,18 @@ ---TEST--
-Test gethostbyname() function : basic functionality
---FILE--
-<?php
-/* Prototype : string gethostbyname ( string $hostname )
- * Description: Get the IPv4 address corresponding to a given Internet host name
- * Source code: ext/standard/dns.c
-*/
-
-echo "*** Testing gethostbyname() : basic functionality ***\n";
-
-echo gethostbyname("localhost")."\n";
-?>
-===DONE===
---EXPECT--
-*** Testing gethostbyname() : basic functionality ***
-127.0.0.1
+--TEST-- +Test gethostbyname() function : basic functionality +--FILE-- +<?php +/* Prototype : string gethostbyname ( string $hostname ) + * Description: Get the IPv4 address corresponding to a given Internet host name + * Source code: ext/standard/dns.c +*/ + +echo "*** Testing gethostbyname() : basic functionality ***\n"; + +echo gethostbyname("localhost")."\n"; +?> +===DONE=== +--EXPECT-- +*** Testing gethostbyname() : basic functionality *** +127.0.0.1 ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/network/gethostbynamel_basic1.phpt b/ext/standard/tests/network/gethostbynamel_basic1.phpt index 5ce7c4251a..9d1580c826 100644 --- a/ext/standard/tests/network/gethostbynamel_basic1.phpt +++ b/ext/standard/tests/network/gethostbynamel_basic1.phpt @@ -1,19 +1,19 @@ ---TEST--
-Test gethostbynamel() function : basic functionality
---FILE--
-<?php
-/* Prototype : array gethostbynamel ( string $hostname )
- * Description: Get a list of IPv4 addresses corresponding to a given Internet host name
- * Source code: ext/standard/dns.c
-*/
-
-echo "*** Testing gethostbynamel() : basic functionality ***\n";
-var_dump(gethostbynamel("localhost"));
-?>
-===DONE===
---EXPECTF--
-*** Testing gethostbynamel() : basic functionality ***
-array(%d) {
- %a
-}
+--TEST-- +Test gethostbynamel() function : basic functionality +--FILE-- +<?php +/* Prototype : array gethostbynamel ( string $hostname ) + * Description: Get a list of IPv4 addresses corresponding to a given Internet host name + * Source code: ext/standard/dns.c +*/ + +echo "*** Testing gethostbynamel() : basic functionality ***\n"; +var_dump(gethostbynamel("localhost")); +?> +===DONE=== +--EXPECTF-- +*** Testing gethostbynamel() : basic functionality *** +array(%d) { + %a +} ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/streams/bug49936_win32.phpt b/ext/standard/tests/streams/bug49936_win32.phpt index 4db4a5044f..594fcae4be 100644 --- a/ext/standard/tests/streams/bug49936_win32.phpt +++ b/ext/standard/tests/streams/bug49936_win32.phpt @@ -1,30 +1,30 @@ ---TEST--
-Bug #49936 (crash with ftp stream in php_stream_context_get_option())
---SKIPIF--
-<?php
-if( substr(PHP_OS, 0, 3) != "WIN" )
- die("skip. Do run on Windows only");
-?>
---INI--
-default_socket_timeout=2
---FILE--
-<?php
-
-$dir = 'ftp://your:self@localhost/';
-
-var_dump(opendir($dir));
-var_dump(opendir($dir));
-
-?>
---EXPECTF--
-Warning: opendir(): connect() failed: %s
- in %s on line %d
-
-Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
-bool(false)
-
-Warning: opendir(): connect() failed: %s
- in %s on line %d
-
-Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
-bool(false)
+--TEST-- +Bug #49936 (crash with ftp stream in php_stream_context_get_option()) +--SKIPIF-- +<?php +if( substr(PHP_OS, 0, 3) != "WIN" ) + die("skip. Do run on Windows only"); +?> +--INI-- +default_socket_timeout=2 +--FILE-- +<?php + +$dir = 'ftp://your:self@localhost/'; + +var_dump(opendir($dir)); +var_dump(opendir($dir)); + +?> +--EXPECTF-- +Warning: opendir(): connect() failed: %s + in %s on line %d + +Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d +bool(false) + +Warning: opendir(): connect() failed: %s + in %s on line %d + +Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d +bool(false) diff --git a/ext/standard/tests/streams/bug74090.phpt b/ext/standard/tests/streams/bug74090.phpt index 370dd13f1b..c0fc85c5ef 100644 --- a/ext/standard/tests/streams/bug74090.phpt +++ b/ext/standard/tests/streams/bug74090.phpt @@ -1,22 +1,22 @@ ---TEST--
-Bug #74090 stream_get_contents maxlength>-1 returns empty string on windows
---SKIPIF--
-<?php
-if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }
-if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); }
-?>
---FILE--
-<?php
-$data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE=");
-$fd = stream_socket_client("udp://8.8.8.8:53", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
-stream_set_blocking($fd, 0);
-stream_socket_sendto($fd,$data);
-sleep(1);
-$ret = stream_get_contents($fd,65565);
-var_dump(strlen($ret) > 0);
-stream_socket_shutdown($fd,STREAM_SHUT_RDWR);
-?>
-==DONE==
---EXPECTF--
-bool(true)
-==DONE==
+--TEST-- +Bug #74090 stream_get_contents maxlength>-1 returns empty string on windows +--SKIPIF-- +<?php +if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); } +if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); } +?> +--FILE-- +<?php +$data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE="); +$fd = stream_socket_client("udp://8.8.8.8:53", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT); +stream_set_blocking($fd, 0); +stream_socket_sendto($fd,$data); +sleep(1); +$ret = stream_get_contents($fd,65565); +var_dump(strlen($ret) > 0); +stream_socket_shutdown($fd,STREAM_SHUT_RDWR); +?> +==DONE== +--EXPECTF-- +bool(true) +==DONE== diff --git a/ext/standard/tests/strings/bug50052.phpt b/ext/standard/tests/strings/bug50052.phpt index 96d859992e..97a4481ea9 100644 --- a/ext/standard/tests/strings/bug50052.phpt +++ b/ext/standard/tests/strings/bug50052.phpt @@ -1,12 +1,12 @@ ---TEST--
-Bug #50052 (Different Hashes on Windows and Linux on wrong Salt size)
---FILE--
-<?php
-$salt = '$1$f+uslYF01$';
-$password = 'test';
-echo $salt . "\n";
-echo crypt($password,$salt) . "\n";
-?>
---EXPECT--
-$1$f+uslYF01$
-$1$f+uslYF0$orVloNmKSLvOeswusE0bY.
+--TEST-- +Bug #50052 (Different Hashes on Windows and Linux on wrong Salt size) +--FILE-- +<?php +$salt = '$1$f+uslYF01$'; +$password = 'test'; +echo $salt . "\n"; +echo crypt($password,$salt) . "\n"; +?> +--EXPECT-- +$1$f+uslYF01$ +$1$f+uslYF0$orVloNmKSLvOeswusE0bY. diff --git a/ext/standard/tests/strings/bug53021.phpt b/ext/standard/tests/strings/bug53021.phpt index 38d904761d..15b3cb07e9 100644 --- a/ext/standard/tests/strings/bug53021.phpt +++ b/ext/standard/tests/strings/bug53021.phpt @@ -1,40 +1,40 @@ ---TEST--
-Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1)
---FILE--
-<?php
-var_dump(unpack("H*",html_entity_decode("é", ENT_QUOTES, "ISO-8859-1")));
-echo "double quotes variations:", "\n";
-echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n";
-echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n";
-echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n";
-echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n";
-echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n";
-echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n";
-echo html_entity_decode("""), "\n";
-echo html_entity_decode("""), "\n";
-
-echo "\nsingle quotes variations:", "\n";
-echo html_entity_decode("'", ENT_NOQUOTES, 'UTF-8'), "\n";
-echo html_entity_decode("'", ENT_QUOTES, 'UTF-8'), "\n";
-echo html_entity_decode("'", ENT_COMPAT, 'UTF-8'), "\n";
-echo html_entity_decode("'"), "\n";
---EXPECT--
-array(1) {
- [1]=>
- string(2) "e9"
-}
-double quotes variations:
-"
-"
-"
-"
-"
-"
-"
-"
-
-single quotes variations:
-'
-'
-'
-'
+--TEST-- +Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1) +--FILE-- +<?php +var_dump(unpack("H*",html_entity_decode("é", ENT_QUOTES, "ISO-8859-1"))); +echo "double quotes variations:", "\n"; +echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n"; +echo html_entity_decode(""", ENT_NOQUOTES, 'UTF-8'), "\n"; +echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n"; +echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n"; +echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n"; +echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n"; +echo html_entity_decode("""), "\n"; +echo html_entity_decode("""), "\n"; + +echo "\nsingle quotes variations:", "\n"; +echo html_entity_decode("'", ENT_NOQUOTES, 'UTF-8'), "\n"; +echo html_entity_decode("'", ENT_QUOTES, 'UTF-8'), "\n"; +echo html_entity_decode("'", ENT_COMPAT, 'UTF-8'), "\n"; +echo html_entity_decode("'"), "\n"; +--EXPECT-- +array(1) { + [1]=> + string(2) "e9" +} +double quotes variations: +" +" +" +" +" +" +" +" + +single quotes variations: +' +' +' +' diff --git a/ext/standard/tests/strings/get_html_translation_table_basic1.phpt b/ext/standard/tests/strings/get_html_translation_table_basic1.phpt index 87857d9cbd..83892a381a 100644 --- a/ext/standard/tests/strings/get_html_translation_table_basic1.phpt +++ b/ext/standard/tests/strings/get_html_translation_table_basic1.phpt @@ -1,549 +1,549 @@ ---TEST--
-Test get_html_translation_table() function : basic functionality - with default args
---FILE--
-<?php
-/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
- * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
- * Source code: ext/standard/html.c
-*/
-
-/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
-
-
-echo "*** Testing get_html_translation_table() : basic functionality ***\n";
-
-echo "-- with table = HTML_ENTITIES --\n";
-$table = HTML_ENTITIES;
-$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
-asort($tt);
-var_dump( $tt );
-
-echo "-- with table = HTML_SPECIALCHARS --\n";
-$table = HTML_SPECIALCHARS;
-$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
-asort($tt);
-var_dump( $tt );
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing get_html_translation_table() : basic functionality ***
--- with table = HTML_ENTITIES --
-array(252) {
- ["Æ"]=>
- string(7) "Æ"
- ["Á"]=>
- string(8) "Á"
- ["Â"]=>
- string(7) "Â"
- ["À"]=>
- string(8) "À"
- ["Α"]=>
- string(7) "Α"
- ["Å"]=>
- string(7) "Å"
- ["Ã"]=>
- string(8) "Ã"
- ["Ä"]=>
- string(6) "Ä"
- ["Β"]=>
- string(6) "Β"
- ["Ç"]=>
- string(8) "Ç"
- ["Χ"]=>
- string(5) "Χ"
- ["‡"]=>
- string(8) "‡"
- ["Δ"]=>
- string(7) "Δ"
- ["Ð"]=>
- string(5) "Ð"
- ["É"]=>
- string(8) "É"
- ["Ê"]=>
- string(7) "Ê"
- ["È"]=>
- string(8) "È"
- ["Ε"]=>
- string(9) "Ε"
- ["Η"]=>
- string(5) "Η"
- ["Ë"]=>
- string(6) "Ë"
- ["Γ"]=>
- string(7) "Γ"
- ["Í"]=>
- string(8) "Í"
- ["Î"]=>
- string(7) "Î"
- ["Ì"]=>
- string(8) "Ì"
- ["Ι"]=>
- string(6) "Ι"
- ["Ï"]=>
- string(6) "Ï"
- ["Κ"]=>
- string(7) "Κ"
- ["Λ"]=>
- string(8) "Λ"
- ["Μ"]=>
- string(4) "Μ"
- ["Ñ"]=>
- string(8) "Ñ"
- ["Ν"]=>
- string(4) "Ν"
- ["Œ"]=>
- string(7) "Œ"
- ["Ó"]=>
- string(8) "Ó"
- ["Ô"]=>
- string(7) "Ô"
- ["Ò"]=>
- string(8) "Ò"
- ["Ω"]=>
- string(7) "Ω"
- ["Ο"]=>
- string(9) "Ο"
- ["Ø"]=>
- string(8) "Ø"
- ["Õ"]=>
- string(8) "Õ"
- ["Ö"]=>
- string(6) "Ö"
- ["Φ"]=>
- string(5) "Φ"
- ["Π"]=>
- string(4) "Π"
- ["″"]=>
- string(7) "″"
- ["Ψ"]=>
- string(5) "Ψ"
- ["Ρ"]=>
- string(5) "Ρ"
- ["Š"]=>
- string(8) "Š"
- ["Σ"]=>
- string(7) "Σ"
- ["Þ"]=>
- string(7) "Þ"
- ["Τ"]=>
- string(5) "Τ"
- ["Θ"]=>
- string(7) "Θ"
- ["Ú"]=>
- string(8) "Ú"
- ["Û"]=>
- string(7) "Û"
- ["Ù"]=>
- string(8) "Ù"
- ["Υ"]=>
- string(9) "Υ"
- ["Ü"]=>
- string(6) "Ü"
- ["Ξ"]=>
- string(4) "Ξ"
- ["Ý"]=>
- string(8) "Ý"
- ["Ÿ"]=>
- string(6) "Ÿ"
- ["Ζ"]=>
- string(6) "Ζ"
- ["á"]=>
- string(8) "á"
- ["â"]=>
- string(7) "â"
- ["´"]=>
- string(7) "´"
- ["æ"]=>
- string(7) "æ"
- ["à"]=>
- string(8) "à"
- ["ℵ"]=>
- string(9) "ℵ"
- ["α"]=>
- string(7) "α"
- ["&"]=>
- string(5) "&"
- ["∧"]=>
- string(5) "∧"
- ["∠"]=>
- string(5) "∠"
- ["å"]=>
- string(7) "å"
- ["≈"]=>
- string(7) "≈"
- ["ã"]=>
- string(8) "ã"
- ["ä"]=>
- string(6) "ä"
- ["„"]=>
- string(7) "„"
- ["β"]=>
- string(6) "β"
- ["¦"]=>
- string(8) "¦"
- ["•"]=>
- string(6) "•"
- ["∩"]=>
- string(5) "∩"
- ["ç"]=>
- string(8) "ç"
- ["¸"]=>
- string(7) "¸"
- ["¢"]=>
- string(6) "¢"
- ["χ"]=>
- string(5) "χ"
- ["ˆ"]=>
- string(6) "ˆ"
- ["♣"]=>
- string(7) "♣"
- ["≅"]=>
- string(6) "≅"
- ["©"]=>
- string(6) "©"
- ["↵"]=>
- string(7) "↵"
- ["∪"]=>
- string(5) "∪"
- ["¤"]=>
- string(8) "¤"
- ["⇓"]=>
- string(6) "⇓"
- ["†"]=>
- string(8) "†"
- ["↓"]=>
- string(6) "↓"
- ["°"]=>
- string(5) "°"
- ["δ"]=>
- string(7) "δ"
- ["♦"]=>
- string(7) "♦"
- ["÷"]=>
- string(8) "÷"
- ["é"]=>
- string(8) "é"
- ["ê"]=>
- string(7) "ê"
- ["è"]=>
- string(8) "è"
- ["∅"]=>
- string(7) "∅"
- [" "]=>
- string(6) " "
- [" "]=>
- string(6) " "
- ["ε"]=>
- string(9) "ε"
- ["≡"]=>
- string(7) "≡"
- ["η"]=>
- string(5) "η"
- ["ð"]=>
- string(5) "ð"
- ["ë"]=>
- string(6) "ë"
- ["€"]=>
- string(6) "€"
- ["∃"]=>
- string(7) "∃"
- ["ƒ"]=>
- string(6) "ƒ"
- ["∀"]=>
- string(8) "∀"
- ["½"]=>
- string(8) "½"
- ["¼"]=>
- string(8) "¼"
- ["¾"]=>
- string(8) "¾"
- ["⁄"]=>
- string(7) "⁄"
- ["γ"]=>
- string(7) "γ"
- ["≥"]=>
- string(4) "≥"
- [">"]=>
- string(4) ">"
- ["⇔"]=>
- string(6) "⇔"
- ["↔"]=>
- string(6) "↔"
- ["♥"]=>
- string(8) "♥"
- ["…"]=>
- string(8) "…"
- ["í"]=>
- string(8) "í"
- ["î"]=>
- string(7) "î"
- ["¡"]=>
- string(7) "¡"
- ["ì"]=>
- string(8) "ì"
- ["ℑ"]=>
- string(7) "ℑ"
- ["∞"]=>
- string(7) "∞"
- ["∫"]=>
- string(5) "∫"
- ["ι"]=>
- string(6) "ι"
- ["¿"]=>
- string(8) "¿"
- ["∈"]=>
- string(6) "∈"
- ["ï"]=>
- string(6) "ï"
- ["κ"]=>
- string(7) "κ"
- ["⇐"]=>
- string(6) "⇐"
- ["λ"]=>
- string(8) "λ"
- ["〈"]=>
- string(6) "⟨"
- ["«"]=>
- string(7) "«"
- ["←"]=>
- string(6) "←"
- ["⌈"]=>
- string(7) "⌈"
- ["“"]=>
- string(7) "“"
- ["≤"]=>
- string(4) "≤"
- ["⌊"]=>
- string(8) "⌊"
- ["∗"]=>
- string(8) "∗"
- ["◊"]=>
- string(5) "◊"
- [""]=>
- string(5) "‎"
- ["‹"]=>
- string(8) "‹"
- ["‘"]=>
- string(7) "‘"
- ["<"]=>
- string(4) "<"
- ["¯"]=>
- string(6) "¯"
- ["—"]=>
- string(7) "—"
- ["µ"]=>
- string(7) "µ"
- ["·"]=>
- string(8) "·"
- ["−"]=>
- string(7) "−"
- ["μ"]=>
- string(4) "μ"
- ["∇"]=>
- string(7) "∇"
- [" "]=>
- string(6) " "
- ["–"]=>
- string(7) "–"
- ["≠"]=>
- string(4) "≠"
- ["∋"]=>
- string(4) "∋"
- ["¬"]=>
- string(5) "¬"
- ["∉"]=>
- string(7) "∉"
- ["⊄"]=>
- string(6) "⊄"
- ["ñ"]=>
- string(8) "ñ"
- ["ν"]=>
- string(4) "ν"
- ["ó"]=>
- string(8) "ó"
- ["ô"]=>
- string(7) "ô"
- ["œ"]=>
- string(7) "œ"
- ["ò"]=>
- string(8) "ò"
- ["‾"]=>
- string(7) "‾"
- ["ω"]=>
- string(7) "ω"
- ["ο"]=>
- string(9) "ο"
- ["⊕"]=>
- string(7) "⊕"
- ["∨"]=>
- string(4) "∨"
- ["ª"]=>
- string(6) "ª"
- ["º"]=>
- string(6) "º"
- ["ø"]=>
- string(8) "ø"
- ["õ"]=>
- string(8) "õ"
- ["⊗"]=>
- string(8) "⊗"
- ["ö"]=>
- string(6) "ö"
- ["¶"]=>
- string(6) "¶"
- ["∂"]=>
- string(6) "∂"
- ["‰"]=>
- string(8) "‰"
- ["⊥"]=>
- string(6) "⊥"
- ["φ"]=>
- string(5) "φ"
- ["π"]=>
- string(4) "π"
- ["ϖ"]=>
- string(5) "ϖ"
- ["±"]=>
- string(8) "±"
- ["£"]=>
- string(7) "£"
- ["′"]=>
- string(7) "′"
- ["∏"]=>
- string(6) "∏"
- ["∝"]=>
- string(6) "∝"
- ["ψ"]=>
- string(5) "ψ"
- ["""]=>
- string(6) """
- ["⇒"]=>
- string(6) "⇒"
- ["√"]=>
- string(7) "√"
- ["〉"]=>
- string(6) "⟩"
- ["»"]=>
- string(7) "»"
- ["→"]=>
- string(6) "→"
- ["⌉"]=>
- string(7) "⌉"
- ["”"]=>
- string(7) "”"
- ["ℜ"]=>
- string(6) "ℜ"
- ["®"]=>
- string(5) "®"
- ["⌋"]=>
- string(8) "⌋"
- ["ρ"]=>
- string(5) "ρ"
- [""]=>
- string(5) "‏"
- ["›"]=>
- string(8) "›"
- ["’"]=>
- string(7) "’"
- ["‚"]=>
- string(7) "‚"
- ["š"]=>
- string(8) "š"
- ["⋅"]=>
- string(6) "⋅"
- ["§"]=>
- string(6) "§"
- [""]=>
- string(5) "­"
- ["σ"]=>
- string(7) "σ"
- ["ς"]=>
- string(8) "ς"
- ["∼"]=>
- string(5) "∼"
- ["♠"]=>
- string(8) "♠"
- ["⊂"]=>
- string(5) "⊂"
- ["⊆"]=>
- string(6) "⊆"
- ["∑"]=>
- string(5) "∑"
- ["¹"]=>
- string(6) "¹"
- ["²"]=>
- string(6) "²"
- ["³"]=>
- string(6) "³"
- ["⊃"]=>
- string(5) "⊃"
- ["⊇"]=>
- string(6) "⊇"
- ["ß"]=>
- string(7) "ß"
- ["τ"]=>
- string(5) "τ"
- ["∴"]=>
- string(8) "∴"
- ["θ"]=>
- string(7) "θ"
- ["ϑ"]=>
- string(10) "ϑ"
- [" "]=>
- string(8) " "
- ["þ"]=>
- string(7) "þ"
- ["˜"]=>
- string(7) "˜"
- ["×"]=>
- string(7) "×"
- ["™"]=>
- string(7) "™"
- ["⇑"]=>
- string(6) "⇑"
- ["ú"]=>
- string(8) "ú"
- ["↑"]=>
- string(6) "↑"
- ["û"]=>
- string(7) "û"
- ["ù"]=>
- string(8) "ù"
- ["¨"]=>
- string(5) "¨"
- ["ϒ"]=>
- string(7) "ϒ"
- ["υ"]=>
- string(9) "υ"
- ["ü"]=>
- string(6) "ü"
- ["℘"]=>
- string(8) "℘"
- ["ξ"]=>
- string(4) "ξ"
- ["ý"]=>
- string(8) "ý"
- ["¥"]=>
- string(5) "¥"
- ["ÿ"]=>
- string(6) "ÿ"
- ["ζ"]=>
- string(6) "ζ"
- [""]=>
- string(5) "‍"
- [""]=>
- string(6) "‌"
-}
--- with table = HTML_SPECIALCHARS --
-array(4) {
- ["&"]=>
- string(5) "&"
- [">"]=>
- string(4) ">"
- ["<"]=>
- string(4) "<"
- ["""]=>
- string(6) """
-}
-Done
+--TEST-- +Test get_html_translation_table() function : basic functionality - with default args +--FILE-- +<?php +/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] ) + * Description: Returns the internal translation table used by htmlspecialchars and htmlentities + * Source code: ext/standard/html.c +*/ + +/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */ + + +echo "*** Testing get_html_translation_table() : basic functionality ***\n"; + +echo "-- with table = HTML_ENTITIES --\n"; +$table = HTML_ENTITIES; +$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8"); +asort($tt); +var_dump( $tt ); + +echo "-- with table = HTML_SPECIALCHARS --\n"; +$table = HTML_SPECIALCHARS; +$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8"); +asort($tt); +var_dump( $tt ); + +echo "Done\n"; +?> +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality *** +-- with table = HTML_ENTITIES -- +array(252) { + ["Æ"]=> + string(7) "Æ" + ["Á"]=> + string(8) "Á" + ["Â"]=> + string(7) "Â" + ["À"]=> + string(8) "À" + ["Α"]=> + string(7) "Α" + ["Å"]=> + string(7) "Å" + ["Ã"]=> + string(8) "Ã" + ["Ä"]=> + string(6) "Ä" + ["Β"]=> + string(6) "Β" + ["Ç"]=> + string(8) "Ç" + ["Χ"]=> + string(5) "Χ" + ["‡"]=> + string(8) "‡" + ["Δ"]=> + string(7) "Δ" + ["Ð"]=> + string(5) "Ð" + ["É"]=> + string(8) "É" + ["Ê"]=> + string(7) "Ê" + ["È"]=> + string(8) "È" + ["Ε"]=> + string(9) "Ε" + ["Η"]=> + string(5) "Η" + ["Ë"]=> + string(6) "Ë" + ["Γ"]=> + string(7) "Γ" + ["Í"]=> + string(8) "Í" + ["Î"]=> + string(7) "Î" + ["Ì"]=> + string(8) "Ì" + ["Ι"]=> + string(6) "Ι" + ["Ï"]=> + string(6) "Ï" + ["Κ"]=> + string(7) "Κ" + ["Λ"]=> + string(8) "Λ" + ["Μ"]=> + string(4) "Μ" + ["Ñ"]=> + string(8) "Ñ" + ["Ν"]=> + string(4) "Ν" + ["Œ"]=> + string(7) "Œ" + ["Ó"]=> + string(8) "Ó" + ["Ô"]=> + string(7) "Ô" + ["Ò"]=> + string(8) "Ò" + ["Ω"]=> + string(7) "Ω" + ["Ο"]=> + string(9) "Ο" + ["Ø"]=> + string(8) "Ø" + ["Õ"]=> + string(8) "Õ" + ["Ö"]=> + string(6) "Ö" + ["Φ"]=> + string(5) "Φ" + ["Π"]=> + string(4) "Π" + ["″"]=> + string(7) "″" + ["Ψ"]=> + string(5) "Ψ" + ["Ρ"]=> + string(5) "Ρ" + ["Š"]=> + string(8) "Š" + ["Σ"]=> + string(7) "Σ" + ["Þ"]=> + string(7) "Þ" + ["Τ"]=> + string(5) "Τ" + ["Θ"]=> + string(7) "Θ" + ["Ú"]=> + string(8) "Ú" + ["Û"]=> + string(7) "Û" + ["Ù"]=> + string(8) "Ù" + ["Υ"]=> + string(9) "Υ" + ["Ü"]=> + string(6) "Ü" + ["Ξ"]=> + string(4) "Ξ" + ["Ý"]=> + string(8) "Ý" + ["Ÿ"]=> + string(6) "Ÿ" + ["Ζ"]=> + string(6) "Ζ" + ["á"]=> + string(8) "á" + ["â"]=> + string(7) "â" + ["´"]=> + string(7) "´" + ["æ"]=> + string(7) "æ" + ["à"]=> + string(8) "à" + ["ℵ"]=> + string(9) "ℵ" + ["α"]=> + string(7) "α" + ["&"]=> + string(5) "&" + ["∧"]=> + string(5) "∧" + ["∠"]=> + string(5) "∠" + ["å"]=> + string(7) "å" + ["≈"]=> + string(7) "≈" + ["ã"]=> + string(8) "ã" + ["ä"]=> + string(6) "ä" + ["„"]=> + string(7) "„" + ["β"]=> + string(6) "β" + ["¦"]=> + string(8) "¦" + ["•"]=> + string(6) "•" + ["∩"]=> + string(5) "∩" + ["ç"]=> + string(8) "ç" + ["¸"]=> + string(7) "¸" + ["¢"]=> + string(6) "¢" + ["χ"]=> + string(5) "χ" + ["ˆ"]=> + string(6) "ˆ" + ["♣"]=> + string(7) "♣" + ["≅"]=> + string(6) "≅" + ["©"]=> + string(6) "©" + ["↵"]=> + string(7) "↵" + ["∪"]=> + string(5) "∪" + ["¤"]=> + string(8) "¤" + ["⇓"]=> + string(6) "⇓" + ["†"]=> + string(8) "†" + ["↓"]=> + string(6) "↓" + ["°"]=> + string(5) "°" + ["δ"]=> + string(7) "δ" + ["♦"]=> + string(7) "♦" + ["÷"]=> + string(8) "÷" + ["é"]=> + string(8) "é" + ["ê"]=> + string(7) "ê" + ["è"]=> + string(8) "è" + ["∅"]=> + string(7) "∅" + [" "]=> + string(6) " " + [" "]=> + string(6) " " + ["ε"]=> + string(9) "ε" + ["≡"]=> + string(7) "≡" + ["η"]=> + string(5) "η" + ["ð"]=> + string(5) "ð" + ["ë"]=> + string(6) "ë" + ["€"]=> + string(6) "€" + ["∃"]=> + string(7) "∃" + ["ƒ"]=> + string(6) "ƒ" + ["∀"]=> + string(8) "∀" + ["½"]=> + string(8) "½" + ["¼"]=> + string(8) "¼" + ["¾"]=> + string(8) "¾" + ["⁄"]=> + string(7) "⁄" + ["γ"]=> + string(7) "γ" + ["≥"]=> + string(4) "≥" + [">"]=> + string(4) ">" + ["⇔"]=> + string(6) "⇔" + ["↔"]=> + string(6) "↔" + ["♥"]=> + string(8) "♥" + ["…"]=> + string(8) "…" + ["í"]=> + string(8) "í" + ["î"]=> + string(7) "î" + ["¡"]=> + string(7) "¡" + ["ì"]=> + string(8) "ì" + ["ℑ"]=> + string(7) "ℑ" + ["∞"]=> + string(7) "∞" + ["∫"]=> + string(5) "∫" + ["ι"]=> + string(6) "ι" + ["¿"]=> + string(8) "¿" + ["∈"]=> + string(6) "∈" + ["ï"]=> + string(6) "ï" + ["κ"]=> + string(7) "κ" + ["⇐"]=> + string(6) "⇐" + ["λ"]=> + string(8) "λ" + ["〈"]=> + string(6) "⟨" + ["«"]=> + string(7) "«" + ["←"]=> + string(6) "←" + ["⌈"]=> + string(7) "⌈" + ["“"]=> + string(7) "“" + ["≤"]=> + string(4) "≤" + ["⌊"]=> + string(8) "⌊" + ["∗"]=> + string(8) "∗" + ["◊"]=> + string(5) "◊" + [""]=> + string(5) "‎" + ["‹"]=> + string(8) "‹" + ["‘"]=> + string(7) "‘" + ["<"]=> + string(4) "<" + ["¯"]=> + string(6) "¯" + ["—"]=> + string(7) "—" + ["µ"]=> + string(7) "µ" + ["·"]=> + string(8) "·" + ["−"]=> + string(7) "−" + ["μ"]=> + string(4) "μ" + ["∇"]=> + string(7) "∇" + [" "]=> + string(6) " " + ["–"]=> + string(7) "–" + ["≠"]=> + string(4) "≠" + ["∋"]=> + string(4) "∋" + ["¬"]=> + string(5) "¬" + ["∉"]=> + string(7) "∉" + ["⊄"]=> + string(6) "⊄" + ["ñ"]=> + string(8) "ñ" + ["ν"]=> + string(4) "ν" + ["ó"]=> + string(8) "ó" + ["ô"]=> + string(7) "ô" + ["œ"]=> + string(7) "œ" + ["ò"]=> + string(8) "ò" + ["‾"]=> + string(7) "‾" + ["ω"]=> + string(7) "ω" + ["ο"]=> + string(9) "ο" + ["⊕"]=> + string(7) "⊕" + ["∨"]=> + string(4) "∨" + ["ª"]=> + string(6) "ª" + ["º"]=> + string(6) "º" + ["ø"]=> + string(8) "ø" + ["õ"]=> + string(8) "õ" + ["⊗"]=> + string(8) "⊗" + ["ö"]=> + string(6) "ö" + ["¶"]=> + string(6) "¶" + ["∂"]=> + string(6) "∂" + ["‰"]=> + string(8) "‰" + ["⊥"]=> + string(6) "⊥" + ["φ"]=> + string(5) "φ" + ["π"]=> + string(4) "π" + ["ϖ"]=> + string(5) "ϖ" + ["±"]=> + string(8) "±" + ["£"]=> + string(7) "£" + ["′"]=> + string(7) "′" + ["∏"]=> + string(6) "∏" + ["∝"]=> + string(6) "∝" + ["ψ"]=> + string(5) "ψ" + ["""]=> + string(6) """ + ["⇒"]=> + string(6) "⇒" + ["√"]=> + string(7) "√" + ["〉"]=> + string(6) "⟩" + ["»"]=> + string(7) "»" + ["→"]=> + string(6) "→" + ["⌉"]=> + string(7) "⌉" + ["”"]=> + string(7) "”" + ["ℜ"]=> + string(6) "ℜ" + ["®"]=> + string(5) "®" + ["⌋"]=> + string(8) "⌋" + ["ρ"]=> + string(5) "ρ" + [""]=> + string(5) "‏" + ["›"]=> + string(8) "›" + ["’"]=> + string(7) "’" + ["‚"]=> + string(7) "‚" + ["š"]=> + string(8) "š" + ["⋅"]=> + string(6) "⋅" + ["§"]=> + string(6) "§" + [""]=> + string(5) "­" + ["σ"]=> + string(7) "σ" + ["ς"]=> + string(8) "ς" + ["∼"]=> + string(5) "∼" + ["♠"]=> + string(8) "♠" + ["⊂"]=> + string(5) "⊂" + ["⊆"]=> + string(6) "⊆" + ["∑"]=> + string(5) "∑" + ["¹"]=> + string(6) "¹" + ["²"]=> + string(6) "²" + ["³"]=> + string(6) "³" + ["⊃"]=> + string(5) "⊃" + ["⊇"]=> + string(6) "⊇" + ["ß"]=> + string(7) "ß" + ["τ"]=> + string(5) "τ" + ["∴"]=> + string(8) "∴" + ["θ"]=> + string(7) "θ" + ["ϑ"]=> + string(10) "ϑ" + [" "]=> + string(8) " " + ["þ"]=> + string(7) "þ" + ["˜"]=> + string(7) "˜" + ["×"]=> + string(7) "×" + ["™"]=> + string(7) "™" + ["⇑"]=> + string(6) "⇑" + ["ú"]=> + string(8) "ú" + ["↑"]=> + string(6) "↑" + ["û"]=> + string(7) "û" + ["ù"]=> + string(8) "ù" + ["¨"]=> + string(5) "¨" + ["ϒ"]=> + string(7) "ϒ" + ["υ"]=> + string(9) "υ" + ["ü"]=> + string(6) "ü" + ["℘"]=> + string(8) "℘" + ["ξ"]=> + string(4) "ξ" + ["ý"]=> + string(8) "ý" + ["¥"]=> + string(5) "¥" + ["ÿ"]=> + string(6) "ÿ" + ["ζ"]=> + string(6) "ζ" + [""]=> + string(5) "‍" + [""]=> + string(6) "‌" +} +-- with table = HTML_SPECIALCHARS -- +array(4) { + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" + ["""]=> + string(6) """ +} +Done diff --git a/ext/standard/tests/strings/htmlentities-utf-3.phpt b/ext/standard/tests/strings/htmlentities-utf-3.phpt index c28917ba16..82693056ef 100644 --- a/ext/standard/tests/strings/htmlentities-utf-3.phpt +++ b/ext/standard/tests/strings/htmlentities-utf-3.phpt @@ -1,83 +1,83 @@ ---TEST--
-Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF-8 sequences
---FILE--
-<?php
-
-/* conformance to Unicode 5.2, section 3.9, D92 */
-
-$val_ranges = array(
- array(array(0x00, 0x7F)),
- array(array(0xC2, 0xDF), array(0x80, 0xBF)),
- array(array(0xE0, 0xE0), array(0xA0, 0xBF), array(0x80, 0xBF)),
- array(array(0xE1, 0xEC), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xED, 0xED), array(0x80, 0x9F), array(0x80, 0xBF)),
- array(array(0xEE, 0xEF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF0, 0xF0), array(0x90, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF1, 0xF3), array(0x80, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF4, 0xF4), array(0x80, 0x8F), array(0x80, 0xBF), array(0x80, 0xBF)),
-);
-
-function is_valid($seq) {
- global $val_ranges;
- $b = ord($seq[0]);
- foreach ($val_ranges as $l) {
- if ($b >= $l[0][0] && $b <= $l[0][1]) {
- if (count($l) != strlen($seq)) {
- return false;
- }
- for ($n = 1; $n < strlen($seq); $n++) {
- if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) {
- return false;
- }
- }
- return true;
- }
- }
- return false;
-}
-
-function concordance($s) {
- $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0;
- $v = is_valid($s);
- return ($vhe === $v);
-}
-
-for ($b1 = 0xC0; $b1 < 0xE0; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2);
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
-}
-
-
-for ($b1 = 0xE0; $b1 < 0xEF; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2)."\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
-}
-
-for ($b1 = 0xF0; $b1 < 0xFF; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2)."\x80\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\x80\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
-}
-echo "Done.\n";
---EXPECT--
-Done.
+--TEST-- +Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF-8 sequences +--FILE-- +<?php + +/* conformance to Unicode 5.2, section 3.9, D92 */ + +$val_ranges = array( + array(array(0x00, 0x7F)), + array(array(0xC2, 0xDF), array(0x80, 0xBF)), + array(array(0xE0, 0xE0), array(0xA0, 0xBF), array(0x80, 0xBF)), + array(array(0xE1, 0xEC), array(0x80, 0xBF), array(0x80, 0xBF)), + array(array(0xED, 0xED), array(0x80, 0x9F), array(0x80, 0xBF)), + array(array(0xEE, 0xEF), array(0x80, 0xBF), array(0x80, 0xBF)), + array(array(0xF0, 0xF0), array(0x90, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)), + array(array(0xF1, 0xF3), array(0x80, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)), + array(array(0xF4, 0xF4), array(0x80, 0x8F), array(0x80, 0xBF), array(0x80, 0xBF)), +); + +function is_valid($seq) { + global $val_ranges; + $b = ord($seq[0]); + foreach ($val_ranges as $l) { + if ($b >= $l[0][0] && $b <= $l[0][1]) { + if (count($l) != strlen($seq)) { + return false; + } + for ($n = 1; $n < strlen($seq); $n++) { + if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) { + return false; + } + } + return true; + } + } + return false; +} + +function concordance($s) { + $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0; + $v = is_valid($s); + return ($vhe === $v); +} + +for ($b1 = 0xC0; $b1 < 0xE0; $b1++) { + for ($b2 = 0x80; $b2 < 0xBF; $b2++) { + $s = chr($b1).chr($b2); + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + } +} + + +for ($b1 = 0xE0; $b1 < 0xEF; $b1++) { + for ($b2 = 0x80; $b2 < 0xBF; $b2++) { + $s = chr($b1).chr($b2)."\x80"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + $s = chr($b1).chr($b2)."\xBF"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + } +} + +for ($b1 = 0xF0; $b1 < 0xFF; $b1++) { + for ($b2 = 0x80; $b2 < 0xBF; $b2++) { + $s = chr($b1).chr($b2)."\x80\x80"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + $s = chr($b1).chr($b2)."\xBF\x80"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + $s = chr($b1).chr($b2)."\x80\xBF"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + $s = chr($b1).chr($b2)."\xBF\xBF"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + } +} +echo "Done.\n"; +--EXPECT-- +Done. diff --git a/ext/standard/tests/strings/md5_basic1.phpt b/ext/standard/tests/strings/md5_basic1.phpt index eda414bc25..a2b2348588 100644 --- a/ext/standard/tests/strings/md5_basic1.phpt +++ b/ext/standard/tests/strings/md5_basic1.phpt @@ -1,17 +1,17 @@ ---TEST--
-Test md5() function : basic functionality
---FILE--
-<?php
-/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
- * Description: Calculate the md5 hash of a string
- * Source code: ext/standard/md5.c
-*/
-
-echo "*** Testing md5() : basic functionality ***\n";
-var_dump(md5(b"apple"));
-?>
-===DONE===
---EXPECTF--
-*** Testing md5() : basic functionality ***
-string(32) "1f3870be274f6c49b3e31a0c6728957f"
-===DONE===
+--TEST-- +Test md5() function : basic functionality +--FILE-- +<?php +/* Prototype : string md5 ( string $str [, bool $raw_output= false ] ) + * Description: Calculate the md5 hash of a string + * Source code: ext/standard/md5.c +*/ + +echo "*** Testing md5() : basic functionality ***\n"; +var_dump(md5(b"apple")); +?> +===DONE=== +--EXPECTF-- +*** Testing md5() : basic functionality *** +string(32) "1f3870be274f6c49b3e31a0c6728957f" +===DONE=== diff --git a/ext/standard/tests/strings/md5_basic2.phpt b/ext/standard/tests/strings/md5_basic2.phpt index 1f89ba82f5..51f711d6c7 100644 --- a/ext/standard/tests/strings/md5_basic2.phpt +++ b/ext/standard/tests/strings/md5_basic2.phpt @@ -1,30 +1,30 @@ ---TEST--
-Test md5() function : basic functionality - with raw output
---FILE--
-<?php
-/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
- * Description: Calculate the md5 hash of a string
- * Source code: ext/standard/md5.c
-*/
-
-echo "*** Testing md5() : basic functionality - with raw output***\n";
-$str = b"Hello World";
-$md5_raw = md5($str, true);
-var_dump(bin2hex($md5_raw));
-
-$md5 = md5($str, false);
-
-if (strcmp(bin2hex($md5_raw), $md5) == 0 ) {
- echo "TEST PASSED\n";
-} else {
- echo "TEST FAILED\n";
- var_dump($md5_raw, $md5);
-}
-
-?>
-===DONE===
---EXPECT--
-*** Testing md5() : basic functionality - with raw output***
-string(32) "b10a8db164e0754105b7a99be72e3fe5"
-TEST PASSED
+--TEST-- +Test md5() function : basic functionality - with raw output +--FILE-- +<?php +/* Prototype : string md5 ( string $str [, bool $raw_output= false ] ) + * Description: Calculate the md5 hash of a string + * Source code: ext/standard/md5.c +*/ + +echo "*** Testing md5() : basic functionality - with raw output***\n"; +$str = b"Hello World"; +$md5_raw = md5($str, true); +var_dump(bin2hex($md5_raw)); + +$md5 = md5($str, false); + +if (strcmp(bin2hex($md5_raw), $md5) == 0 ) { + echo "TEST PASSED\n"; +} else { + echo "TEST FAILED\n"; + var_dump($md5_raw, $md5); +} + +?> +===DONE=== +--EXPECT-- +*** Testing md5() : basic functionality - with raw output*** +string(32) "b10a8db164e0754105b7a99be72e3fe5" +TEST PASSED ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/strings/md5_error.phpt b/ext/standard/tests/strings/md5_error.phpt index 190b09c8e5..dbdbdcb2a5 100644 --- a/ext/standard/tests/strings/md5_error.phpt +++ b/ext/standard/tests/strings/md5_error.phpt @@ -1,35 +1,35 @@ ---TEST--
-Test md5() function : error conditions
---FILE--
-<?php
-/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
- * Description: Calculate the md5 hash of a string
- * Source code: ext/standard/md5.c
-*/
-
-echo "*** Testing md5() : error conditions ***\n";
-
-echo "\n-- Testing md5() function with no arguments --\n";
-var_dump( md5());
-
-echo "\n-- Testing md5() function with more than expected no. of arguments --\n";
-$str = "Hello World";
-$raw_output = true;
-$extra_arg = 10;
-
-var_dump(md5($str, $raw_output, $extra_arg));
-?>
-===DONE==
---EXPECTF--
-*** Testing md5() : error conditions ***
-
--- Testing md5() function with no arguments --
-
-Warning: md5() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing md5() function with more than expected no. of arguments --
-
-Warning: md5() expects at most 2 parameters, 3 given in %s on line %d
-NULL
+--TEST-- +Test md5() function : error conditions +--FILE-- +<?php +/* Prototype : string md5 ( string $str [, bool $raw_output= false ] ) + * Description: Calculate the md5 hash of a string + * Source code: ext/standard/md5.c +*/ + +echo "*** Testing md5() : error conditions ***\n"; + +echo "\n-- Testing md5() function with no arguments --\n"; +var_dump( md5()); + +echo "\n-- Testing md5() function with more than expected no. of arguments --\n"; +$str = "Hello World"; +$raw_output = true; +$extra_arg = 10; + +var_dump(md5($str, $raw_output, $extra_arg)); +?> +===DONE== +--EXPECTF-- +*** Testing md5() : error conditions *** + +-- Testing md5() function with no arguments -- + +Warning: md5() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing md5() function with more than expected no. of arguments -- + +Warning: md5() expects at most 2 parameters, 3 given in %s on line %d +NULL ===DONE==
\ No newline at end of file diff --git a/ext/standard/tests/strings/soundex_basic.phpt b/ext/standard/tests/strings/soundex_basic.phpt index 65bcb64252..9777473ee9 100644 --- a/ext/standard/tests/strings/soundex_basic.phpt +++ b/ext/standard/tests/strings/soundex_basic.phpt @@ -1,46 +1,46 @@ ---TEST--
-Test soundex() function : basic functionality
---FILE--
-<?php
-/* Prototype : string soundex ( string $str )
- * Description: Calculate the soundex key of a string
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing soundex() : basic functionality ***\n";
-
-var_dump(soundex("Euler"));
-var_dump(soundex("Gauss"));
-var_dump(soundex("Hilbert"));
-var_dump(soundex("Knuth"));
-var_dump(soundex("Lloyd"));
-var_dump(soundex("Lukasiewicz"));
-
-var_dump(soundex("Euler") == soundex("Ellery")); // E460
-var_dump(soundex("Gauss") == soundex("Ghosh")); // G200
-var_dump(soundex("Hilbert") == soundex("Heilbronn")); // H416
-var_dump(soundex("Knuth") == soundex("Kant")); // K530
-var_dump(soundex("Lloyd") == soundex("Ladd")); // L300
-var_dump(soundex("Lukasiewicz") == soundex("Lissajous")); // L222
-
-var_dump(soundex("Lukasiewicz") == soundex("Ghosh"));
-var_dump(soundex("Hilbert") == soundex("Ladd"));
-?>
-===DONE===
---EXPECT--
-*** Testing soundex() : basic functionality ***
-string(4) "E460"
-string(4) "G200"
-string(4) "H416"
-string(4) "K530"
-string(4) "L300"
-string(4) "L222"
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-
-===DONE===
+--TEST-- +Test soundex() function : basic functionality +--FILE-- +<?php +/* Prototype : string soundex ( string $str ) + * Description: Calculate the soundex key of a string + * Source code: ext/standard/string.c +*/ +echo "*** Testing soundex() : basic functionality ***\n"; + +var_dump(soundex("Euler")); +var_dump(soundex("Gauss")); +var_dump(soundex("Hilbert")); +var_dump(soundex("Knuth")); +var_dump(soundex("Lloyd")); +var_dump(soundex("Lukasiewicz")); + +var_dump(soundex("Euler") == soundex("Ellery")); // E460 +var_dump(soundex("Gauss") == soundex("Ghosh")); // G200 +var_dump(soundex("Hilbert") == soundex("Heilbronn")); // H416 +var_dump(soundex("Knuth") == soundex("Kant")); // K530 +var_dump(soundex("Lloyd") == soundex("Ladd")); // L300 +var_dump(soundex("Lukasiewicz") == soundex("Lissajous")); // L222 + +var_dump(soundex("Lukasiewicz") == soundex("Ghosh")); +var_dump(soundex("Hilbert") == soundex("Ladd")); +?> +===DONE=== +--EXPECT-- +*** Testing soundex() : basic functionality *** +string(4) "E460" +string(4) "G200" +string(4) "H416" +string(4) "K530" +string(4) "L300" +string(4) "L222" +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) + +===DONE=== diff --git a/ext/standard/tests/strings/soundex_error.phpt b/ext/standard/tests/strings/soundex_error.phpt index a81b9d24fe..20cf2c9d3e 100644 --- a/ext/standard/tests/strings/soundex_error.phpt +++ b/ext/standard/tests/strings/soundex_error.phpt @@ -1,34 +1,34 @@ ---TEST--
-Test soundex() function : error conditions
---FILE--
-<?php
-/* Prototype : string soundex ( string $str )
- * Description: Calculate the soundex key of a string
- * Source code: ext/standard/string.c
-*/
-
-echo "\n*** Testing soundex error conditions ***";
-
-echo "-- Testing soundex() function with Zero arguments --\n";
-var_dump( soundex() );
-
-echo "\n\n-- Testing soundex() function with more than expected no. of arguments --\n";
-$str = "Euler";
-$extra_arg = 10;
-var_dump( soundex( $str, $extra_arg) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing soundex error conditions ***-- Testing soundex() function with Zero arguments --
-
-Warning: soundex() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-
--- Testing soundex() function with more than expected no. of arguments --
-
-Warning: soundex() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
+--TEST-- +Test soundex() function : error conditions +--FILE-- +<?php +/* Prototype : string soundex ( string $str ) + * Description: Calculate the soundex key of a string + * Source code: ext/standard/string.c +*/ + +echo "\n*** Testing soundex error conditions ***"; + +echo "-- Testing soundex() function with Zero arguments --\n"; +var_dump( soundex() ); + +echo "\n\n-- Testing soundex() function with more than expected no. of arguments --\n"; +$str = "Euler"; +$extra_arg = 10; +var_dump( soundex( $str, $extra_arg) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing soundex error conditions ***-- Testing soundex() function with Zero arguments -- + +Warning: soundex() expects exactly 1 parameter, 0 given in %s on line %d +NULL + + +-- Testing soundex() function with more than expected no. of arguments -- + +Warning: soundex() expects exactly 1 parameter, 2 given in %s on line %d +NULL + ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/strings/str_rot13_basic.phpt b/ext/standard/tests/strings/str_rot13_basic.phpt index 949d725754..321a2bf1b7 100644 --- a/ext/standard/tests/strings/str_rot13_basic.phpt +++ b/ext/standard/tests/strings/str_rot13_basic.phpt @@ -1,55 +1,55 @@ ---TEST--
-Test soundex() function : basic functionality
---FILE--
-<?php
-/* Prototype : string str_rot13 ( string $str )
- * Description: Perform the rot13 transform on a string
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing str_rot13() : basic functionality ***\n";
-
-echo "\nBasic tests\n";
-var_dump(str_rot13("str_rot13() tests starting"));
-var_dump(str_rot13("abcdefghijklmnopqrstuvwxyz"));
-
-echo "\nEnsure numeric characters are left untouched\n";
-if (strcmp(str_rot13("0123456789"), "0123456789") == 0) {
- echo "Strings equal : TEST PASSED\n";
-} else {
- echo "Strings unequal : TEST FAILED\n";
-}
-
-echo "\nEnsure non-alphabetic characters are left untouched\n";
-if (strcmp(str_rot13("!%^&*()_-+={}[]:;@~#<,>.?"), "!%^&*()_-+={}[]:;@~#<,>.?")) {
- echo "Strings equal : TEST PASSED\n";
-} else {
- echo "Strings unequal : TEST FAILED\n";
-}
-
-echo "\nEnsure strings round trip\n";
-$str = "str_rot13() tests starting";
-$encode = str_rot13($str);
-$decode = str_rot13($encode);
-if (strcmp($str, $decode) == 0) {
- echo "Strings equal : TEST PASSED\n";
-} else {
- echo "Strings unequal : TEST FAILED\n";
-}
-?>
-===DONE===
---EXPECTF--
-*** Testing str_rot13() : basic functionality ***
-
-Basic tests
-string(26) "fge_ebg13() grfgf fgnegvat"
-string(26) "nopqrstuvwxyzabcdefghijklm"
-
-Ensure numeric characters are left untouched
-Strings equal : TEST PASSED
-
-Ensure non-alphabetic characters are left untouched
-Strings unequal : TEST FAILED
-
-Ensure strings round trip
-Strings equal : TEST PASSED
+--TEST-- +Test soundex() function : basic functionality +--FILE-- +<?php +/* Prototype : string str_rot13 ( string $str ) + * Description: Perform the rot13 transform on a string + * Source code: ext/standard/string.c +*/ +echo "*** Testing str_rot13() : basic functionality ***\n"; + +echo "\nBasic tests\n"; +var_dump(str_rot13("str_rot13() tests starting")); +var_dump(str_rot13("abcdefghijklmnopqrstuvwxyz")); + +echo "\nEnsure numeric characters are left untouched\n"; +if (strcmp(str_rot13("0123456789"), "0123456789") == 0) { + echo "Strings equal : TEST PASSED\n"; +} else { + echo "Strings unequal : TEST FAILED\n"; +} + +echo "\nEnsure non-alphabetic characters are left untouched\n"; +if (strcmp(str_rot13("!%^&*()_-+={}[]:;@~#<,>.?"), "!%^&*()_-+={}[]:;@~#<,>.?")) { + echo "Strings equal : TEST PASSED\n"; +} else { + echo "Strings unequal : TEST FAILED\n"; +} + +echo "\nEnsure strings round trip\n"; +$str = "str_rot13() tests starting"; +$encode = str_rot13($str); +$decode = str_rot13($encode); +if (strcmp($str, $decode) == 0) { + echo "Strings equal : TEST PASSED\n"; +} else { + echo "Strings unequal : TEST FAILED\n"; +} +?> +===DONE=== +--EXPECTF-- +*** Testing str_rot13() : basic functionality *** + +Basic tests +string(26) "fge_ebg13() grfgf fgnegvat" +string(26) "nopqrstuvwxyzabcdefghijklm" + +Ensure numeric characters are left untouched +Strings equal : TEST PASSED + +Ensure non-alphabetic characters are left untouched +Strings unequal : TEST FAILED + +Ensure strings round trip +Strings equal : TEST PASSED ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/strings/str_rot13_error.phpt b/ext/standard/tests/strings/str_rot13_error.phpt index 99a99f29c5..2361c0abb5 100644 --- a/ext/standard/tests/strings/str_rot13_error.phpt +++ b/ext/standard/tests/strings/str_rot13_error.phpt @@ -1,32 +1,32 @@ ---TEST--
-Test str_rot13() function : error conditions
---FILE--
-<?php
-/* Prototype : string str_rot13 ( string $str )
- * Description: Perform the rot13 transform on a string
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing str_rot13() : error conditions ***\n";
-
-echo "-- Testing str_rot13() function with Zero arguments --\n";
-var_dump( str_rot13() );
-
-echo "\n\n-- Testing str_rot13() function with more than expected no. of arguments --\n";
-$str = "str_rot13() tests starting";
-$extra_arg = 10;
-var_dump( str_rot13( $str, $extra_arg) );
-?>
-===DONE===
---EXPECTF--
-*** Testing str_rot13() : error conditions ***
--- Testing str_rot13() function with Zero arguments --
-
-Warning: str_rot13() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-
--- Testing str_rot13() function with more than expected no. of arguments --
-
-Warning: str_rot13() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
+--TEST-- +Test str_rot13() function : error conditions +--FILE-- +<?php +/* Prototype : string str_rot13 ( string $str ) + * Description: Perform the rot13 transform on a string + * Source code: ext/standard/string.c +*/ +echo "*** Testing str_rot13() : error conditions ***\n"; + +echo "-- Testing str_rot13() function with Zero arguments --\n"; +var_dump( str_rot13() ); + +echo "\n\n-- Testing str_rot13() function with more than expected no. of arguments --\n"; +$str = "str_rot13() tests starting"; +$extra_arg = 10; +var_dump( str_rot13( $str, $extra_arg) ); +?> +===DONE=== +--EXPECTF-- +*** Testing str_rot13() : error conditions *** +-- Testing str_rot13() function with Zero arguments -- + +Warning: str_rot13() expects exactly 1 parameter, 0 given in %s on line %d +NULL + + +-- Testing str_rot13() function with more than expected no. of arguments -- + +Warning: str_rot13() expects exactly 1 parameter, 2 given in %s on line %d +NULL ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/strings/strnatcasecmp_error.phpt b/ext/standard/tests/strings/strnatcasecmp_error.phpt index 45a15daefc..3085e8d8fd 100644 --- a/ext/standard/tests/strings/strnatcasecmp_error.phpt +++ b/ext/standard/tests/strings/strnatcasecmp_error.phpt @@ -1,33 +1,33 @@ ---TEST--
-Test strnatcasecmp() function : error conditions
---FILE--
-<?php
-/* Prototype : int strnatcasecmp ( string $str1 , string $str2 )
- * Description: Case insensitive string comparisons using a "natural order" algorithm
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing strnatcasecmp() : error conditions ***\n";
-
-echo "-- Testing strnatcmp() function with Zero arguments --\n";
-var_dump( strnatcasecmp() );
-
-echo "\n\n-- Testing strnatcasecmp() function with more than expected no. of arguments --\n";
-$str1 = "abc1";
-$str2 = "ABC1";
-$extra_arg = 10;
-var_dump( strnatcasecmp( $str1, $str2, $extra_arg) );
-?>
-===DONE===
---EXPECTF--
-*** Testing strnatcasecmp() : error conditions ***
--- Testing strnatcmp() function with Zero arguments --
-
-Warning: strnatcasecmp() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-
--- Testing strnatcasecmp() function with more than expected no. of arguments --
-
-Warning: strnatcasecmp() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
+--TEST-- +Test strnatcasecmp() function : error conditions +--FILE-- +<?php +/* Prototype : int strnatcasecmp ( string $str1 , string $str2 ) + * Description: Case insensitive string comparisons using a "natural order" algorithm + * Source code: ext/standard/string.c +*/ +echo "*** Testing strnatcasecmp() : error conditions ***\n"; + +echo "-- Testing strnatcmp() function with Zero arguments --\n"; +var_dump( strnatcasecmp() ); + +echo "\n\n-- Testing strnatcasecmp() function with more than expected no. of arguments --\n"; +$str1 = "abc1"; +$str2 = "ABC1"; +$extra_arg = 10; +var_dump( strnatcasecmp( $str1, $str2, $extra_arg) ); +?> +===DONE=== +--EXPECTF-- +*** Testing strnatcasecmp() : error conditions *** +-- Testing strnatcmp() function with Zero arguments -- + +Warning: strnatcasecmp() expects exactly 2 parameters, 0 given in %s on line %d +NULL + + +-- Testing strnatcasecmp() function with more than expected no. of arguments -- + +Warning: strnatcasecmp() expects exactly 2 parameters, 3 given in %s on line %d +NULL ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/strings/strnatcmp_basic.phpt b/ext/standard/tests/strings/strnatcmp_basic.phpt index 140bd48d6c..bef01de653 100644 --- a/ext/standard/tests/strings/strnatcmp_basic.phpt +++ b/ext/standard/tests/strings/strnatcmp_basic.phpt @@ -1,80 +1,80 @@ ---TEST--
-Test strnatcmp() function : basic functionality
---FILE--
-<?php
-/* Prototype : int strnatcmp ( string $str1 , string $str2 )
- * Description: String comparisons using a "natural order" algorithm
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing strnatcmp() : basic functionality ***\n";
-
-$a1 = "abc1";
-$b1 = "abc10";
-$c1 = "abc15";
-$d1 = "abc2";
-
-$a2 = "ABC1";
-$b2 = "ABC10";
-$c2 = "ABC15";
-$d2 = "ABC2";
-
-echo "Less than tests\n";
-var_dump(strnatcmp($a1, $b1));
-var_dump(strnatcmp($a1, $c1));
-var_dump(strnatcmp($a1, $d1));
-var_dump(strnatcmp($b1, $c1));
-var_dump(strnatcmp($d1, $c1));
-
-var_dump(strnatcmp($a1, $b2));
-var_dump(strnatcmp($a1, $c2));
-var_dump(strnatcmp($a1, $d2));
-var_dump(strnatcmp($b1, $c2));
-var_dump(strnatcmp($d1, $c2));
-
-
-echo "Equal too tests\n";
-var_dump(strnatcmp($b1, $b1));
-var_dump(strnatcmp($b1, $b2));
-
-echo "Greater than tests\n";
-var_dump(strnatcmp($b1, $a1));
-var_dump(strnatcmp($c1, $a1));
-var_dump(strnatcmp($d1, $a1));
-var_dump(strnatcmp($c1, $b1));
-var_dump(strnatcmp($c1, $d1));
-
-var_dump(strnatcmp($b1, $a2));
-var_dump(strnatcmp($c1, $a2));
-var_dump(strnatcmp($d1, $a2));
-var_dump(strnatcmp($c1, $b2));
-var_dump(strnatcmp($c1, $d2));
-?>
-===DONE===
---EXPECT--
-*** Testing strnatcmp() : basic functionality ***
-Less than tests
-int(-1)
-int(-1)
-int(-1)
-int(-1)
-int(-1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-Equal too tests
-int(0)
-int(1)
-Greater than tests
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
-int(1)
+--TEST-- +Test strnatcmp() function : basic functionality +--FILE-- +<?php +/* Prototype : int strnatcmp ( string $str1 , string $str2 ) + * Description: String comparisons using a "natural order" algorithm + * Source code: ext/standard/string.c +*/ +echo "*** Testing strnatcmp() : basic functionality ***\n"; + +$a1 = "abc1"; +$b1 = "abc10"; +$c1 = "abc15"; +$d1 = "abc2"; + +$a2 = "ABC1"; +$b2 = "ABC10"; +$c2 = "ABC15"; +$d2 = "ABC2"; + +echo "Less than tests\n"; +var_dump(strnatcmp($a1, $b1)); +var_dump(strnatcmp($a1, $c1)); +var_dump(strnatcmp($a1, $d1)); +var_dump(strnatcmp($b1, $c1)); +var_dump(strnatcmp($d1, $c1)); + +var_dump(strnatcmp($a1, $b2)); +var_dump(strnatcmp($a1, $c2)); +var_dump(strnatcmp($a1, $d2)); +var_dump(strnatcmp($b1, $c2)); +var_dump(strnatcmp($d1, $c2)); + + +echo "Equal too tests\n"; +var_dump(strnatcmp($b1, $b1)); +var_dump(strnatcmp($b1, $b2)); + +echo "Greater than tests\n"; +var_dump(strnatcmp($b1, $a1)); +var_dump(strnatcmp($c1, $a1)); +var_dump(strnatcmp($d1, $a1)); +var_dump(strnatcmp($c1, $b1)); +var_dump(strnatcmp($c1, $d1)); + +var_dump(strnatcmp($b1, $a2)); +var_dump(strnatcmp($c1, $a2)); +var_dump(strnatcmp($d1, $a2)); +var_dump(strnatcmp($c1, $b2)); +var_dump(strnatcmp($c1, $d2)); +?> +===DONE=== +--EXPECT-- +*** Testing strnatcmp() : basic functionality *** +Less than tests +int(-1) +int(-1) +int(-1) +int(-1) +int(-1) +int(1) +int(1) +int(1) +int(1) +int(1) +Equal too tests +int(0) +int(1) +Greater than tests +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) ===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/strings/strnatcmp_error.phpt b/ext/standard/tests/strings/strnatcmp_error.phpt index 09cc668af9..2b6d93afee 100644 --- a/ext/standard/tests/strings/strnatcmp_error.phpt +++ b/ext/standard/tests/strings/strnatcmp_error.phpt @@ -1,34 +1,34 @@ ---TEST--
-Test strnatcmp() function : error conditions
---FILE--
-<?php
-/* Prototype : int strnatcmp ( string $str1 , string $str2 )
- * Description: String comparisons using a "natural order" algorithm
- * Source code: ext/standard/string.c
-*/
-echo "*** Testing strnatcmp() : error conditions ***\n";
-
-echo "-- Testing strnatcmp() function with Zero arguments --\n";
-var_dump( strnatcmp() );
-
-echo "\n\n-- Testing strnatcmp() function with more than expected no. of arguments --\n";
-$str1 = "abc1";
-$str2 = "ABC1";
-$extra_arg = 10;
-var_dump( strnatcmp( $str1, $str2, $extra_arg) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing strnatcmp() : error conditions ***
--- Testing strnatcmp() function with Zero arguments --
-
-Warning: strnatcmp() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-
--- Testing strnatcmp() function with more than expected no. of arguments --
-
-Warning: strnatcmp() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-===DONE===
+--TEST-- +Test strnatcmp() function : error conditions +--FILE-- +<?php +/* Prototype : int strnatcmp ( string $str1 , string $str2 ) + * Description: String comparisons using a "natural order" algorithm + * Source code: ext/standard/string.c +*/ +echo "*** Testing strnatcmp() : error conditions ***\n"; + +echo "-- Testing strnatcmp() function with Zero arguments --\n"; +var_dump( strnatcmp() ); + +echo "\n\n-- Testing strnatcmp() function with more than expected no. of arguments --\n"; +$str1 = "abc1"; +$str2 = "ABC1"; +$extra_arg = 10; +var_dump( strnatcmp( $str1, $str2, $extra_arg) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing strnatcmp() : error conditions *** +-- Testing strnatcmp() function with Zero arguments -- + +Warning: strnatcmp() expects exactly 2 parameters, 0 given in %s on line %d +NULL + + +-- Testing strnatcmp() function with more than expected no. of arguments -- + +Warning: strnatcmp() expects exactly 2 parameters, 3 given in %s on line %d +NULL +===DONE=== diff --git a/ext/xml/tests/bug49687.phpt b/ext/xml/tests/bug49687.phpt index 3ff19cee7e..6101f9f354 100644 --- a/ext/xml/tests/bug49687.phpt +++ b/ext/xml/tests/bug49687.phpt @@ -1,24 +1,24 @@ ---TEST--
-Bug #49687 Several utf8_decode deficiencies and vulnerabilities
---SKIPIF--
-<?php
-require_once("skipif.inc");
-if (!extension_loaded('xml')) die ("skip xml extension not available");
-?>
---FILE--
-<?php
-
-$tests = array(
- "\x41\xC2\x3E\x42",
- "\xE3\x80\x22",
- "\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98",
-);
-foreach ($tests as $t) {
- echo bin2hex(utf8_decode($t)), "\n";
-}
-echo "Done.\n";
---EXPECT--
-413f3e42
-3f22
-413f3f423f433f3f
-Done.
+--TEST-- +Bug #49687 Several utf8_decode deficiencies and vulnerabilities +--SKIPIF-- +<?php +require_once("skipif.inc"); +if (!extension_loaded('xml')) die ("skip xml extension not available"); +?> +--FILE-- +<?php + +$tests = array( + "\x41\xC2\x3E\x42", + "\xE3\x80\x22", + "\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98", +); +foreach ($tests as $t) { + echo bin2hex(utf8_decode($t)), "\n"; +} +echo "Done.\n"; +--EXPECT-- +413f3e42 +3f22 +413f3f423f433f3f +Done. |