php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79193 Incorrect type inference for self::$field =& $field
Submitted: 2020-01-29 20:38 UTC Modified: 2020-01-30 13:55 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: leho at conversionready dot com Assigned: nikic (profile)
Status: Closed Package: opcache
PHP Version: 7.4.2 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: leho at conversionready dot com
New email:
PHP Version: OS:

 

 [2020-01-29 20:38 UTC] leho at conversionready dot com
Description:
------------
This seems like some kind of an engine regression from 7.3. Staging system running 7.4.2 breaks, live system 7.3.13 works.

Code https://github.com/opencredit/badgeos/blob/1.4.11/includes/cmb/init.php#L380

Relevant code below:

```
/**
 * $field $field array (4)
 *
 *   ⇄name => string (18) "Upload Badge Image"
 *
 *   ⇄⧉desc => string (903) "<p>To set an image use the <strong>Achievement Image</strong> metabox to the...
 *
 *   ⇄id => string (39) "_badgeos_upload_badge_image_achievement"
 *
 *   ⇄type => string (9) "text_only"
 */

...
self::$field =& $field;

isset( $field['name'] ); // false. How??
```

Behavior changed when I loaded the same screen on another FPM pool that was running Xdebug - everything passed error free.

Behavior also changes if I replace reference with regular assignment, like `self::$field = $field` - this particular problem goes away, but other (probably unrelated) pieces in the chain now cough.

Your thoughts?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-29 20:45 UTC] leho at conversionready dot com
Interestingly, `isset( self::$field['name'] ); // true`
 [2020-01-29 21:33 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2020-01-29 21:33 UTC] requinix@php.net
Any difference if you disable opcache?
 [2020-01-29 21:44 UTC] leho at conversionready dot com
-Status: Feedback +Status: Open
 [2020-01-29 21:44 UTC] leho at conversionready dot com
Good call! `opcache.enable = 0` also makes this problem disappear.

Time to reassign Package -> Opcache?
 [2020-01-29 22:04 UTC] requinix@php.net
-Package: Variables related +Package: opcache
 [2020-01-29 22:04 UTC] requinix@php.net
Yup.
 [2020-01-30 13:49 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2020-01-30 13:49 UTC] nikic@php.net
Looks like a type inference bug.
 [2020-01-30 13:55 UTC] nikic@php.net
-Summary: 7.3 -> 7.4 broke `self::$field =& $field`, now `isset( $field['name'] )` false +Summary: Incorrect type inference for self::$field =& $field
 [2020-01-30 13:56 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f70b552326e5242655d6ac2c55ca220e89afef34
Log: Fixed bug #79193
 [2020-01-30 13:56 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 00:01:27 2024 UTC