Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* commit 'ae4576324e1aaa7bbddd664053573fd26e46b461': (29 commits)
  Drupal 7.55
  Update CHANGELOG.txt in preparation for the 7.55 release.
  Issue #1858486 by idebr, David_Rothstein, trawekp, joseph.olstad, MrHaroldA, jhedstrom: Ajax call breaks Password Reset
  Issue #2853160 by hgoto, smaaz: Variable $name is defined but not used in file_get_content_headers()
  Revert "Issue #2853160 by hgoto, RenatoG: Variable $name is defined but not used in file_get_content_headers()"
  Issue #2853160 by hgoto, RenatoG: Variable $name is defined but not used in file_get_content_headers()
  Issue #2042239 by lucaslg, tbradbury, snehi, pkiraly, pjonckiere, oriol_e9g, ivanchaer, jhodgdon, chx, cilefen, David_Rothstein: Fix DeleteQuery::execute() return value documentation and DeleteQuery_sqlite documentation
  Issue #2851725 by Jigar.addweb, tameeshb: Fix typos in various code comments in the includes directory
  Issue #2451449 by drumm: User's contact setting reverts to default when saving
  Issue #348815 by twistor, aerozeppelin, xjm, PROMES, nileema.jadhav, Jill L: Remove category from feed and feed items when category is deleted
  Issue #1611430 by Berdir, brad.bulger, Stevel, sun, catch: Verbose debug output in unit tests relies on the database
  Issue #1599774 by longwave, ben.bunk, Rob C, stefan.r, David_Rothstein, BTMash, kristofferwiklund, marcingy, mpdonadio, DuneBL, serundeputy, Letharion, quicksketch, alexpott, J-Lee, Morbus Iff: Drupal fails to boot with 503 error and .htaccess protections do not work on Apache 2.4 without mod_access_compat
  Issue #1823504 by axel.rutz, michalis.kambi, Sylvain Lecoy: Unit tests (descendants of DrupalUnitTestCase) do not work when default site language is not English
  Issue #1851530 by JvE, jcovington, tatarbj: Notice: Undefined index: status in _block_rehash()
  Issue #2182265 by Sweetchuck, joseph.olstad, nod_, andrejsmuzikovs, Gábor Hojtsy, droplet, mr.baileys: Drupal.t() placeholder substitution doesn't always work correctly
  Issue #2289867 by joseph.olstad, jamesrward, dman, superspring, legolasbo, bceyssens, mdeletter, anrikun, Damien Tournoud: W3C HTML5 Validation error with PHP array-based query-strings built with url() containing [ ] characters
  Issue #2807393 by armrus, joseph.olstad, pankajchaudhari: Console error on Firefox due to redeclared function argument in Drupal.formatPlural
  Add issue #2883202 to CHANGELOG.txt.
  Issue #2883202 by David_Rothstein: Statistics module subtracts an empty string from an integer, causing PHP 7.1 test failures
  Issue #2870289 by markcarver: file_ajax_upload() causes malformed Drupal.settings
  ...
  • Loading branch information
ccjjmartin committed Jun 21, 2017
2 parents 8b72499 + ae45763 commit 3359e3e
Show file tree
Hide file tree
Showing 28 changed files with 337 additions and 86 deletions.
11 changes: 8 additions & 3 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
Order allow,deny
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
</IfModule>
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Expand Down Expand Up @@ -80,7 +85,7 @@ DirectoryIndex index.php index.html index.htm
# If you do not have mod_rewrite installed, you should remove these
# directories from your webroot or otherwise protect them from being
# downloaded.
RewriteRule "(^|/)\." - [F]
RewriteRule "/\.|^\.(?!well-known/)" - [F]

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@

Drupal 7.55, 2017-06-07
-----------------------
- Fixed incompatibility with PHP versions 7.0.19 and 7.1.5 due to duplicate
DATE_RFC7231 definition.
- Made Drupal core pass all automated tests on PHP 7.1.
- Allowed services such as Let's Encrypt to work with Drupal on Apache, by
making Drupal's .htaccess file allow access to the .well-known directory
defined by RFC 5785.
- Made new Drupal sites work correctly on Apache 2.4 when the mod_access_compat
Apache module is disabled.
- Fixed Drupal's URL-generating functions to always encode '[' and ']' so that
the URLs will pass HTML5 validation.
- Various additional bug fixes.
- Various API documentation improvements.
- Additional automated test coverage.

