Permalink
Browse files

Forms: fixed JSON optimization in BaseControl::getControl()

  • Loading branch information...
1 parent 0180d95 commit 936095ccd6abc10e6b2181376015779f03f48f59 @dg dg committed May 16, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 Nette/Forms/Controls/BaseControl.php
@@ -392,8 +392,8 @@ public function getControl()
$rules = self::exportRules($this->rules);
$rules = substr(json_encode($rules), 1, -1);
- $rules = preg_replace('#"([a-z0-9]+)":#i', '$1:', $rules);
- $rules = preg_replace('#(?<!\\\\)"([^\\\\\',]*)"#i', "'$1'", $rules);
+ $rules = preg_replace('#"([a-z0-9_]+)":#i', '$1:', $rules);
+ $rules = preg_replace('#(?<!\\\\)"(?!:[^a-z])([^\\\\\',]*)"#i', "'$1'", $rules);
$control->data('nette-rules', $rules ? $rules : NULL);
return $control;

0 comments on commit 936095c

Please sign in to comment.