Bug #7466

Default value for "base site URL" on installation gives validation error

Added by Mike Gale over 4 years ago. Updated over 4 years ago.

Status:VerifiedStart date:11/04/2014
Priority:MediumDue date:
Assignee:Mike Gale% Done:

0%

Category:Installation
Target version:Release 2.2.0
Google Code Legacy ID: Tested version:2.2
Sponsored:No Requires documentation:No

Description

Steps to reproduce:
1. Clone a copy of the latest qa/2.2.x branch from git
2. Go to install the new AtoM instance (sfInstallPlugin), enter values until you reach the page that lets you set site title, etc.
3. The default value is "http://localhost", leave as is
4. Click continue
5. A red box pops up next to the base URL field specifying "Invalid."

Expected behavior:
The default site base url should be a valid value (I think http://localhost makes sense? -- it should be valid?)


Related issues

Related to Access to Memory (AtoM) - Bug #7437: Site base URL problems Verified 10/27/2014
Related to Access to Memory (AtoM) - Bug #5954: command line bulk export - URLs exporting incorrectly Verified 11/12/2013
Related to Access to Memory (AtoM) - Bug #7415: Can't install qa/2.2.x branch - configureSite page fails Verified 10/20/2014

History

#1 Updated by Jesús García Crespo over 4 years ago

Weird, sfValidatorUrl seems like could handle a URL like http://localhost
We'll have to look at this closer...

#2 Updated by Mike Cantelon over 4 years ago

Yeah, this seems like a regression from #3292. An easy fix could be to use filter_var (PHP 5.2+) instead of the regex. I'll make a branch with that fix.

#3 Updated by Mike Cantelon over 4 years ago

  • Status changed from New to Feedback
  • Assignee changed from Mike Cantelon to Jesús García Crespo

If I change the URL validation class to this it works:

class sfValidatorUrl extends sfValidatorBase
{
  /**
   * @param array $options   An array of options
   * @param array $messages  An array of error messages
   *
   * @see sfValidatorBase
   */
  protected function configure($options = array(), $messages = array())
  {
    $this->setMessage('invalid', '"%value%" is not a URL.');
  }

  /**
   * @see sfValidatorBase
   */
  protected function doClean($value)
  {
    if (!filter_var($value, FILTER_VALIDATE_URL))
    {
      throw new sfValidatorError($this, 'invalid', array('value' => $value));
    }

    return $value;
  }
}

This is hacking Symfony though. Might be techically cleaner to add a new validator as lib/form/arValidatorUrl.class.php or something.

#4 Updated by Dan Gillean over 4 years ago

  • Assignee changed from Jesús García Crespo to Mike Gale

#5 Updated by Mike Gale over 4 years ago

  • Status changed from Feedback to Code Review
  • Assignee changed from Mike Gale to Jesús García Crespo

I ended up going the 'create our own validator' route and using Mike C's code there. This is in line with what Fabien Potencier suggested here: http://trac.symfony-project.org/ticket/6414 (scroll to bottom for comments)

https://github.com/artefactual/atom/pull/119

#6 Updated by Mike Gale over 4 years ago

  • Status changed from Code Review to In progress
  • Assignee changed from Jesús García Crespo to Mike Gale

#7 Updated by Mike Gale over 4 years ago

  • Status changed from In progress to Verified

Also available in: Atom PDF