Skip to content

[RFC] Make compact function reports undefined passed variables#3240

Closed
carusogabriel wants to merge 1 commit intophp:masterfrom
carusogabriel:warning-unknow-compact-variable
Closed

[RFC] Make compact function reports undefined passed variables#3240
carusogabriel wants to merge 1 commit intophp:masterfrom
carusogabriel:warning-unknow-compact-variable

Conversation

@carusogabriel
Copy link
Copy Markdown
Contributor

@carusogabriel carusogabriel commented May 12, 2018

--EXPECTF--
Warning: compact(): Undefined variable: this in %s on line %d
array(1) {
["this"]=>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Are these this warnings right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems to be related to it only dealing with this a couple lines below in https://github.com/php/php-src/pull/3240/files#diff-497f073aa1ab88afcb8b248fc25d2a12R2595

@carusogabriel carusogabriel changed the title Make compact function reports undefined passed variables [RFC] Make compact function reports undefined passed variables May 25, 2018
@marcioAlmada
Copy link
Copy Markdown
Contributor

I see there is a special branch for '$this' but do we have a test covering it? Anyway, a minor detail, voted yes!

@nikic
Copy link
Copy Markdown
Member

nikic commented Jun 6, 2018

@marcioAlmada Yes, see #3240 (comment) :)

@krakjoe krakjoe added the RFC label Jun 14, 2018
@carusogabriel
Copy link
Copy Markdown
Contributor Author

Should be RTM as the RFC was Accepted 😄

@php-pulls
Copy link
Copy Markdown

Comment on behalf of cmb at php.net:

Thanks. Applied via fc775f6.

@php-pulls php-pulls closed this Jun 19, 2018
@carusogabriel carusogabriel deleted the warning-unknow-compact-variable branch June 19, 2018 10:54
@Majkl578
Copy link
Copy Markdown
Contributor

@LC43 It is possible to declare variables with such malformed names: https://3v4l.org/M9mAJ

@LC43
Copy link
Copy Markdown

LC43 commented Feb 18, 2019

oops, thanks for the correction, @Majkl578! I'll remove my initial comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants