Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Routing] Disallow object usage inside Route#27727

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

paxal
Copy link
Contributor

QA
Branch?master
Bug fix?no
New feature?no
BC breaks?no
Deprecations?no
Tests pass??
Fixed tickets#27723
LicenseMIT
Doc PR

As discussed in#27723 theRoute object should not support nested objects as attributes (requirements,defaults, ...).

Thus, if detected, an\InvalidArgumentException will be thrown.

Willfix#27723

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

For 4.1 as bug fix? the issue also exists on 2.8, but there we don't have an "export" method as we rely only onvar_export().

@@ -746,6 +746,10 @@ public static function export($value): string
return 'null';
}
if (!\is_array($value)) {
if (\is_object($value)) {

Choose a reason for hiding this comment

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

if (\is_object($value) && !method_exists($value, '__set_state')) {

Copy link
Member

Choose a reason for hiding this comment

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

even objects with__set_state are broken, as the logic currently replaces new lines by a concatenation with"\n" instead (because when var_export-ing a scalar, new lines appear only inside strings).

If we want to keep support for objects with__set_state, it should be handled as a separate case (and I would put it before theif (!is_array()) case then, rather than nesting in it)

Choose a reason for hiding this comment

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

even objects with __set_state are broken

indeed, then let's keep it unsupported :)

Copy link
ContributorAuthor

@paxalpaxalJun 26, 2018
edited
Loading

Choose a reason for hiding this comment

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

The purpose of this PR is to disallow object usage, and avoid to export objects (viavar_export). Thus, the fact that__set_state exists or not is not relevant. The dumped file does not work when we export an object (because of\n replacements).

Did not see the comments above :)

@@ -746,6 +746,10 @@ public static function export($value): string
return 'null';
}
if (!\is_array($value)) {
if (\is_object($value)) {
throw new \InvalidArgumentException('Symfony\Component\Routing\Route cannot contain objects');

Choose a reason for hiding this comment

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

missing dot at end of message

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Fixed and squashed.

@nicolas-grekasnicolas-grekas added this to the4.1 milestoneJun 26, 2018
@paxalpaxalforce-pushed thefix/php_matcher_dumper_export_class branch from59f5f54 tof1b3ffcCompareJune 26, 2018 12:15
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

(for 4.1)

nicolas-grekasand others added5 commitsJune 28, 2018 07:55
…Bonfante)This PR was submitted for the master branch but it was squashed and merged into the 4.1 branch instead (closessymfony#27754).Discussion----------[HttpFoundation] missing namespace for RedisProxyI think the intention was to check if is instance of \Symfony\Component\Cache\Traits\RedisProxy| Q             | A| ------------- | ---| Branch?       | 4.1 (becareful when merging)| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |<!--Write a short README entry for your feature/bugfix here (replace this comment block.)This will help people understand your PR and can be used as a start of the Doc PR.Additionally: - Bug fixes must be submitted against the lowest branch where they apply   (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch.-->Commits-------8e0acfc [HttpFoundation] missing namespace for RedisProxy
…regex (nicolas-grekas)This PR was merged into the 4.1 branch.Discussion----------[Routing] fix too much greediness in host-matching regex| Q             | A| ------------- | ---| Branch?       | 4.1| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |symfony#27721| License       | MIT| Doc PR        | -Commits-------e16b302 [Routing] fix too much greediness in host-matching regex
@nicolas-grekasnicolas-grekas changed the base branch frommaster to4.1June 28, 2018 06:30
@nicolas-grekasnicolas-grekasforce-pushed thefix/php_matcher_dumper_export_class branch fromf1b3ffc to426fb45CompareJune 28, 2018 06:30
@nicolas-grekas
Copy link
Member

Thank you@paxal.

paxal reacted with heart emoji

@nicolas-grekasnicolas-grekas merged commit426fb45 intosymfony:4.1Jun 28, 2018
nicolas-grekas added a commit that referenced this pull requestJun 28, 2018
This PR was submitted for the master branch but it was merged into the 4.1 branch instead (closes#27727).Discussion----------[Routing] Disallow object usage inside Route| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | ?| Fixed tickets |#27723| License       | MIT| Doc PR        | ✘As discussed in#27723 the `Route` object should not support nested objects as attributes (`requirements`, `defaults`, ...).Thus, if detected, an `\InvalidArgumentException` will be thrown.Willfix#27723Commits-------426fb45 [Routing] Disallow object usage inside Route
@fabpotfabpot mentioned this pull requestJul 23, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
4.1
Development

Successfully merging this pull request may close these issues.

5 participants
@paxal@nicolas-grekas@stof@carsonbot@bonfante

[8]ページ先頭

©2009-2025 Movatter.jp