Skip to content
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

Fixed #74035 - ReflectionClass::newInstance param set as optional #2363

Closed
wants to merge 1 commit into from

Conversation

andrewnester
Copy link
Contributor

@krakjoe krakjoe added the Bug label Feb 3, 2017
@@ -6273,7 +6273,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isInstance, 0)
ZEND_ARG_INFO(0, object)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstance, 0)
ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_newInstance, 0, 0, 0)
ZEND_ARG_INFO(0, args)
Copy link
Member

Choose a reason for hiding this comment

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

While at it, this should be specified as a variadic argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nikic Good catch! thanks! fixed now.

@andrewnester andrewnester changed the base branch from master to PHP-7.0 February 3, 2017 09:47
@nikic
Copy link
Member

nikic commented Feb 3, 2017

Merged via 9ffc6ca, thanks!

@nikic nikic closed this Feb 3, 2017
@alexpott
Copy link

This commit appears to have broken doctrine-common's static reflection parser - ie. \Doctrine\Common\Reflection\StaticReflectionClass::newInstance()

Drupal 8 tests against php 7.0-dev and 7.1-dev and we're seeing lots of errors like:
Declaration of Doctrine\Common\Reflection\StaticReflectionClass::newInstance($args) should be compatible with ReflectionClass::newInstance(...$args)

We're tracking the issue in https://www.drupal.org/node/2850639

@nikic
Copy link
Member

nikic commented Feb 12, 2017

Aww, crap. Looks like we can't make this parameter optional without breaking BC. I will revert this from 7.0 and 7.1 and leave it in master only.

@alexpott
Copy link

@nikic I think it might have only been the change to specify it being variadic that looks like it was an addition to the patch on review.

@nikic
Copy link
Member

nikic commented Feb 12, 2017

@alexpott Unfortunately both are breaking changes, because making an optional parameter required during inheritance is not legal.

@nikic
Copy link
Member

nikic commented Feb 12, 2017

Change reverted by eb1373e in 7.0 and 7.1. The change is still in master, so code still needs to be adjusted to use the correct signature at some point.

@andrewnester
Copy link
Contributor Author

Wow, sorry! Will be a good lesson for me in future to check if my changes break BC

@alexpott
Copy link

alexpott commented Nov 2, 2017

@nikic this is about to break things in PHP7.2. Is this change allowed in a minor PHP version?

@Majkl578
Copy link
Contributor

Majkl578 commented Nov 2, 2017

Ping @sgolemon @remicollet, this has NOT been reverted for 7.2 and still is a BC break: https://3v4l.org/7igHL

@Majkl578
Copy link
Contributor

Majkl578 commented Nov 2, 2017

There's already an open bug report for this: https://bugs.php.net/bug.php?id=74292

@Majkl578
Copy link
Contributor

Majkl578 commented Nov 2, 2017

PR against PHP-7.2 reverting this: #2893

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.

None yet

5 participants