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;
              }
  • 相关阅读:
    求一个电子书制作的好方法
    解决windows xp系统,报iis提示访问人数过多错误
    DEVELOPER: ODP.NET Instant ODP.NET Deployment
    重新注册Oracle相关库
    ODP.NET调用存储需要使用事务
    ReportViewer在设计报告参数(SetParameter)时线程挂起(hang)
    js 时间
    验证码
    script标签属性用type还是language?
    iScroll框架的修改
  • 原文地址:https://www.cnblogs.com/rooney/p/2314808.html
Copyright © 2011-2022 走看看