Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
[XenForoBridge] Fix error if message is < 70 chars (RSS-Bridge#2707)
Browse files Browse the repository at this point in the history
At the time of writing, this occurs on the following thread:
https://forum.xda-developers.com/t/optimized-lineageos19-1-v4-0-23apr.4426575/

Fixes the following error:
ValueError: strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) in ./rss-bridge/bridges/XenForoBridge.php:272
Stack trace:
0 ./rss-bridge/bridges/XenForoBridge.php(272): strpos()
1 ./rss-bridge/bridges/XenForoBridge.php(146): XenForoBridge->extractThreadPostsV2()
2 ./rss-bridge/actions/DisplayAction.php(134): XenForoBridge->collectData()
3 ./rss-bridge/index.php(24): DisplayAction->execute()
4 {main}
  • Loading branch information
Mynacol authored May 8, 2022
1 parent d107592 commit 36d11fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bridges/XenForoBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private function extractThreadPostsV2($html, $url) {
$item['uri'] = $url . '#' . $post->getAttribute('id');

$title = $post->find('div[class~="message-content"] article', 0)->plaintext;
$end = strpos($title, ' ', 70);
$end = strpos($title, ' ', min(70, strlen($title)));
$item['title'] = substr($title, 0, $end);

if ($post->find('time[datetime]', 0)) {
Expand Down

0 comments on commit 36d11fd

Please sign in to comment.