Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2697627
D25356.1734946638.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25356.1734946638.diff
View Options
diff --git a/src/parser/PhutilURI.php b/src/parser/PhutilURI.php
--- a/src/parser/PhutilURI.php
+++ b/src/parser/PhutilURI.php
@@ -561,4 +561,32 @@
return false;
}
+ /**
+ * This is just a complicated type-check - we'll eventually replace it with a
+ * native type-hint of `PhutilURI | string | null`, when this type-hint is
+ * available (php 8.0).
+ *
+ * Before php 8, and after we suspect there aren't many more cases where this
+ * fails, we'll replace the log with an exception.
+ */
+ public static function checkHrefType($value) {
+ if ($value === null || is_string($value)) {
+ return;
+ }
+
+ if ($value instanceof PhutilURI) {
+ return;
+ }
+
+ $report_type = is_object($value) ? get_class($value) : gettype($value);
+
+ // We log stuff with a kind stack trace
+ phlog(
+ pht(
+ 'Unexpected value type provided for an HREF field - %s. '.
+ 'Please share this stack trace as comment in Task %s',
+ $report_type,
+ 'https://we.phorge.it/T15316'));
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 09:37 (15 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1026889
Default Alt Text
D25356.1734946638.diff (1 KB)
Attached To
Mode
D25356: (arc) Unify type-checking for `setHref()` type methods
Attached
Detach File
Event Timeline
Log In to Comment