Skip to content

Commit

Permalink
Merge pull request #56 from mparker17/pressflow-7.37
Browse files Browse the repository at this point in the history
Pressflow 7.37
  • Loading branch information
fluxsauce committed May 8, 2015
2 parents 1396aae + 95f42ad commit c3446ac
Show file tree
Hide file tree
Showing 27 changed files with 236 additions and 56 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@

Drupal 7.37, 2015-05-07
-----------------------
- Fixed a regression in Drupal 7.36 which caused certain kinds of content types
to become disabled if they were defined by a no-longer-enabled module.
- Removed a confusing description regarding automatic time zone detection from
the user account form (minor UI and data structure change).
- Allowed custom HTML tags with a dash in the name to pass through filter_xss()
when specified in the list of allowed tags.
- Allowed hook_field_schema() implementations to specify indexes for fields
based on a fixed-length column prefix (rather than the entire column), as was
already allowed in hook_schema() implementations.
- Fixed PDO exceptions on PostgreSQL when accessing invalid entity URLs.
- Added a sites/all/libraries folder to the codebase, with instructions for
using it.
- Added a description to the "Administer text formats and filters" permission
on the Permissions page (string change).
- Numerous small bug fixes.
- Numerous API documentation improvements.
- Additional automated test coverage.

Drupal 7.36, 2015-04-01
-----------------------
- Added a 'file_public_schema' variable which allows modules that define
Expand Down
2 changes: 1 addition & 1 deletion includes/bootstrap.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* The current system version.
*/
define('VERSION', '7.36');
define('VERSION', '7.37');

/**
* Core API compatibility.
Expand Down
22 changes: 20 additions & 2 deletions includes/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ function _filter_xss_split($m, $store = FALSE) {
return '<';
}

if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?|(<!--.*?-->)$%', $string, $matches)) {
if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9\-]+)([^>]*)>?|(<!--.*?-->)$%', $string, $matches)) {
// Seriously malformed.
return '';
}
Expand Down Expand Up @@ -3802,7 +3802,7 @@ function drupal_load_stylesheet_content($contents, $optimize = FALSE) {

// Replaces @import commands with the actual stylesheet content.
// This happens recursively but omits external files.
$contents = preg_replace_callback('/@import\s*(?:url\(\s*)?[\'"]?(?![a-z]+:)([^\'"\()]+)[\'"]?\s*\)?\s*;/', '_drupal_load_stylesheet', $contents);
$contents = preg_replace_callback('/@import\s*(?:url\(\s*)?[\'"]?(?![a-z]+:)(?!\/\/)([^\'"\()]+)[\'"]?\s*\)?\s*;/', '_drupal_load_stylesheet', $contents);
return $contents;
}

Expand Down Expand Up @@ -7155,6 +7155,23 @@ function _drupal_schema_initialize(&$schema, $module, $remove_descriptions = TRU
}
}

/**
* Retrieves the type for every field in a table schema.
*
* @param $table
* The name of the table from which to retrieve type information.
*
* @return
* An array of types, keyed by field name.
*/
function drupal_schema_field_types($table) {
$table_schema = drupal_get_schema($table);
foreach ($table_schema['fields'] as $field_name => $field_info) {
$field_types[$field_name] = isset($field_info['type']) ? $field_info['type'] : NULL;
}
return $field_types;
}

/**
* Retrieves a list of fields from a table schema.
*
Expand Down Expand Up @@ -7779,6 +7796,7 @@ function entity_get_info($entity_type = NULL) {
// Prepare entity schema fields SQL info for
// DrupalEntityControllerInterface::buildQuery().
if (isset($entity_info[$name]['base table'])) {
$entity_info[$name]['base table field types'] = drupal_schema_field_types($entity_info[$name]['base table']);
$entity_info[$name]['schema_fields_sql']['base table'] = drupal_schema_fields_sql($entity_info[$name]['base table']);
if (isset($entity_info[$name]['revision table'])) {
$entity_info[$name]['schema_fields_sql']['revision table'] = drupal_schema_fields_sql($entity_info[$name]['revision table']);
Expand Down
34 changes: 34 additions & 0 deletions includes/entity.inc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
}
}

// Ensure integer entity IDs are valid.
if (!empty($ids)) {
$this->cleanIds($ids);
}

// Load any remaining entities from the database. This is the case if $ids
// is set to FALSE (so we load all entities), if there are any ids left to
// load, if loading a revision, or if $conditions was passed without $ids.
Expand Down Expand Up @@ -223,6 +228,35 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
return $entities;
}

/**
* Ensures integer entity IDs are valid.
*
* The identifier sanitization provided by this method has been introduced
* as Drupal used to rely on the database to facilitate this, which worked
* correctly with MySQL but led to errors with other DBMS such as PostgreSQL.
*
* @param array $ids
* The entity IDs to verify. Non-integer IDs are removed from this array if
* the entity type requires IDs to be integers.
*/
protected function cleanIds(&$ids) {
$entity_info = entity_get_info($this->entityType);
if (isset($entity_info['base table field types'])) {
$id_type = $entity_info['base table field types'][$this->idKey];
if ($id_type == 'serial' || $id_type == 'int') {
$ids = array_filter($ids, array($this, 'filterId'));
$ids = array_map('intval', $ids);
}
}
}

