Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Console] HHVM read input stream bug#17253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

@mbutkereit
Copy link

QA
Bug fix?[yes]
New feature?[no]
BC breaks?[no]
Deprecations?[no]
Tests pass?[yes]
LicenseMIT

HHVM readline() function requires a parameter see:

https://github.com/facebook/hhvm/blob/master/hphp/runtime/ext/readline/ext_readline.php

But the php readline does not require one.

In   Symfony\Component\Console\Helper\QuestionHelper … readFromInput($stream) …

we use readline() without a parameter.

HHVM Version:

HipHop VM 3.10.1 (rel)Compiler: tags/HHVM-3.10.1-0-g689b4969a141620ee5a282ce0dbf72278c84d44bRepo schema: 6c99ee1f98340f6f3ef397a332583f0e843a627d

Docker Container:

docker run --rm -it -v `pwd`:`pwd` -w `pwd` brunoric/hhvm:deb hhvm test.php ls

Test.php

<?phpuse Symfony\Component\Console\Application;use Symfony\Component\Console\Input\InputInterface;use Symfony\Component\Console\Input\InputArgument;use Symfony\Component\Console\Input\InputOption;use Symfony\Component\Console\Output\OutputInterface;use Symfony\Component\Console\Question\Question;use Symfony\Component\Console\Helper\QuestionHelper;require_once  "vendor/autoload.php";$console = new Application();$console    ->register('ls')    ->setDescription('Try input')    ->setCode(function (InputInterface $input, OutputInterface $output) {        $question = new Question('Your email address: ');        $question->setValidator(            function ($answer) {                return $answer;            }        );        $question->setMaxAttempts(5);            $helper = new QuestionHelper();          $email = $helper->ask($input, $output, $question);        $output->writeln(sprintf('Email Adress: <info>%s</info>', $email));    });$console->run();

composer.json

{    "require": {        "symfony/console": "^3.0"    }}

Result:
No input is possible and you got a warning

Your email address: Warning: readline() expects exactly 1 parameter, 0 given in /clitest/vendor/symfony/console/Helper/QuestionHelper.php on line 436Email Adress:

Fix:
Add a empty string parameter to readline() or use fgets() for hhvm.

@xabbuh
Copy link
Member

Can you add a test to avoid regressions?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

giving the empty string looks more feature-full, isn't it? why prefer fgets on hhvm when readline works?

@mbutkereit
Copy link
Author

@nicolas-grekas i think you are right. (i have changed it)
@xabbuh i dont' know how i can write a test for readline().
Does it make sense to test stdin( readline() ) ? i don't know.

@stof
Copy link
Member

stof commentedJan 8, 2016

Please also report it to HHVM as an incompatibility bug.

@mbutkereit
Copy link
Author

@stof done seefacebook/hhvm#6731

@nicolas-grekas
Copy link
Member

👍
Status: reviewed

@nicolas-grekas
Copy link
Member

Thank you@mbutkereit.

nicolas-grekas added a commit that referenced this pull requestJan 14, 2016
This PR was squashed before being merged into the 2.8 branch (closes#17253).Discussion----------[Console] HHVM read input stream bug| Q             | A| ------------- | ---| Bug fix?      | [yes]| New feature?  | [no]| BC breaks?    | [no]| Deprecations? | [no]| Tests pass?   | [yes]| License       | MITHHVM readline() function requires a parameter  see:https://github.com/facebook/hhvm/blob/master/hphp/runtime/ext/readline/ext_readline.phpBut the php readline does not require one.```In   Symfony\Component\Console\Helper\QuestionHelper … readFromInput($stream) …```we use readline() without a parameter.HHVM Version:```HipHop VM 3.10.1 (rel)Compiler: tags/HHVM-3.10.1-0-g689b4969a141620ee5a282ce0dbf72278c84d44bRepo schema: 6c99ee1f98340f6f3ef397a332583f0e843a627d```Docker Container:```docker run --rm -it -v `pwd`:`pwd` -w `pwd` brunoric/hhvm:deb hhvm test.php ls```Test.php```<?phpuse Symfony\Component\Console\Application;use Symfony\Component\Console\Input\InputInterface;use Symfony\Component\Console\Input\InputArgument;use Symfony\Component\Console\Input\InputOption;use Symfony\Component\Console\Output\OutputInterface;use Symfony\Component\Console\Question\Question;use Symfony\Component\Console\Helper\QuestionHelper;require_once  "vendor/autoload.php";$console = new Application();$console    ->register('ls')    ->setDescription('Try input')    ->setCode(function (InputInterface $input, OutputInterface $output) {        $question = new Question('Your email address: ');        $question->setValidator(            function ($answer) {                return $answer;            }        );        $question->setMaxAttempts(5);    $helper = new QuestionHelper();      $email = $helper->ask($input, $output, $question);        $output->writeln(sprintf('Email Adress: <info>%s</info>', $email));    });$console->run();```composer.json```{    "require": {        "symfony/console": "^3.0"    }}```Result:No input is possible and you got a warning```Your email address:Warning: readline() expects exactly 1 parameter, 0 given in /clitest/vendor/symfony/console/Helper/QuestionHelper.php on line 436Email Adress:```Fix:Add a empty string parameter to  readline() or use fgets() for hhvm.Commits-------e7f17a7 [Console] HHVM read input stream bug
@fabpotfabpot mentioned this pull requestJan 14, 2016
@fabpotfabpot mentioned this pull requestFeb 3, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@mbutkereit@xabbuh@stof@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp