A small bug in thinkphp

Source: Internet
Author: User
Two days ago found their website inexplicably a bit more files
Original address: http://bbs.csdn.net/topics/390469279

This morning to observe these inexplicable HTML files, finally found the problem!!!
Reason:
If you turn on static caching, you have parameters in the static rules, such as
Static cache ' html_cache_on ' =>true, ' html_cache_rules ' = = Array (' infor:search ' = = Array (' Home/{:module}/{:action} /{key} '),


Examples Show
{Key}=test
Html/home/infor/search/test.html
{key}=.. /boot
Html/home/infor/boot.html
Yes, the second static file HTML flies to the parent directory, so the server directory has a lot more files and folders.
This should be considered a small bug of thinkphp, although it is not harmful to the site, but very annoying

The solution is simple, too.
is static rules do not directly use parameters, recommended that you use MD5 processing {$_server. REQUEST_URI|MD5}

A witty silk?


Reply to discussion (solution)

Come and see, the static cache is relatively small.

This is not a thinkphp bug.
It's natural for you to be responsible for your own actions.

For the rules of your example, if key =. /boot
by $rule = Preg_replace ('/{(\w+)}/e ', "\$_get[' \\1 ']", $rule);
To be interpreted as home/module_name/action_name/. /boot

What reason does TP have to prevent you from putting static files in the parent directory?

This is not a thinkphp bug.
It's natural for you to be responsible for your own actions.

For the rules of your example, if key =. /boot
by $rule = Preg_replace ('/{(\w+)}/e ', "\$_get[' \\1 ']", $rule);
To be interpreted as home/module_name/action_name/. /boot

What reason does TP have to prevent you from putting static files in the parent directory?

I think TP should consider the filter of the {key} parameter.

If you want to filter, you have to give the rules, write code
URLs like http://bbs.csdn.net/topics/390469279/..x, at least, do not constitute an attack.
You can't expect people to do everything for you, after all, he's just a development tool.
If this is the case of Dede, it can be said that it is a bug

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.