Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18831143
D21173.id50415.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
906 B
Referenced Files
None
Subscribers
None
D21173.id50415.diff
View Options
diff --git a/src/parser/xhpast/api/XHPASTNode.php b/src/parser/xhpast/api/XHPASTNode.php
--- a/src/parser/xhpast/api/XHPASTNode.php
+++ b/src/parser/xhpast/api/XHPASTNode.php
@@ -163,7 +163,26 @@
$re = '/\\\\.|(\$|\{\$|\${)([a-z_\x7F-\xFF][a-z0-9_\x7F-\xFF]*)/i';
$matches = null;
preg_match_all($re, $value, $matches, PREG_OFFSET_CAPTURE);
- return ipull(array_filter($matches[2]), 0, 1);
+
+ // NOTE: The result format for this construction changed in PHP 7.4.
+ // See T13518.
+
+ $names = $matches[2];
+ foreach ($names as $name_idx => $name_match) {
+ if (!strlen($name_match[0])) {
+ unset($names[$name_idx]);
+ continue;
+ }
+
+ if ($name_match[1] === -1) {
+ unset($names[$name_idx]);
+ continue;
+ }
+ }
+
+ $names = ipull($names, 0, 1);
+
+ return $names;
}
public function getStringLiteralValue() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 26, 11:13 AM (3 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
12818879
Default Alt Text
D21173.id50415.diff (906 B)
Attached To
Mode
D21173: Accommodate PHP 7.4 changes to certain "preg_match_all()" calls
Attached
Detach File
Event Timeline
Log In to Comment