#37071 closed defect (bug) (fixed)
PHP 7.1.0 changed how they handle string vs array-indexes.
| Reported by: | simonvik | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.6 |
| Component: | Users | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
Login to wordpress fails with Warning: Illegal string offset 'user_login' under php 7.1.0 alpha 1.
wp-login.php sends an empty string to wp_signon that expects an array.
The following patch to wp-login.php seems to solves the issue:
@@ -790,7 +790,7 @@ function retrieve_password() { $reauth = empty($_REQUEST['reauth']) ? false : true; - $user = wp_signon( '', $secure_cookie ); + $user = wp_signon( array(), $secure_cookie ); if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { if ( headers_sent() ) {
Attachments (1)
Change History (14)
#4
@
10 years ago
Might make sense to fix this in wp_signon as well, just in case plugins copied core's implementation.
#6
@
10 years ago
From #37083:
[Mon Jun 13 00:24:29 2016] PHP Warning: Illegal string offset 'remember' in /tmp/wordpress/wp-includes/user.php on line 41
[Mon Jun 13 00:24:29 2016] PHP Stack trace:
[Mon Jun 13 00:24:29 2016] PHP 1. {main}() /tmp/wordpress/router.php:0
[Mon Jun 13 00:24:29 2016] PHP 2. require_once() /tmp/wordpress/router.php:51
[Mon Jun 13 00:24:29 2016] PHP 3. wp_signon() /tmp/wordpress/wp-login.php:784
[Mon Jun 13 00:24:29 2016] PHP Warning: Cannot assign an empty string to a string offset in /tmp/wordpress/wp-includes/user.php on line 41
[Mon Jun 13 00:24:29 2016] PHP Stack trace:
[Mon Jun 13 00:24:29 2016] PHP 1. {main}() /tmp/wordpress/router.php:0
[Mon Jun 13 00:24:29 2016] PHP 2. require_once() /tmp/wordpress/router.php:51
[Mon Jun 13 00:24:29 2016] PHP 3. wp_signon() /tmp/wordpress/wp-login.php:784
[Mon Jun 13 00:24:29 2016] PHP Warning: Illegal string offset 'user_login' in /tmp/wordpress/wp-includes/user.php on line 56
[Mon Jun 13 00:24:29 2016] PHP Stack trace:
[Mon Jun 13 00:24:29 2016] PHP 1. {main}() /tmp/wordpress/router.php:0
[Mon Jun 13 00:24:29 2016] PHP 2. require_once() /tmp/wordpress/router.php:51
[Mon Jun 13 00:24:29 2016] PHP 3. wp_signon() /tmp/wordpress/wp-login.php:784
[Mon Jun 13 00:24:29 2016] PHP Fatal error: Uncaught Error: Cannot create references to/from string offsets in /tmp/wordpress/wp-includes/user.php:56
Moved here as it's all related.
#10
@
10 years ago
there are some failed external-http tests with a similar cause.
#12
@
10 years ago
- Resolution → fixed
- Status reopened → closed
Upstream ticket for the change: https://bugs.php.net/bug.php?id=53432
Tests are running fine with PHP 7.1.0alpha2, closing as fixed. Feel free to reopen if you find another case which needs to be fixed.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Attached patch that might solve the issue.