summaryrefslogtreecommitdiff
path: root/tests/strings
diff options
context:
space:
mode:
authorkharhamel <oognic@gmail.com>2019-10-15 17:51:39 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-10-28 11:58:59 +0100
commit82dc9a31c335d8cf7aff68d76698bc3d24f761f8 (patch)
tree20bf9e2500ad33927810b24015ef74a20740c2a4 /tests/strings
parent9d48bf5152295fb63ab5da8570c9b2fd73aa2cf7 (diff)
downloadphp-git-82dc9a31c335d8cf7aff68d76698bc3d24f761f8.tar.gz
Convert warnings to Errors in sprintf() functions
Closes GH-4837.
Diffstat (limited to 'tests/strings')
-rw-r--r--tests/strings/002.phpt9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/strings/002.phpt b/tests/strings/002.phpt
index 5e82091088..a43a68c88b 100644
--- a/tests/strings/002.phpt
+++ b/tests/strings/002.phpt
@@ -2,7 +2,6 @@
Formatted print functions
--FILE--
<?php
-error_reporting(0);
$fp = fopen("php://stdout", "w") or die("Arrggsgg!!");
$x = fprintf($fp, "fprintf test 1:%.5s", "abcdefghij");
@@ -40,7 +39,11 @@ printf("printf test 26:%2\$d %1\$d\n", 1, 2);
printf("printf test 27:%3\$d %d %d\n", 1, 2, 3);
printf("printf test 28:%2\$02d %1\$2d\n", 1, 2);
printf("printf test 29:%2\$-2d %1\$2d\n", 1, 2);
-print("printf test 30:"); printf("%0\$s", 1); print("x\n");
+try {
+ print("printf test 30:"); printf("%0\$s", 1); print("x\n");
+} catch(\ValueError $e) {
+ print('Error found: '.$e->getMessage()."\n");
+}
vprintf("vprintf test 1:%2\$-2d %1\$2d\n", array(1, 2));
@@ -79,5 +82,5 @@ printf test 26:2 1
printf test 27:3 1 2
printf test 28:02 1
printf test 29:2 1
-printf test 30:x
+printf test 30:Error found: Argument number must be greater than zero
vprintf test 1:2 1