Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working after upgrading to PHP 7.3 #540

Closed
dportalesr opened this issue Dec 8, 2018 · 87 comments
Closed

Not working after upgrading to PHP 7.3 #540

dportalesr opened this issue Dec 8, 2018 · 87 comments

Comments

@dportalesr
Copy link

From @dciancu:

After upgrading PHP to 7.3.0 - latest version (and Xdebug to 2.7.0beta1 latest version compatible with PHP 7.3, in case it matters), tinker is no longer working. It launches correctly but I after I input a command it just exits with no error, nothing written to log file and status code 0.

laravel/tinker#63

I can confirm it's happening to me as well. Any input closes the REPL, no errors or messages at all.

Any ideas about how to proceed? Thanks.

@GrahamCampbell
Copy link
Contributor

Does it work after uninstalling xdebug?

@GrahamCampbell
Copy link
Contributor

xdebug 2.7.0beta1 is not actually compatible fully with php 7.3 yet. No release or even master of xdebug fully works yet.

@dciancu
Copy link

dciancu commented Dec 8, 2018

@GrahamCampbell It doesn't work with xdebug disabled either

@dciancu
Copy link

dciancu commented Dec 8, 2018

xdebug works very well with php 7.3 from what I have tested, had no issue with it.

@GrahamCampbell
Copy link
Contributor

Does it work after full uninstallation of the plugin, not just disabling?

@GrahamCampbell
Copy link
Contributor

xdebug works very well with php 7.3 from what I have tested, has no issue with it.

There are various known issues documented on xdebug's github, including a failing test suite.

@dciancu
Copy link

dciancu commented Dec 8, 2018

@GrahamCampbell not disabled by xdebug.enable, but removed from php.ini I meant

@dportalesr
Copy link
Author

dportalesr commented Dec 9, 2018

Apparently Xdebug added support for PHP 7.3 recently
https://bugs.xdebug.org/view.php?id=1519
xdebug/xdebug#430

As @GrahamCampbell mentions there are still a couple of issues in their tracker. Not sure how to generate a report of this problem for them.

@chapeupreto
Copy link

I have a fresh PHP7.3 install (brew install [email protected]) with no xdebug and that very same problem is happening to me as well:

bug

@bobthecow
Copy link
Owner

bobthecow commented Dec 9, 2018

Update: as discussed below, this is a bug in Homebrew/macOS/PHP/pcntl. It should really be worked around by disabling pcre.jit in your php.ini.

It has something to do with forking / pcntl. I'm trying to sort it out.

In the meantime, you can use PsySH by disabling pcntl support, by adding this to your config file:

// really, don't do this. disable it in php.ini :)
return [
  'usePcntl' => false, 
];

bobthecow added a commit that referenced this issue Dec 10, 2018
@bobthecow
Copy link
Owner

Ok, got it!

Homebrew-installed PHP 7.3.0 on Mojave segfaults when calling preg_match from a child process.

Repro:

<?php

if (preg_match('/./', 'a')) echo "pre-fork works\n";

$pid = pcntl_fork();
if ($pid == -1) {
    die('fail');
} elseif ($pid) {
    if (preg_match('/./', 'a')) echo "parent works\n";
    pcntl_wait($status);
    if (pcntl_wifsignaled($status) && pcntl_wtermsig($status) == SIGSEGV) {
        die('child process segfaulted');
    }
} else {
    if (preg_match('/./', 'a')) echo "child works\n";
}

In PHP < 7.3, this results in:

pre-fork works
parent works
child works

But in PHP 7.3, we get:

pre-fork works
parent works
child process segfaulted

I'm not sure what the extent of this issue is. 3v4l.org doesn't have PCNTL so we can't test there. All versions of PHP that Travis tests worked. That said, Travis is testing RC3, so it might be a bug introduced between that and the stable release?

Are y'all on Homebrew + Mojave? Can anyone repro this with other PHP 7.3 versions or sources or operating systems?

@dportalesr
Copy link
Author

Are y'all on Homebrew + Mojave?

Yeah.

@ghost
Copy link

ghost commented Dec 10, 2018

Same here, Homebrew and Mojave without xdebug installed.

@chapeupreto
Copy link

Just to let you know: same problem with PHP7.3 running on macOS High Sierra

@bobthecow
Copy link
Owner

Just to let you know: same problem with PHP7.3 running on macOS High Sierra

Also installed via Homebrew?

@chapeupreto
Copy link

Just to let you know: same problem with PHP7.3 running on macOS High Sierra

Also installed via Homebrew?

Yes!

@CQD
Copy link

CQD commented Dec 10, 2018

Ubuntu 16.04 + PHP 7.3 (ppa:ondre/php) + psysh 0.9.9 works fine.

No segfault when running #540 (comment)

@bobthecow
Copy link
Owner

It fails for both bottled and built-from-source PHP 7.3 via Homebrew.

@hulkur
Copy link

hulkur commented Dec 11, 2018

As a workaround:

In php.ini set pcre.jit=0

Note comment below.

@Majkl578
Copy link

@hulkur Please don't recommend people to disable JIT, report a bug to bugs.php.net instead and only suggest it as a temporary workaround. JIT is an important performance feature.

@johnchendev
Copy link

@bobthecow, Thanks for the workaround. However, I was not able to find the config file that you referenced.

It has something to do with forking / pcntl. I'm trying to sort it out. In the meantime, you can use PsySH by disabling pcntl support, by adding this to your config file:

return [
  'usePcntl' => false,
];

May I know how do you open this file and drop in the code you mentioned? Thanks.

Running Mac Mojave

@dportalesr
Copy link
Author

dportalesr commented Dec 12, 2018

May I know how do you open this file and drop in the code you mentioned? Thanks.

