PHP 5.3.3 bug 或 preg_match 验证错误?

发布于 2024-10-05 14:37:20 字数 1047 浏览 0 评论 0原文

<?php
$query = 'q=Riha47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a4744444444444444444444444444444444444444444444444na&start-index=60&max-results=20';
$pattern = "/^(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\];\/?:@&=+$,])*$/";

if (preg_match($pattern, $query))
    echo 'true';
else
    echo 'false';

该脚本没有任何输出...它提供下载 php 文件 0 字节.. 我需要修复它,因为它可能仍然是 Zend_Gdata 中的一个错误!抱歉英语不好。

编辑:

你有 5.3.3 版本的 php? 如果在表达式末尾添加“U”,问题就会消失。 搞什么鬼?

<?php
$query = 'q=Riha47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a4744444444444444444444444444444444444444444444444na&start-index=60&max-results=20';
$pattern = "/^(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\];\/?:@&=+$,])*$/";

if (preg_match($pattern, $query))
    echo 'true';
else
    echo 'false';

The script has nothing as the output... It offers to download php file 0 bytes..
I need to fix it because it's probably still a bug in Zend_Gdata! Sorry for bad english.

EDIT:

You have a 5.3.3 version of php?
The problem disappears if you add a "U" at the end of the expression.
What the f*ck?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

揽月 2024-10-12 14:37:20
$query = 'q=Riha47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a4744444444444444444444444444444444444444444444444na&start-index=60&max-results=20';

if (preg_match('#^(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*\'()[\];/?:@&=+$,])*$#i', $query)) {
    echo "TRUE"; // THIS CASE
} else {
    echo "FALSE"
}
$query = 'q=Riha47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a4744444444444444444444444444444444444444444444444na&start-index=60&max-results=20';

if (preg_match('#^(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*\'()[\];/?:@&=+$,])*$#i', $query)) {
    echo "TRUE"; // THIS CASE
} else {
    echo "FALSE"
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文