/**
* Callback for array_filter that removes non-integer IDs.
*/
protected function filterId($id) {
return is_numeric($id) && $id == (int) $id;
}

/**
* Builds the query to load the entity.
*
Expand Down
4 changes: 2 additions & 2 deletions includes/form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2662,8 +2662,8 @@ function _form_options_flatten($array) {
* - #required: (optional) Whether the user needs to select an option (TRUE)
* or not (FALSE). Defaults to FALSE.
* - #empty_option: (optional) The label to show for the first default option.
* By default, the label is automatically set to "- Please select -" for a
* required field and "- None -" for an optional field.
* By default, the label is automatically set to "- Select -" for a required
* field and "- None -" for an optional field.
* - #empty_value: (optional) The value for the first default option, which is
* used to determine whether the user submitted a value or not.
* - If #required is TRUE, this defaults to '' (an empty string).
Expand Down
9 changes: 7 additions & 2 deletions includes/install.core.inc
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ function install_run_tasks(&$install_state) {
* Runs an individual installation task.
*
* @param $task
* An array of information about the task to be run.
* An array of information about the task to be run as returned by
* hook_install_tasks().
* @param $install_state
* An array of information about the current installation state. This is
* passed in by reference so that it can be modified by the task.
Expand Down Expand Up @@ -478,11 +479,15 @@ function install_run_task($task, &$install_state) {
* the page request evolves (for example, if an installation profile hasn't
* been selected yet, we don't yet know which profile tasks need to be run).
*
* You can override this using hook_install_tasks() or
* hook_install_tasks_alter().
*
* @param $install_state
* An array of information about the current installation state.
*
* @return
* A list of tasks to be performed, with associated metadata.
* A list of tasks to be performed, with associated metadata as returned by
* hook_install_tasks().
*/
function install_tasks_to_perform($install_state) {
// Start with a list of all currently available tasks.
Expand Down
24 changes: 22 additions & 2 deletions modules/field/modules/field_sql_storage/field_sql_storage.module
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,17 @@ function _field_sql_storage_schema($field) {
foreach ($field['indexes'] as $index_name => $columns) {
$real_name = _field_sql_storage_indexname($field['field_name'], $index_name);
foreach ($columns as $column_name) {
$current['indexes'][$real_name][] = _field_sql_storage_columnname($field['field_name'], $column_name);
// Indexes can be specified as either a column name or an array with
// column name and length. Allow for either case.
if (is_array($column_name)) {
$current['indexes'][$real_name][] = array(
_field_sql_storage_columnname($field['field_name'], $column_name[0]),
$column_name[1],
);
}
else {
$current['indexes'][$real_name][] = _field_sql_storage_columnname($field['field_name'], $column_name);
}
}
}

Expand Down Expand Up @@ -332,7 +342,17 @@ function field_sql_storage_field_storage_update_field($field, $prior_field, $has
$real_name = _field_sql_storage_indexname($field['field_name'], $name);
$real_columns = array();
foreach ($columns as $column_name) {
$real_columns[] = _field_sql_storage_columnname($field['field_name'], $column_name);
// Indexes can be specified as either a column name or an array with
// column name and length. Allow for either case.
if (is_array($column_name)) {
$real_columns[] = array(
_field_sql_storage_columnname($field['field_name'], $column_name[0]),
$column_name[1],
);
}
else {
$real_columns[] = _field_sql_storage_columnname($field['field_name'], $column_name);
}
}
db_add_index($table, $real_name, $real_columns);
db_add_index($revision_table, $real_name, $real_columns);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,14 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
field_attach_insert('test_entity', $entity);

// Add an index
$field = array('field_name' => $field_name, 'indexes' => array('value' => array('value')));
$field = array('field_name' => $field_name, 'indexes' => array('value' => array(array('value', 255))));
field_update_field($field);
foreach ($tables as $table) {
$this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), format_string("Index on value created in %table", array('%table' => $table)));
}

// Add a different index, removing the existing custom one.
$field = array('field_name' => $field_name, 'indexes' => array('value_format' => array('value', 'format')));
$field = array('field_name' => $field_name, 'indexes' => array('value_format' => array(array('value', 127), array('format', 127))));
field_update_field($field);
foreach ($tables as $table) {
$this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value_format"), format_string("Index on value_format created in %table", array('%table' => $table)));
Expand Down
1 change: 1 addition & 0 deletions modules/filter/filter.module
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ function filter_admin_format_title($format) {
function filter_permission() {
$perms['administer filters'] = array(
'title' => t('Administer text formats and filters'),
'description' => t('Define how text is handled by combining filters into <a href="@url">text formats</a>.', array('@url' => url('admin/config/content/formats'))),
'restrict access' => TRUE,
);

Expand Down
6 changes: 5 additions & 1 deletion modules/filter/filter.test
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
// Setup dummy filter object.
$filter = new stdClass();
$filter->settings = array(
'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>',
'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <test-element>',
'filter_html_help' => 1,
'filter_html_nofollow' => 0,
);
Expand Down Expand Up @@ -1184,6 +1184,10 @@ class FilterUnitTestCase extends DrupalUnitTestCase {

$f = _filter_html('<code onerror>&nbsp;</code>', $filter);
$this->assertNoNormalized($f, 'onerror', 'HTML filter should remove empty on* attributes on default.');

// Custom tags are supported and should be allowed through.
$f = _filter_html('<test-element></test-element>', $filter);
$this->assertNormalized($f, 'test-element', 'HTML filter should allow custom elements.');
}

/**
Expand Down
10 changes: 10 additions & 0 deletions modules/node/node.install
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,16 @@ function node_update_7014() {
db_add_index('node', 'language', array('language'));
}

/**
* Enable node types that may have been erroneously disabled in Drupal 7.36.
*/
function node_update_7015() {
db_update('node_type')
->fields(array('disabled' => 0))
->condition('base', 'node_content')
->execute();
}

/**
* @} End of "addtogroup updates-7.x-extra".
*/
8 changes: 5 additions & 3 deletions modules/node/node.module
Original file line number Diff line number Diff line change
Expand Up @@ -740,9 +740,11 @@ function _node_types_build($rebuild = FALSE) {
$type_db = $type_object->type;
// Original disabled value.
$disabled = $type_object->disabled;
// Check for node types either from disabled modules or otherwise not defined
// and mark as disabled.
if (empty($type_object->custom) && empty($_node_types->types[$type_db])) {
// Check for node types from disabled modules and mark their types for removal.
// Types defined by the node module in the database (rather than by a separate
// module using hook_node_info) have a base value of 'node_content'. The isset()
// check prevents errors on old (pre-Drupal 7) databases.
if (isset($type_object->base) && $type_object->base != 'node_content' && empty($_node_types->types[$type_db])) {
$type_object->disabled = TRUE;
}
if (isset($_node_types->types[$type_db])) {
Expand Down
1 change: 0 additions & 1 deletion modules/poll/poll.module
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ function poll_node_info() {
'base' => 'poll',
'description' => t('A <em>poll</em> is a question with a set of possible responses. A <em>poll</em>, once created, automatically provides a simple running count of the number of votes received for each response.'),
'title_label' => t('Question'),
'has_body' => FALSE,
)
);
}
Expand Down
7 changes: 6 additions & 1 deletion modules/simpletest/drupal_web_test_case.php
Original file line number Diff line number Diff line change
Expand Up @@ -2257,8 +2257,13 @@ protected function drupalPostAJAX($path, $edit, $triggering_element, $ajax_path
if ($wrapperNode) {
// ajax.js adds an enclosing DIV to work around a Safari bug.
$newDom = new DOMDocument();
// DOM can load HTML soup. But, HTML soup can throw warnings,
// suppress them.
$newDom->loadHTML('<div>' . $command['data'] . '</div>');
$newNode = $dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
// Suppress warnings thrown when duplicate HTML IDs are
// encountered. This probably means we are replacing an element
// with the same ID.
$newNode = @$dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
$method = isset($command['method']) ? $command['method'] : $ajax_settings['method'];
// The "method" is a jQuery DOM manipulation function. Emulate
// each one using PHP's DOMNode API.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@


@import url("http://example.com/style.css");
@import url("//example.com/style.css");
@import "import1.css";
@import "import2.css";

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@


@import url("http://example.com/style.css");
@import url("//example.com/style.css");

ul, select {
font: 1em/160% Verdana, sans-serif;
Expand Down
1 change: 1 addition & 0 deletions modules/simpletest/tests/common.test
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ class CascadingStylesheetsUnitTest extends DrupalUnitTestCase {
* - Proper URLs in imported files. (https://drupal.org/node/265719)
* - Retain pseudo-selectors. (https://drupal.org/node/460448)
* - Don't adjust data URIs. (https://drupal.org/node/2142441)
* - Files imported from external URLs. (https://drupal.org/node/2014851)
*/
function testLoadCssBasic() {
// Array of files to test living in 'simpletest/files/css_test_files/'.
Expand Down
10 changes: 0 additions & 10 deletions modules/simpletest/tests/file.test
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,6 @@ class FileValidatorTest extends DrupalWebTestCase {
* Test file_validate_size().
*/
function testFileValidateSize() {
global $user;
$original_user = $user;
drupal_save_session(FALSE);

// Run these tests as a regular user.
$user = $this->drupalCreateUser();

// Create a file with a size of 1000 bytes, and quotas of only 1 byte.
$file = new stdClass();
$file->filesize = 1000;
Expand All @@ -498,9 +491,6 @@ class FileValidatorTest extends DrupalWebTestCase {
$this->assertEqual(count($errors), 1, 'Error for the user being over their limit.', 'File');
$errors = file_validate_size($file, 1, 1);
$this->assertEqual(count($errors), 2, 'Errors for both the file and their limit.', 'File');

$user = $original_user;
drupal_save_session(TRUE);
}
}

Expand Down
Loading

0 comments on commit c3446ac

Please sign in to comment.