diff options
Diffstat (limited to 'tests')
45 files changed, 534 insertions, 191 deletions
diff --git a/tests/basic/precision.phpt b/tests/basic/precision.phpt new file mode 100644 index 0000000000..173b94701e --- /dev/null +++ b/tests/basic/precision.phpt @@ -0,0 +1,164 @@ +--TEST-- +precision setting test +--INI-- +precision=14 +serialize_precision=17 +--FILE-- +<?php +$v = array(123456789.012345678901234567890, 10/3, 987e100, 10.0000001); + +echo "INI".PHP_EOL; +ini_set('precision', -1); +ini_set('serialize_precision', -1); +echo ini_get('precision'), PHP_EOL; +echo ini_get('serialize_precision'), PHP_EOL; +echo "OUTPUTS".PHP_EOL; +echo join($v, ' ').PHP_EOL; +var_dump(serialize($v)); +var_export($v);echo PHP_EOL; + + +echo "INI".PHP_EOL; +ini_set('precision', 0); +ini_set('serialize_precision', 0); +echo ini_get('precision'), PHP_EOL; +echo ini_get('serialize_precision'), PHP_EOL; +echo "OUTPUTS".PHP_EOL; +echo join($v, ' ').PHP_EOL; +var_dump(serialize($v)); +var_export($v);echo PHP_EOL; + +echo "INI".PHP_EOL; +ini_set('precision', 9); +ini_set('serialize_precision', 9); +echo ini_get('precision'), PHP_EOL; +echo ini_get('serialize_precision'), PHP_EOL; +echo "OUTPUTS".PHP_EOL; +echo join($v, ' ').PHP_EOL; +var_dump(serialize($v)); +var_export($v);echo PHP_EOL; + +echo "INI".PHP_EOL; +ini_set('precision', 14); +ini_set('serialize_precision', 14); +echo ini_get('precision'), PHP_EOL; +echo ini_get('serialize_precision'), PHP_EOL; +echo "OUTPUTS".PHP_EOL; +echo join($v, ' ').PHP_EOL; +var_dump(serialize($v)); +var_export($v);echo PHP_EOL; + +echo "INI".PHP_EOL; +ini_set('precision', 17); +ini_set('serialize_precision', 17); +echo ini_get('precision'), PHP_EOL; +echo ini_get('serialize_precision'), PHP_EOL; +echo "OUTPUTS".PHP_EOL; +echo join($v, ' ').PHP_EOL; +var_dump(serialize($v)); +var_export($v);echo PHP_EOL; + +echo "INI".PHP_EOL; +ini_set('precision', 25); +ini_set('serialize_precision', 25); +echo ini_get('precision'), PHP_EOL; +echo ini_get('serialize_precision'), PHP_EOL; +echo "OUTPUTS".PHP_EOL; +echo join($v, ' ').PHP_EOL; +var_dump(serialize($v)); +var_export($v);echo PHP_EOL; + +echo "INI".PHP_EOL; +ini_set('precision', 100); +ini_set('serialize_precision', 100); +echo ini_get('precision'), PHP_EOL; +echo ini_get('serialize_precision'), PHP_EOL; +echo "OUTPUTS".PHP_EOL; +echo join($v, ' ').PHP_EOL; +var_dump(serialize($v)); +var_export($v);echo PHP_EOL; +--EXPECT-- +INI +-1 +-1 +OUTPUTS +123456789.01234567 3.3333333333333335 9.87E+102 10.0000001 +string(89) "a:4:{i:0;d:123456789.01234567;i:1;d:3.3333333333333335;i:2;d:9.87E+102;i:3;d:10.0000001;}" +array ( + 0 => 123456789.01234567, + 1 => 3.3333333333333335, + 2 => 9.87E+102, + 3 => 10.0000001, +) +INI +0 +0 +OUTPUTS +1.0E+8 3 1.0E+103 1.0E+1 +string(60) "a:4:{i:0;d:1.0E+8;i:1;d:3.0E+0;i:2;d:1.0E+103;i:3;d:1.0E+1;}" +array ( + 0 => 1.0E+8, + 1 => 3.0E+0, + 2 => 1.0E+103, + 3 => 1.0E+1, +) +INI +9 +9 +OUTPUTS +123456789 3.33333333 9.87E+102 10.0000001 +string(72) "a:4:{i:0;d:123456789;i:1;d:3.33333333;i:2;d:9.87E+102;i:3;d:10.0000001;}" +array ( + 0 => 123456789.0, + 1 => 3.33333333, + 2 => 9.87E+102, + 3 => 10.0000001, +) +INI +14 +14 +OUTPUTS +123456789.01235 3.3333333333333 9.87E+102 10.0000001 +string(83) "a:4:{i:0;d:123456789.01235;i:1;d:3.3333333333333;i:2;d:9.87E+102;i:3;d:10.0000001;}" +array ( + 0 => 123456789.01235, + 1 => 3.3333333333333, + 2 => 9.87E+102, + 3 => 10.0000001, +) +INI +17 +17 +OUTPUTS +123456789.01234567 3.3333333333333335 9.8700000000000007E+102 10.000000099999999 +string(111) "a:4:{i:0;d:123456789.01234567;i:1;d:3.3333333333333335;i:2;d:9.8700000000000007E+102;i:3;d:10.000000099999999;}" +array ( + 0 => 123456789.01234567, + 1 => 3.3333333333333335, + 2 => 9.8700000000000007E+102, + 3 => 10.000000099999999, +) +INI +25 +25 +OUTPUTS +123456789.0123456716537476 3.33333333333333348136307 9.870000000000000687310143E+102 10.0000000999999993922529 +string(141) "a:4:{i:0;d:123456789.0123456716537476;i:1;d:3.33333333333333348136307;i:2;d:9.870000000000000687310143E+102;i:3;d:10.0000000999999993922529;}" +array ( + 0 => 123456789.0123456716537476, + 1 => 3.33333333333333348136307, + 2 => 9.870000000000000687310143E+102, + 3 => 10.0000000999999993922529, +) +INI +100 +100 +OUTPUTS +123456789.01234567165374755859375 3.333333333333333481363069950020872056484222412109375 9.87000000000000068731014283095442748328521861543465424509123736073120616987695396574376473706259651E+102 10.0000000999999993922529029077850282192230224609375 +string(277) "a:4:{i:0;d:123456789.01234567165374755859375;i:1;d:3.333333333333333481363069950020872056484222412109375;i:2;d:9.87000000000000068731014283095442748328521861543465424509123736073120616987695396574376473706259651E+102;i:3;d:10.0000000999999993922529029077850282192230224609375;}" +array ( + 0 => 123456789.01234567165374755859375, + 1 => 3.333333333333333481363069950020872056484222412109375, + 2 => 9.87000000000000068731014283095442748328521861543465424509123736073120616987695396574376473706259651E+102, + 3 => 10.0000000999999993922529029077850282192230224609375, +) diff --git a/tests/basic/rfc1867_anonymous_upload.phpt b/tests/basic/rfc1867_anonymous_upload.phpt index ce1f4479ce..361bbbcca7 100644 --- a/tests/basic/rfc1867_anonymous_upload.phpt +++ b/tests/basic/rfc1867_anonymous_upload.phpt @@ -2,8 +2,6 @@ rfc1867 anonymous upload --INI-- file_uploads=1 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors upload_max_filesize=1024 max_file_uploads=10 --POST_RAW-- diff --git a/tests/basic/rfc1867_array_upload.phpt b/tests/basic/rfc1867_array_upload.phpt index d9f93530c2..bbaa5c82ef 100644 --- a/tests/basic/rfc1867_array_upload.phpt +++ b/tests/basic/rfc1867_array_upload.phpt @@ -2,8 +2,6 @@ rfc1867 array upload --INI-- file_uploads=1 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors upload_max_filesize=1024 max_file_uploads=10 --POST_RAW-- diff --git a/tests/basic/rfc1867_boundary_1.phpt b/tests/basic/rfc1867_boundary_1.phpt index fe0a9f2f4d..e5321201a5 100644 --- a/tests/basic/rfc1867_boundary_1.phpt +++ b/tests/basic/rfc1867_boundary_1.phpt @@ -2,8 +2,6 @@ rfc1867 boundary 1 --INI-- post_max_size=1024 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors --POST_RAW-- Content-Type: multipart/form-data; boundary="------------------------------------foobar" --------------------------------------foobar diff --git a/tests/basic/rfc1867_boundary_2.phpt b/tests/basic/rfc1867_boundary_2.phpt index 256ec4bf78..88f213fffa 100644 --- a/tests/basic/rfc1867_boundary_2.phpt +++ b/tests/basic/rfc1867_boundary_2.phpt @@ -2,8 +2,6 @@ rfc1867 boundary 2 --INI-- post_max_size=1024 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors --POST_RAW-- Content-Type: multipart/form-data; boundary=------------------------------------foo, bar --------------------------------------foo diff --git a/tests/basic/rfc1867_empty_upload.phpt b/tests/basic/rfc1867_empty_upload.phpt index c2dcb9b2ef..039d994c50 100644 --- a/tests/basic/rfc1867_empty_upload.phpt +++ b/tests/basic/rfc1867_empty_upload.phpt @@ -2,8 +2,6 @@ rfc1867 empty upload --INI-- file_uploads=1 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors upload_max_filesize=1024 max_file_uploads=10 --POST_RAW-- diff --git a/tests/basic/rfc1867_file_upload_disabled.phpt b/tests/basic/rfc1867_file_upload_disabled.phpt index 99dee9b835..aa4b5ee0f1 100644 --- a/tests/basic/rfc1867_file_upload_disabled.phpt +++ b/tests/basic/rfc1867_file_upload_disabled.phpt @@ -2,8 +2,6 @@ rfc1867 file_upload disabled --INI-- file_uploads=0 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors --POST_RAW-- Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737 -----------------------------20896060251896012921717172737 diff --git a/tests/basic/rfc1867_garbled_mime_headers.phpt b/tests/basic/rfc1867_garbled_mime_headers.phpt index 4010f22ca1..a6c0425335 100644 --- a/tests/basic/rfc1867_garbled_mime_headers.phpt +++ b/tests/basic/rfc1867_garbled_mime_headers.phpt @@ -2,8 +2,6 @@ rfc1867 garbled mime headers --INI-- file_uploads=1 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors upload_max_filesize=1024 --POST_RAW-- Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737 diff --git a/tests/basic/rfc1867_invalid_boundary.phpt b/tests/basic/rfc1867_invalid_boundary.phpt index cb27675a01..3b63b27222 100644 --- a/tests/basic/rfc1867_invalid_boundary.phpt +++ b/tests/basic/rfc1867_invalid_boundary.phpt @@ -2,8 +2,6 @@ rfc1867 invalid boundary --INI-- post_max_size=1024 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors --POST_RAW-- Content-Type: multipart/form-data; boundary="foobar -----------------------------20896060251896012921717172737 diff --git a/tests/basic/rfc1867_malicious_input.phpt b/tests/basic/rfc1867_malicious_input.phpt index 40b43d277f..98ed47ca20 100644 --- a/tests/basic/rfc1867_malicious_input.phpt +++ b/tests/basic/rfc1867_malicious_input.phpt @@ -2,8 +2,6 @@ rfc1867 malicious input --INI-- file_uploads=1 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors upload_max_filesize=1024 --POST_RAW-- Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737 diff --git a/tests/basic/rfc1867_max_file_size.phpt b/tests/basic/rfc1867_max_file_size.phpt index 9c576b477c..1b7b9aabee 100644 --- a/tests/basic/rfc1867_max_file_size.phpt +++ b/tests/basic/rfc1867_max_file_size.phpt @@ -2,8 +2,6 @@ rfc1867 MAX_FILE_SIZE --INI-- file_uploads=1 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors upload_max_filesize=1024 max_file_uploads=10 --POST_RAW-- diff --git a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt index 76327fdb06..4da55f2597 100644 --- a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt +++ b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt @@ -1,10 +1,7 @@ --TEST--
-rfc1867 max_file_uploads - empty files shouldn't count (non-debug version)
---SKIPIF--
-<?php if(function_exists("leak")) print "skip only for non-debug builds"; ?>
+rfc1867 max_file_uploads - empty files shouldn't count
--INI--
file_uploads=1
-error_reporting=E_ALL
max_file_uploads=2
--POST_RAW--
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
diff --git a/tests/basic/rfc1867_max_file_uploads_empty_files_debug.phpt b/tests/basic/rfc1867_max_file_uploads_empty_files_debug.phpt deleted file mode 100644 index 279851cc28..0000000000 --- a/tests/basic/rfc1867_max_file_uploads_empty_files_debug.phpt +++ /dev/null @@ -1,102 +0,0 @@ ---TEST--
-rfc1867 max_file_uploads - empty files shouldn't count (debug version)
---SKIPIF--
-<?php if(!function_exists("leak")) print "skip only for debug builds"; ?>
---INI--
-file_uploads=1
-error_reporting=E_ALL
-max_file_uploads=1
---POST_RAW--
-Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
------------------------------20896060251896012921717172737
-Content-Disposition: form-data; name="file2"; filename=""
-Content-Type: text/plain-file
-
-
------------------------------20896060251896012921717172737
-Content-Disposition: form-data; name="file3"; filename=""
-Content-Type: text/plain-file
-
-33
------------------------------20896060251896012921717172737
-Content-Disposition: form-data; name="file4"; filename="file4.txt"
-Content-Type: text/plain-file
-
-
------------------------------20896060251896012921717172737
-Content-Disposition: form-data; name="file1"; filename="file1.txt"
-Content-Type: text/plain-file
-
-1
------------------------------20896060251896012921717172737--
---FILE--
-<?php
-var_dump($_FILES);
-var_dump($_POST);
-if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
-}
-?>
---EXPECTF--
-Notice: No file uploaded in Unknown on line 0
-
-Notice: No file uploaded in Unknown on line 0
-
-Warning: Uploaded file size 0 - file [file4=file4.txt] not saved in Unknown on line 0
-array(4) {
- ["file2"]=>
- array(5) {
- ["name"]=>
- string(0) ""
- ["type"]=>
- string(0) ""
- ["tmp_name"]=>
- string(0) ""
- ["error"]=>
- int(4)
- ["size"]=>
- int(0)
- }
- ["file3"]=>
- array(5) {
- ["name"]=>
- string(0) ""
- ["type"]=>
- string(0) ""
- ["tmp_name"]=>
- string(0) ""
- ["error"]=>
- int(4)
- ["size"]=>
- int(0)
- }
- ["file4"]=>
- array(5) {
- ["name"]=>
- string(9) "file4.txt"
- ["type"]=>
- string(0) ""
- ["tmp_name"]=>
- string(0) ""
- ["error"]=>
- int(5)
- ["size"]=>
- int(0)
- }
- ["file1"]=>
- array(5) {
- ["name"]=>
- string(9) "file1.txt"
- ["type"]=>
- string(15) "text/plain-file"
- ["tmp_name"]=>
- string(%d) "%s"
- ["error"]=>
- int(0)
- ["size"]=>
- int(1)
- }
-}
-array(0) {
-}
-string(1) "1"
diff --git a/tests/basic/rfc1867_missing_boundary.phpt b/tests/basic/rfc1867_missing_boundary.phpt index 6218b135f1..aadd1a8aed 100644 --- a/tests/basic/rfc1867_missing_boundary.phpt +++ b/tests/basic/rfc1867_missing_boundary.phpt @@ -2,8 +2,6 @@ rfc1867 missing boundary --INI-- post_max_size=1024 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors --POST_RAW-- Content-Type: multipart/form-data -----------------------------20896060251896012921717172737 diff --git a/tests/basic/rfc1867_missing_boundary_2.phpt b/tests/basic/rfc1867_missing_boundary_2.phpt index a8f38ae533..1c4581c6c3 100644 --- a/tests/basic/rfc1867_missing_boundary_2.phpt +++ b/tests/basic/rfc1867_missing_boundary_2.phpt @@ -2,8 +2,6 @@ rfc1867 missing boundary 2 --INI-- file_uploads=1 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors upload_max_filesize=1024 --POST_RAW-- Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737 diff --git a/tests/basic/rfc1867_post_max_filesize.phpt b/tests/basic/rfc1867_post_max_filesize.phpt index 04c0c5c2b9..da851c417c 100644 --- a/tests/basic/rfc1867_post_max_filesize.phpt +++ b/tests/basic/rfc1867_post_max_filesize.phpt @@ -2,8 +2,6 @@ rfc1867 post_max_filesize --INI-- file_uploads=1 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors upload_max_filesize=1 max_file_uploads=10 --POST_RAW-- diff --git a/tests/basic/rfc1867_post_max_size.phpt b/tests/basic/rfc1867_post_max_size.phpt index 92281351df..eba547c7d9 100644 --- a/tests/basic/rfc1867_post_max_size.phpt +++ b/tests/basic/rfc1867_post_max_size.phpt @@ -2,8 +2,6 @@ rfc1867 post_max_size --INI-- post_max_size=1 -error_reporting=E_ALL&~E_NOTICE -comment=debug builds show some additional E_NOTICE errors --POST_RAW-- Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737 -----------------------------20896060251896012921717172737 diff --git a/tests/classes/__call_007.phpt b/tests/classes/__call_007.phpt index b061d17d85..cc7a2773bd 100644 --- a/tests/classes/__call_007.phpt +++ b/tests/classes/__call_007.phpt @@ -54,21 +54,25 @@ try { --EXPECTF-- Warning: The magic method __call() must have public visibility and cannot be static in %s on line 3 ---> Invoke __call via simple method call. -NULL +object(A)#1 (0) { +} Exception caught OK; continuing. ---> Invoke __call via scope resolution operator within instance. -NULL +object(A)#1 (0) { +} Exception caught OK; continuing. ---> Invoke __call via scope resolution operator within child instance. -NULL +object(B)#2 (0) { +} Exception caught OK; continuing. ---> Invoke __call via callback. -NULL +object(B)#2 (0) { +} Exception caught OK; continuing. ==DONE== diff --git a/tests/classes/constants_comments_001.phpt b/tests/classes/constants_comments_001.phpt new file mode 100644 index 0000000000..dbdd67c332 --- /dev/null +++ b/tests/classes/constants_comments_001.phpt @@ -0,0 +1,34 @@ +--TEST-- +Class constants and doc comments +--INI-- +opcache.save_comments=1 +--FILE-- +<?php +class X { + /** comment X1 */ + const X1 = 1; + const X2 = 2; + /** comment X3 */ + const X3 = 3; +} +class Y extends X { + /** comment Y1 */ + const Y1 = 1; + const Y2 = 2; + /** comment Y3 */ + const Y3 = 3; +} +$r = new ReflectionClass('Y'); +foreach ($r->getReflectionConstants() as $rc) { + echo $rc->getName() . " : " . $rc->getDocComment() . "\n"; +} + + +?> +--EXPECT-- +Y1 : /** comment Y1 */ +Y2 : +Y3 : /** comment Y3 */ +X1 : /** comment X1 */ +X2 : +X3 : /** comment X3 */ diff --git a/tests/classes/constants_visibility_001.phpt b/tests/classes/constants_visibility_001.phpt new file mode 100644 index 0000000000..37a0154d92 --- /dev/null +++ b/tests/classes/constants_visibility_001.phpt @@ -0,0 +1,23 @@ +--TEST-- +Class public constant visibility +--FILE-- +<?php +class A { + public const publicConst = 'publicConst'; + static function staticConstDump() { + var_dump(self::publicConst); + } + function constDump() { + var_dump(self::publicConst); + } +} + +var_dump(A::publicConst); +A::staticConstDump(); +(new A())->constDump(); + +?> +--EXPECTF-- +string(11) "publicConst" +string(11) "publicConst" +string(11) "publicConst" diff --git a/tests/classes/constants_visibility_002.phpt b/tests/classes/constants_visibility_002.phpt new file mode 100644 index 0000000000..6ec9901269 --- /dev/null +++ b/tests/classes/constants_visibility_002.phpt @@ -0,0 +1,28 @@ +--TEST-- +Class protected constant visibility +--FILE-- +<?php +class A { + protected const protectedConst = 'protectedConst'; + static function staticConstDump() { + var_dump(self::protectedConst); + } + function constDump() { + var_dump(self::protectedConst); + } +} + +A::staticConstDump(); +(new A())->constDump(); +constant('A::protectedConst'); + +?> +--EXPECTF-- +string(14) "protectedConst" +string(14) "protectedConst" + +Fatal error: Uncaught Error: Cannot access protected const A::protectedConst in %s:14 +Stack trace: +#0 %s(14): constant('A::protectedCon...') +#1 {main} + thrown in %s on line 14 diff --git a/tests/classes/constants_visibility_003.phpt b/tests/classes/constants_visibility_003.phpt new file mode 100644 index 0000000000..9c7bcfb21c --- /dev/null +++ b/tests/classes/constants_visibility_003.phpt @@ -0,0 +1,28 @@ +--TEST-- +Class private constant visibility +--FILE-- +<?php +class A { + private const privateConst = 'privateConst'; + static function staticConstDump() { + var_dump(self::privateConst); + } + function constDump() { + var_dump(self::privateConst); + } +} + +A::staticConstDump(); +(new A())->constDump(); +constant('A::privateConst'); + +?> +--EXPECTF-- +string(12) "privateConst" +string(12) "privateConst" + +Fatal error: Uncaught Error: Cannot access private const A::privateConst in %s:14 +Stack trace: +#0 %s(14): constant('A::privateConst') +#1 {main} + thrown in %s on line 14 diff --git a/tests/classes/constants_visibility_004.phpt b/tests/classes/constants_visibility_004.phpt new file mode 100644 index 0000000000..93acacf3c9 --- /dev/null +++ b/tests/classes/constants_visibility_004.phpt @@ -0,0 +1,28 @@ +--TEST-- +Only public and protected class constants should be inherited +--FILE-- +<?php +class A { + public const X = 1; + protected const Y = 2; + private const Z = 3; +} +class B extends A { + static public function checkConstants() { + var_dump(self::X); + var_dump(self::Y); + var_dump(self::Z); + } +} + +B::checkConstants(); +?> +--EXPECTF-- +int(1) +int(2) + +Fatal error: Uncaught Error: Undefined class constant 'Z' in %s:11 +Stack trace: +#0 %s(15): B::checkConstants() +#1 {main} + thrown in %s on line 11 diff --git a/tests/classes/constants_visibility_005.phpt b/tests/classes/constants_visibility_005.phpt new file mode 100644 index 0000000000..813009c675 --- /dev/null +++ b/tests/classes/constants_visibility_005.phpt @@ -0,0 +1,10 @@ +--TEST-- +Static constants are not allowed +--FILE-- +<?php +class A { + static const X = 1; +} +?> +--EXPECTF-- +Fatal error: Cannot use 'static' as constant modifier in %s on line 3 diff --git a/tests/classes/constants_visibility_006.phpt b/tests/classes/constants_visibility_006.phpt new file mode 100644 index 0000000000..537c8eac0f --- /dev/null +++ b/tests/classes/constants_visibility_006.phpt @@ -0,0 +1,11 @@ +--TEST-- +Abstract constants are not allowed +--FILE-- +<?php +class A { + abstract const X = 1; +} +?> +--EXPECTF-- +Fatal error: Cannot use 'abstract' as constant modifier in %s on line 3 + diff --git a/tests/classes/constants_visibility_007.phpt b/tests/classes/constants_visibility_007.phpt new file mode 100644 index 0000000000..f1b040c5c3 --- /dev/null +++ b/tests/classes/constants_visibility_007.phpt @@ -0,0 +1,10 @@ +--TEST-- +Final constants are not allowed +--FILE-- +<?php +class A { + final const X = 1; +} +?> +--EXPECTF-- +Fatal error: Cannot use 'final' as constant modifier in %s on line 3 diff --git a/tests/classes/constants_visibility_error_001.phpt b/tests/classes/constants_visibility_error_001.phpt new file mode 100644 index 0000000000..397dd24882 --- /dev/null +++ b/tests/classes/constants_visibility_error_001.phpt @@ -0,0 +1,16 @@ +--TEST-- +Class private constant visibility error +--FILE-- +<?php +class A { + private const privateConst = 'privateConst'; +} + +var_dump(A::privateConst); + +?> +--EXPECTF-- +Fatal error: Uncaught Error: Cannot access private const A::privateConst in %s:6 +Stack trace: +#0 {main} + thrown in %s on line 6 diff --git a/tests/classes/constants_visibility_error_002.phpt b/tests/classes/constants_visibility_error_002.phpt new file mode 100644 index 0000000000..2980b52c37 --- /dev/null +++ b/tests/classes/constants_visibility_error_002.phpt @@ -0,0 +1,16 @@ +--TEST-- +Class protected constant visibility error +--FILE-- +<?php +class A { + protected const protectedConst = 'protectedConst'; +} + +var_dump(A::protectedConst); + +?> +--EXPECTF-- +Fatal error: Uncaught Error: Cannot access protected const A::protectedConst in %s:6 +Stack trace: +#0 {main} + thrown in %s on line 6 diff --git a/tests/classes/constants_visibility_error_003.phpt b/tests/classes/constants_visibility_error_003.phpt new file mode 100644 index 0000000000..c385bbd300 --- /dev/null +++ b/tests/classes/constants_visibility_error_003.phpt @@ -0,0 +1,16 @@ +--TEST-- +A redeclared class constant must have the same or higher visibility +--FILE-- +<?php + +class A { + public const publicConst = 0; +} + +class B extends A { + protected const publicConst = 1; +} + + +--EXPECTF-- +Fatal error: Access level to B::publicConst must be public (as in class A) in %s on line 9 diff --git a/tests/classes/constants_visibility_error_004.phpt b/tests/classes/constants_visibility_error_004.phpt new file mode 100644 index 0000000000..fe37b0691f --- /dev/null +++ b/tests/classes/constants_visibility_error_004.phpt @@ -0,0 +1,16 @@ +--TEST-- +A redeclared class constant must have the same or higher visibility +--FILE-- +<?php + +class A { + protected const protectedConst = 0; +} + +class B extends A { + private const protectedConst = 1; +} + + +--EXPECTF-- +Fatal error: Access level to B::protectedConst must be protected (as in class A) or weaker in %s on line 9 diff --git a/tests/classes/interface_constant_inheritance_005.phpt b/tests/classes/interface_constant_inheritance_005.phpt new file mode 100644 index 0000000000..60bf222e85 --- /dev/null +++ b/tests/classes/interface_constant_inheritance_005.phpt @@ -0,0 +1,12 @@ +--TEST-- +Ensure a interface can have public constants +--FILE-- +<?php +interface IA { + public const FOO = 10; +} + +echo "Done\n"; +?> +--EXPECT-- +Done
\ No newline at end of file diff --git a/tests/classes/interface_constant_inheritance_006.phpt b/tests/classes/interface_constant_inheritance_006.phpt new file mode 100644 index 0000000000..125326b224 --- /dev/null +++ b/tests/classes/interface_constant_inheritance_006.phpt @@ -0,0 +1,10 @@ +--TEST-- +Ensure a interface can not have protected constants + +--FILE-- +<?php +interface A { + protected const FOO = 10; +} +--EXPECTF-- +Fatal error: Access type for interface constant A::FOO must be public in %s on line 3 diff --git a/tests/classes/interface_constant_inheritance_007.phpt b/tests/classes/interface_constant_inheritance_007.phpt new file mode 100644 index 0000000000..52695343e1 --- /dev/null +++ b/tests/classes/interface_constant_inheritance_007.phpt @@ -0,0 +1,10 @@ +--TEST-- +Ensure a interface can not have private constants + +--FILE-- +<?php +interface A { + private const FOO = 10; +} +--EXPECTF-- +Fatal error: Access type for interface constant A::FOO must be public in %s on line 3 diff --git a/tests/classes/interfaces_003.phpt b/tests/classes/interfaces_003.phpt index e1cbfdaf54..28680096c5 100644 --- a/tests/classes/interfaces_003.phpt +++ b/tests/classes/interfaces_003.phpt @@ -23,7 +23,7 @@ $obj = new MyTestClass; ===DONE=== --EXPECTF-- -Fatal error: Uncaught TypeError: Argument 1 passed to MyTestClass::__construct() must be an instance of MyObject, none given, called in %sinterfaces_003.php:%d +Fatal error: Uncaught ArgumentCountError: Too few arguments to function MyTestClass::__construct(), 0 passed in %sinterfaces_003.php on line 17 and exactly 1 expected in %sinterfaces_003.php:12 Stack trace: #0 %s(%d): MyTestClass->__construct() #1 {main} diff --git a/tests/classes/static_this.phpt b/tests/classes/static_this.phpt index 91b0287195..f7a11f5481 100644 --- a/tests/classes/static_this.phpt +++ b/tests/classes/static_this.phpt @@ -28,12 +28,4 @@ TestClass::Test2(new stdClass); ?> ===DONE=== --EXPECTF-- - -Notice: Undefined variable: this in %sstatic_this.php on line %d -NULL - -Notice: Undefined variable: this in %sstatic_this.php on line %d -NULL -object(stdClass)#%d (0) { -} -===DONE=== +Fatal error: Cannot use $this as parameter in %sstatic_this.php on line 16 diff --git a/tests/classes/type_hinting_004.phpt b/tests/classes/type_hinting_004.phpt index 8883f26336..95df6264dd 100644 --- a/tests/classes/type_hinting_004.phpt +++ b/tests/classes/type_hinting_004.phpt @@ -152,7 +152,7 @@ Ensure type hints are enforced for functions invoked as callbacks. 0: Argument 1 passed to f1() must be an instance of A, integer given%s(%d) in f1; -0: Argument 1 passed to f2() must be an instance of A, integer given%s(%d) +0: Argument 1 passed to f2() must be an instance of A or null, integer given%s(%d) in f2; in f2; @@ -163,7 +163,7 @@ in f2; 0: Argument 1 passed to C::f1() must be an instance of A, integer given%s(%d) in C::f1 (static); -0: Argument 1 passed to C::f2() must be an instance of A, integer given%s(%d) +0: Argument 1 passed to C::f2() must be an instance of A or null, integer given%s(%d) in C::f2 (static); in C::f2 (static); @@ -174,7 +174,7 @@ in C::f2 (static); 0: Argument 1 passed to D::f1() must be an instance of A, integer given%s(%d) in C::f1 (instance); -0: Argument 1 passed to D::f2() must be an instance of A, integer given%s(%d) +0: Argument 1 passed to D::f2() must be an instance of A or null, integer given%s(%d) in C::f2 (instance); in C::f2 (instance); diff --git a/tests/lang/045.phpt b/tests/lang/045.phpt index 11598cf035..44fb801410 100644 --- a/tests/lang/045.phpt +++ b/tests/lang/045.phpt @@ -3,7 +3,10 @@ Timeout again inside register_shutdown_function --SKIPIF-- <?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +if (PHP_ZTS) die("skip hard_timeout works only on no-zts builds"); ?> +--INI-- +hard_timeout=1 --FILE-- <?php set_time_limit(1); diff --git a/tests/lang/bug22592.phpt b/tests/lang/bug22592.phpt index 270584185f..4614efc169 100644 --- a/tests/lang/bug22592.phpt +++ b/tests/lang/bug22592.phpt @@ -32,7 +32,8 @@ var_dump($result); $e = $result[1] = $result[6]; var_dump($result); var_dump($a, $b, $c, $d, $e); -$result[-1] = 'a'; +$result[0] = $result[-4] = $result[-1] = 'a'; +var_dump($result); ?> --EXPECT-- string(5) "* *-*" @@ -50,4 +51,4 @@ string(1) "s" string(1) "4" string(1) "5" string(1) "5" -[Illegal string offset: -1] +string(9) "a54s4a50a" diff --git a/tests/lang/bug28800.phpt b/tests/lang/bug28800.phpt index f81ad7fec9..8bd2c306e1 100644 --- a/tests/lang/bug28800.phpt +++ b/tests/lang/bug28800.phpt @@ -7,11 +7,23 @@ Bug #28800 (Incorrect string to number conversion for strings starting with 'inf echo ($v+0)."\n"; } ?> ---EXPECT-- +--EXPECTF-- + +Warning: A non-numeric value encountered in %s on line %d 0 + +Warning: A non-numeric value encountered in %s on line %d 0 + +Warning: A non-numeric value encountered in %s on line %d 0 + +Warning: A non-numeric value encountered in %s on line %d 0 + +Warning: A non-numeric value encountered in %s on line %d 0 + +Warning: A non-numeric value encountered in %s on line %d 0 diff --git a/tests/lang/bug71897.phpt b/tests/lang/bug71897.phpt new file mode 100644 index 0000000000..bd76921af6 --- /dev/null +++ b/tests/lang/bug71897.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #71897 (ASCII 0x7F Delete control character permitted in identifiers) +--FILE-- +<?php + +eval(" + \$a\x7Fb = 3; + var_dump(\$a\x7Fb); +"); + +?> +--EXPECTF-- + +Warning: Unexpected character in input: '%s' (ASCII=127) state=0 in %s(%d) : eval()'d code on line %d + +Parse error: syntax error, unexpected 'b' (T_STRING) in %s(%d) : eval()'d code on line %d diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt index d5888d837f..69fd90f1c8 100644 --- a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt +++ b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt @@ -226,17 +226,17 @@ int(984) --- testing: '123abc' << 'a5.9' ---
int(123)
--- testing: '123e5' << '0' ---
-int(123)
+int(12300000)
--- testing: '123e5' << '65' ---
int(0)
--- testing: '123e5' << '-44' ---
Exception: Bit shift by negative number
--- testing: '123e5' << '1.2' ---
-int(246)
+int(24600000)
--- testing: '123e5' << '-7.7' ---
Exception: Bit shift by negative number
--- testing: '123e5' << 'abc' ---
-int(123)
+int(12300000)
--- testing: '123e5' << '123abc' ---
int(0)
--- testing: '123e5' << '123e5' ---
@@ -250,21 +250,21 @@ int(0) --- testing: '123e5' << '123abc ' ---
int(0)
--- testing: '123e5' << '3.4a' ---
-int(984)
+int(98400000)
--- testing: '123e5' << 'a5.9' ---
-int(123)
+int(12300000)
--- testing: '123e5xyz' << '0' ---
-int(123)
+int(12300000)
--- testing: '123e5xyz' << '65' ---
int(0)
--- testing: '123e5xyz' << '-44' ---
Exception: Bit shift by negative number
--- testing: '123e5xyz' << '1.2' ---
-int(246)
+int(24600000)
--- testing: '123e5xyz' << '-7.7' ---
Exception: Bit shift by negative number
--- testing: '123e5xyz' << 'abc' ---
-int(123)
+int(12300000)
--- testing: '123e5xyz' << '123abc' ---
int(0)
--- testing: '123e5xyz' << '123e5' ---
@@ -278,9 +278,9 @@ int(0) --- testing: '123e5xyz' << '123abc ' ---
int(0)
--- testing: '123e5xyz' << '3.4a' ---
-int(984)
+int(98400000)
--- testing: '123e5xyz' << 'a5.9' ---
-int(123)
+int(12300000)
--- testing: ' 123abc' << '0' ---
int(123)
--- testing: ' 123abc' << '65' ---
diff --git a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt index a86d0cfddb..a4c425aab3 100644 --- a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt +++ b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt @@ -222,17 +222,17 @@ int(15) --- testing: '123abc' >> 'a5.9' --- int(123) --- testing: '123e5' >> '0' --- -int(123) +int(12300000) --- testing: '123e5' >> '65' --- int(0) --- testing: '123e5' >> '-44' --- Exception: Bit shift by negative number --- testing: '123e5' >> '1.2' --- -int(61) +int(6150000) --- testing: '123e5' >> '-7.7' --- Exception: Bit shift by negative number --- testing: '123e5' >> 'abc' --- -int(123) +int(12300000) --- testing: '123e5' >> '123abc' --- int(0) --- testing: '123e5' >> '123e5' --- @@ -246,21 +246,21 @@ int(0) --- testing: '123e5' >> '123abc ' --- int(0) --- testing: '123e5' >> '3.4a' --- -int(15) +int(1537500) --- testing: '123e5' >> 'a5.9' --- -int(123) +int(12300000) --- testing: '123e5xyz' >> '0' --- -int(123) +int(12300000) --- testing: '123e5xyz' >> '65' --- int(0) --- testing: '123e5xyz' >> '-44' --- Exception: Bit shift by negative number --- testing: '123e5xyz' >> '1.2' --- -int(61) +int(6150000) --- testing: '123e5xyz' >> '-7.7' --- Exception: Bit shift by negative number --- testing: '123e5xyz' >> 'abc' --- -int(123) +int(12300000) --- testing: '123e5xyz' >> '123abc' --- int(0) --- testing: '123e5xyz' >> '123e5' --- @@ -274,9 +274,9 @@ int(0) --- testing: '123e5xyz' >> '123abc ' --- int(0) --- testing: '123e5xyz' >> '3.4a' --- -int(15) +int(1537500) --- testing: '123e5xyz' >> 'a5.9' --- -int(123) +int(12300000) --- testing: ' 123abc' >> '0' --- int(123) --- testing: ' 123abc' >> '65' --- diff --git a/tests/lang/operators/modulus_variationStr.phpt b/tests/lang/operators/modulus_variationStr.phpt index c647ecd380..4cfd7768ff 100644 --- a/tests/lang/operators/modulus_variationStr.phpt +++ b/tests/lang/operators/modulus_variationStr.phpt @@ -208,9 +208,9 @@ Exception: Modulo by zero --- testing: '123abc' % '123abc' ---
int(0)
--- testing: '123abc' % '123e5' ---
-int(0)
+int(123)
--- testing: '123abc' % '123e5xyz' ---
-int(0)
+int(123)
--- testing: '123abc' % ' 123abc' ---
int(0)
--- testing: '123abc' % '123 abc' ---
@@ -224,13 +224,13 @@ Exception: Modulo by zero --- testing: '123e5' % '0' ---
Exception: Modulo by zero
--- testing: '123e5' % '65' ---
-int(58)
+int(50)
--- testing: '123e5' % '-44' ---
-int(35)
+int(20)
--- testing: '123e5' % '1.2' ---
int(0)
--- testing: '123e5' % '-7.7' ---
-int(4)
+int(6)
--- testing: '123e5' % 'abc' ---
Exception: Modulo by zero
--- testing: '123e5' % '123abc' ---
@@ -252,13 +252,13 @@ Exception: Modulo by zero --- testing: '123e5xyz' % '0' ---
Exception: Modulo by zero
--- testing: '123e5xyz' % '65' ---
-int(58)
+int(50)
--- testing: '123e5xyz' % '-44' ---
-int(35)
+int(20)
--- testing: '123e5xyz' % '1.2' ---
int(0)
--- testing: '123e5xyz' % '-7.7' ---
-int(4)
+int(6)
--- testing: '123e5xyz' % 'abc' ---
Exception: Modulo by zero
--- testing: '123e5xyz' % '123abc' ---
@@ -292,9 +292,9 @@ Exception: Modulo by zero --- testing: ' 123abc' % '123abc' ---
int(0)
--- testing: ' 123abc' % '123e5' ---
-int(0)
+int(123)
--- testing: ' 123abc' % '123e5xyz' ---
-int(0)
+int(123)
--- testing: ' 123abc' % ' 123abc' ---
int(0)
--- testing: ' 123abc' % '123 abc' ---
@@ -320,9 +320,9 @@ Exception: Modulo by zero --- testing: '123 abc' % '123abc' ---
int(0)
--- testing: '123 abc' % '123e5' ---
-int(0)
+int(123)
--- testing: '123 abc' % '123e5xyz' ---
-int(0)
+int(123)
--- testing: '123 abc' % ' 123abc' ---
int(0)
--- testing: '123 abc' % '123 abc' ---
@@ -348,9 +348,9 @@ Exception: Modulo by zero --- testing: '123abc ' % '123abc' ---
int(0)
--- testing: '123abc ' % '123e5' ---
-int(0)
+int(123)
--- testing: '123abc ' % '123e5xyz' ---
-int(0)
+int(123)
--- testing: '123abc ' % ' 123abc' ---
int(0)
--- testing: '123abc ' % '123 abc' ---
diff --git a/tests/lang/operators/negate_variationStr.phpt b/tests/lang/operators/negate_variationStr.phpt index a25bdda7f5..7405d42882 100644 --- a/tests/lang/operators/negate_variationStr.phpt +++ b/tests/lang/operators/negate_variationStr.phpt @@ -16,7 +16,7 @@ foreach ($strVals as $strVal) { ?>
===DONE===
---EXPECT--
+--EXPECTF--
--- testing: '0' --- int(0) --- testing: '65' --- @@ -28,21 +28,37 @@ float(-1.2) --- testing: '-7.7' --- float(7.7) --- testing: 'abc' --- + +Warning: A non-numeric value encountered in %s on line %d int(0) --- testing: '123abc' --- + +Notice: A non well formed numeric value encountered in %s on line %d int(-123) --- testing: '123e5' --- float(-12300000) --- testing: '123e5xyz' --- + +Notice: A non well formed numeric value encountered in %s on line %d float(-12300000) --- testing: ' 123abc' --- + +Notice: A non well formed numeric value encountered in %s on line %d int(-123) --- testing: '123 abc' --- + +Notice: A non well formed numeric value encountered in %s on line %d int(-123) --- testing: '123abc ' --- + +Notice: A non well formed numeric value encountered in %s on line %d int(-123) --- testing: '3.4a' --- + +Notice: A non well formed numeric value encountered in %s on line %d float(-3.4) --- testing: 'a5.9' --- + +Warning: A non-numeric value encountered in %s on line %d int(0)
===DONE===
diff --git a/tests/output/ob_010.phpt b/tests/output/ob_010.phpt index 24d650c50d..7e362cabe1 100644 --- a/tests/output/ob_010.phpt +++ b/tests/output/ob_010.phpt @@ -4,10 +4,10 @@ output buffering - fatalism <?php function obh($s) { - print_r($s, 1); + return print_r($s, 1); } ob_start("obh"); echo "foo\n"; ?> --EXPECTF-- -Fatal error: print_r(): Cannot use output buffering in output buffering display handlers in %sob_010.php on line %d +foo |