shakty/Patterns — Issue #38: special characters in Patterns file
Author: satomic
Created: 2011-12-02 10:47:50+00:00
State: open

Having a ":" in the Patterns file crashes the saving process. Need to check if other characters aren't allowed, too, and escape or filter these characters.

Notice: Undefined index: description in patterns_db_save_pattern() (line 80 of /var/www/drupal-7.9/sites/all/modules/Patterns/includes/patterns.db.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'description' cannot be null: INSERT INTO {patterns} (name, status, file, updated, enabled, title, description, pattern) VALUES ( :name, 0, :file, :time, 0, :title, :descr, :pattern); Array ( [name] => mymodule7 [pattern] => a:2:{s:4:"info";a:8:{s:5:"title";s:0:"";s:70:"description: automatically generated Pattern file from following forms";s:0:"";s:6:"author";s:0:"";s:8:"category";s:8:"mymodule";s:7:"version";s:3:"1.0";s:4:"core";s:3:"7.x";s:12:"author_email";s:0:"";s:14:"author_website";s:0:"";}s:7:"actions";a:1:{i:0;a:1:{s:6:"modify";a:2:{s:3:"tag";s:8:"mymodule";s:27:"mymodule_number_of_messages";i:4;}}}} [title] => [file] => /var/www/drupal-7.9/sites/default/files/patterns/mymodule7.yaml [descr] => [time] => 1322822603 ) in patterns_db_save_pattern() (line 133 of /var/www/drupal-7.9/sites/all/modules/Patterns/includes/patterns.db.inc).

Pattern file:
\# YAML mymodulePattern

info:
title:
description: automatically generated Pattern file from following forms:
author:
category: mymodule
version: 1.0
core: 7.x
author_email:
author_website:

actions:
- modify:
tag: mymodule
mymodule_number_of_messages: 4