summaryrefslogtreecommitdiff
path: root/ext/standard/tests
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-04-26 00:32:51 +0400
committerDmitry Stogov <dmitry@zend.com>2014-04-26 00:32:51 +0400
commitf9927a6c97208c60d922f9a4e98feb8079c57d1f (patch)
tree35815b69d1bf7d47fb41e857ff8d2b024ddac153 /ext/standard/tests
parent4e7cbf3f5842abe6688c11ce3cc11d2eabf0695f (diff)
parentb82d077f988606580e5c06a9da18fe4f60ddb7cb (diff)
downloadphp-git-f9927a6c97208c60d922f9a4e98feb8079c57d1f.tar.gz
Merge mainstream 'master' branch into refactoring
During merge I had to revert: Nikita's patch for php_splice() (it probably needs to be applyed again) Bob Weinand's patches related to constant expression handling (we need to review them carefully) I also reverted all our attempts to support sapi/phpdbg (we didn't test it anyway) Conflicts: Zend/zend.h Zend/zend_API.c Zend/zend_ast.c Zend/zend_compile.c Zend/zend_compile.h Zend/zend_constants.c Zend/zend_exceptions.c Zend/zend_execute.c Zend/zend_execute.h Zend/zend_execute_API.c Zend/zend_hash.c Zend/zend_highlight.c Zend/zend_language_parser.y Zend/zend_language_scanner.c Zend/zend_language_scanner_defs.h Zend/zend_variables.c Zend/zend_vm_def.h Zend/zend_vm_execute.h ext/date/php_date.c ext/dom/documenttype.c ext/hash/hash.c ext/iconv/iconv.c ext/mbstring/tests/zend_multibyte-10.phpt ext/mbstring/tests/zend_multibyte-11.phpt ext/mbstring/tests/zend_multibyte-12.phpt ext/mysql/php_mysql.c ext/mysqli/mysqli.c ext/mysqlnd/mysqlnd_reverse_api.c ext/mysqlnd/php_mysqlnd.c ext/opcache/ZendAccelerator.c ext/opcache/zend_accelerator_util_funcs.c ext/opcache/zend_persist.c ext/opcache/zend_persist_calc.c ext/pcre/php_pcre.c ext/pdo/pdo_dbh.c ext/pdo/pdo_stmt.c ext/pdo_pgsql/pgsql_driver.c ext/pgsql/pgsql.c ext/reflection/php_reflection.c ext/session/session.c ext/spl/spl_array.c ext/spl/spl_observer.c ext/standard/array.c ext/standard/basic_functions.c ext/standard/html.c ext/standard/mail.c ext/standard/php_array.h ext/standard/proc_open.c ext/standard/streamsfuncs.c ext/standard/user_filters.c ext/standard/var_unserializer.c ext/standard/var_unserializer.re main/php_variables.c sapi/phpdbg/phpdbg.c sapi/phpdbg/phpdbg_bp.c sapi/phpdbg/phpdbg_frame.c sapi/phpdbg/phpdbg_help.c sapi/phpdbg/phpdbg_list.c sapi/phpdbg/phpdbg_print.c sapi/phpdbg/phpdbg_prompt.c
Diffstat (limited to 'ext/standard/tests')
-rw-r--r--ext/standard/tests/array/bug67064.phpt17
-rw-r--r--ext/standard/tests/file/bug65701.phpt30
-rw-r--r--ext/standard/tests/general_functions/bug44487.phpt24
-rw-r--r--ext/standard/tests/general_functions/call_user_method.phpt20
-rw-r--r--ext/standard/tests/general_functions/call_user_method_002.phpt12
-rw-r--r--ext/standard/tests/image/getimagesize.phpt17
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type.phpt4
-rw-r--r--ext/standard/tests/image/test-1pix.bmpbin0 -> 58 bytes
-rw-r--r--ext/standard/tests/mail/bug66535.phpt43
-rw-r--r--ext/standard/tests/math/bug45712.phpt4
-rw-r--r--ext/standard/tests/math/pow-operator.phpt22
-rw-r--r--ext/standard/tests/math/pow_variation1.phpt2
-rw-r--r--ext/standard/tests/math/pow_variation1_64bit.phpt4
-rw-r--r--ext/standard/tests/math/pow_variation2.phpt4
-rw-r--r--ext/standard/tests/math/tan_basiclong_64bit.phpt37
-rw-r--r--ext/standard/tests/network/bug64330.phpt21
-rw-r--r--ext/standard/tests/serialize/005.phpt8
-rw-r--r--ext/standard/tests/serialize/bug67072.phpt12
-rw-r--r--ext/standard/tests/streams/bug60602.phpt57
-rw-r--r--ext/standard/tests/streams/bug61019.phpt78
-rw-r--r--ext/standard/tests/strings/bug33605.phpt4
-rw-r--r--ext/standard/tests/strings/default_charset.phpt104
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic5.phpt9
-rw-r--r--ext/standard/tests/strings/htmlentities_html5.phpt3
-rw-r--r--ext/standard/tests/strings/substr_compare.phpt9
-rw-r--r--ext/standard/tests/url/parse_url_basic_001.phpt7
-rw-r--r--ext/standard/tests/url/parse_url_basic_002.phpt1
-rw-r--r--ext/standard/tests/url/parse_url_basic_003.phpt1
-rw-r--r--ext/standard/tests/url/parse_url_basic_004.phpt1
-rw-r--r--ext/standard/tests/url/parse_url_basic_005.phpt1
-rw-r--r--ext/standard/tests/url/parse_url_basic_006.phpt1
-rw-r--r--ext/standard/tests/url/parse_url_basic_007.phpt1
-rw-r--r--ext/standard/tests/url/parse_url_basic_008.phpt1
-rw-r--r--ext/standard/tests/url/parse_url_basic_009.phpt1
-rw-r--r--ext/standard/tests/url/urls.inc1
35 files changed, 466 insertions, 95 deletions
diff --git a/ext/standard/tests/array/bug67064.phpt b/ext/standard/tests/array/bug67064.phpt
new file mode 100644
index 0000000000..2818516dac
--- /dev/null
+++ b/ext/standard/tests/array/bug67064.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #67064 (Countable interface prevents using 2nd parameter ($mode) of count() function)
+--FILE--
+<?php
+class Counter implements Countable {
+ public function count($mode = COUNT_NORMAL) {
+ var_dump($mode == COUNT_RECURSIVE);
+ return 1;
+ }
+}
+
+$counter = new Counter;
+var_dump(count($counter, COUNT_RECURSIVE));
+?>
+--EXPECTF--
+bool(true)
+int(1)
diff --git a/ext/standard/tests/file/bug65701.phpt b/ext/standard/tests/file/bug65701.phpt
new file mode 100644
index 0000000000..2b1b5d491d
--- /dev/null
+++ b/ext/standard/tests/file/bug65701.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test for bug #65701: copy() doesn't work when destination filename is created by tempnam()
+--CREDITS--
+Boro Sitnikovski <buritomath@yahoo.com>
+--FILE--
+<?php
+$file_path = dirname(__FILE__) . "/bug65701/";
+
+mkdir($file_path);
+
+$src = $file_path . '/srcbug65701_file.txt';
+$dst = tempnam($file_path, 'dstbug65701_file.txt');
+
+file_put_contents($src, "Hello World");
+
+copy($src, $dst);
+var_dump(filesize($dst));
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__) . "/bug65701/";
+foreach (scandir($file_path) as $file) {
+ if (strpos($file, "bug65701") !== false) {
+ unlink($file_path . $file);
+ }
+}
+rmdir($file_path);
+?>
+--EXPECT--
+int(11)
diff --git a/ext/standard/tests/general_functions/bug44487.phpt b/ext/standard/tests/general_functions/bug44487.phpt
deleted file mode 100644
index 10c52c6b3f..0000000000
--- a/ext/standard/tests/general_functions/bug44487.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #44487 (call_user_method_array issues a warning when throwing an exception)
---INI--
-error_reporting = E_ALL & ~E_DEPRECATED
---FILE--
-<?php
-
-class Foo
-{
- public function test()
- {
- print 'test';
- throw new Exception();
- }
-}
-
-try {
- $bar = new Foo();
- call_user_method_array('test', $bar, array()) ;
-} catch (Exception $e) {
-}
-?>
---EXPECT--
-test
diff --git a/ext/standard/tests/general_functions/call_user_method.phpt b/ext/standard/tests/general_functions/call_user_method.phpt
deleted file mode 100644
index cc54ff9544..0000000000
--- a/ext/standard/tests/general_functions/call_user_method.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Basic behaviour of call_user_method() test
---CREDITS--
-Sebastian Schürmann
-sebs@php.net
-Testfest 2009 Munich
---FILE--
-<?php
-class a {
- static function b() {
- return true;
- }
-}
-$a = new a();
-$res = call_user_method('b', $a);
-var_dump($res);
-?>
---EXPECTF--
-Deprecated: Function call_user_method() is deprecated in %s on line 8
-bool(true)
diff --git a/ext/standard/tests/general_functions/call_user_method_002.phpt b/ext/standard/tests/general_functions/call_user_method_002.phpt
deleted file mode 100644
index 054bc3edeb..0000000000
--- a/ext/standard/tests/general_functions/call_user_method_002.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-call_user_method() Invalid free
---FILE--
-<?php
-
-call_user_method("1", $arr1);
-
-?>
---EXPECTF--
-Deprecated: Function call_user_method() is deprecated in %s on line %d
-
-Warning: call_user_method(): Second argument is not an object or class name in %s on line %d
diff --git a/ext/standard/tests/image/getimagesize.phpt b/ext/standard/tests/image/getimagesize.phpt
index 6cd8275e06..04ddd8c82b 100644
--- a/ext/standard/tests/image/getimagesize.phpt
+++ b/ext/standard/tests/image/getimagesize.phpt
@@ -23,7 +23,22 @@ GetImageSize()
var_dump($result);
?>
--EXPECT--
-array(12) {
+array(13) {
+ ["test-1pix.bmp"]=>
+ array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(6)
+ [3]=>
+ string(20) "width="1" height="1""
+ ["bits"]=>
+ int(24)
+ ["mime"]=>
+ string(14) "image/x-ms-bmp"
+ }
["test1bpix.bmp"]=>
array(6) {
[0]=>
diff --git a/ext/standard/tests/image/image_type_to_mime_type.phpt b/ext/standard/tests/image/image_type_to_mime_type.phpt
index d83ab8d146..9f7ffa1aa3 100644
--- a/ext/standard/tests/image/image_type_to_mime_type.phpt
+++ b/ext/standard/tests/image/image_type_to_mime_type.phpt
@@ -25,7 +25,9 @@ image_type_to_mime_type()
var_dump($result);
?>
--EXPECT--
-array(12) {
+array(13) {
+ ["test-1pix.bmp"]=>
+ string(14) "image/x-ms-bmp"
["test1bpix.bmp"]=>
string(14) "image/x-ms-bmp"
["test1pix.bmp"]=>
diff --git a/ext/standard/tests/image/test-1pix.bmp b/ext/standard/tests/image/test-1pix.bmp
new file mode 100644
index 0000000000..ec68a571cc
--- /dev/null
+++ b/ext/standard/tests/image/test-1pix.bmp
Binary files differ
diff --git a/ext/standard/tests/mail/bug66535.phpt b/ext/standard/tests/mail/bug66535.phpt
new file mode 100644
index 0000000000..db1f449cb6
--- /dev/null
+++ b/ext/standard/tests/mail/bug66535.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Bug #66535: Extra newline if add_x_header and no additional headers are used
+--INI--
+sendmail_path=tee mailBasic.out >/dev/null
+mail.add_x_header = On
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Won't run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mail() : send email without additional headers ***\n";
+
+// Initialise all required variables
+$to = 'user@company.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+
+$outFile = "mailBasic.out";
+@unlink($outFile);
+
+var_dump( mail($to, $subject, $message) );
+echo file_get_contents($outFile);
+unlink($outFile);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mail() : send email without additional headers ***
+bool(true)
+To: user@company.com
+Subject: Test Subject
+X-PHP-Originating-Script: %d:bug66535.php
+
+A Message
+===DONE===
diff --git a/ext/standard/tests/math/bug45712.phpt b/ext/standard/tests/math/bug45712.phpt
index e10d0e7ec3..2aa4386587 100644
--- a/ext/standard/tests/math/bug45712.phpt
+++ b/ext/standard/tests/math/bug45712.phpt
@@ -1,7 +1,5 @@
--TEST--
Bug #45712 (NaN/INF comparison)
---XFAIL--
-Bug 45712 not fixed yet.
--FILE--
<?php
@@ -66,7 +64,7 @@ bool(false)
bool(false)
bool(false)
bool(false)
-bool(false)
+bool(true)
bool(false)
bool(false)
bool(false)
diff --git a/ext/standard/tests/math/pow-operator.phpt b/ext/standard/tests/math/pow-operator.phpt
new file mode 100644
index 0000000000..f80cae1962
--- /dev/null
+++ b/ext/standard/tests/math/pow-operator.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Various pow() tests
+--FILE--
+<?php // $Id$
+
+$x = 2;
+$x **= 3;
+
+$tests = <<<TESTS
+ -3 ** 2 === -9
+ (-3) **2 === 9
+ 2 ** 3 ** 2 === 512
+ (2 ** 3) ** 2 === 64
+ $x === 8
+TESTS;
+
+ echo "On failure, please mail result to php-dev@lists.php.net\n";
+ include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
+
+--EXPECT--
+On failure, please mail result to php-dev@lists.php.net
+OK
diff --git a/ext/standard/tests/math/pow_variation1.phpt b/ext/standard/tests/math/pow_variation1.phpt
index df511906b0..5576e5b493 100644
--- a/ext/standard/tests/math/pow_variation1.phpt
+++ b/ext/standard/tests/math/pow_variation1.phpt
@@ -149,7 +149,7 @@ int(0)
int(0)
-- Iteration 19 --
-float(0)
+int(0)
-- Iteration 20 --
int(0)
diff --git a/ext/standard/tests/math/pow_variation1_64bit.phpt b/ext/standard/tests/math/pow_variation1_64bit.phpt
index 24b482680b..e1986ba858 100644
--- a/ext/standard/tests/math/pow_variation1_64bit.phpt
+++ b/ext/standard/tests/math/pow_variation1_64bit.phpt
@@ -149,7 +149,7 @@ int(0)
int(0)
-- Iteration 19 --
-float(0)
+int(0)
-- Iteration 20 --
int(0)
@@ -173,4 +173,4 @@ int(0)
-- Iteration 26 --
%s
-===Done=== \ No newline at end of file
+===Done===
diff --git a/ext/standard/tests/math/pow_variation2.phpt b/ext/standard/tests/math/pow_variation2.phpt
index b1800bb15f..f571936727 100644
--- a/ext/standard/tests/math/pow_variation2.phpt
+++ b/ext/standard/tests/math/pow_variation2.phpt
@@ -145,7 +145,7 @@ float(1)
float(1)
-- Iteration 19 --
-float(1)
+int(1)
-- Iteration 20 --
float(1)
@@ -169,4 +169,4 @@ float(1)
-- Iteration 26 --
%s
-===Done=== \ No newline at end of file
+===Done===
diff --git a/ext/standard/tests/math/tan_basiclong_64bit.phpt b/ext/standard/tests/math/tan_basiclong_64bit.phpt
index 8ab083d500..3c8abe9d27 100644
--- a/ext/standard/tests/math/tan_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/tan_basiclong_64bit.phpt
@@ -1,5 +1,7 @@
--TEST--
Test tan function : 64bit long tests
+--INI--
+precision=5
--SKIPIF--
<?php
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
@@ -28,33 +30,34 @@ foreach ($longVals as $longVal) {
===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
-float(84.739312968756)
+float(84.739)
--- testing: -9223372036854775808 ---
-float(-84.739312968756)
+float(-84.739)
--- testing: 2147483647 ---
-float(1.0523779637351)
+float(1.0524)
--- testing: -2147483648 ---
-float(4.0842894552986)
+float(4.0843)
--- testing: 9223372034707292160 ---
-float(-0.25738520049439)
+float(-0.25739)
--- testing: -9223372034707292160 ---
-float(0.25738520049439)
+float(0.25739)
--- testing: 2147483648 ---
-float(-4.0842894552986)
+float(-4.0843)
--- testing: -2147483649 ---
-float(0.34328416030117)
+float(0.34328)
--- testing: 4294967294 ---
-float(-19.579238091943)
+float(-19.579)
--- testing: 4294967295 ---
-float(-0.57225137018055)
+float(-0.57225)
--- testing: 4294967293 ---
-float(0.71667000824652)
+float(0.71667)
--- testing: 9223372036854775806 ---
-float(84.739312968756)
---- testing: 9.2233720368548E+18 ---
-float(84.739312968756)
+float(84.739)
+--- testing: 9.2234E+18 ---
+float(84.739)
--- testing: -9223372036854775807 ---
-float(-84.739312968756)
---- testing: -9.2233720368548E+18 ---
-float(-84.739312968756)
+float(-84.739)
+--- testing: -9.2234E+18 ---
+float(-84.739)
===DONE===
+
diff --git a/ext/standard/tests/network/bug64330.phpt b/ext/standard/tests/network/bug64330.phpt
new file mode 100644
index 0000000000..e5653e7459
--- /dev/null
+++ b/ext/standard/tests/network/bug64330.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #64330 (stream_socket_server() creates wrong Abstract Namespace UNIX sockets)
+--SKIPIF--
+<?php
+if (!in_array("unix", stream_get_transports())) die("SKIP unix domain sockets unavailable");
+if (!stristr(PHP_OS, "Linux")) die('skip abstract namespace is a Linux-only feature');
+?>
+--FILE--
+<?php
+echo "Test\n";
+$server = stream_socket_server("unix://\x00/MyBindName");
+$client = stream_socket_client("unix://\x00/MyBindName");
+if ($client) {
+ echo "ok\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test
+ok
+===DONE===
diff --git a/ext/standard/tests/serialize/005.phpt b/ext/standard/tests/serialize/005.phpt
index e7b23db701..2df270154d 100644
--- a/ext/standard/tests/serialize/005.phpt
+++ b/ext/standard/tests/serialize/005.phpt
@@ -156,9 +156,11 @@ object(TestNAOld)#%d (0) {
}
===NANew===
unserializer(TestNANew)
-TestNew::__wakeup()
-object(TestNANew)#%d (0) {
-}
+
+Warning: Erroneous data format for unserializing 'TestNANew' in %s005.php on line %d
+
+Notice: unserialize(): Error at offset 19 of 20 bytes in %s005.php on line %d
+bool(false)
===NANew2===
unserializer(TestNANew2)
TestNew::unserialize()
diff --git a/ext/standard/tests/serialize/bug67072.phpt b/ext/standard/tests/serialize/bug67072.phpt
new file mode 100644
index 0000000000..951db75a07
--- /dev/null
+++ b/ext/standard/tests/serialize/bug67072.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #67072 Echoing unserialized "SplFileObject" crash
+--FILE--
+<?php
+ echo unserialize('O:13:"SplFileObject":1:{s:9:"*filename";s:15:"/home/flag/flag";}');
+?>
+===DONE==
+--EXPECTF--
+Warning: Erroneous data format for unserializing 'SplFileObject' in %sbug67072.php on line %d
+
+Notice: unserialize(): Error at offset 24 of 64 bytes in %sbug67072.php on line %d
+===DONE==
diff --git a/ext/standard/tests/streams/bug60602.phpt b/ext/standard/tests/streams/bug60602.phpt
new file mode 100644
index 0000000000..2c08ce87b7
--- /dev/null
+++ b/ext/standard/tests/streams/bug60602.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Bug #60602 proc_open() modifies environment if it contains arrays
+--FILE--
+<?php
+
+$descs = array(
+ 0 => array('pipe', 'r'), // stdin
+ 1 => array('pipe', 'w'), // stdout
+ 2 => array('pipe', 'w'), // strerr
+);
+
+$environment = array('test' => array(1, 2, 3));
+
+$cmd = (substr(PHP_OS, 0, 3) == 'WIN') ? 'dir' : 'ls';
+$p = proc_open($cmd, $descs, $pipes, '.', $environment);
+
+if (is_resource($p)) {
+ $data = '';
+
+ while (1) {
+ $w = $e = NULL;
+ $n = stream_select($pipes, $w, $e, 300);
+
+ if ($n === false) {
+ echo "no streams \n";
+ break;
+ } else if ($n === 0) {
+ echo "process timed out\n";
+ proc_terminate($p, 9);
+ break;
+ } else if ($n > 0) {
+ $line = fread($pipes[1], 8192);
+ if (strlen($line) == 0) {
+ /* EOF */
+ break;
+ }
+ $data .= $line;
+ }
+ }
+ var_dump(strlen($data));
+
+ $ret = proc_close($p);
+ var_dump($ret);
+ var_dump(is_array($environment['test']));
+} else {
+ echo "no process\n";
+}
+?>
+==DONE==
+--EXPECTF--
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(%d)
+int(0)
+bool(true)
+==DONE==
diff --git a/ext/standard/tests/streams/bug61019.phpt b/ext/standard/tests/streams/bug61019.phpt
new file mode 100644
index 0000000000..45b207ea9e
--- /dev/null
+++ b/ext/standard/tests/streams/bug61019.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Bug #61019 (Out of memory on command stream_get_contents)
+--FILE--
+<?php
+
+echo "Test\n";
+
+$descriptorspec = array(
+ 0 => array("pipe", "r"), // stdin is a pipe that the child will read from
+ 1 => array("pipe", "w"), // stdout is a pipe that the child will write to
+ 2 => array("pipe", "w") // stderr is a pipe that the child will write to
+);
+
+$process=proc_open("echo testtext",$descriptorspec,$pipes);
+if(is_resource($process))
+{
+ stream_set_blocking($pipes[0],false);
+ stream_set_blocking($pipes[1],false);
+ stream_set_blocking($pipes[2],false);
+ stream_set_write_buffer($pipes[0],0);
+ stream_set_read_buffer($pipes[1],0);
+ stream_set_read_buffer($pipes[2],0);
+ $stdin_stream="";
+ $stderr_stream="";
+
+ echo "External command executed\n";
+ do
+ {
+ $process_state=proc_get_status($process);
+ $tmp_stdin=stream_get_contents($pipes[1]);
+ if($tmp_stdin)
+ {
+ $stdin_stream=$stdin_stream.$tmp_stdin;
+ }
+ $tmp_stderr=stream_get_contents($pipes[2]);
+ if($tmp_stderr)
+ {
+ $stderr_stream=$stderr_stream.$tmp_stderr;
+ }
+ } while($process_state['running']);
+
+ echo "External command exit: ".$process_state['exitcode']."\n";
+
+ //read outstanding data
+ $tmp_stdin=stream_get_contents($pipes[1]);
+ if($tmp_stdin)
+ {
+ $stdin_stream=$stdin_stream.$tmp_stdin;
+ }
+ $tmp_stderr=stream_get_contents($pipes[2]);
+ if($tmp_stderr)
+ {
+ $stderr_stream=$stderr_stream.$tmp_stderr;
+ }
+
+ fclose ($pipes[0]);
+ fclose ($pipes[1]);
+ fclose ($pipes[2]);
+
+ proc_close($process);
+
+ echo "STDOUT: ".$stdin_stream."\n";
+ echo "STDERR: ".$stderr_stream."\n";
+}
+else
+{
+ echo "Can't start external command\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test
+External command executed
+External command exit: 0
+STDOUT: testtext
+
+STDERR:
+===DONE===
diff --git a/ext/standard/tests/strings/bug33605.phpt b/ext/standard/tests/strings/bug33605.phpt
index f0c49eb18f..7ba38f94f5 100644
--- a/ext/standard/tests/strings/bug33605.phpt
+++ b/ext/standard/tests/strings/bug33605.phpt
@@ -2,10 +2,10 @@
Bug #33605 (substr_compare crashes)
--FILE--
<?php
-$res = substr_compare("aa", "a", -99999999, 0, 0);
+$res = substr_compare("aa", "a", -99999999, -1, 0);
var_dump($res);
?>
--EXPECTF--
-Warning: substr_compare(): The length must be greater than zero in %s on line %d
+Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d
bool(false)
diff --git a/ext/standard/tests/strings/default_charset.phpt b/ext/standard/tests/strings/default_charset.phpt
new file mode 100644
index 0000000000..3665132413
--- /dev/null
+++ b/ext/standard/tests/strings/default_charset.phpt
@@ -0,0 +1,104 @@
+--TEST--
+default_charset and htmlentities/htmlspecialchars/html_entity_decode
+--INI--
+default_charset=UTF-8
+internal_encoding=
+input_encoding=
+output_encoding=
+--FILE--
+<?php
+echo "*** Default php.ini value ***\n";
+var_dump(ini_get('default_charset'),
+ ini_get('internal_encoding'),
+ ini_get('input_encoding'),
+ ini_get('output_encoding')
+ );
+
+
+echo "*** Runtime change of default_charset ***\n";
+var_dump(ini_set('default_charset', 'cp1252'));
+
+echo "*** Test with updated default_charset ***\n";
+var_dump(ini_get('default_charset'),
+ ini_get('internal_encoding'),
+ ini_get('input_encoding'),
+ ini_get('output_encoding')
+ );
+
+var_dump(htmlentities("\xA3", ENT_HTML5));
+var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252'));
+
+var_dump(bin2hex(html_entity_decode("&pound;", ENT_HTML5)));
+var_dump(bin2hex(html_entity_decode("&pound;", ENT_HTML5, 'cp1252')));
+
+// Set internal_encoding to empty and try again
+echo "*** Change internal_encoding to empty ***\n";
+var_dump(ini_set('internal_encoding', ''));
+var_dump(ini_get('default_charset'),
+ ini_get('internal_encoding'),
+ ini_get('input_encoding'),
+ ini_get('output_encoding')
+ );
+
+var_dump(htmlentities("\xA3", ENT_HTML5));
+var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252'));
+var_dump(bin2hex(html_entity_decode("&pound;", ENT_HTML5)));
+var_dump(bin2hex(html_entity_decode("&pound;", ENT_HTML5, 'cp1252')));
+
+echo "*** Update input/output_encoding ***\n";
+var_dump(ini_set('input_encoding', 'ISO-8859-1'));
+var_dump(ini_set('output_encoding', 'ISO-8859-1'));
+var_dump(ini_get('default_charset'),
+ ini_get('internal_encoding'),
+ ini_get('input_encoding'),
+ ini_get('output_encoding')
+ );
+
+// Should not be affected
+var_dump(htmlentities("\xA3", ENT_HTML5));
+var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252'));
+var_dump(bin2hex(html_entity_decode("&pound;", ENT_HTML5)));
+var_dump(bin2hex(html_entity_decode("&pound;", ENT_HTML5, 'cp1252')));
+
+echo "Done\n";
+
+?>
+--EXPECT--
+*** Default php.ini value ***
+string(5) "UTF-8"
+string(0) ""
+string(0) ""
+string(0) ""
+*** Runtime change of default_charset ***
+string(5) "UTF-8"
+*** Test with updated default_charset ***
+string(6) "cp1252"
+string(0) ""
+string(0) ""
+string(0) ""
+string(7) "&pound;"
+string(7) "&pound;"
+string(2) "a3"
+string(2) "a3"
+*** Change internal_encoding to empty ***
+string(0) ""
+string(6) "cp1252"
+string(0) ""
+string(0) ""
+string(0) ""
+string(7) "&pound;"
+string(7) "&pound;"
+string(2) "a3"
+string(2) "a3"
+*** Update input/output_encoding ***
+string(0) ""
+string(0) ""
+string(6) "cp1252"
+string(0) ""
+string(10) "ISO-8859-1"
+string(10) "ISO-8859-1"
+string(7) "&pound;"
+string(7) "&pound;"
+string(2) "a3"
+string(2) "a3"
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic5.phpt b/ext/standard/tests/strings/get_html_translation_table_basic5.phpt
index 600ad43635..c7a9622fb7 100644
--- a/ext/standard/tests/strings/get_html_translation_table_basic5.phpt
+++ b/ext/standard/tests/strings/get_html_translation_table_basic5.phpt
@@ -46,7 +46,7 @@ echo "Done\n";
--EXPECT--
*** Testing get_html_translation_table() : basic functionality/HTML 5 ***
-- with table = HTML_ENTITIES, ENT_COMPAT --
-int(1509)
+int(1510)
Array
(
[Æ] => &AElig;
@@ -1108,6 +1108,7 @@ Array
[⋾] => &notnivb;
[⋽] => &notnivc;
[∦] => &nparallel;
+ [⫽⃥] => &nparsl
[∂̸] => &npart
[⨔] => &npolint;
[⊀] => &npr;
@@ -1196,6 +1197,7 @@ Array
[⌽] => &ovbar;
[¶] => &para;
[⫳] => &parsim;
+ [⫽] => &parsl;
[∂] => &part;
[п] => &pcy;
[%] => &percnt;
@@ -1500,7 +1502,6 @@ Array
[⦜] => &vangrt;
[ϰ] => &varkappa;
[⫌︀] => &varsupsetneqq
- [⫽︀] => &varsupsetneqq
[⊲] => &vartriangleleft;
[в] => &vcy;
[⊢] => &vdash;
@@ -1561,9 +1562,9 @@ Array
[‌] => &zwnj;
)
-- with table = HTML_ENTITIES, ENT_QUOTES --
-int(1510)
+int(1511)
-- with table = HTML_ENTITIES, ENT_NOQUOTES --
-int(1508)
+int(1509)
-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
int(4)
Array
diff --git a/ext/standard/tests/strings/htmlentities_html5.phpt b/ext/standard/tests/strings/htmlentities_html5.phpt
index 1f3409723e..e7c216a292 100644
--- a/ext/standard/tests/strings/htmlentities_html5.phpt
+++ b/ext/standard/tests/strings/htmlentities_html5.phpt
@@ -1418,6 +1418,7 @@ foreach ($mpcent as $i) {
&topcir; U+02AF1
&nhpar; U+02AF2
&parsim; U+02AF3
+&parsl; U+02AFD
&fflig; U+0FB00
&filig; U+0FB01
&fllig; U+0FB02
@@ -1620,4 +1621,4 @@ foreach ($mpcent as $i) {
&nsupseteqq; U+02AC6 U+00338
&vsubnE; U+02ACB U+0FE00
&varsupsetneqq; U+02ACC U+0FE00
-&varsupsetneqq; U+02AFD U+0FE00
+&parsl;︀ U+02AFD U+0FE00 \ No newline at end of file
diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt
index c647506b53..1896f3cacc 100644
--- a/ext/standard/tests/strings/substr_compare.phpt
+++ b/ext/standard/tests/strings/substr_compare.phpt
@@ -3,6 +3,7 @@ substr_compare()
--FILE--
<?php
+var_dump(substr_compare("abcde", "df", -2) < 0);
var_dump(substr_compare("abcde", "bc", 1, 2));
var_dump(substr_compare("abcde", "bcg", 1, 2));
var_dump(substr_compare("abcde", "BC", 1, 2, true));
@@ -10,15 +11,17 @@ var_dump(substr_compare("abcde", "bc", 1, 3));
var_dump(substr_compare("abcde", "cd", 1, 2));
var_dump(substr_compare("abcde", "abc", 5, 1));
var_dump(substr_compare("abcde", "abcdef", -10, 10));
-
+var_dump(substr_compare("abcde", "abc", 0, 0));
var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass));
echo "Test\n";
+var_dump(substr_compare("abcde", "abc", 0, -1));
var_dump(substr_compare("abcde", "abc", -1, NULL, -5));
var_dump(substr_compare("abcde", -1, 0, "str", new stdClass));
echo "Done\n";
?>
--EXPECTF--
+bool(true)
int(0)
int(0)
int(0)
@@ -28,13 +31,15 @@ int(-1)
Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
bool(false)
int(-1)
+int(0)
Warning: substr_compare() expects parameter 5 to be boolean, object given in %s on line %d
bool(false)
Test
-Warning: substr_compare(): The length must be greater than zero in %s on line %d
+Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d
bool(false)
+int(0)
Warning: substr_compare() expects parameter 4 to be long, string given in %s on line %d
bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt
index 4c5b0944c6..a6f4f7a252 100644
--- a/ext/standard/tests/url/parse_url_basic_001.phpt
+++ b/ext/standard/tests/url/parse_url_basic_001.phpt
@@ -845,6 +845,13 @@ echo "Done";
string(1) "/"
}
+--> /rest/Users?filter={"id":"123"}: array(2) {
+ ["path"]=>
+ string(11) "/rest/Users"
+ ["query"]=>
+ string(19) "filter={"id":"123"}"
+}
+
--> http:///blah.com: bool(false)
--> http://:80: bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt
index ed0f08a84f..c05d1f487a 100644
--- a/ext/standard/tests/url/parse_url_basic_002.phpt
+++ b/ext/standard/tests/url/parse_url_basic_002.phpt
@@ -110,6 +110,7 @@ echo "Done";
--> http://[x:80]/ : string(4) "http"
--> : NULL
--> / : NULL
+--> /rest/Users?filter={"id":"123"} : NULL
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt
index a2bbfa6482..88eda504d5 100644
--- a/ext/standard/tests/url/parse_url_basic_003.phpt
+++ b/ext/standard/tests/url/parse_url_basic_003.phpt
@@ -109,6 +109,7 @@ echo "Done";
--> http://[x:80]/ : string(6) "[x:80]"
--> : NULL
--> / : NULL
+--> /rest/Users?filter={"id":"123"} : NULL
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt
index 839ebee554..e3b9abd91c 100644
--- a/ext/standard/tests/url/parse_url_basic_004.phpt
+++ b/ext/standard/tests/url/parse_url_basic_004.phpt
@@ -109,6 +109,7 @@ echo "Done";
--> http://[x:80]/ : NULL
--> : NULL
--> / : NULL
+--> /rest/Users?filter={"id":"123"} : NULL
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt
index c113461fe7..1fc946e5b3 100644
--- a/ext/standard/tests/url/parse_url_basic_005.phpt
+++ b/ext/standard/tests/url/parse_url_basic_005.phpt
@@ -109,6 +109,7 @@ echo "Done";
--> http://[x:80]/ : NULL
--> : NULL
--> / : NULL
+--> /rest/Users?filter={"id":"123"} : NULL
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt
index 24de1cc233..5104326198 100644
--- a/ext/standard/tests/url/parse_url_basic_006.phpt
+++ b/ext/standard/tests/url/parse_url_basic_006.phpt
@@ -109,6 +109,7 @@ echo "Done";
--> http://[x:80]/ : NULL
--> : NULL
--> / : NULL
+--> /rest/Users?filter={"id":"123"} : NULL
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_007.phpt b/ext/standard/tests/url/parse_url_basic_007.phpt
index d4006879f4..8e04553983 100644
--- a/ext/standard/tests/url/parse_url_basic_007.phpt
+++ b/ext/standard/tests/url/parse_url_basic_007.phpt
@@ -109,6 +109,7 @@ echo "Done";
--> http://[x:80]/ : string(1) "/"
--> : string(0) ""
--> / : string(1) "/"
+--> /rest/Users?filter={"id":"123"} : string(11) "/rest/Users"
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_008.phpt b/ext/standard/tests/url/parse_url_basic_008.phpt
index b283829c46..0c77221465 100644
--- a/ext/standard/tests/url/parse_url_basic_008.phpt
+++ b/ext/standard/tests/url/parse_url_basic_008.phpt
@@ -109,6 +109,7 @@ echo "Done";
--> http://[x:80]/ : NULL
--> : NULL
--> / : NULL
+--> /rest/Users?filter={"id":"123"} : string(19) "filter={"id":"123"}"
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_009.phpt b/ext/standard/tests/url/parse_url_basic_009.phpt
index a7d70f34da..487b271149 100644
--- a/ext/standard/tests/url/parse_url_basic_009.phpt
+++ b/ext/standard/tests/url/parse_url_basic_009.phpt
@@ -109,6 +109,7 @@ echo "Done";
--> http://[x:80]/ : NULL
--> : NULL
--> / : NULL
+--> /rest/Users?filter={"id":"123"} : NULL
--> http:///blah.com : bool(false)
--> http://:80 : bool(false)
--> http://user@:80 : bool(false)
diff --git a/ext/standard/tests/url/urls.inc b/ext/standard/tests/url/urls.inc
index 4192f4a869..d8ffe91378 100644
--- a/ext/standard/tests/url/urls.inc
+++ b/ext/standard/tests/url/urls.inc
@@ -89,6 +89,7 @@ $urls = array(
'http://[x:80]/',
'',
'/',
+'/rest/Users?filter={"id":"123"}',
// Severely malformed URLs that do not parse:
'http:///blah.com',