jenkins-bot has submitted this change and it was merged.

Change subject: fix bug with echo when first argument is null or false (v 
3.10.1)
......................................................................


fix bug with echo when first argument is null or false (v 3.10.1)

Change-Id: Iaa3a54594fe91d9d418280ba03365bf09824be86
---
M PhpTags.body.php
M PhpTags.php
M tests/parser/PhpTagsTests.txt
M tests/phpunit/includes/RuntimeTest.php
4 files changed, 43 insertions(+), 3 deletions(-)

Approvals:
  Pastakhov: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/PhpTags.body.php b/PhpTags.body.php
index c1cc3ac..3137436 100644
--- a/PhpTags.body.php
+++ b/PhpTags.body.php
@@ -88,7 +88,7 @@
                }
                self::$time += $parser->mOutput->getTimeSinceStart( 'cpu' ) - 
$time;
 
-               if( true === isset( $result[0] ) ) {
+               if( $result ) {
                        $return = self::insertGeneral(
                                        $parser,
                                        $parser->recursiveTagParse( 
implode($result), $frame )
diff --git a/PhpTags.php b/PhpTags.php
index f90132d..8b595f5 100644
--- a/PhpTags.php
+++ b/PhpTags.php
@@ -17,7 +17,7 @@
 
 const PHPTAGS_MAJOR_VERSION = 3;
 const PHPTAGS_MINOR_VERSION = 10;
-const PHPTAGS_RELEASE_VERSION = 0;
+const PHPTAGS_RELEASE_VERSION = 1;
 define( 'PHPTAGS_VERSION', PHPTAGS_MAJOR_VERSION . '.' . PHPTAGS_MINOR_VERSION 
. '.' . PHPTAGS_RELEASE_VERSION );
 
 const PHPTAGS_HOOK_RELEASE = 5;
diff --git a/tests/parser/PhpTagsTests.txt b/tests/parser/PhpTagsTests.txt
index 92b8629..09771b2 100644
--- a/tests/parser/PhpTagsTests.txt
+++ b/tests/parser/PhpTagsTests.txt
@@ -57,4 +57,20 @@
 !! result
 <p>bar
 </p>
-!! end
\ No newline at end of file
+!! end
+
+!! test
+echo null true false
+!! input
+<phptag> echo null, true, false; </phptag>
+!! result
+<p>1
+</p>
+!! end
+
+!! test
+echo nothing
+!! input
+<phptag> ; </phptag>
+!! result
+!! end
diff --git a/tests/phpunit/includes/RuntimeTest.php 
b/tests/phpunit/includes/RuntimeTest.php
index 740e51c..5180a61 100644
--- a/tests/phpunit/includes/RuntimeTest.php
+++ b/tests/phpunit/includes/RuntimeTest.php
@@ -3,6 +3,30 @@
 
 class RuntimeTest extends \PHPUnit_Framework_TestCase {
 
+       public function testRun_echo_null_1() {
+               $this->assertEquals(
+                               Runtime::runSource('echo null;'),
+                               array( null )
+                       );
+       }
+       public function testRun_echo_true_1() {
+               $this->assertEquals(
+                               Runtime::runSource('echo true;'),
+                               array( true )
+                       );
+       }
+       public function testRun_echo_false_1() {
+               $this->assertEquals(
+                               Runtime::runSource('echo false;'),
+                               array( false )
+                       );
+       }
+       public function testRun_no_echo_1() {
+               $this->assertEquals(
+                               Runtime::runSource(';'),
+                               array()
+                       );
+       }
        public function testRun_echo_apostrophe_1() {
                $this->assertEquals(
                                Runtime::runSource('echo "Hello!";'),

-- 
To view, visit https://gerrit.wikimedia.org/r/171808
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaa3a54594fe91d9d418280ba03365bf09824be86
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PhpTags
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <pastak...@yandex.ru>
Gerrit-Reviewer: Pastakhov <pastak...@yandex.ru>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to