Jump to:

23481 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » parse_url error on Director.php - SS 2.4.5

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1342 Views
  • Chris Hope
    Avatar
    Community Member
    18 Posts

    parse_url error on Director.php - SS 2.4.5 Link to this post

    I have a bad bot spidering one of my sites at the moment that can't construct URLs from the HTML source correctly and so I'm seeing stuff like this in the Apache logs:

    "GET /blogs/%22http://upingtonairportcarrental.com/%22%3Ehere%3C/a%3E.%3Cdiv HTTP/1.1" 404 3291 "-" "Mozilla/5.0 (compatible; Purebot/1.1; +http://www.puritysearch.net/)"

    and getting warnings like this logged and emailed to me:

    parse_url(/blogs/"http://upingtonairportcarrental.com/">here</a>.<div) Line 541 of Director.php

    I have everything from warning and up emailed to me (I prefer it that way) but would prefer not to be emailed this particular message. I've also seen it from another bot and there's also a piece of code out there in the wild that checks SSL servers but prefixes / before the domain name which also results in an error message like this one:

    parse_url(/https://www.example.com/) Line 541 of Director.php

    As I mentioned, I would prefer to keep the reporting level at warnings, but is there also a way I can suppress this particular error relating to parsing urls on Line 541 of Director.php from logging errors? Or perhaps that it can be rewritten slightly to prevent this cropping up?

    Version used, SS 2.4.5

  • Chris Hope
    Avatar
    Community Member
    18 Posts

    Re: parse_url error on Director.php - SS 2.4.5 Link to this post

    Just as a follow up, this only affects PHP < 5.3.3. I hacked the Director.php file and added a @ to the parse_url call i.e. @parse_url(...)

  • Chris_Bryer
    Avatar
    Community Member
    35 Posts

    Re: parse_url error on Director.php - SS 2.4.5 Link to this post

    Hey Chris,
    one other thing you may want to consider is to block the bot / ip address in the .htaccess.. otherwise the bot is still hitting your website and using up memory. here's a blog article to show you how to block either option:

    http://blamcast.net/articles/block-bots-hotlinking-ban-ip-htaccess

    -Chris

    1342 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.