@@ -1834,7 +1834,7 @@ function filter_xss($string, $allowed_tags = NULL) {
18341834
18351835 // Defuse all HTML entities.
18361836 $ string = str_replace ('& ' , '& ' , $ string );
1837- // Change back only well-formed entities in our whitelist :
1837+ // Change back only well-formed entities in our allowlist :
18381838 // Decimal numeric entities.
18391839 $ string = preg_replace ('/&#([0-9]+;)/ ' , '&#\1 ' , $ string );
18401840 // Hexadecimal numeric entities.
@@ -2544,7 +2544,7 @@ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) {
25442544 * arguments for internal paths must be supplied in $options['query'], not
25452545 * included in $path.
25462546 * - If you provide an internal path and $options['alias'] is set to TRUE, the
2547- * path is assumed already to be the correct path alias, and the alias is
2547+ * path is assumed already to be the correct URL alias, and the alias is
25482548 * not looked up.
25492549 * - The special string '<front>' generates a link to the site's base URL.
25502550 * - If your external URL contains a query (e.g. http://example.com/foo?a=b),
@@ -2678,7 +2678,7 @@ function url($path = NULL, array $options = array()) {
26782678 $ langcode = isset ($ options ['language ' ]) && isset ($ options ['language ' ]->langcode ) ? $ options ['language ' ]->langcode : '' ;
26792679 $ alias = backdrop_get_path_alias ($ original_path , $ langcode );
26802680 if ($ alias != $ original_path ) {
2681- // Strip leading slashes from internal path aliases to prevent them
2681+ // Strip leading slashes from internal URL aliases to prevent them
26822682 // becoming external URLs without protocol. /example.com should not be
26832683 // turned into //example.com.
26842684 $ path = ltrim ($ alias , '/ ' );
@@ -2814,7 +2814,7 @@ function backdrop_http_header_attributes(array $attributes = array()) {
28142814 * // will return an onmouseout attribute with JavaScript code that, when used
28152815 * // as attribute in a tag, will cause users to be redirected to another site.
28162816 * //
2817- * // In this case, the 'onmouseout' attribute should not be whitelisted --
2817+ * // In this case, the 'onmouseout' attribute should not be allowed --
28182818 * // you don't want users to have the ability to add this attribute or others
28192819 * // that take JavaScript commands.
28202820 * backdrop_attributes(array('onmouseout' => 'window.location="http://malicious.com/";')));
@@ -7814,7 +7814,7 @@ function backdrop_common_theme() {
78147814 'variables ' => array ('type ' => MARK_NEW ),
78157815 ),
78167816 'item_list ' => array (
7817- 'variables ' => array ('items ' => array (), 'title ' => '' , 'type ' => 'ul ' , 'attributes ' => array ()),
7817+ 'variables ' => array ('items ' => array (), 'title ' => '' , 'type ' => 'ul ' , 'attributes ' => array (), ' empty ' => NULL ),
78187818 ),
78197819 'more_help_link ' => array (
78207820 'variables ' => array ('url ' => NULL ),
@@ -8665,12 +8665,13 @@ function backdrop_parse_dependency($dependency) {
86658665 $ p_major = '(?P<major>\d+) ' ;
86668666 // By setting the minor version to x, branches can be matched.
86678667 $ p_minor = '(?P<minor>(?:\d+|x)(?:-[A-Za-z]+\d+)?) ' ;
8668+ $ p_patch = '(?P<patch>(?:\d+|x)(?:-[A-Za-z]+\d+)?)? ' ;
86688669 $ parts = explode ('( ' , $ dependency , 2 );
86698670 $ value ['name ' ] = trim ($ parts [0 ]);
86708671 if (isset ($ parts [1 ])) {
86718672 $ value ['original_version ' ] = '( ' . $ parts [1 ];
86728673 foreach (explode (', ' , $ parts [1 ]) as $ version ) {
8673- if (preg_match ("/^\s* $ p_op\s* $ p_core$ p_major\. $ p_minor/ " , $ version , $ matches )) {
8674+ if (preg_match ("/^\s* $ p_op\s* $ p_core$ p_major\. $ p_minor\.? $ p_patch / " , $ version , $ matches )) {
86748675 $ op = !empty ($ matches ['operation ' ]) ? $ matches ['operation ' ] : '= ' ;
86758676 if ($ matches ['minor ' ] == 'x ' ) {
86768677 // Backdrop considers "2.x" to mean any version that begins with
@@ -8688,7 +8689,23 @@ function backdrop_parse_dependency($dependency) {
86888689 $ op = '>= ' ;
86898690 }
86908691 }
8691- $ value ['versions ' ][] = array ('op ' => $ op , 'version ' => $ matches ['major ' ] . '. ' . $ matches ['minor ' ]);
8692+
8693+ if (isset ($ matches ['patch ' ]) && ($ matches ['patch ' ] === '0 ' || $ matches ['patch ' ])) {
8694+ if ($ matches ['patch ' ] == 'x ' && $ matches ['minor ' ] !== 'x ' ) {
8695+ // See comments above about "x" in minor.
8696+ // Same principle applies to patch in relation to minor.
8697+ if ($ op == '> ' || $ op == '<= ' ) {
8698+ $ matches ['minor ' ]++;
8699+ }
8700+ if ($ op == '= ' || $ op == '== ' ) {
8701+ $ value ['versions ' ][] = array ('op ' => '< ' , 'version ' => $ matches ['major ' ] . '. ' . ($ matches ['minor ' ] + 1 ) . '.x ' );
8702+ $ op = '>= ' ;
8703+ }
8704+ }
8705+ }
8706+ $ version = $ matches ['major ' ] . '. ' . $ matches ['minor ' ];
8707+ $ version .= (isset ($ matches ['patch ' ]) && ($ matches ['patch ' ] === '0 ' || $ matches ['patch ' ])) ? '. ' . $ matches ['patch ' ] : '' ;
8708+ $ value ['versions ' ][] = array ('op ' => $ op , 'version ' => $ version );
86928709 }
86938710 }
86948711 }
@@ -8726,12 +8743,18 @@ function backdrop_check_incompatibility(array $dependency_info, $current_version
87268743 * Converts a Backdrop version string into numeric-only version string.
87278744 *
87288745 * @param string $version_string
8729- * A version string such as 1.10.0-beta4 or 1.4.x-dev.
8746+ * A version string such as 1.x-1.2.3, 1. 10.0-beta4, or 1.4.x-dev.
87308747 * @return string
87318748 * A converted string only containing numbers, for use in PHP's
87328749 * version_compare() function.
87338750 */
87348751function _backdrop_version_compare_convert ($ version_string ) {
8752+ // Remove the "1.x-" prefix (indicating Backdrop core version compatibility).
8753+ $ core_prefix = BACKDROP_CORE_COMPATIBILITY . '- ' ;
8754+ if (strpos ($ version_string , $ core_prefix ) === 0 ) {
8755+ $ version_string = substr ($ version_string , strlen ($ core_prefix ));
8756+ }
8757+
87358758 // Convert "dev" releases to be the highest possible version number. For
87368759 // example 1.5.x-dev should be considered higher than any other 1.5 release,
87378760 // so we replace .x with 99999.
0 commit comments