From 7f26dd796339cf08e98e192d60a602ad5c7f7724 Mon Sep 17 00:00:00 2001 From: Gemorroj Date: Tue, 31 Dec 2019 15:05:38 +0300 Subject: [PATCH] fixes for php 7.4 --- src/Xbbcode.php | 4 ++-- tests/Tag/ATest.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Xbbcode.php b/src/Xbbcode.php index 9d24e0b..b2c683a 100644 --- a/src/Xbbcode.php +++ b/src/Xbbcode.php @@ -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; diff --git a/tests/Tag/ATest.php b/tests/Tag/ATest.php index 31a5eaf..8fd9b68 100644 --- a/tests/Tag/ATest.php +++ b/tests/Tag/ATest.php @@ -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 xBBCode.'; + $text = 'test [url=https://github.com/Gemorroj/xBBCode]xBBCode - привет мир[/url].'; + $result = 'test xBBCode - привет мир.'; $xbbcode = new Xbbcode(); $xbbcode->setAutoLinks(true); @@ -21,8 +21,8 @@ public function testTag() $this->assertEquals($result, $xbbcode->getHtml()); - $text = 'test [url]https://github.com/Gemorroj/xBBCode[/url].'; - $result = 'test https://github.com/Gemorroj/xBBCode.'; + $text = 'test [url]https://github.com/Gemorroj/xBBCode#привет[/url].'; + $result = 'test https://github.com/Gemorroj/xBBCode#привет.'; $xbbcode = new Xbbcode(); $xbbcode->setAutoLinks(true);