diff options
Diffstat (limited to 'ext/standard')
39 files changed, 1887 insertions, 1887 deletions
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 776a6d44c8..92172b9112 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], 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], 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/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/password/password_get_info_argon2.phpt b/ext/standard/tests/password/password_get_info_argon2.phpt index 80c6f93416..0c9080f0a9 100644 --- a/ext/standard/tests/password/password_get_info_argon2.phpt +++ b/ext/standard/tests/password/password_get_info_argon2.phpt @@ -1,29 +1,29 @@ ---TEST--
-Test normal operation of password_get_info() with Argon2
---SKIPIF--
-<?php
-if (!defined('PASSWORD_ARGON2I')) die('skip password_get_info not built with Argon2');
-?>
---FILE--
-<?php
-
-var_dump(password_get_info('$argon2i$v=19$m=65536,t=3,p=1$SWhIcG5MT21Pc01PbWdVZw$WagZELICsz7jlqOR2YzoEVTWb2oOX1tYdnhZYXxptbU'));
-echo "OK!";
-?>
---EXPECT--
-array(3) {
- ["algo"]=>
- int(2)
- ["algoName"]=>
- string(7) "argon2i"
- ["options"]=>
- array(3) {
- ["memory_cost"]=>
- int(65536)
- ["time_cost"]=>
- int(3)
- ["threads"]=>
- int(1)
- }
-}
+--TEST-- +Test normal operation of password_get_info() with Argon2 +--SKIPIF-- +<?php +if (!defined('PASSWORD_ARGON2I')) die('skip password_get_info not built with Argon2'); +?> +--FILE-- +<?php + +var_dump(password_get_info('$argon2i$v=19$m=65536,t=3,p=1$SWhIcG5MT21Pc01PbWdVZw$WagZELICsz7jlqOR2YzoEVTWb2oOX1tYdnhZYXxptbU')); +echo "OK!"; +?> +--EXPECT-- +array(3) { + ["algo"]=> + int(2) + ["algoName"]=> + string(7) "argon2i" + ["options"]=> + array(3) { + ["memory_cost"]=> + int(65536) + ["time_cost"]=> + int(3) + ["threads"]=> + int(1) + } +} OK!
\ No newline at end of file diff --git a/ext/standard/tests/password/password_hash_argon2.phpt b/ext/standard/tests/password/password_hash_argon2.phpt index 7bd8cd700c..29f7f28a95 100644 --- a/ext/standard/tests/password/password_hash_argon2.phpt +++ b/ext/standard/tests/password/password_hash_argon2.phpt @@ -1,18 +1,18 @@ ---TEST--
-Test normal operation of password_hash() with argon2
---SKIPIF--
-<?php
-if (!defined('PASSWORD_ARGON2I')) die('skip password_hash not built with Argon2');
---FILE--
-<?php
-
-$password = "the password for testing 12345!";
-
-$hash = password_hash($password, PASSWORD_ARGON2I);
-var_dump(password_verify($password, $hash));
-
-echo "OK!";
-?>
---EXPECT--
-bool(true)
+--TEST-- +Test normal operation of password_hash() with argon2 +--SKIPIF-- +<?php +if (!defined('PASSWORD_ARGON2I')) die('skip password_hash not built with Argon2'); +--FILE-- +<?php + +$password = "the password for testing 12345!"; + +$hash = password_hash($password, PASSWORD_ARGON2I); +var_dump(password_verify($password, $hash)); + +echo "OK!"; +?> +--EXPECT-- +bool(true) OK!
\ No newline at end of file diff --git a/ext/standard/tests/password/password_hash_error_argon2.phpt b/ext/standard/tests/password/password_hash_error_argon2.phpt index 7e8722ec6f..92c71e064b 100644 --- a/ext/standard/tests/password/password_hash_error_argon2.phpt +++ b/ext/standard/tests/password/password_hash_error_argon2.phpt @@ -1,21 +1,21 @@ ---TEST--
-Test error operation of password_hash() with argon2
---SKIPIF--
-<?php
-if (!defined('PASSWORD_ARGON2I')) die('skip password_hash not built with Argon2');
-?>
---FILE--
-<?php
-var_dump(password_hash('test', PASSWORD_ARGON2I, ['memory_cost' => 0]));
-var_dump(password_hash('test', PASSWORD_ARGON2I, ['time_cost' => 0]));
-var_dump(password_hash('test', PASSWORD_ARGON2I, ['threads' => 0]));
-?>
---EXPECTF--
-Warning: password_hash(): Memory cost is outside of allowed memory range in %s on line %d
-NULL
-
-Warning: password_hash(): Time cost is outside of allowed time range in %s on line %d
-NULL
-
-Warning: password_hash(): Invalid number of threads in %s on line %d
+--TEST-- +Test error operation of password_hash() with argon2 +--SKIPIF-- +<?php +if (!defined('PASSWORD_ARGON2I')) die('skip password_hash not built with Argon2'); +?> +--FILE-- +<?php +var_dump(password_hash('test', PASSWORD_ARGON2I, ['memory_cost' => 0])); +var_dump(password_hash('test', PASSWORD_ARGON2I, ['time_cost' => 0])); +var_dump(password_hash('test', PASSWORD_ARGON2I, ['threads' => 0])); +?> +--EXPECTF-- +Warning: password_hash(): Memory cost is outside of allowed memory range in %s on line %d +NULL + +Warning: password_hash(): Time cost is outside of allowed time range in %s on line %d +NULL + +Warning: password_hash(): Invalid number of threads in %s on line %d NULL
\ No newline at end of file diff --git a/ext/standard/tests/password/password_needs_rehash_argon2.phpt b/ext/standard/tests/password/password_needs_rehash_argon2.phpt index 61fc0a5cae..0b5fede1e3 100644 --- a/ext/standard/tests/password/password_needs_rehash_argon2.phpt +++ b/ext/standard/tests/password/password_needs_rehash_argon2.phpt @@ -1,22 +1,22 @@ ---TEST--
-Test normal operation of password_needs_rehash() with argon2
---SKIPIF--
-<?php
-if (!defined('PASSWORD_ARGON2I')) die('skip password_needs_rehash not built with Argon2');
-?>
---FILE--
-<?php
-
-$hash = password_hash('test', PASSWORD_ARGON2I);
-var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I));
-var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['memory_cost' => 1<<17]));
-var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['time_cost' => 4]));
-var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['threads' => 4]));
-echo "OK!";
-?>
---EXPECT--
-bool(false)
-bool(true)
-bool(true)
-bool(true)
-OK!
+--TEST-- +Test normal operation of password_needs_rehash() with argon2 +--SKIPIF-- +<?php +if (!defined('PASSWORD_ARGON2I')) die('skip password_needs_rehash not built with Argon2'); +?> +--FILE-- +<?php + +$hash = password_hash('test', PASSWORD_ARGON2I); +var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I)); +var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['memory_cost' => 1<<17])); +var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['time_cost' => 4])); +var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['threads' => 4])); +echo "OK!"; +?> +--EXPECT-- +bool(false) +bool(true) +bool(true) +bool(true) +OK! diff --git a/ext/standard/tests/password/password_verify_argon2.phpt b/ext/standard/tests/password/password_verify_argon2.phpt index e3a35942f5..986f5e7005 100644 --- a/ext/standard/tests/password/password_verify_argon2.phpt +++ b/ext/standard/tests/password/password_verify_argon2.phpt @@ -1,18 +1,18 @@ ---TEST--
-Test normal operation of password_verify() with argon2
---SKIPIF--
-<?php
-if (!defined('PASSWORD_ARGON2I')) die('skip password_verify not built with Argon2');
-?>
---FILE--
-<?php
-
-var_dump(password_verify('test', '$argon2i$v=19$m=65536,t=3,p=1$OEVjWWs2Z3YvWlNZQ0ZmNw$JKin7ahjmh8JYvMyFcXri0Ss/Uvd3uYpD7MG6C/5Cy0'));
-
-var_dump(password_verify('argon2', '$argon2i$v=19$m=65536,t=3,p=1$OEVjWWs2Z3YvWlNZQ0ZmNw$JKin7ahjmh8JYvMyFcXri0Ss/Uvd3uYpD7MG6C/5Cy0'));
-echo "OK!";
-?>
---EXPECT--
-bool(true)
-bool(false)
+--TEST-- +Test normal operation of password_verify() with argon2 +--SKIPIF-- +<?php +if (!defined('PASSWORD_ARGON2I')) die('skip password_verify not built with Argon2'); +?> +--FILE-- +<?php + +var_dump(password_verify('test', '$argon2i$v=19$m=65536,t=3,p=1$OEVjWWs2Z3YvWlNZQ0ZmNw$JKin7ahjmh8JYvMyFcXri0Ss/Uvd3uYpD7MG6C/5Cy0')); + +var_dump(password_verify('argon2', '$argon2i$v=19$m=65536,t=3,p=1$OEVjWWs2Z3YvWlNZQ0ZmNw$JKin7ahjmh8JYvMyFcXri0Ss/Uvd3uYpD7MG6C/5Cy0')); +echo "OK!"; +?> +--EXPECT-- +bool(true) +bool(false) OK!
\ 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/strings/bug49687.phpt b/ext/standard/tests/strings/bug49687.phpt index 99e8dc3ec6..ae191be088 100644 --- a/ext/standard/tests/strings/bug49687.phpt +++ b/ext/standard/tests/strings/bug49687.phpt @@ -1,19 +1,19 @@ ---TEST--
-Bug #49687 Several utf8_decode deficiencies and vulnerabilities
---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 +--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. 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 c1f8805ac0..af91ade73f 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("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("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 670872f74d..7098dc41b5 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 = "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 = "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=== |