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

WP-CLI doesn't work in PHP 7 #1842

Closed
szepeviktor opened this Issue May 19, 2015 · 19 comments

Comments

5 participants
@szepeviktor
Contributor

szepeviktor commented May 19, 2015

# wp --allow-root --info
PHP binary:     /usr/local/bin/php
PHP version:    7.0.0-dev
php.ini used:   /usr/local/etc/php.ini
WP-CLI root dir:        phar://wp-cli.phar
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 0.19.1

# wp --allow-root core download
Error: This does not seem to be a WordPress install.
Pass --path=`path/to/wordpress` or run `wp core download`.
@digitalchild

This comment has been minimized.

Show comment
Hide comment
@digitalchild

digitalchild May 20, 2015

Clear out your .wp-cli cache/core directory and try again. I had this issue just yesterday.

digitalchild commented May 20, 2015

Clear out your .wp-cli cache/core directory and try again. I had this issue just yesterday.

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor May 20, 2015

Contributor

Thanks.
It is a brand new server with PHP 7.

Contributor

szepeviktor commented May 20, 2015

Thanks.
It is a brand new server with PHP 7.

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor May 20, 2015

Contributor

I think DocParser does not work in PHP 7. wp --allow-root help core download
http://php.net/manual/en/reflectionclass.getdoccomment.php

NAME

  wp core download

DESCRIPTION



SYNOPSIS

  wp core download



GLOBAL PARAMETERS

  --path=<path>
      Path to the WordPress files

  --url=<url>
      Pretend request came from given URL. In multisite, this argument is how the target
  site is specified.
Contributor

szepeviktor commented May 20, 2015

I think DocParser does not work in PHP 7. wp --allow-root help core download
http://php.net/manual/en/reflectionclass.getdoccomment.php

NAME

  wp core download

DESCRIPTION



SYNOPSIS

  wp core download



GLOBAL PARAMETERS

  --path=<path>
      Path to the WordPress files

  --url=<url>
      Pretend request came from given URL. In multisite, this argument is how the target
  site is specified.
@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor May 20, 2015

Contributor

But

# php -r 'var_Export(class_exists("Reflection"));'
true
Contributor

szepeviktor commented May 20, 2015

But

# php -r 'var_Export(class_exists("Reflection"));'
true
@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber May 20, 2015

Member

Hm, I can't replicate in PHP 5.5.9-1ubuntu4.7

#1844 is running Travis against PHP7 nightly. Let's see what explodes.

Member

danielbachhuber commented May 20, 2015

Hm, I can't replicate in PHP 5.5.9-1ubuntu4.7

#1844 is running Travis against PHP7 nightly. Let's see what explodes.

@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber May 20, 2015

Member

Low and behold, lots of failures :)

Member

danielbachhuber commented May 20, 2015

Low and behold, lots of failures :)

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor May 21, 2015

Contributor

state:confirmed

Contributor

szepeviktor commented May 21, 2015

state:confirmed

@danielbachhuber danielbachhuber changed the title from core download does not work to WP-CLI doesn't work in PHP 7 May 21, 2015

@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber Jun 8, 2015

Member

I'm not sure we'll be able to support PHP 7 fully until WP supports PHP 7

Member

danielbachhuber commented Jun 8, 2015

I'm not sure we'll be able to support PHP 7 fully until WP supports PHP 7

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor Jun 9, 2015

Contributor

WP runs on PHP 7

Contributor

szepeviktor commented Jun 9, 2015

WP runs on PHP 7

@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber Jun 9, 2015

Member

If you look at the test failures though, there are some error notices coming from WP.

Member

danielbachhuber commented Jun 9, 2015

If you look at the test failures though, there are some error notices coming from WP.

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor Jun 9, 2015

Contributor

I think the number of them is close to 1.

Contributor

szepeviktor commented Jun 9, 2015

I think the number of them is close to 1.

@centminmod

This comment has been minimized.

Show comment
Hide comment
@centminmod

centminmod Jun 12, 2015

FYI, PHP 7.0.0 Alpha1 is released and WP-CPI throws up a bunch of errors on installing some WP Plugins https://community.centminmod.com/posts/14892/

centminmod commented Jun 12, 2015

FYI, PHP 7.0.0 Alpha1 is released and WP-CPI throws up a bunch of errors on installing some WP Plugins https://community.centminmod.com/posts/14892/

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor Jun 24, 2015

