Commit Graph

89 Commits

Author SHA1 Message Date
Sergey Biryukov
3ec2d2fcfa Build/Test Tools: Update PHPCompatibilityWP to version 2.1.3.
The latest release takes the new polyfills added in WordPress 5.9 into account.

This commit also removes redundant inline ignore comments for WP-polyfilled functionality. The PHPCompatibilityWP ruleset explicitly excludes those polyfills, so they don't need to be annotated as ignored.

Release notes:
https://github.com/PHPCompatibility/PHPCompatibilityWP/releases/tag/2.1.3

For a full list of changes in this update, see the PHPCompatibilityWP GitHub:
https://github.com/PHPCompatibility/PHPCompatibilityWP/compare/2.1.2...2.1.3

Follow-up to [46290], [51543].

Props jrf.
Fixes #54711.
Built from https://develop.svn.wordpress.org/trunk@52425


git-svn-id: http://core.svn.wordpress.org/trunk@52017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-31 13:55:03 +00:00
hellofromTonya
3d10105120 General: Introduce polyfills for str_ends_with() and str_starts_with() added in PHP 8.0.
PHP 8.0 introduced two new functions: `str_ends_with()` and `str_starts_with()`. These perform a case-sensitive check indicating if the string to search in (haystack) ends or begins with the given substring (needle).

These polyfills make these functios available for use in Core.

Ref:
* PHP RFC https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions
* PHP manual `str_ends_with()` https://www.php.net/manual/en/function.str-ends-with.php
* PHP manual `str_starts_with()`  https://www.php.net/manual/en/function.str-starts-with.php

Props costdev, hellofromTonya, pbearne, pbiron.
Fixes #54377.
Built from https://develop.svn.wordpress.org/trunk@52040


git-svn-id: http://core.svn.wordpress.org/trunk@51632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 14:22:57 +00:00
hellofromTonya
87557c6260 General: Introduce polyfill for str_contains() added in PHP 8.0.
PHP 8.0 introduced a new function: `str_contains()`. It performs a case-sensitive check indicating if given substring (needle) is contained in the string to search in (haystack).

This polyfill makes this function available for use in Core.

Ref:
* PHP RFC https://wiki.php.net/rfc/str_contains
* PHP manual https://www.php.net/manual/en/function.str-contains.php

Props ayeshrajans, costdev, desrosj, hellofromTonya, knutsp, pbearne.
Fixes #49652.
Built from https://develop.svn.wordpress.org/trunk@52039


git-svn-id: http://core.svn.wordpress.org/trunk@51631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 14:03:58 +00:00
hellofromTonya
10dc403b88 General: Introduce polyfills for array_key_first() and array_key_last() added in PHP 7.3.0.
PHP 7.3.0 introduced two new functions: `array_key_first()` and `array_key_last()`. These two functions return the first and last key of each array respectively, without affecting the internal state of the array.

The polyfills make these two functions available for use in Core on PHP versions less than 7.3.0.

Ref:
* PHP RFC https://wiki.php.net/rfc/array_key_first_last
* PHP manual `array_key_first()` https://www.php.net/manual/en/function.array-key-first.php
* PHP manual `array_key_last()` https://www.php.net/manual/en/function.array-key-last.php

Props desrosj, pbearne, costdev, hellofromTonya, ayeshrajans, manzoorwanijk, audrasjb, sergeybiryukov.
Fixes #45055.
Built from https://develop.svn.wordpress.org/trunk@52038


git-svn-id: http://core.svn.wordpress.org/trunk@51630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 13:51:57 +00:00
hellofromTonya
847b7d8690 Code Modernization: Fix "passing null to non-nullable" deprecation in _mb_substr().
The `_mb_substr()` function expects a string for the `$str` parameter, but does not do input validation. This function contains a `preg_match_all()` which also expects a string type for the given subject (i.e. `$str`). 

Passing `null` to this parameter results in `preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated` notice on PHP 8.1.

To maintain the same behaviour as before, a guard clause is added to bail out early when `$str` is passed as `null`. The outcome will, in that case, only ever be an empty string.

Note: this does mean that the `_mb_substr()` function now has a subtle difference in behaviour compared to the PHP native `mb_substr()` function as the latter ''will'' throw the deprecation notice.

