URL_FORMAT constant does not support IP address as servername

Project:ProjectPier
Version:0.8.5.0-Beta1
Component:Code
Category:bug report
Priority:normal
Assigned:phpfreak
Status:closed - fixed
Description

I identified this problem by viewing the source of a page. The stylesheet link for the UserBoxMenu/widget.css was incorrect.

I tracked the problem down to being an issue with the URL_FORMAT constant in environment/constants.php

The current regex expects the final '.aaa' of the server name to be an a-z character repeated 2-5 times.

It should support [a-z0-9]{1,5} instead so that the url can be expressed as an IP address.

The attached patch was generated against r159.

AttachmentSize
constants-url_format.patch2.01 KB
#1
Status:new» patch - code needs review

As far as I can tell, it does work to be able to have a real URL or an IP address.

The only thing to me is that it would now allow URIs like http://abc.blabla.14 for example, which is not valid.

I don't think it's really a problem in itself because the URIs are used for the web-app itself on for the companies' homepages. If you mistype the former, nothing will work but it won't work better if you type http://abc.blablaa.com, in itself it's still a configuration problem that has not much to do with the URI being valid or not. If you mistype the latter, it won't affect the operation of ProjectPier.

I suppose the regex could be written to have either a "regular" URI or an IP, but not a mix of the two. The question is: is it really worth it? does the app really care so much if the URI is valid or not? why do we check the URI in the first place?

Anybody has any thoughts on that?

#2
Assigned to:spascoe» phpfreak
Status:patch - code needs review» closed - fixed

Solved

http://www.projectpier.org/node/1641#comment-4108

Accepted in 0.8.6