doucheng2053 2013-12-03 23:06
浏览 70
已采纳

PHP filter_strip_low / high允许将控制字符转换为字符串

Hey guys you'll have to run this to see what I'm talking about, but I am getting either low or high control characters into my strings using the below code, I recommend running it through a bash terminal as this is how I am seeing glyph like characters.

To my knowledge this should be happening? How are these character escaping the filter?

#!/usr/bin/php
<?php
$i=0; while ($i++ <= 20)

    echo 'STR: ' .filter_var(openssl_random_pseudo_bytes(100), FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH) . "
";

Example, I'm not sure if you can see the [] after the character sequence js*w but that is pretty much what I'm talking about, it was my opinion that it should have been filtered out with the rest of the high/low stuff

STR: &#60;|f)/KZ2|36rb2&#60;.9|X3 js*wjZ6Dp-f8R[/O/VY
  • 写回答

1条回答 默认 最新

  • dongtan6695 2013-12-04 06:13
    关注

    FILTER_FLAG_STRIP_LOW: Strips characters that has a numerical value <32. FILTER_FLAG_STRIP_HIGH: Strips characters that has a numerical value >127.

    ord("[") returns 91, and ord("]") returns 93 so they should not be filtered out

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?