@johnchendev Try creating a file at ~/.config/psysh/config.php if not already there.

<?php
return [
  'usePcntl' => false,
];

That's it.

@bobthecow
Copy link
Owner

See also that whole page under the "your config file" link in my comment 😉

@ruudk
Copy link

ruudk commented Dec 27, 2018

@bobthecow Thanks for posting the issue here. I'm using a completely different package (Resque) that also forks and crashes on preg_match. Also on Homebrew Mojave. Is there an issue on the Homebrew repository already that tracks this?

@bobthecow
Copy link
Owner

Not that I know of. Wanna take it over there? :)

@ruudk
Copy link

ruudk commented Dec 27, 2018

Added issue @ Homebrew Homebrew/homebrew-core#35491

@chapeupreto
Copy link

Unfortunately, it's not working with PHP 7.3.5 installed via homebrew.

@mallardduck
Copy link

Just wanted to say I appreciate @bobthecow keeping this open, even tho at this point it seems clear to be a platform issue. The config based solution works as a 'fix', but the issue is pervasive beyond psysh so not a real/full solution.

Until the underlying issue is fixed then other applications and use cases will still be affected. Perhaps more important, it means that a development environment is even less similar to production environments.

@akeebismail
Copy link

As a workaround:

In php.ini set pcre.jit=0

Note comment below.

this solve the problem for now

@ihorvorotnov
Copy link

ihorvorotnov commented Jun 5, 2019

Brew's PHP 7.3.6 - still crashes. This fixes it.

@miken32
Copy link

miken32 commented Jun 14, 2019

For the record, I had this problem with PHP 7.2.19 on MacOS Mojave – the suggested fix of disabling the pcntl extension in psysh config fixed it for me. And I don't use Homebrew at all.

@mallardduck
Copy link

@miken32 And you're on a Mac, PC, or Linux?

@JacquesvanWyk
Copy link

May I know how do you open this file and drop in the code you mentioned? Thanks.

@johnchendev Try creating a file at ~/.config/psysh/config.php if not already there.

<?php
return [
  'usePcntl' => false,
];

That's it.

That worked for me. Thank you

@ngocphamm
Copy link

It looks like this is fix with PHP 7.3.7 Homebrew. At least for me, I don't need the line in config.php file anymore.

@welenofsky
Copy link

It looks like this is fix with PHP 7.3.7 Homebrew. At least for me, I don't need the line in config.php file anymore.

I just tried upgrading from 7.3.5 -> 7.3.7 and it did not resolve the issue for me :(

@mallardduck
Copy link

Same issue as @welenofsky, not working after upgrading. I wonder if @ngocphamm has something setup differently on their machine?

@ngocphamm
Copy link

I'm not too sure. This is my .config/psysh/config.php. PHP was upgraded with brew upgrade (update all outdated brews in my system)

return array(
    'historySize' => 200,
    'eraseDuplicates' => true,
    //'usePcntl' => false,
);

@mallardduck
Copy link

@ngocphamm I wonder if it has something to do with other system configurations though. Like the Mac OS X version you're using, PCRE version, things like that maybe?

I'm also forgetting and wonder if this is isolated to Mac's or if it would also affect other Unix based systems?

@ngocphamm
Copy link

ngocphamm commented Jul 9, 2019

I'm using latest macOS 10.14.5, with both pcre and pcre2 installed via Homebrew, with version 8.43, and 10.33, respectively. And php actually uses pcre according to this

~ »  brew uses pcre --installed
cairo                 glib                  imagemagick           nginx                 shared-mime-info      zsh
ffmpeg                harfbuzz              libass                php                   the_silver_searcher
~ »  brew uses pcre2 --installed
fish                                                                ripgrep

@welenofsky
Copy link

I'm using latest macOS 10.14.5, with both pcre and pcre2 installed via Homebrew, with version 8.43, and 10.33, respectively. And php actually uses pcre according to this

~ »  brew uses pcre --installed
cairo                 glib                  imagemagick           nginx                 shared-mime-info      zsh
ffmpeg                harfbuzz              libass                php                   the_silver_searcher
~ »  brew uses pcre2 --installed
fish                                                                ripgrep

I am using the same macOS version (10.14.5) and same PCRE/PCRE2 versions as you listed. Wondering what the difference could be.

@bobthecow
Copy link
Owner

I'm also forgetting and wonder if this is isolated to Mac's or if it would also affect other Unix based systems?

It has been reported on Linux systems as well.

@zeshan77
Copy link

zeshan77 commented Oct 2, 2019

Update: as discussed below, this is a bug in Homebrew/macOS/PHP/pcntl. It should really be worked around by disabling pcre.jit in your php.ini.

It has something to do with forking / pcntl. I'm trying to sort it out. In the meantime, you can use PsySH by disabling pcntl support, by adding this to your config file:

return [
  'usePcntl' => false,
];

It worked for me. Thanks for the workaround!

@mk-conn
Copy link

mk-conn commented Oct 30, 2019

Just upgraded to PHP 7.3.11 and psysh is working again

@ramsey
Copy link

ramsey commented Oct 30, 2019

I can confirm the same. I do not need to set usePcntl to false when running psysh on PHP 7.3.11.

@driesvints
Copy link

Same for me. Seems to be finally fixed 👍

@zymawy
Copy link

zymawy commented Oct 30, 2019

Confirmed ! 🥇

@chapeupreto
Copy link

All good here (PHP 7.3.11)

@welenofsky
Copy link

Confirmed here as well!

@bobthecow
Copy link
Owner

Working for me as well.

I'm going to close this, but leave it pinned, so people can find it if they need to.

@bobthecow bobthecow unpinned this issue Apr 10, 2020
Arul- added a commit to Arul-/RestlerApplication that referenced this issue Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests