• 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;
              }
  • 相关阅读:
    ASP.Net软件工程师基础(四)
    ASP.Net软件工程师基础(三)
    ASP.Net软件工程师基础(二)
    ASP.Net软件工程师基础(一)
    SVN小小用法(一)svn服务器搭建
    必须声明标量变量
    用户 NT AUTHORITYNETWORK SERVICE 登录失败
    winmail安装完成后,SMTP/POP3/ADMIN/HTTP/IMAP/LDAP服务不能启动?
    CF-798C
    CF-798B
  • 原文地址:https://www.cnblogs.com/rooney/p/2314808.html
Copyright © 2020-2023  润新知