Amit K.
Amit K.

Reputation: 3754

Parse_url not working correctly on staging server

I am facing a problem with parse_url function. if i use parse_url on my local system i am getting following output. Url for parsing used is www.youtube.com/embed/u-j1nx_HY5o

Array
(
    [host] => www.youtube.com
    [path] => /embed/u-j1nx_HY5o
) 

But i parse same url on staging i got following output.

Array(
    [path] => //www.youtube.com/embed/u-j1nx_HY5o
)

ie. I am not getting host name on staging server.

Note : PHP version on staging server is 5.3.3. Can anyone let me know why its happening.

Many Thanks,

M.

Upvotes: 1

Views: 1147

Answers (1)

Pred
Pred

Reputation: 9042

There was a bug prior 5.4.7: 5.4.7 Fixed host recognition when scheme is omitted and a leading component separator is present.

Check if your staging server's version is lower than 5.4.7.

As an additional advice: Always use the exactly same version and configuration (except the error reporting settings) in all of your environments.

EDIT

If you can not update your staging environment, adding the scheme to the URL (http:// for example) could help. Also downgrade your development environment to the version running on staging and production environment.

Upvotes: 2

Related Questions