]> granicus.if.org Git - php/commitdiff
Show "php://stdin" instead of "-" in error messages
authorAndrea Faulds <ajf@ajf.me>
Thu, 21 May 2015 17:08:01 +0000 (18:08 +0100)
committerJoe Watkins <krakjoe@php.net>
Sat, 12 Nov 2016 17:26:20 +0000 (17:26 +0000)
main/main.c
sapi/cgi/cgi_main.c
sapi/cgi/tests/007.phpt
sapi/cli/php_cli.c
sapi/cli/tests/015.phpt

index 49a68bd887a693935d0b3986af4e8aa3819695b1..703aa6926345aeccd17640003ac3462881071b6b 100644 (file)
@@ -2483,7 +2483,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file)
                 *   otherwise it will get opened and added to the included_files list in zend_execute_scripts
                 */
                if (primary_file->filename &&
-                   (primary_file->filename[0] != '-' || primary_file->filename[1] != 0) &&
+                   strcmp("php://stdin", primary_file->filename) &&
                        primary_file->opened_path == NULL &&
                        primary_file->type != ZEND_HANDLE_FILENAME
                ) {
index 0b6deb10e8255dfff42edac2798bde64935e3e42..bf33dc109bcb8414b1948c366185c15fa47cb8b8 100644 (file)
@@ -2431,7 +2431,7 @@ consult the installation file that came with this distribution, or visit \n\
                                file_handle.filename = SG(request_info).path_translated;
                                file_handle.handle.fp = NULL;
                        } else {
-                               file_handle.filename = "-";
+                               file_handle.filename = "php://stdin";
                                file_handle.type = ZEND_HANDLE_FP;
                                file_handle.handle.fp = stdin;
                        }
index f2c9c0226ce2c677bd36b86f8073c094a23a7bef..ed83db0cf3f48e00087153859309517d59230fb7 100644 (file)
@@ -17,6 +17,6 @@ var_dump(`"$php" -n -s -w -l`);
 --EXPECTF--    
 string(25) "No input file specified.
 "
-string(31) "No syntax errors detected in -
+string(41) "No syntax errors detected in php://stdin
 "
 ===DONE===
index 56ab3fec6db4d2607f7f362822698014db092b8c..28a5a7c108f3be2ba72a5bdb239f432efdebf2b6 100644 (file)
@@ -945,7 +945,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
                        /* here but this would make things only more complicated. And it */
                        /* is consitent with the way -R works where the stdin file handle*/
                        /* is also accessible. */
-                       file_handle.filename = "-";
+                       file_handle.filename = "php://stdin";
                        file_handle.handle.fp = stdin;
                }
                file_handle.type = ZEND_HANDLE_FP;
@@ -984,7 +984,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
                PG(during_request_startup) = 0;
                switch (behavior) {
                case PHP_MODE_STANDARD:
-                       if (strcmp(file_handle.filename, "-")) {
+                       if (strcmp(file_handle.filename, "php://stdin")) {
                                cli_register_file_handles();
                        }
 
index ab5918b4d23c5cc44ab6b07aca0475504558786a..da2b64617de32cde518e526284b13c5d8975d1a8 100644 (file)
@@ -24,7 +24,7 @@ echo "Done\n";
 PHP %d.%d.%d%s(cli) (built: %s)%s
 Array
 (
-    [0] => -
+    [0] => php://stdin
     [1] => foo
     [2] => bar
     [3] => baz