From a38217df2b9ee5a4cea8dba1066d45d8e33db08a Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 8 Oct 2020 13:02:56 +0100 Subject: [PATCH] fix: check prefix correctly `strpos(string, sub)` returns `false` if `sub` is not present in `string`. In this case, we want to check if `sub` is not a *prefix* of `string`. Hence, we just need to test if the returned position is simply different from 0. --- lib/XRay/PostType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/XRay/PostType.php b/lib/XRay/PostType.php index ed6610a..3c9dc72 100644 --- a/lib/XRay/PostType.php +++ b/lib/XRay/PostType.php @@ -59,7 +59,7 @@ class PostType { // If this processed "name" property value is NOT a prefix of the // processed "content" property, then it is an article post. - if(strpos($content, $name) === false) { + if(strpos($content, $name) !== 0) { return 'article'; }