Pastakhov has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/271207

Change subject: Fix string to number conversion in Compiler (v 5.7.2) Runtime 10
......................................................................

Fix string to number conversion in Compiler (v 5.7.2) Runtime 10

There were different values in pure PHP and PhpTags. Now it the same.

Problem depends of conversion inside pure PHP:
Example: (int)420000000000000000000
Output for 5.3.22 - 5.4.45, hhvm-3.6.1 - 3.12.0
int 0

Output for 5.5.0 - 7.0.3
int -4275113695319687168

Change-Id: I1ec745fb100aa680ad6a05d5a669e7b7b2010586
---
M PhpTags.php
M includes/Compiler.php
2 files changed, 4 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PhpTags 
refs/changes/07/271207/1

diff --git a/PhpTags.php b/PhpTags.php
index 427bf0e..07d18ae 100644
--- a/PhpTags.php
+++ b/PhpTags.php
@@ -17,11 +17,11 @@
 
 const PHPTAGS_MAJOR_VERSION = 5;
 const PHPTAGS_MINOR_VERSION = 7;
-const PHPTAGS_RELEASE_VERSION = 1;
+const PHPTAGS_RELEASE_VERSION = 2;
 define( 'PHPTAGS_VERSION', PHPTAGS_MAJOR_VERSION . '.' . PHPTAGS_MINOR_VERSION 
. '.' . PHPTAGS_RELEASE_VERSION );
 
 const PHPTAGS_HOOK_RELEASE = 8;
-const PHPTAGS_RUNTIME_RELEASE = 9;
+const PHPTAGS_RUNTIME_RELEASE = 10;
 const PHPTAGS_JSONLOADER_RELEASE = 3;
 
 // Register this extension on Special:Version
diff --git a/includes/Compiler.php b/includes/Compiler.php
index 0b8828c..a9fb168 100644
--- a/includes/Compiler.php
+++ b/includes/Compiler.php
@@ -453,17 +453,12 @@
                                                $tmp = intval( $text, 8 );
                                        }
                                } else {
-                                       $tmp = (int)$text;
+                                       $tmp = $text + 0;
                                }
                                $result = array( Runtime::B_COMMAND=>null, 
Runtime::B_RESULT=>$tmp, Runtime::B_TOKEN_LINE=>$this->tokenLine, 
Runtime::B_DEBUG=>$text );
                                break;
                        case T_DNUMBER:
-                               $epos = stripos($text, 'e');
-                               if ( $epos === false ) {
-                                       $tmp = (float)$text;
-                               } else {
-                                       $tmp = (float)( substr($text, 0, $epos) 
* pow(10, substr($text, $epos+1)) );
-                               }
+                               $tmp = $text + 0;
                                $result = array( Runtime::B_COMMAND=>null, 
Runtime::B_RESULT=>$tmp, Runtime::B_TOKEN_LINE=>$this->tokenLine, 
Runtime::B_DEBUG=>$text );
                                break;
                        case T_CONSTANT_ENCAPSED_STRING:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ec745fb100aa680ad6a05d5a669e7b7b2010586
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PhpTags
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <pastak...@yandex.ru>

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

Reply via email to