8
8
/**
9
9
* The current system version.
10
10
*/
11
- define ('VERSION ' , '7.35 -dev ' );
11
+ define ('VERSION ' , '7.37 -dev ' );
12
12
13
13
/**
14
14
* Core API compatibility.
@@ -529,9 +529,8 @@ function timer_stop($name) {
529
529
* Returns the appropriate configuration directory.
530
530
*
531
531
* Returns the configuration path based on the site's hostname, port, and
532
- * pathname. Uses find_conf_path() to find the current configuration directory.
533
- * See default.settings.php for examples on how the URL is converted to a
534
- * directory.
532
+ * pathname. See default.settings.php for examples on how the URL is converted
533
+ * to a directory.
535
534
*
536
535
* @param bool $require_settings
537
536
* Only configuration directories with an existing settings.php file
@@ -1223,23 +1222,10 @@ function drupal_send_headers($default_headers = array(), $only_default = FALSE)
1223
1222
* fresh page on every request. This prevents authenticated users from seeing
1224
1223
* locally cached pages.
1225
1224
*
1226
- * Also give each page a unique ETag. This will force clients to include both
1227
- * an If-Modified-Since header and an If-None-Match header when doing
1228
- * conditional requests for the page (required by RFC 2616, section 13.3.4),
1229
- * making the validation more robust. This is a workaround for a bug in Mozilla
1230
- * Firefox that is triggered when Drupal's caching is enabled and the user
1231
- * accesses Drupal via an HTTP proxy (see
1232
- * https://bugzilla.mozilla.org/show_bug.cgi?id=269303): When an authenticated
1233
- * user requests a page, and then logs out and requests the same page again,
1234
- * Firefox may send a conditional request based on the page that was cached
1235
- * locally when the user was logged in. If this page did not have an ETag
1236
- * header, the request only contains an If-Modified-Since header. The date will
1237
- * be recent, because with authenticated users the Last-Modified header always
1238
- * refers to the time of the request. If the user accesses Drupal via a proxy
1239
- * server, and the proxy already has a cached copy of the anonymous page with an
1240
- * older Last-Modified date, the proxy may respond with 304 Not Modified, making
1241
- * the client think that the anonymous and authenticated pageviews are
1242
- * identical.
1225
+ * ETag and Last-Modified headers are not set per default for authenticated
1226
+ * users so that browsers do not send If-Modified-Since headers from
1227
+ * authenticated user pages. drupal_serve_page_from_cache() will set appropriate
1228
+ * ETag and Last-Modified headers for cached pages.
1243
1229
*
1244
1230
* @see drupal_page_set_cache()
1245
1231
*/
@@ -1252,9 +1238,7 @@ function drupal_page_header() {
1252
1238
1253
1239
$ default_headers = array (
1254
1240
'Expires ' => 'Sun, 19 Nov 1978 05:00:00 GMT ' ,
1255
- 'Last-Modified ' => gmdate (DATE_RFC7231 , REQUEST_TIME ),
1256
1241
'Cache-Control ' => 'no-cache, must-revalidate, post-check=0, pre-check=0 ' ,
1257
- 'ETag ' => '" ' . REQUEST_TIME . '" ' ,
1258
1242
);
1259
1243
drupal_send_headers ($ default_headers );
1260
1244
}
@@ -1636,14 +1620,14 @@ function request_uri() {
1636
1620
* information about the passed-in exception is used.
1637
1621
* @param $variables
1638
1622
* Array of variables to replace in the message on display. Defaults to the
1639
- * return value of drupal_decode_exception ().
1623
+ * return value of _drupal_decode_exception ().
1640
1624
* @param $severity
1641
1625
* The severity of the message, as per RFC 3164.
1642
1626
* @param $link
1643
1627
* A link to associate with the message.
1644
1628
*
1645
1629
* @see watchdog()
1646
- * @see drupal_decode_exception ()
1630
+ * @see _drupal_decode_exception ()
1647
1631
*/
1648
1632
function watchdog_exception ($ type , Exception $ exception , $ message = NULL , $ variables = array (), $ severity = WATCHDOG_ERROR , $ link = NULL ) {
1649
1633
@@ -2414,6 +2398,26 @@ function _drupal_bootstrap_variables() {
2414
2398
// Load bootstrap modules.
2415
2399
require_once DRUPAL_ROOT . '/includes/module.inc ' ;
2416
2400
module_load_all (TRUE );
2401
+
2402
+ // Sanitize the destination parameter (which is often used for redirects) to
2403
+ // prevent open redirect attacks leading to other domains. Sanitize both
2404
+ // $_GET['destination'] and $_REQUEST['destination'] to protect code that
2405
+ // relies on either, but do not sanitize $_POST to avoid interfering with
2406
+ // unrelated form submissions. The sanitization happens here because
2407
+ // url_is_external() requires the variable system to be available.
2408
+ if (isset ($ _GET ['destination ' ]) || isset ($ _REQUEST ['destination ' ])) {
2409
+ require_once DRUPAL_ROOT . '/includes/common.inc ' ;
2410
+ // If the destination is an external URL, remove it.
2411
+ if (isset ($ _GET ['destination ' ]) && url_is_external ($ _GET ['destination ' ])) {
2412
+ unset($ _GET ['destination ' ]);
2413
+ unset($ _REQUEST ['destination ' ]);
2414
+ }
2415
+ // If there's still something in $_REQUEST['destination'] that didn't come
2416
+ // from $_GET, check it too.
2417
+ if (isset ($ _REQUEST ['destination ' ]) && (!isset ($ _GET ['destination ' ]) || $ _REQUEST ['destination ' ] != $ _GET ['destination ' ]) && url_is_external ($ _REQUEST ['destination ' ])) {
2418
+ unset($ _REQUEST ['destination ' ]);
2419
+ }
2420
+ }
2417
2421
}
2418
2422
2419
2423
/**
@@ -2550,7 +2554,7 @@ function drupal_installation_attempted() {
2550
2554
*
2551
2555
* This would include implementations of hook_install(), which could run
2552
2556
* during the Drupal installation phase, and might also be run during
2553
- * non-installation time, such as while installing the module from the the
2557
+ * non-installation time, such as while installing the module from the
2554
2558
* module administration page.
2555
2559
*
2556
2560
* Example usage:
@@ -3079,10 +3083,13 @@ function _registry_check_code($type, $name = NULL) {
3079
3083
// This function may get called when the default database is not active, but
3080
3084
// there is no reason we'd ever want to not use the default database for
3081
3085
// this query.
3082
- $ file = Database::getConnection ('default ' , 'default ' )->query ("SELECT filename FROM {registry} WHERE name = :name AND type = :type " , array (
3083
- ':name ' => $ name ,
3084
- ':type ' => $ type ,
3085
- ))
3086
+ $ file = Database::getConnection ('default ' , 'default ' )
3087
+ ->select ('registry ' , 'r ' , array ('target ' => 'default ' ))
3088
+ ->fields ('r ' , array ('filename ' ))
3089
+ // Use LIKE here to make the query case-insensitive.
3090
+ ->condition ('r.name ' , db_like ($ name ), 'LIKE ' )
3091
+ ->condition ('r.type ' , $ type )
3092
+ ->execute ()
3086
3093
->fetchField ();
3087
3094
3088
3095
// Flag that we've run a lookup query and need to update the cache.
@@ -3420,3 +3427,34 @@ function drupal_check_memory_limit($required, $memory_limit = NULL) {
3420
3427
// - The memory limit is greater than the memory required for the operation.
3421
3428
return ((!$ memory_limit ) || ($ memory_limit == -1 ) || (parse_size ($ memory_limit ) >= parse_size ($ required )));
3422
3429
}
3430
+
3431
+ /**
3432
+ * Invalidates a PHP file from any active opcode caches.
3433
+ *
3434
+ * If the opcode cache does not support the invalidation of individual files,
3435
+ * the entire cache will be flushed.
3436
+ *
3437
+ * @param string $filepath
3438
+ * The absolute path of the PHP file to invalidate.
3439
+ */
3440
+ function drupal_clear_opcode_cache ($ filepath ) {
3441
+ if (!defined ('PHP_VERSION_ID ' ) || PHP_VERSION_ID < 50300 ) {
3442
+ // Below PHP 5.3, clearstatcache does not accept any function parameters.
3443
+ clearstatcache ();
3444
+ }
3445
+ else {
3446
+ clearstatcache (TRUE , $ filepath );
3447
+ }
3448
+
3449
+ // Zend OPcache.
3450
+ if (function_exists ('opcache_invalidate ' )) {
3451
+ opcache_invalidate ($ filepath , TRUE );
3452
+ }
3453
+ // APC.
3454
+ if (function_exists ('apc_delete_file ' )) {
3455
+ // apc_delete_file() throws a PHP warning in case the specified file was
3456
+ // not compiled yet.
3457
+ // @see http://php.net/apc-delete-file
3458
+ @apc_delete_file ($ filepath );
3459
+ }
3460
+ }
0 commit comments