Drupal 7.54, 2017-02-01
-----------------------
- Modules are now able to define theme engines (API addition:
Expand Down
9 changes: 7 additions & 2 deletions 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.54');
define('VERSION', '7.55');

/**
* Core API compatibility.
Expand Down Expand Up @@ -254,8 +254,13 @@ define('DRUPAL_PHP_FUNCTION_PATTERN', '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
* http://tools.ietf.org/html/rfc7231#section-7.1.1.1
*
* Example: Sun, 06 Nov 1994 08:49:37 GMT
*
* This constant was introduced in PHP 7.0.19 and PHP 7.1.5 but needs to be
* defined by Drupal for earlier PHP versions.
*/
define('DATE_RFC7231', 'D, d M Y H:i:s \G\M\T');
if (!defined('DATE_RFC7231')) {
define('DATE_RFC7231', 'D, d M Y H:i:s \G\M\T');
}

/**
* Provides a caching wrapper to be used in place of large array structures.
Expand Down
2 changes: 1 addition & 1 deletion includes/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ function drupal_http_build_query(array $query, $parent = '') {
$params = array();

foreach ($query as $key => $value) {
$key = ($parent ? $parent . '[' . rawurlencode($key) . ']' : rawurlencode($key));
$key = $parent ? $parent . rawurlencode('[' . $key . ']') : rawurlencode($key);

// Recurse into children.
if (is_array($value)) {
Expand Down
12 changes: 6 additions & 6 deletions includes/database/pgsql/database.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

/**
* The name by which to obtain a lock for retrive the next insert id.
* The name by which to obtain a lock for retrieving the next insert id.
*/
define('POSTGRESQL_NEXTID_LOCK', 1000);

Expand Down Expand Up @@ -55,7 +55,7 @@ class DatabaseConnection_pgsql extends DatabaseConnection {
$connection_options['pdo'] += array(
// Prepared statements are most effective for performance when queries
// are recycled (used several times). However, if they are not re-used,
// prepared statements become ineffecient. Since most of Drupal's
// prepared statements become inefficient. Since most of Drupal's
// prepared queries are not re-used, it should be faster to emulate
// the preparation than to actually ready statements for re-use. If in
// doubt, reset to FALSE and measure performance.
Expand Down Expand Up @@ -175,14 +175,14 @@ class DatabaseConnection_pgsql extends DatabaseConnection {
}

/**
* Retrive a the next id in a sequence.
* Retrieve the next id in a sequence.
*
* PostgreSQL has built in sequences. We'll use these instead of inserting
* and updating a sequences table.
*/
public function nextId($existing = 0) {

// Retrive the name of the sequence. This information cannot be cached
// Retrieve the name of the sequence. This information cannot be cached
// because the prefix may change, for example, like it does in simpletests.
$sequence_name = $this->makeSequenceName('sequences', 'value');

Expand All @@ -194,7 +194,7 @@ class DatabaseConnection_pgsql extends DatabaseConnection {
}

// PostgreSQL advisory locks are simply locks to be used by an
// application such as Drupal. This will prevent other Drupal proccesses
// application such as Drupal. This will prevent other Drupal processes
// from altering the sequence while we are.
$this->query("SELECT pg_advisory_lock(" . POSTGRESQL_NEXTID_LOCK . ")");

Expand All @@ -209,7 +209,7 @@ class DatabaseConnection_pgsql extends DatabaseConnection {
// Reset the sequence to a higher value than the existing id.
$this->query("ALTER SEQUENCE " . $sequence_name . " RESTART WITH " . ($existing + 1));

// Retrive the next id. We know this will be as high as we want it.
// Retrieve the next id. We know this will be as high as we want it.
$id = $this->query("SELECT nextval('" . $sequence_name . "')")->fetchField();

$this->query("SELECT pg_advisory_unlock(" . POSTGRESQL_NEXTID_LOCK . ")");
Expand Down
2 changes: 1 addition & 1 deletion includes/database/pgsql/install.inc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class DatabaseTasks_pgsql extends DatabaseTasks {
LANGUAGE \'sql\''
);

// Using || to concatenate in Drupal is not recommeneded because there are
// Using || to concatenate in Drupal is not recommended because there are
// database drivers for Drupal that do not support the syntax, however
// they do support CONCAT(item1, item2) which we can replicate in
// PostgreSQL. PostgreSQL requires the function to be defined for each
Expand Down
4 changes: 2 additions & 2 deletions includes/database/pgsql/select.inc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class SelectQuery_pgsql extends SelectQuery {
}

// If a table loads all fields, it can not be added again. It would
// result in an ambigious alias error because that field would be loaded
// result in an ambiguous alias error because that field would be loaded
// twice: Once through table_alias.* and once directly. If the field
// actually belongs to a different table, it must be added manually.
foreach ($this->tables as $table) {
Expand All @@ -90,7 +90,7 @@ class SelectQuery_pgsql extends SelectQuery {
}

// If $field contains an characters which are not allowed in a field name
// it is considered an expression, these can't be handeld automatically
// it is considered an expression, these can't be handled automatically
// either.
if ($this->connection->escapeField($field) != $field) {
return $return;
Expand Down
6 changes: 3 additions & 3 deletions includes/database/query.inc
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,8 @@ class DeleteQuery extends Query implements QueryConditionInterface {
/**
* Executes the DELETE query.
*
* @return
* The return value is dependent on the database connection.
* @return int
* The number of rows affected by the delete query.
*/
public function execute() {
$values = array();
Expand Down Expand Up @@ -1242,7 +1242,7 @@ class UpdateQuery extends Query implements QueryConditionInterface {
* MergeQuery::updateFields() and MergeQuery::insertFields() needs to be called
* instead. MergeQuery::fields() can also be called which calls both of these
* methods as the common case is to use the same column-value pairs for both
* INSERT and UPDATE. However, this is not mandatory. Another convinient
* INSERT and UPDATE. However, this is not mandatory. Another convenient
* wrapper is MergeQuery::key() which adds the same column-value pairs to the
* condition and the INSERT query part.
*
Expand Down
5 changes: 4 additions & 1 deletion includes/database/schema.inc
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ require_once dirname(__FILE__) . '/query.inc';
* @see drupal_install_schema()
*/

/**
* Base class for database schema definitions.
*/
abstract class DatabaseSchema implements QueryPlaceholderInterface {

protected $connection;
Expand Down Expand Up @@ -291,7 +294,7 @@ abstract class DatabaseSchema implements QueryPlaceholderInterface {
protected function buildTableNameCondition($table_name, $operator = '=', $add_prefix = TRUE) {
$info = $this->connection->getConnectionOptions();

// Retrive the table name and schema
// Retrieve the table name and schema
$table_info = $this->getPrefixInfo($table_name, $add_prefix);

$condition = new DatabaseCondition('AND');
Expand Down
13 changes: 6 additions & 7 deletions includes/database/sqlite/query.inc
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,15 @@ class UpdateQuery_sqlite extends UpdateQuery {

/**
* SQLite specific implementation of DeleteQuery.
*
* When the WHERE is omitted from a DELETE statement and the table being deleted
* has no triggers, SQLite uses an optimization to erase the entire table content
* without having to visit each row of the table individually.
*
* Prior to SQLite 3.6.5, SQLite does not return the actual number of rows deleted
* by that optimized "truncate" optimization.
*/
class DeleteQuery_sqlite extends DeleteQuery {
public function execute() {
// When the WHERE is omitted from a DELETE statement and the table being
// deleted has no triggers, SQLite uses an optimization to erase the entire
// table content without having to visit each row of the table individually.
// Prior to SQLite 3.6.5, SQLite does not return the actual number of rows
// deleted by that optimized "truncate" optimization. But we want to return
// the number of rows affected, so we calculate it directly.
if (!count($this->condition)) {
$total_rows = $this->connection->query('SELECT COUNT(*) FROM {' . $this->connection->escapeTable($this->table) . '}')->fetchField();
parent::execute();
Expand Down
2 changes: 1 addition & 1 deletion includes/database/sqlite/schema.inc
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class DatabaseSchema_sqlite extends DatabaseSchema {
// database. So the syntax '...RENAME TO database.table' would fail.
// So we must determine the full table name here rather than surrounding
// the table with curly braces incase the db_prefix contains a reference
// to a database outside of our existsing database.
// to a database outside of our existing database.
$info = $this->getPrefixInfo($new_name);
$this->connection->query('ALTER TABLE {' . $table . '} RENAME TO ' . $info['table']);

Expand Down
6 changes: 3 additions & 3 deletions includes/errors.inc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function _drupal_error_handler_real($error_level, $message, $filename, $line, $c
_drupal_log_error(array(
'%type' => isset($types[$error_level]) ? $severity_msg : 'Unknown error',
// The standard PHP error handler considers that the error messages
// are HTML. We mimick this behavior here.
// are HTML. We mimic this behavior here.
'!message' => filter_xss_admin($message),
'%function' => $caller['function'],
'%file' => $caller['file'],
Expand Down Expand Up @@ -114,7 +114,7 @@ function _drupal_decode_exception($exception) {
return array(
'%type' => get_class($exception),
// The standard PHP exception handler considers that the exception message
// is plain-text. We mimick this behavior here.
// is plain-text. We mimic this behavior here.
'!message' => check_plain($message),
'%function' => $caller['function'],
'%file' => $caller['file'],
Expand Down Expand Up @@ -233,7 +233,7 @@ function _drupal_log_error($error, $fatal = FALSE) {
}
else {
// Display the message if the current error reporting level allows this type
// of message to be displayed, and unconditionnaly in update.php.
// of message to be displayed, and unconditionally in update.php.
if (error_displayable($error)) {
$class = 'error';

Expand Down
15 changes: 12 additions & 3 deletions includes/file.inc
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,18 @@ SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
EOF;

if ($private) {
$lines = "Deny from all\n\n" . $lines;
$lines = <<<EOF
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
EOF
. "\n\n" . $lines;
}

return $lines;
Expand Down Expand Up @@ -889,7 +900,6 @@ function file_valid_uri($uri) {
*/
function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
$original_source = $source;
$original_destination = $destination;

// Assert that the source file actually exists.
if (!file_exists($source)) {
Expand Down Expand Up @@ -2553,7 +2563,6 @@ function file_directory_temp() {
* An associative array of headers, as expected by file_transfer().
*/
function file_get_content_headers($file) {
$name = mime_header_encode($file->filename);
$type = mime_header_encode($file->filemime);

return array(
Expand Down
85 changes: 69 additions & 16 deletions misc/drupal.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,76 @@ Drupal.checkPlain = function (str) {
Drupal.formatString = function(str, args) {
// Transform arguments before inserting them.
for (var key in args) {
switch (key.charAt(0)) {
// Escaped only.
case '@':
args[key] = Drupal.checkPlain(args[key]);
break;
// Pass-through.
case '!':
break;
// Escaped and placeholder.
case '%':
default:
args[key] = Drupal.theme('placeholder', args[key]);
break;
if (args.hasOwnProperty(key)) {
switch (key.charAt(0)) {
// Escaped only.
case '@':
args[key] = Drupal.checkPlain(args[key]);
break;
// Pass-through.
case '!':
break;
// Escaped and placeholder.
default:
args[key] = Drupal.theme('placeholder', args[key]);
break;
}
}
str = str.replace(key, args[key]);
}
return str;

return Drupal.stringReplace(str, args, null);
};

/**
* Replace substring.
*
* The longest keys will be tried first. Once a substring has been replaced,
* its new value will not be searched again.
*
* @param {String} str
* A string with placeholders.
* @param {Object} args
* Key-value pairs.
* @param {Array|null} keys
* Array of keys from the "args". Internal use only.
*
* @return {String}
* Returns the replaced string.
*/
Drupal.stringReplace = function (str, args, keys) {
if (str.length === 0) {
return str;
}

// If the array of keys is not passed then collect the keys from the args.
if (!$.isArray(keys)) {
keys = [];
for (var k in args) {
if (args.hasOwnProperty(k)) {
keys.push(k);
}
}

// Order the keys by the character length. The shortest one is the first.
keys.sort(function (a, b) { return a.length - b.length; });
}

if (keys.length === 0) {
return str;
}

// Take next longest one from the end.
var key = keys.pop();
var fragments = str.split(key);

if (keys.length) {
for (var i = 0; i < fragments.length; i++) {
// Process each fragment with a copy of remaining keys.
fragments[i] = Drupal.stringReplace(fragments[i], args, keys.slice(0));
}
}

return fragments.join(args[key]);
};

/**
Expand Down Expand Up @@ -251,7 +304,7 @@ Drupal.t = function (str, args, options) {
* A translated string.
*/
Drupal.formatPlural = function (count, singular, plural, args, options) {
var args = args || {};
args = args || {};
args['@count'] = count;
// Determine the index of the plural form.
var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] == 1) ? 0 : 1);
Expand Down
Loading

0 comments on commit 3359e3e

Please sign in to comment.