zoukankan      html  css  js  c++  java
  • amfphp传递负数的bug

    There is a weird bug in AMFPHP regarding sending negative integers. If you try and send a number such as -87, it shows up as 4294967209 in php. I did some digging and found on the amfphp forums that it has to do with amfphp's readAmf3Int() method in AMFDeserialzer.php. Here is the updated function that was posted on the forum:

          function readAmf3Int()

              {
                  $res = 0;
                  $int = $this->readByte();
                
                  if($int <128) {
                      return $int;
                  } else {
                      $int = ($int & 0x7f) <<7;
                     
                      $tmp = $this->readByte();
                     
                      if($tmp <128) {
                          $int |= $tmp;
                      }else{
                          $int = ($int | ($tmp & 0x7f)) <<7;
                          $tmp = $this->readByte();
                          if($tmp <128){
                              $int |= $tmp;
                          }else{
                              $int = ($int | ($tmp & 0x7f)) <<8;
                              $tmp = $this->readByte();
                              $int |= $tmp;
                          }
                      }
                  }
           
                  $mask = 1<<28;
                  $res = -($int & $mask) | $int;
           
                  return $res;
              }
  • 相关阅读:
    java获取当前项目或类路径
    java转义字符处理——“\”替换为“/”
    OpenModelica 在特定目录下生成仿真结果文件
    Eclipse常用设置
    java反编译器
    OMShell常用命令及遇到的问题
    Java中的单实例
    Eclipse常用设置
    Eclipse快捷键
    vlookup+match高亮显示行
  • 原文地址:https://www.cnblogs.com/rooney/p/2314808.html
Copyright © 2011-2022 走看看