The existing tests already cover this issue.

Follow-up to [17621], [36017], [32364].

Props jrf, hellofromTonya.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51853


git-svn-id: http://core.svn.wordpress.org/trunk@51452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-22 23:34:57 +00:00
Sergey Biryukov
8a975839f1 Docs: Correct a comment about WebP constants in wp-includes/compat.php.
Follow-up to [50810], [50814].

Props GaryJ, rtm909.
Fixes #53680.
Built from https://develop.svn.wordpress.org/trunk@51474


git-svn-id: http://core.svn.wordpress.org/trunk@51085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 13:07:57 +00:00
Sergey Biryukov
0778849c12 Media: Some documentation and test improvements for WebP support:
* Document that WebP constants are only defined in PHP 7.1+.
* Correct the `$filename` parameter type in `wp_get_webp_info()`.
* Use a consistent message when skipping tests due to the lack of WebP support.
* Remove unnecessary `else` branches after `markTestSkipped()`.
* Replace `assertEquals()` with more appropriate assertions.

Follow-up to [50810].

See #35725.
Built from https://develop.svn.wordpress.org/trunk@50814


git-svn-id: http://core.svn.wordpress.org/trunk@50423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-05 17:08:01 +00:00
Adam Silverstein
524030edfa Images: enable WebP support.
Add support for uploading, editing and saving WebP images when supported by the server.

Add 'image/webp' to supported mime types. Correctly identify WebP images and sizes even when PHP doesn't support WebP. Resize uploaded WebP files (when supported) and use for front end markup.

Props markoheijne, blobfolio, Clorith, joemcgill, atjn, desrosj, spacedmonkey, marylauc, mikeschroder, hellofromtonya, flixos90.
Fixes #35725.


Built from https://develop.svn.wordpress.org/trunk@50810


git-svn-id: http://core.svn.wordpress.org/trunk@50419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-04 14:44:58 +00:00
Sergey Biryukov
0e3147c40e Coding Standards: Replace alias PHP functions with the canonical names.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@49193


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-18 17:27:06 +00:00
Sergey Biryukov
b16368c268 Docs: Remove @staticvar tags from core.
The tag was supported in phpDocumentor 1.x, but is no longer supported in 2.x and 3.x.

Usage of static variables is considered an internal implementation detail and has no information value for someone reading the docs.

Props alishanvr, jrf.
Fixes #50426.
Built from https://develop.svn.wordpress.org/trunk@48109


git-svn-id: http://core.svn.wordpress.org/trunk@47878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:40:12 +00:00
Sergey Biryukov
a576a13246 Docs: Remove an empty line between @param and @return tags, per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48102


git-svn-id: http://core.svn.wordpress.org/trunk@47871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 11:18:09 +00:00
Sergey Biryukov
38676936ba Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47550


