Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7824059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:28:14+00:00 2026-06-02T08:28:14+00:00

For some weird reason the function below says this url paradox-productions.net is invalid on

  • 0

For some weird reason the function below says this url “paradox-productions.net” is invalid on http://alpha.shurl.be/ and valid on my localhost.
Is it a bug in PHP or what could cause this?
Anyone who can confirm this? Possible to solve or do I need a PHP upgrade on my server?

phpinfo: http://alpha.shurl.be/phpinfo.php

function:

<?php
function validUrl($url) {
    var_dump($url);
    if(strpos($url, ".") !== false) {
        var_dump($url);
        if(strpos($url, "://") === false) {
            $url = "http://" . $url;
            var_dump($url);
        }
    }

    if(filter_var($url, FILTER_VALIDATE_URL)) {
        echo "VALID\n";
    }
    else {
        echo "INVALID\n";
    }
    var_dump(filter_var($url, FILTER_VALIDATE_URL));

    return filter_var($url, FILTER_VALIDATE_URL);
}
?>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:28:18+00:00Added an answer on June 2, 2026 at 8:28 am

    This is a known bug in PHP 5.3.2. It thinks URL’s with dashes in them are invalid. See https://bugs.php.net/bug.php?id=51258. Your local PHP must be a different version where this bug is not present.

    If you can upgrade to a working version, probably a good idea to do so. If you can’t, you can work around this by removing all dashes separated by other valid url characters from the string before validating. The below regex is not perfect, but it should work if you know the dashes will only appear between letters, digits, or underscores (typically true, but just be aware of the caveat that this will not deal with certain unlikely edge cases).

    $url_to_validate = preg_replace("/([\w\d])-(?=[\w\d])/", '\\1\\2', $url);
    

    \w means “any letter or underscore” and \d means “any digit”, so [\w\d] means any letter, digit, or underscore. The second one requires a zero-width positive lookahead assertion (using (?=...)) to make sure it catches all the dashes in sequences like a-b-c-d-e (without it, it would miss every other dash in that sequence).

    Here’s the body of the bug report:

    Description:

    FILTER_VALIDATE_URL does not allow dashes/hyphens in the host name. That’s just silly.

    Test script:

    $ php -r 'var_dump(filter_var("http://www.something.com/",
    FILTER_VALIDATE_URL));'
    
    $ php -r 'var_dump(filter_var("http://www.some-thing.com/",
    FILTER_VALIDATE_URL));'
    

    Expected result:

    $ php -r 'var_dump(filter_var("http://www.something.com/",
    FILTER_VALIDATE_URL));' string(25) "http://www.something.com/"
    
    $ php -r 'var_dump(filter_var("http://www.some-thing.com/",
    FILTER_VALIDATE_URL));' string(26) "http://www.some-thing.com/"
    

    Actual result:

    $ php -r 'var_dump(filter_var("http://www.something.com/",
    FILTER_VALIDATE_URL));' string(25) "http://www.something.com/"
    
    $ php -r 'var_dump(filter_var("http://www.some-thing.com/",
    FILTER_VALIDATE_URL));' bool(false)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason this function is doing something weird just in Firefox function fadeOUT_sect(id)
Hi I am having trouble with this function. For some reason weird values are
For some weird reason, the codes below are first working, then website is redirecting
http://churchsafeplan.com/overview.php?content=0201#intro For some strange, strange reason, the function accordian is not working. Seems as
This is really weird, for some reason the Id of the ViewModel is being
I am using this home-made function to validate text fields, but for some reason,
For some really weird reason when i set the .Enabled property to false on
I'm having some weird issues with pytz's .localize() function. Sometimes it wouldn't make adjustments
For some weird reason i'm getting my confirm box coming up twice. here is
http://jqueryui.com/demos/button/#default They are very simple to use, but for some reason my buttons are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.