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
Sergey Biryukov
b76cfbcdb4
Fix a copy/paste error in a comment.
...
see #31951 .
Built from https://develop.svn.wordpress.org/trunk@32115
git-svn-id: http://core.svn.wordpress.org/trunk@32094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-11 23:20:25 +00:00
Andrew Ozz
f008aea0e1
Add mb_strlen()
compatibility function. Works the same way as the existing mb_substr()
compatibility function.
...
Props SergeyBiryukov. Fixes #31951 .
Built from https://develop.svn.wordpress.org/trunk@32114
git-svn-id: http://core.svn.wordpress.org/trunk@32093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-11 23:14:26 +00:00
Scott Taylor
fe6b5983df
In PHP 5.0.0, is_a()
became deprecated in favour of the instanceof
operator. Calling is_a()
would result in an E_STRICT
warning.
...
In PHP 5.3.0, `is_a()` is no longer deprecated, and will therefore no longer throw `E_STRICT` warnings.
To avoid warnings in PHP < 5.3.0, convert all `is_a()` calls to `$var instanceof WP_Class` calls.
`instanceof` does not throw any error if the variable being tested is not an object, it simply returns `false`.
Props markoheijnen, wonderboymusic.
Fixes #25672 .
Built from https://develop.svn.wordpress.org/trunk@31188
git-svn-id: http://core.svn.wordpress.org/trunk@31169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 01:06:24 +00:00
Mark Jaquith
45afcde640
Define JSON_PRETTY_PRINT
so it can be used with wp_json_encode()
...
* `JSON_PRETTY_PRINT` was introduced in PHP 5.4
* Now you can use it with lower PHP versions, without a notice
fixes #30139
see #28786
Built from https://develop.svn.wordpress.org/trunk@30075
git-svn-id: http://core.svn.wordpress.org/trunk@30075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 21:13:22 +00:00
Andrew Nacin
7d672c38a4
Constant time for wp_verify_nonce().
...
Built from https://develop.svn.wordpress.org/trunk@29382
git-svn-id: http://core.svn.wordpress.org/trunk@29160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-06 05:26:16 +00:00
nacin
c8e85fcb81
Restore compat for json_decode and json_encode. fixes #18015 for trunk.
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@18404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-06 23:33:05 +00:00
ryan
38e198f8f1
Resurrect hash_hmac() compat for hosts that --disable-hash. Props aaroncampbell. fixes #17647
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@18111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-02 14:21:09 +00:00
markjaquith
86bc31ea2b
Add mb_substr() back to compat.php (it is non-default). see #16918 . props joostdevalk
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@17621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-07 15:46:57 +00:00
markjaquith
613639762a
Add _() back to compat.php (it is non-default). see #16918 . props aaroncampbell
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@17620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-07 15:46:48 +00:00
ryan
91dc365567
Take out unnecessary compat functions from compat.php. Props hakre, ptahdunbar. see #16918
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@17603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-05 17:13:04 +00:00
dd32
f7e764312b
Fix invalid paths in requires. See r14139. See #12594
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@14151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-04-18 09:51:19 +00:00
nacin
6ec7cb4540
Use relative paths when including files, avoiding include_path. fixes #12594 , props sorich87.
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@14139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-04-18 06:14:45 +00:00
dd32
ceb1acf3f7
Implement the 2nd parameter of json_decode() for back-compat purposes. Returns an associative array instead of an object. For the recursive object handling, Props carbolineum. Fixes #11963
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@13863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-03-28 04:42:44 +00:00
dd32
adb825f6d0
Implement the 2nd parameter of json_decode() for back-compat purposes. Returns an associative array instead of an object. Fixes #11963
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@13862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-03-28 04:35:42 +00:00
ryan
137705d20b
Update json lib. Use encodeUnsafe in our json wrapper. Props nacin. fixes #11537 for trunk
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@12491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-12-22 16:49:35 +00:00
westi
50a2f86dda
Correct key padding and add support for raw_output in hash_hmac. Fixes #10284 props mdawaffe.
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@11921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-09-12 22:03:14 +00:00
westi
b45dcf2df5
Make our hash_hmac compatibility function unit testable even when the real one exists. See #10284 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@11920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-09-12 08:26:44 +00:00
azaozz
1c161c23c2
Image editing (first run). Includes code by stephanreiter, see #10528
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@11911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-09-10 22:07:33 +00:00
azaozz
a0467d5cda
Add JSON compat for PHP < 5.2, props Viper007Bond, see #10337
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@11875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-08-25 07:48:59 +00:00
ryan
ead9ed7938
Add compat for mb_substr rather than mb_strcut. fixes #9055
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@10707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-03-04 22:05:49 +00:00
ryan
39edc65b53
Use right variable name. Props stringfold. fixes #9090 for trunk
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@10543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-02-11 19:36:32 +00:00