Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2686535
D25605.1734718416.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
D25605.1734718416.diff
View Options
diff --git a/src/infrastructure/markup/markuprule/PhutilRemarkupHexColorCodeRule.php b/src/infrastructure/markup/markuprule/PhutilRemarkupHexColorCodeRule.php
--- a/src/infrastructure/markup/markuprule/PhutilRemarkupHexColorCodeRule.php
+++ b/src/infrastructure/markup/markuprule/PhutilRemarkupHexColorCodeRule.php
@@ -9,10 +9,13 @@
public function apply($text) {
// Match {#FFFFFF}
- return preg_replace_callback(
- '@\B\{(#([0-9a-fA-F]{3}){1,2})\}@',
- array($this, 'markupHexColorCodedText'),
- $text);
+ if (is_string($text)) {
+ return preg_replace_callback(
+ '@\B\{(#([0-9a-fA-F]{3}){1,2})\}@',
+ array($this, 'markupHexColorCodedText'),
+ $text);
+ }
+ return $text;
}
protected function contrastingColor($color_code) {
diff --git a/src/infrastructure/markup/markuprule/PhutilRemarkupRule.php b/src/infrastructure/markup/markuprule/PhutilRemarkupRule.php
--- a/src/infrastructure/markup/markuprule/PhutilRemarkupRule.php
+++ b/src/infrastructure/markup/markuprule/PhutilRemarkupRule.php
@@ -18,6 +18,12 @@
return 500.0;
}
+ /**
+ * Check input whether to apply RemarkupRule. If true, apply formatting.
+ * @param string|PhutilSafeHTML String to check and potentially format.
+ * @return string|PhutilSafeHTML Unchanged input if no match, or input after
+ * matching the formatting rule and applying the formatting.
+ */
abstract public function apply($text);
public function getPostprocessKey() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 18:13 (11 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1019033
Default Alt Text
D25605.1734718416.diff (1 KB)
Attached To
Mode
D25605: PhutilRemarkupHexColorCodeRule: Do not assume that parameter is a string
Attached
Detach File
Event Timeline
Log In to Comment