Browse Source

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.
pull/100/head
Henrique Dias 4 years ago
committed by GitHub
parent
commit
a38217df2b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      lib/XRay/PostType.php

+ 1
- 1
lib/XRay/PostType.php View File

@ -59,7 +59,7 @@ class PostType {
// If this processed "name" property value is NOT a prefix of the // If this processed "name" property value is NOT a prefix of the
// processed "content" property, then it is an article post. // processed "content" property, then it is an article post.
if(strpos($content, $name) === false) {
if(strpos($content, $name) !== 0) {
return 'article'; return 'article';
} }

Loading…
Cancel
Save