Skip to content

Commit

Permalink
fixes for php 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemorroj committed Dec 31, 2019
1 parent 0e5221a commit 7f26dd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Xbbcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -1089,13 +1089,13 @@ protected function getToken()
$charType = false;
while (true) {
$tokenType = $charType;
if (!isset($this->text{$this->cursor})) {
if (!isset($this->text[$this->cursor])) {
if (false === $charType) {
return false;
}
break;
}
$char = $this->text{$this->cursor};
$char = $this->text[$this->cursor];
switch ($char) {
case '[':
$charType = 0;
Expand Down
8 changes: 4 additions & 4 deletions tests/Tag/ATest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class ATest extends \PHPUnit\Framework\TestCase
{
public function testTag()
{
$text = 'test [url=https://github.com/Gemorroj/xBBCode]xBBCode[/url].';
$result = 'test <a class="bb" href="https://github.com/Gemorroj/xBBCode">xBBCode</a>.';
$text = 'test [url=https://github.com/Gemorroj/xBBCode]xBBCode - привет мир[/url].';
$result = 'test <a class="bb" href="https://github.com/Gemorroj/xBBCode">xBBCode - привет мир</a>.';

$xbbcode = new Xbbcode();
$xbbcode->setAutoLinks(true);
Expand All @@ -21,8 +21,8 @@ public function testTag()
$this->assertEquals($result, $xbbcode->getHtml());


$text = 'test [url]https://github.com/Gemorroj/xBBCode[/url].';
$result = 'test <a class="bb" href="https://github.com/Gemorroj/xBBCode">https://github.com/Gemorroj/xBBCode</a>.';
$text = 'test [url]https://github.com/Gemorroj/xBBCode#привет[/url].';
$result = 'test <a class="bb" href="https://github.com/Gemorroj/xBBCode#%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82">https://github.com/Gemorroj/xBBCode#привет</a>.';

$xbbcode = new Xbbcode();
$xbbcode->setAutoLinks(true);
Expand Down

0 comments on commit 7f26dd7

Please # to comment.