git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-05 03:02:11 +00:00
Sergey Biryukov
641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
Sergey Biryukov
001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
desrosj
e589297afc Code Modernization: Remove JSON related polyfills.
The PHP native JSON extension has been bundled and compiled with PHP by default since version 5.2.0. Because the minimum version of PHP required by WordPress is now 5.6.20 (see #46594 and [45058]), JSON extension related polyfills and backwards compatibility code can now be removed.

This change removes the `json_last_error_msg()` and `JsonSerializable` polyfills included in WordPress for full JSON extension support in PHP < 5.6.

Follow up of [46205-46206].

See #47699.
Props jrf, Clorith, pento.
Built from https://develop.svn.wordpress.org/trunk@46208


git-svn-id: http://core.svn.wordpress.org/trunk@46020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-20 20:16:58 +00:00
Gary Pendergast
bd45c7d3b9 Code Modernisation: Document when the Hash polyfills can be removed.
The Hash extension cannot be disabled as of PHP 7.4. So, while we can't remove these polyfills yet, we can document when we'll be able to.

Props jrf.
Fixes #47698.


Built from https://develop.svn.wordpress.org/trunk@45638


git-svn-id: http://core.svn.wordpress.org/trunk@45449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-15 05:14:55 +00:00
Gary Pendergast
21df1bda5b Code Modernisation: Remove the SPL autoloader polyfill.
As of PHP 5.3, the SPL extension cannot be disabled, so we no longer need this polyfill.

The file is kept with a `_deprecated_file()` call, to alert any plugins or themes that may be loading it directly.

Props jrf, ayeshrajans.
See #47698, #46630.


Built from https://develop.svn.wordpress.org/trunk@45637


git-svn-id: http://core.svn.wordpress.org/trunk@45448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-15 05:11:56 +00:00
Gary Pendergast
501b5f545b Code Modernisation: Remove the array_replace_recursive() polyfill.
This function was added in PHP 5.3.0, so we no longer need the polyfill.

Props jrf.
See #47698.


Built from https://develop.svn.wordpress.org/trunk@45636


git-svn-id: http://core.svn.wordpress.org/trunk@45447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-15 05:08:56 +00:00
Gary Pendergast
abcbee954f Coding Standards: Fix instances of WordPress.PHP.NoSilencedErrors.Discouraged.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

Built from https://develop.svn.wordpress.org/trunk@45611


git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-09 05:45:58 +00:00
Gary Pendergast
87675d288b Coding Standards: Fix all WordPress.WhiteSpace.PrecisionAlignment issues.
See #47632.


Built from https://develop.svn.wordpress.org/trunk@45602


git-svn-id: http://core.svn.wordpress.org/trunk@45413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-05 05:21:56 +00:00
Gary Pendergast
55af0f0d0a Coding Standards: Fix/ignore the WordPress.NamingConventions.ValidFunctionName violations.
See #47632


Built from https://develop.svn.wordpress.org/trunk@45580


git-svn-id: http://core.svn.wordpress.org/trunk@45391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-01 08:01:57 +00:00
tellyworth
cb01bbf97b General: Add sodium_compat library for crypto APIs in PHP < 7.2
This adds a pure PHP implementation of the cryptographic functions supported in PHP 7.2+. It provides the necessary backwards compatibility required to support signature verification and other security features going forward across all supported PHP versions.

Props paragoninitiativeenterprises
Fixes #45806. See #39309.

Built from https://develop.svn.wordpress.org/trunk@44953


git-svn-id: http://core.svn.wordpress.org/trunk@44784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 04:56:52 +00:00
Sergey Biryukov
29d5e980cc General: In the is_countable() polyfill, if the provided object implements SimpleXMLElement or ResourceBundle, consider it countable.
Props ayeshrajans, jrf, desrosj.
Fixes #43583.
Built from https://develop.svn.wordpress.org/trunk@43220


git-svn-id: http://core.svn.wordpress.org/trunk@43049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-10 17:58:22 +00:00
Sergey Biryukov
94cbb2a3f6 General: Introduce a polyfill for is_iterable() function added in PHP 7.1.
Props jrf, schlessera, desrosj.
See #43619.
Built from https://develop.svn.wordpress.org/trunk@43036


git-svn-id: http://core.svn.wordpress.org/trunk@42865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-30 04:15:21 +00:00
Sergey Biryukov
5813ccec07 General: Introduce a polyfill for is_countable() function added in PHP 7.3.
Props jrf, ayeshrajans, desrosj.
See #43583.
Built from https://develop.svn.wordpress.org/trunk@43034


git-svn-id: http://core.svn.wordpress.org/trunk@42863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-30 03:43:21 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Gary Pendergast
c90cfa3b50 General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


Built from https://develop.svn.wordpress.org/trunk@42228


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 23:57:55 +00:00
John Blackbourn
df808fc42d General: Move the __autoload() compat function into its own file to prevent deprecated notices being thrown by the compiler in PHP 7.2.
The `__autoload()` function is deprecated in PHP 7.2, which means WordPress' own `__autoload()` compat function for PHP 5.2 needs to be moved into a separate file to prevent the PHP 7.2 compiler from complaining.

Props ayeshrajans

See #40109

Built from https://develop.svn.wordpress.org/trunk@41178


git-svn-id: http://core.svn.wordpress.org/trunk@41018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-28 01:15:52 +00:00
Sergey Biryukov
df97f83cb6 Docs: Replace some more HTTP links with HTTPS.
Props johnpgreen.
Fixes #37622. See #36993.
Built from https://develop.svn.wordpress.org/trunk@38239


git-svn-id: http://core.svn.wordpress.org/trunk@38180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-10 16:10:31 +00:00
Drew Jaynes
6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

Built from https://develop.svn.wordpress.org/trunk@38121


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Pascal Birchler
ddca3c1e01 Menus: Fix _wp_expand_nav_menu_post_data() for PHP 5.2.
[37748] introduced `_wp_expand_nav_menu_post_data()` together with an `array_replace_recursive()` compatibility function for PHP 5.2.
Even though that compat function is tried and tested in other projects like BuddyPress, we need to add additional `isset()` checks in order to avoid 'Undefined index' notices in our case.

See #36590.
Built from https://develop.svn.wordpress.org/trunk@37750


git-svn-id: http://core.svn.wordpress.org/trunk@37715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-19 12:51:27 +00:00
Pascal Birchler
542e462d9d Menus: Support nested array variables in POST data when saving menus.
[36510] allowed larger menus to be created in the Edit Menu screen by JSON-encoding the entire form into a single input field. However, it did not correctly handle nested arrays.

This introduces a new `_wp_expand_nav_menu_post_data()` helper function to handle this POST data which uses `array_replace_recursive()` internally. Since the latter is only available on PHP 5.3+, we add a compatibility function to ensure PHP 5.2 support.

Props ericlewis, neverything, swissspidy.
Fixes #36590 for trunk. See #14134.
Built from https://develop.svn.wordpress.org/trunk@37748


git-svn-id: http://core.svn.wordpress.org/trunk@37713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-19 12:25:28 +00:00
Peter Wilson
47d26cd9fb DOCS: Replace HTTP links with HTTPS.
Replaces unsecure links in documentation and translator comments with their secure versions.

Props johnpgreen, netweb

Fixes #36993

Built from https://develop.svn.wordpress.org/trunk@37674


git-svn-id: http://core.svn.wordpress.org/trunk@37640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-10 04:50:33 +00:00
Ryan McCue
fe7a3ab5d9 Autoload: Add missed @since tags to SPL shim.
See #36926.

Built from https://develop.svn.wordpress.org/trunk@37637


git-svn-id: http://core.svn.wordpress.org/trunk@37605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-06 03:59:28 +00:00
Ryan McCue
0def38c30b Autoload: Introduce shim for SPL autoloading.
For PHP 5.2, SPL can be disabled. As SPL provides the support for multiple autoloaders, this needs to be shimmed if not available.

Fixes #36926.

Built from https://develop.svn.wordpress.org/trunk@37636


git-svn-id: http://core.svn.wordpress.org/trunk@37604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-06 03:24:29 +00:00
Drew Jaynes
b1127321ec Docs: Fix one line of the DocBlock for the JsonSerializable compat interface to use a tab instead of spaces.
Props Frozzare.
Fixes #35699.

Built from https://develop.svn.wordpress.org/trunk@36490


git-svn-id: http://core.svn.wordpress.org/trunk@36457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-07 01:18:27 +00:00
Drew Jaynes
decb25a8ae Docs: Add missing DocBlocks for hash_hmac() and _hash_hmac().
Both will be ignored from parsing as and serve as compat functions for PHP's `hash_hmac()`.

Introduced in [18111].

See #32246.

Built from https://develop.svn.wordpress.org/trunk@36021


git-svn-id: http://core.svn.wordpress.org/trunk@35986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-19 05:11:27 +00:00
Drew Jaynes
c10ec122ca Docs: Fix inline comment syntax in _mb_strlen(), an internal compat method for mb_strlen().
See #32246.

Built from https://develop.svn.wordpress.org/trunk@36020


git-svn-id: http://core.svn.wordpress.org/trunk@35985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-19 04:59:33 +00:00
Drew Jaynes
87786b4373 Docs: Add missing DocBlocks for mb_strlen() and _mb_strlen().
Both will be ignored from parsing as and serve as compat functions for PHP's `mb_strlen()`, which is not enabled by default.

Introduced in [32114].

See #32246.

Built from https://develop.svn.wordpress.org/trunk@36019


git-svn-id: http://core.svn.wordpress.org/trunk@35984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-19 04:56:29 +00:00
Drew Jaynes
9e04750fc4 Docs: Fix inline comment syntax in _mb_substr(), an internal compat method for mb_substr().
See #32246.

Built from https://develop.svn.wordpress.org/trunk@36018


git-svn-id: http://core.svn.wordpress.org/trunk@35983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-19 04:50:28 +00:00
Drew Jaynes
be6589730d Docs: Add missing DocBlocks for mb_substr() and _mb_substr().
Both will be ignored from parsing as and serve as compat functions for PHP's `mb_substr()`, which is not enabled by default.

Introduced in [17621].

See #32246.

Built from https://develop.svn.wordpress.org/trunk@36017


git-svn-id: http://core.svn.wordpress.org/trunk@35982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-19 04:47:28 +00:00
Nikolay Bachiyski
c512f8cbdd Docs: clarify inline docs for hash_equals
Before the docs implied the complexity of the function was O(1) by using the term "constant time", now we use the more descriptive term "Timing attack safe".

Props AramZS.
Fixes #32778.

Built from https://develop.svn.wordpress.org/trunk@35805


git-svn-id: http://core.svn.wordpress.org/trunk@35769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-06 22:04:51 +00:00
Dion Hulse
4852cbf14b Use PHP7's random_int() CSPRNG functionality in wp_rand() with a fallback to the random_compat library for PHP 5.x.
`random_compat` offers a set of compatible functions for older versions of PHP, filling in the gap by using other PHP extensions when available.
We still include our existing `wp_rand()` functionality as a fallback for when no proper CSPRNG exists on the system.

Take Two, this was previously committed in [34922] but had an issue on PHP 5.2 which sarciszewski has now resolved.

Props sarciszewski
See #28633

Built from https://develop.svn.wordpress.org/trunk@34981


git-svn-id: http://core.svn.wordpress.org/trunk@34946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-09 04:28:24 +00:00
Dion Hulse
bb8ba86ed1 Revert [34922] pending PHP 5.2 compatibility.
See #28633

Built from https://develop.svn.wordpress.org/trunk@34924


git-svn-id: http://core.svn.wordpress.org/trunk@34889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 00:17:24 +00:00
Dion Hulse
0e322469a6 Use PHP7's random_int() CSPRNG functionality in wp_rand() with a fallback to the random_compat library for PHP 5.x.
`random_compat` offers a set of compatible functions for older versions of PHP, filling in the gap by using other PHP extensions when available.
We still include our existing `wp_rand()` functionality as a fallback for when no proper CSPRNG exists on the system.

Props sarciszewski
See #28633

Built from https://develop.svn.wordpress.org/trunk@34922


git-svn-id: http://core.svn.wordpress.org/trunk@34887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 00:02:24 +00:00
Scott Taylor
f8c3aca01c REST API: add JsonSerializable() compatibility interface for PHP <5.4 to compat.php
Props rmmcue.
See #33982.

Built from https://develop.svn.wordpress.org/trunk@34845


git-svn-id: http://core.svn.wordpress.org/trunk@34810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 02:56:24 +00:00
Scott Taylor
5a357a452f REST API: add json_last_error_msg() compatibility function for PHP <5.5 to compat.php
Props rmmcue.
See #33982.

Built from https://develop.svn.wordpress.org/trunk@34844


git-svn-id: http://core.svn.wordpress.org/trunk@34809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 02:45:26 +00:00
Scott Taylor
42d51a4f89 Add doc blocks to functions that are missing them.
If the function has no need for `@param` or `@return`, do an archeaological dig to find `@since`.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32672


git-svn-id: http://core.svn.wordpress.org/trunk@32642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-31 03:18:25 +00:00
Scott Taylor
19a3aacc94 Add @static* annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32650


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Gary Pendergast
364886a5be WPDB: When checking that a string can be sent to MySQL, we shouldn't use mb_convert_encoding(), as it behaves differently to MySQL's character encoding conversion.
Props mdawaffe, pento, nbachiyski, jorbin, johnjamesjacoby, jeremyfelt.

See #32165.


Built from https://develop.svn.wordpress.org/trunk@32364


git-svn-id: http://core.svn.wordpress.org/trunk@32335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-06 03:00:25 +00:00