Re: com php-src: Show "php://stdin" instead of "-" in error messages: main/main.c sapi/cgi/cgi_main.c sapi/cgi/tests/007.phpt sapi/cli/php_cli.c
sapi/cli/tests/015.phpt
| From: | Joe Watkins | Date: | Sun, 13 Nov 2016 08:16:02 +0000 |
| Subject: | Re: com php-src: Show "php://stdin" instead of "-" in error messages: main/main.c sapi/cgi/cgi_main.c sapi/cgi/tests/007.phpt sapi/cli/php_cli.c sapi/cli/tests/015.phpt |
||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-95747@lists.php.net to get a copy of this message | ||
Morning Matteo,
Fixed the fault but the test still fails, actually the expected output
looks wrong to me.
Asked bob to have a look at it, he recently added the stdin stuff to
phpdbg.
Cheers
Joe
On Sun, Nov 13, 2016 at 7:32 AM, Matteo Beccati <php@beccati.com> wrote:
> Hi Joe,
>
> not sure which one of the commits is responsible, but I see a
> segmentation fault in one test now:
>
> https://revive.beccati.com/bamboo/browse/PHP-SRC-TESTS-
> 997/test/case/32172446
>
>
> Cheers
>
> On 12/11/2016 18:26, Joe Watkins wrote:
> > Commit: a103aa2dbd9fe4261e7ebbafb00ff5283c7fb5e5
> > Author: Andrea Faulds <ajf@ajf.me> Thu, 21 May 2015 18:08:01
> +0100
> > Committer: Joe Watkins <krakjoe@php.net> Sat, 12 Nov 2016 17:26:20
> +0000
> > Parents: 28ebf8df668014df3d74837f2fdb7a24a895bb9c
> > Branches: master
> >
> > Link:
> > http://git.php.net/?p=php-src.git;a=commitdiff;h=
> a103aa2dbd9fe4261e7ebbafb00ff5283c7fb5e5
> >
> > Log:
> > Show "php://stdin" instead of "-" in error messages
> >
> > Changed paths:
> > M main/main.c
> > M sapi/cgi/cgi_main.c
> > M sapi/cgi/tests/007.phpt
> > M sapi/cli/php_cli.c
> > M sapi/cli/tests/015.phpt
> >
> >
> > Diff:
> > diff --git a/main/main.c b/main/main.c
> > index 49a68bd..703aa69 100644
> > --- a/main/main.c
> > +++ b/main/main.c
> > @@ -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
> > ) {
> > diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
> > index 0b6deb1..bf33dc1 100644
> > --- a/sapi/cgi/cgi_main.c
> > +++ b/sapi/cgi/cgi_main.c
> > @@ -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;
> > }
> > diff --git a/sapi/cgi/tests/007.phpt b/sapi/cgi/tests/007.phpt
> > index f2c9c02..ed83db0 100644
> > --- a/sapi/cgi/tests/007.phpt
> > +++ b/sapi/cgi/tests/007.phpt
> > @@ -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===
> > diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
> > index 56ab3fe..28a5a7c 100644
> > --- a/sapi/cli/php_cli.c
> > +++ b/sapi/cli/php_cli.c
> > @@ -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();
> > }
> >
> > diff --git a/sapi/cli/tests/015.phpt b/sapi/cli/tests/015.phpt
> > index ab5918b..da2b646 100644
> > --- a/sapi/cli/tests/015.phpt
> > +++ b/sapi/cli/tests/015.phpt
> > @@ -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
> >
> >
>
>
> --
> Matteo Beccati
>
> Development & Consulting - http://www.beccati.com/
>