-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ReflectionParameter::isDefaultValueConstant() is missing #3812
Comments
I believe I'm able to fix this one. |
@lucastadeu: This is what I have locally for this. (Postponed for some reason, which I don't remember.) Sadly there is no native way to get the info, so detection is extremely hackish. diff --git a/hphp/runtime/ext/reflection/ext_reflection-classes.php b/hphp/runtime/ext/reflection/ext_reflection-classes.php
index 9d4a680..617ae1a 100644
--- a/hphp/runtime/ext/reflection/ext_reflection-classes.php
+++ b/hphp/runtime/ext/reflection/ext_reflection-classes.php
@@ -413,11 +413,18 @@ class ReflectionParameter implements Reflector {
* @return mixed Returns string on success or NULL on failure.
*/
public function getDefaultValueConstantName() {
- if (array_key_exists('defaultText', $this->info)) {
- return $this->info['defaultText'];
+ if (!array_key_exists('defaultText', $this->info)) {
+ return null;
}
- return '';
+ $val = $this->info['defaultText'];
+ if ($val[0] === '"' || $val[0] === "'" || $val[0] === '['
+ || $val === 'NULL' || $val === 'true' || $val === 'false'
+ || substr($val, 0, 5) === 'array' || strpbrk($val[0], '-0123456789') !== FALSE) {
+ return null;
+ }
+
+ return ltrim($val, '\\');
}
// This doc comment block generated by idl/sysdoc.php
@@ -495,6 +502,20 @@ class ReflectionParameter implements Reflector {
$index);
}
}
+
+ /**
+ * ( excerpt from
+ * http://php.net/manual/en/reflectionparameter.isdefaultvalueconstant.php )
+ *
+ * Warning: This function is currently not documented; only its argument
+ * list is available.
+ *
+ * @return mixed Returns TRUE if the default value is constant, FALSE
+ * if it is not or NULL on failure.
+ */
+ public function isDefaultValueConstant() {
+ return $this->getDefaultValueConstantName() !== null;
+ }
}
/////////////////////////////////////////////////////////////////////////////// |
@Majkl578 mine was equally hackish :-P Nevermind it then. |
@lucastadeu: Feel free to send PR if you want, if not, I'll try. :) |
@Majkl578: Okay then! I'll send a PR soon enough :) |
@lucastadeu Are you planning to submit that PR? |
Any update on this one? |
This bug is still open: facebook/hhvm#3812
Up! |
This sounds like it was implemented. |
Doesn't appear to have been merged though |
Implemented now. |
@JoelMarcey Thank you, what's the fix version for this bug? The latest release, 3.11.1 is still affected. |
Is there a PR for the 3.11 branch? At the moment it's not in there |
@fredemmott Is 3.11 going to be 3.11.2, without a new cut? |
We re-cut for y releases, z releases are cherry-picks on top of the HHVM-x.y branch |
I didn't think this was 100% necessary for a z-release cherry-pick. I was thinking this would go into 3.12. Has 3.12 been cut? |
Yep, cut on the 18th: https://docs.hhvm.com/hhvm/installation/release-schedule |
So, I would be in favor of either cherry-picking into 3.12 or waiting until 3.13. I think we have enough to deal with in 3.11.x at this point. |
So if I'm matching against a version number for this, what version should I be using? |
Right now there is nor version number to match. You need to download the nightlies (http://dl.hhvm.com/) or build from |
The fix for ReflectionParameter::isDefaultValueConstant() is still not present in any version. @see facebook/hhvm#3812
As mentioned in #1600, this method is missing. (#1600 was addressing this issue, but was closed because too broad.)
The text was updated successfully, but these errors were encountered: