If I set the machine name of my block display "3g",
http://drupal.org/files/Screen Shot 2012-12-21 at 下午8.09.27.png

After saving the view, the edit page will not show anymore, will only show the name "3g" , other functionalities are fine.
http://drupal.org/files/Screen Shot 2012-12-21 at 下午8.13.58.png

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Right, it's a problem so we should add a validation for the name to require non-numbers at the beginning.

Mirroar’s picture

Version: 7.x-3.5 » 7.x-3.x-dev
Component: Miscellaneous » User interface
Status: Active » Needs review
FileSize
704 bytes

I can confirm this still happens with the latest dev version.

It also only happens with certain numbers (2 and 3 work), and only because in php a statement like (3 == '3g') evaluates to TRUE.

I have attached a patch that should fix the Views UI problem, so we actually don't need to forbid machine names like this.

dawehner’s picture

Issue summary: View changes
Status: Needs review » Needs work

I would argue that we should disallow it right from the beginning AND OR use in_array with strict.

Mirroar’s picture

The problem with disallowing it now: What happens to views that already use these machine names? Also, you can create views in several ways, like the UI and importing, so I'm not sure whether it would be as simple a change.
So far, this UI bug is the only time I've had a problem with the machine name starting with a number, so I'm in favor of this simple fix to views_ui. I wasn't aware of the strict-parameter for in_array, but I can create a new patch when I have some time.