Contributor

@danielbachhuber

Results

  • php -r 'var_dump(substr( "--flag", strlen( "--flag" ) ));' 5.6: bool(false), 7.0: string(0) ""

Current manual says:

Returns the extracted part of string; or FALSE on failure, or an empty string.

Could it be a bug?? https://github.com/wp-cli/wp-cli/blob/master/php/WP_CLI/SynopsisParser.php#L62

  • STDOUT/STDERR cause silent failure, php://stderr works.

Very strange, this works with $handle = STDOUT in function _line

include 'Regular.php';
$a=new WP_CLI\Loggers\Regular(false);
$a->success('msg');

strace says that file descriptor 1 is closed just before it is written to:

close(1)                                = 0
munmap(0x6c56a0383000, 4096)            = 0
getcwd("/root/wp-cli", 4096)            = 13
write(1, ".", 1)                        = -1 EBADF (Bad file descriptor)

This also works:

define ('X_STDOUT', fopen('php://stdout', 'w'));

private function _line( $message, $label, $color, $handle = X_STDOUT ) {
Contributor

szepeviktor commented Jun 24, 2015

@danielbachhuber

Results

  • php -r 'var_dump(substr( "--flag", strlen( "--flag" ) ));' 5.6: bool(false), 7.0: string(0) ""

Current manual says:

Returns the extracted part of string; or FALSE on failure, or an empty string.

Could it be a bug?? https://github.com/wp-cli/wp-cli/blob/master/php/WP_CLI/SynopsisParser.php#L62

  • STDOUT/STDERR cause silent failure, php://stderr works.

Very strange, this works with $handle = STDOUT in function _line

include 'Regular.php';
$a=new WP_CLI\Loggers\Regular(false);
$a->success('msg');

strace says that file descriptor 1 is closed just before it is written to:

close(1)                                = 0
munmap(0x6c56a0383000, 4096)            = 0
getcwd("/root/wp-cli", 4096)            = 13
write(1, ".", 1)                        = -1 EBADF (Bad file descriptor)

This also works:

define ('X_STDOUT', fopen('php://stdout', 'w'));

private function _line( $message, $label, $color, $handle = X_STDOUT ) {
@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor Jun 24, 2015

Contributor

Scenario: Ability to set a custom version when building fails on PHP 5.6 too. Is it a bug?
PHP Fatal error: require(): Failed opening required './vendor/autoload.php' in utils/make-phar.php on line 3
cwd is /tmp/wp-cli-test-run-558a0cad917f32.82006223

Contributor

szepeviktor commented Jun 24, 2015

Scenario: Ability to set a custom version when building fails on PHP 5.6 too. Is it a bug?
PHP Fatal error: require(): Failed opening required './vendor/autoload.php' in utils/make-phar.php on line 3
cwd is /tmp/wp-cli-test-run-558a0cad917f32.82006223

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor Jun 24, 2015

Contributor

All other things are green providing E_DEPRECATED is muted in WP core.

Contributor

szepeviktor commented Jun 24, 2015

All other things are green providing E_DEPRECATED is muted in WP core.

@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber Jun 24, 2015

Member

STDOUT/STDERR cause silent failure

Have you come across any relevant bug reports upstream?

Scenario: Ability to set a custom version when building fails on PHP 5.6 too. Is it a bug?
PHP Fatal error: require(): Failed opening required './vendor/autoload.php' in utils/make-phar.php on line 3

I suspect this means that Composer failed in some way.

Member

danielbachhuber commented Jun 24, 2015

STDOUT/STDERR cause silent failure

Have you come across any relevant bug reports upstream?

Scenario: Ability to set a custom version when building fails on PHP 5.6 too. Is it a bug?
PHP Fatal error: require(): Failed opening required './vendor/autoload.php' in utils/make-phar.php on line 3

I suspect this means that Composer failed in some way.

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor Jun 24, 2015

Contributor

Have you come across any relevant bug reports upstream?

No.
https://bugs.php.net/search.php?limit=30&order_by=id&direction=DESC&cmd=display&status=Open&bug_type=All&phpver=7.0

I suspect this means that Composer failed in some way.

Also on PHP 5.6?

Contributor

szepeviktor commented Jun 24, 2015

Have you come across any relevant bug reports upstream?

No.
https://bugs.php.net/search.php?limit=30&order_by=id&direction=DESC&cmd=display&status=Open&bug_type=All&phpver=7.0

I suspect this means that Composer failed in some way.

Also on PHP 5.6?

@tw2113

This comment has been minimized.

Show comment
Hide comment
@tw2113

tw2113 Aug 10, 2015

Just some hopefully helpful notes. I'm using https://atlas.hashicorp.com/rasmus/boxes/php7dev for my PHP7 source and am not running into much for issues, other than the ones below and similar.

Warning: The `wp plugin install` command has an invalid synopsis part: [--force]
Warning: The `wp plugin install` command has an invalid synopsis part: [--activate]
Warning: The `wp plugin install` command has an invalid synopsis part: [--activate-network]

However, I am also using the .phar file locally in the folder instead of having it in a place like /usr/local/bin.

Not sure how related it is, but food for thought.

tw2113 commented Aug 10, 2015

Just some hopefully helpful notes. I'm using https://atlas.hashicorp.com/rasmus/boxes/php7dev for my PHP7 source and am not running into much for issues, other than the ones below and similar.

Warning: The `wp plugin install` command has an invalid synopsis part: [--force]
Warning: The `wp plugin install` command has an invalid synopsis part: [--activate]
Warning: The `wp plugin install` command has an invalid synopsis part: [--activate-network]

However, I am also using the .phar file locally in the folder instead of having it in a place like /usr/local/bin.

Not sure how related it is, but food for thought.

@centminmod

This comment has been minimized.

Show comment
Hide comment
@centminmod

centminmod Aug 20, 2015

yeah ran into similar as @tw2113 with PHP 7.0.0RC1 at https://community.centminmod.com/posts/17561/

wp cli update --allow-root
Warning: The `wp cli update` command has an invalid synopsis part: [--patch]
Warning: The `wp cli update` command has an invalid synopsis part: [--minor]
Warning: The `wp cli update` command has an invalid synopsis part: [--yes]
Success: WP-CLI is at the latest version.

also

Warning: The `wp core download` command has an invalid synopsis part: [--force]
Downloading WordPress 4.3 (en_US)...
Success: WordPress downloaded.
Warning: The `wp core config` command has an invalid synopsis part: [--extra-php]
Warning: The `wp core config` command has an invalid synopsis part: [--skip-salts]
Warning: The `wp core config` command has an invalid synopsis part: [--skip-check]
Success: Generated wp-config.php file.
Success: WordPress installed successfully.

PHP

php -v
PHP 7.0.0RC1 (cli) (built: Aug 19 2015 21:30:01) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

modules loaded

php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
enchant
exif
filter
ftp
gd
geoip
gettext
gmp
hash
iconv
imagick
imap
intl
json
libxml
mbstring
memcached
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
phpdbg_webhelper
posix
pspell
readline
Reflection
session
shmop
SimpleXML
snmp
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

centminmod commented Aug 20, 2015

yeah ran into similar as @tw2113 with PHP 7.0.0RC1 at https://community.centminmod.com/posts/17561/

wp cli update --allow-root
Warning: The `wp cli update` command has an invalid synopsis part: [--patch]
Warning: The `wp cli update` command has an invalid synopsis part: [--minor]
Warning: The `wp cli update` command has an invalid synopsis part: [--yes]
Success: WP-CLI is at the latest version.

also

Warning: The `wp core download` command has an invalid synopsis part: [--force]
Downloading WordPress 4.3 (en_US)...
Success: WordPress downloaded.
Warning: The `wp core config` command has an invalid synopsis part: [--extra-php]
Warning: The `wp core config` command has an invalid synopsis part: [--skip-salts]
Warning: The `wp core config` command has an invalid synopsis part: [--skip-check]
Success: Generated wp-config.php file.
Success: WordPress installed successfully.

PHP

php -v
PHP 7.0.0RC1 (cli) (built: Aug 19 2015 21:30:01) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

modules loaded

php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
enchant
exif
filter
ftp
gd
geoip
gettext
gmp
hash
iconv
imagick
imap
intl
json
libxml
mbstring
memcached
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
phpdbg_webhelper
posix
pspell
readline
Reflection
session
shmop
SimpleXML
snmp
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment