Commit Graph

2030 Commits

Author SHA1 Message Date
dmsnell
83559dd036 Functions: Memoize wp_normalize_path().
`wp_normalize_path()` is called thousands of times on a given request. This patch adds memoization via a function-local static variable. This reduces the call count to the underlying `wp_is_stream()` function, and measured in testing around a 66% cache hit rate.

In testing, for a site making 4000 calls to `wp_normalize_path()`, this patch led to a reduction in runtime from 1.4 ms to 0.4 ms on the test computer. While small, this time occurs early in the hotpath of the loading WordPress.

Developed in: https://github.com/WordPress/wordpress-develop/pull/10770
Discussed in: https://core.trac.wordpress.org/ticket/64538

Props dmsnell, josephscott, mreishus, westonruter.
Fixes #64538.

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


git-svn-id: http://core.svn.wordpress.org/trunk@61144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-03-06 20:05:46 +00:00
Sergey Biryukov
f0bd85c8c1 General: Remove unused variable in wp_unique_filename().
Follow-up to [51653].

Props Soean.
Fixes #64675.
Built from https://develop.svn.wordpress.org/trunk@61710


git-svn-id: http://core.svn.wordpress.org/trunk@61018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-20 19:50:12 +00:00
Weston Ruter
bd3f20e8c7 Build/Test Tools: Integrate PHPStan into the core development workflow.
This change introduces PHPStan static analysis configured at [https://phpstan.org/user-guide/rule-levels rule level 0], which includes: "basic checks, unknown classes, unknown functions, unknown methods called on `$this`, wrong number of arguments passed to those methods and functions, always undefined variables". Contributors may elect for a higher PHPStan rule level by creating a `phpstan.neon` which overrides `phpstan.neon.dist`.

* Fix various PHPStan level 0 errors by adding `@phpstan-ignore` comments, updating PHPDoc types, and adding missing return values.
* Remove existing `@phpstan-ignore` comments that are now obsolete or inapplicable for level 0.
* Add a new GitHub Actions workflow for PHPStan Static Analysis. Reports are currently provided as warnings with inline annotations in pull requests and do not fail the build.
* Add a `phpstan` Grunt task and include it in the `precommit:php` task to run before `phpunit`.
* Introduce a `typecheck:php` npm script and a `composer phpstan` script to run analysis in local development environments.
* Add documentation for PHPStan usage in `tests/phpstan/README.md`.

Developed in https://github.com/WordPress/wordpress-develop/pull/10419

Props justlevine, westonruter, johnbillion, desrosj, SirLouen, dmsnell, oglekler, joehoyle, jorbin.
See #64238, #63268, #52217, #51423.
Fixes #61175.

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


git-svn-id: http://core.svn.wordpress.org/trunk@61007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-20 02:25:46 +00:00
audrasjb
82dc7c5d79 Coding Standards: Remove an unwanted space after [61691].
Follow-up to [61691].

Unprops audrasjb.
See #60770.


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


git-svn-id: http://core.svn.wordpress.org/trunk@61000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-19 11:16:51 +00:00
audrasjb
2acbd93df1 I18N: Add dir="auto" to Timezone dropdown options.
This changeset adds `dir="auto"` to the Timezones dropdown located in Settings > General. With this attribute, the option alignment will be delegated to the user agent.

@see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir.

Props farhad0, swissspidy, drysand, sabernhardt, khoipro, olmostblue, sajib1223.
Fixes #60770.


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


git-svn-id: http://core.svn.wordpress.org/trunk@60999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-19 11:12:53 +00:00
audrasjb
b3ac058a85 General: Allow to hook into wp_trigger_error() when WP_DEBUG is not truthy.
This changeset allow developers to attach custom error handlers into `wp_trigger_error()` even if `WP_DEBUG` is not truthy.
It introduces two new hooks, making `wp_trigger_error()` consistent with what is available in `_doing_it_wrong`:
- `wp_trigger_error_always_run` always fires when the given function triggers a user-level error/warning/notice/deprecation message.
- `wp_trigger_error_trigger_error` filters whether to trigger the error.

Props kkmuffme, swissspidy, audrasjb.
Fixes #60886.


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


git-svn-id: http://core.svn.wordpress.org/trunk@60996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-19 10:21:02 +00:00
joedolson
9c13eca1c3 Admin: Update focus styles to match design reskin.
Apply design reskin changes to focus states on links, classic editor, media library, and other omitted contexts.

See also [61645].

Props joedolson, fabiankaegy.
Fixes #64644.
Built from https://develop.svn.wordpress.org/trunk@61652


git-svn-id: http://core.svn.wordpress.org/trunk@60963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-16 17:24:42 +00:00
Weston Ruter
702895761a Code Modernization: Use null coalescing operator instead of ternaries where possible.
Developed in https://github.com/WordPress/wordpress-develop/pull/10911

Follow-up to [61621], [61464].

Props soean, westonruter.
See #63430.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-13 17:52:44 +00:00
Weston Ruter
df5581dd90 Code Modernization: Use null coalescing operator in additional isset() ternaries.
These had been missed previously due to additional parentheses around the `isset()` expressions.

Developed in https://github.com/WordPress/wordpress-develop/pull/10704

Follow-up to [61463], [61457], [61456], [61455], [61454], [61453], [61445], [61444], [61443], [61442], [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403].

Props soean.
See #58874, #63430.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-10 05:29:48 +00:00
Weston Ruter
f124de962f Code Modernization: Taxonomy, Posts/Post Types, Options/Meta APIs, Query, General: Use null coalescing operator instead of isset() ternaries.
Developed as a subset of https://github.com/WordPress/wordpress-develop/pull/10654
Initially developed in https://github.com/WordPress/wordpress-develop/pull/4886

Follow-up to [61444], [61443], [61442], [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403].

Props costdev, westonruter.
See #58874, #63430.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-06 06:08:03 +00:00
jonsurrell
5e1414562a Scripts: Remove default type attribute from tags.
`SCRIPT`, `STYLE`, and stylesheet `LINK` tags do not require a type attribute since the HTML5 standard was released in 2008. Removing the type attribute simplifies logic and normalizes the produced HTML content.

Developed in https://github.com/WordPress/wordpress-develop/pull/10658.

Follow-up to [46164].

Props hardikhuptechdev, jonsurrell, dmsnell, westonruter.
Fixes #64428. See #59883, #64442.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-26 13:16:34 +00:00
John Blackbourn
133d50d5a2 Docs: Miscellaneous improvements and corrections to inline documentation.
See #64224

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


git-svn-id: http://core.svn.wordpress.org/trunk@60699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-16 20:21:37 +00:00
Weston Ruter
a49aba3014 Docs: Add missing descriptions and fix types for some @return tags.
Props huzaifaalmesbah, sabernhardt, westonruter.
See #64224.
Fixes #64262.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-19 06:17:32 +00:00
johnjamesjacoby
5cd43e9b41 Date/Time: Prevent a PHP exception when inserting posts with a partially malformed post_date.
This commit updates `wp_resolve_post_date()` to use a regular expression for parsing the date string into year, month, and day matches. This approach handles missing leading zeros more reliably than `substr()` while remaining performant (see #57683).

It also adds checks and type-casting to `wp_checkdate()` variables before passing them into PHP's `checkdate()` function to avoid the potential for a `TypeError` in PHP 8 and newer (see #54186).

Lastly, it includes 2 new unit tests (with data providers) to cover an array of valid and invalid date formats (YYYY-MM-DD, YYYY-MM-DD HH:MM:SS, ISO 8601, RSS, leap years, malformed inputs, etc...)

Props alordiel, desrosj, johnbillion, johnjamesjacoby, johnregan3, modius5150, nacin, pbearne.

Fixes #26798.
Built from https://develop.svn.wordpress.org/trunk@61172


git-svn-id: http://core.svn.wordpress.org/trunk@60508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-06 23:37:31 +00:00
Sergey Biryukov
7065ba5866 Docs: Update MDN Web Docs link to avoid an extra redirect.
Follow-up to [41741], [59712].

See #63166.
Built from https://develop.svn.wordpress.org/trunk@60922


git-svn-id: http://core.svn.wordpress.org/trunk@60258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-10 23:17:31 +00:00
Weston Ruter
8dc4b2a207 Script Loader: Add sourceURL comments to inline SCRIPT tags manually constructed in wp-includes.
This applies to tags constructed without `wp_get_inline_script_tag()`/`wp_print_inline_script_tag()`.

Developed in https://github.com/WordPress/wordpress-develop/pull/9955.

Props westonruter, jonsurrell.
See #63887.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-07 01:24:36 +00:00
Pascal Birchler
310424d1fc Code Modernization: Fix instances of using null as an array offset.
Addresses a new [https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_using_values_null_as_an_array_offset_and_when_calling_array_key_exists deprecation in PHP 8.5].

Props swissspidy.
Fixes #63957.
Built from https://develop.svn.wordpress.org/trunk@60809


git-svn-id: http://core.svn.wordpress.org/trunk@60145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-09-29 16:29:35 +00:00
Sergey Biryukov
43018cae19 Docs: Clarify the description for get_temp_dir().
Includes a note that `sys_get_temp_dir()` honors the `TMPDIR` environment variable.

Follow-up to [17555], [22008], [28936].

Props TimoTijhof, SergeyBiryukov.
See #63711.
Built from https://develop.svn.wordpress.org/trunk@60776


git-svn-id: http://core.svn.wordpress.org/trunk@60112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-09-17 13:37:39 +00:00
Sergey Biryukov
126fc3b4ca Code Modernization: Address no-op function deprecations in PHP 8.5.
Several PHP functions that have not been doing anything since PHP 8.0/8.1, specifically:

* `finfo_close()` since the `ext/fileinfo` migration in PHP 8.1
* `xml_parser_free()` since the `ext/xml` migration in PHP 8.0
* `curl_close()` since the `ext/curl` migration in PHP 8.0
* `curl_share_close()` since the `ext/curl` migration in PHP 8.0
* `imagedestroy()` since the `ext/gd` migration in PHP 8.0

will be deprecated in PHP 8.5 and will thus be throwing warnings.

This commit adds conditional checks to only call these functions on the relevant PHP versions.

Reference: [https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_no-op_functions_from_the_resource_to_object_conversion PHP RFC: Deprecations for PHP 8.5: Deprecate no-op functions from the resource to object conversion].

Props TobiasBg, SergeyBiryukov.
See #63061.
Built from https://develop.svn.wordpress.org/trunk@60703


git-svn-id: http://core.svn.wordpress.org/trunk@60039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-09-03 12:18:31 +00:00
Sergey Biryukov
57f78b73af Docs: Clarify return value for wp_get_default_extension_for_mime_type().
Follow-up to [51653].

Props rollybueno, SergeyBiryukov.
See #63166.
Built from https://develop.svn.wordpress.org/trunk@60696


git-svn-id: http://core.svn.wordpress.org/trunk@60032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-08-31 18:55:26 +00:00
Sergey Biryukov
1de88be2d6 Docs: Improve grammar in some DocBlocks for more clarity and consistency.
Follow-up to [8215], [8598].

Props prab18hat, dhruvang21, swissspidy, SergeyBiryukov.
Fixes #63892.
Built from https://develop.svn.wordpress.org/trunk@60687


git-svn-id: http://core.svn.wordpress.org/trunk@60023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-08-28 15:08:28 +00:00
Sergey Biryukov
aeb1e8f940 Security: Set the frame-ancestors directive in send_frame_options_header().
The `X-Frame-Options` HTTP response header is a way of controlling whether and how a document may be loaded inside of a child navigable. For sites using `Content-Security-Policy`, the `frame-ancestors` directive provides more granular control over the same situations.

Includes adding a `headers_sent()` check before sending the headers.

References:
* [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Frame-Options MDN Web Docs: X-Frame-Options header]
* [https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/frame-ancestors MDN Web Docs: Content-Security-Policy: frame-ancestors directive]

Follow-up to [17826].

Props danielbachhuber, killerbishop, callumbw95, josephscott, nacin, chriscct7, iandunn, SergeyBiryukov.
Fixes #29429.
Built from https://develop.svn.wordpress.org/trunk@60657


git-svn-id: http://core.svn.wordpress.org/trunk@59993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-08-23 14:08:30 +00:00
John Blackbourn
e00c5f086c Docs: Add a few missing @since tags.
See #63166
Built from https://develop.svn.wordpress.org/trunk@60416


git-svn-id: http://core.svn.wordpress.org/trunk@59752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-07-06 11:57:35 +00:00
John Blackbourn
d68311701e Docs: Improve and standardise the format of placeholder strings that get replaced within email messages.
This prevents the strings being treated as h3 headings by the documentation parser on developer.wordpress.org.

See #63166
Built from https://develop.svn.wordpress.org/trunk@60178


git-svn-id: http://core.svn.wordpress.org/trunk@59514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-04-21 11:49:31 +00:00
Sergey Biryukov
a4b3fa981f Coding Standards: Check for an empty address first on admin email change notification.
This follows a common best practice of checking for an empty value before doing a specific comparison.

Follow-up to [60122], [60129].

Props dilipbheda, Presskopp.
Fixes #63267.
Built from https://develop.svn.wordpress.org/trunk@60153


git-svn-id: http://core.svn.wordpress.org/trunk@59489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-04-13 16:48:30 +00:00
Sergey Biryukov
36f1464972 Coding Standards: Move wp_unique_id_from_values() next to wp_unique_id() and wp_unique_prefixed_id(), for consistency.
Follow-up to [60038].

See #63168.
Built from https://develop.svn.wordpress.org/trunk@60131


git-svn-id: http://core.svn.wordpress.org/trunk@59467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-04-05 21:06:27 +00:00
John Blackbourn
d06ea932de Administration: Don't attempt to send a notification about a change of site admin or network admin email address when the old address is empty.
Props spenserhale.

Fixes #62211
Built from https://develop.svn.wordpress.org/trunk@60129


git-svn-id: http://core.svn.wordpress.org/trunk@59465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-04-04 16:36:31 +00:00
Peter Wilson
f54720e6e5 Docs: Fix types for wp_cache_set_last_changed filter.
Corrects the type for the `$time` and `$previous_time` parameters in the filter to indicate the times are expressed as strings. The values are generated from a call to `microtime()` which returns the time as a string in the form `msec sec`.

Props tillkruess, westonruter.
Fixes #63194.



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


git-svn-id: http://core.svn.wordpress.org/trunk@59464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-04-03 20:49:31 +00:00
John Blackbourn
746ed91e1e Application Passwords: Correct the fallback behaviour for application passwords that don't use a generic hash.
Application passwords that aren't hashed using BLAKE2b should be checked using `wp_check_password()` rather than assuming they were hashed with phpass. This provides full back compat support for application passwords that were created via an overridden `wp_hash_password()` function that uses an alternative hashing algorithm.

Props snicco, debarghyabanerjee, peterwilsoncc, jorbin, johnbillion.

Fixes #63203
Built from https://develop.svn.wordpress.org/trunk@60123


git-svn-id: http://core.svn.wordpress.org/trunk@59459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-04-03 13:53:28 +00:00
Sergey Biryukov
6f969c6c79 Docs: Correct documentation for current_time(), date_i18n(), and wp_date().
Includes:
* Standardizing on the `bool` type for the `$gmt` parameter between `current_time()` and `date_i18n()`.
* Documenting `null` as an acceptable value for `$timestamp` and `$timezone` parameters in `wp_date()`.
* Removing a redundant note on the `$gmt` parameter for the `date_i18n` filter, as defaults are normally only documented for function parameters.

Follow-up to [1001], [9616], [28109], [45901].

Props dilipbheda.
Fixes #63207.
Built from https://develop.svn.wordpress.org/trunk@60119


git-svn-id: http://core.svn.wordpress.org/trunk@59455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-04-01 16:43:28 +00:00
audrasjb
73540ca808 Coding Standards: Use sprintf() for correct i18n in wp_unique_id_from_values().
Follow-up to [60075], [60079].

Fixes #62985.


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


git-svn-id: http://core.svn.wordpress.org/trunk@59421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-03-25 14:31:31 +00:00
Joe McGill
98a3f5f11c Editor: Fix translators note in wp_unique_id_from_values().
Follow up to [60075] to fix a typo.

Props mukesh27, johnbillion.
See #62985.

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


git-svn-id: http://core.svn.wordpress.org/trunk@59415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-03-25 12:54:22 +00:00
Peter Wilson
886fb31207 Editor: Tidy up _doing_it_wrong() call in wp_unique_id_from_values().
Adds a translator note not to translate the parameter name `$data` and removes an unused `sprintf()` that doesn't contain any placeholders.

Props peterwilsoncc, joemcgill.
Fixes #62985.

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


git-svn-id: http://core.svn.wordpress.org/trunk@59411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-03-25 01:47:25 +00:00
Aaron Jorbin
e382a52cde Coding Standards: Fix alignment in wp_check_filetype_and_ext.
Follow-up to [59315].

See #62272, #62279.

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


git-svn-id: http://core.svn.wordpress.org/trunk@59385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-03-18 23:41:26 +00:00
Joe McGill
1c43cd6743 Editor: Fix layout support classes to be generated with a stable ID.
This fixes a bug reported in https://github.com/WordPress/gutenberg/issues/67308 related to the Interactivity API's client-side navigation feature by replacing the incrementally generated IDs with stable hashes derived from the block's layout style definition.

Fixes #62985.
Props darerodz.

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


git-svn-id: http://core.svn.wordpress.org/trunk@59374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-03-18 12:43:24 +00:00
audrasjb
bd18318a94 General: Cast $public param to bool in do_robots().
This changeset properly casts the `$public` variable into `bool` in `do_robots()` for better consistency between code and docs.

Props SergeyBiryukov, shailu25, kapilpaul.
Fixes #63039.


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


git-svn-id: http://core.svn.wordpress.org/trunk@59288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-03-06 15:36:26 +00:00
John Blackbourn
f2de6c15ca Security: Reduce the length of the hash returned by wp_fast_hash() so it can be used in the user_activation_key field when a legacy database schema is still in use.
This reduces the hash length from 32 bytes to 30 so the overall length of an activation key after encoding, prefixing, and prepending a timestamp fits into 60 bytes.

A key is also introduced for domain separation. This doesn't affect the output length.

Props dd32, paragoninitiativeenterprises, peterwilsoncc, johnbillion

Fixes #21022
Built from https://develop.svn.wordpress.org/trunk@59904


git-svn-id: http://core.svn.wordpress.org/trunk@59246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-03-03 09:51:22 +00:00
Pascal Birchler
1d6b7d6fe8 General: Fix force_ssl_admin() to always return bool.
Props pbearne, costdev, autotutorial, debarghyabanerjee, swissspidy.
Fixes #60023.
Built from https://develop.svn.wordpress.org/trunk@59830


git-svn-id: http://core.svn.wordpress.org/trunk@59172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-02-17 15:32:22 +00:00
John Blackbourn
05770e25c3 Security: Switch to using bcrypt for hashing user passwords and BLAKE2b for hashing application passwords and security keys.
Passwords and security keys that were saved in prior versions of WordPress will continue to work. Each user's password will be opportunistically rehashed and resaved when they next subsequently log in using a valid password.

The following new functions have been introduced:

* `wp_password_needs_rehash()`
* `wp_fast_hash()`
* `wp_verify_fast_hash()`

The following new filters have been introduced:

* `password_needs_rehash`
* `wp_hash_password_algorithm`
* `wp_hash_password_options`

Props ayeshrajans, bgermann, dd32, deadduck169, desrosj, haozi, harrym, iandunn, jammycakes, joehoyle, johnbillion, mbijon, mojorob, mslavco, my1xt, nacin, otto42, paragoninitiativeenterprises, paulkevan, rmccue, ryanhellyer, scribu, swalkinshaw, synchro, th23, timothyblynjacobs, tomdxw, westi, xknown.

Additional thanks go to the Roots team, Soatok, Calvin Alkan, and Raphael Ahrens.

Fixes #21022, #44628
Built from https://develop.svn.wordpress.org/trunk@59828


git-svn-id: http://core.svn.wordpress.org/trunk@59170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-02-17 11:24:21 +00:00
audrasjb
6309ca8f17 General: Error messages improvements in /wp-includes files.
This changeset improves a bunch of error messages, notably replacing the good old cryptic "Something went wrong" message with more helpful information.

Props peterwilsoncc, netweb, karmatosed, JoshuaWold, mrtortai, audrasjb, sukhendu2002, joedolson.
Fixes #43622.



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


git-svn-id: http://core.svn.wordpress.org/trunk@59132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-02-08 16:00:19 +00:00
John Blackbourn
31c811c962 Security: Always include the no-store and private directives in the Cache-Control header when setting headers that prevent caching.
The intention of these headers is to prevent any form of caching, whether that's in the browser or in an intermediate cache such as a proxy server. These directives instruct an intermediate cache to not store the response in their cache for any user – not just for logged-in users.

This does not affect the caching behaviour of assets within a page such as images, CSS, and JavaScript files.

Props kkmuffme, devansh2002, johnbillion.

Fixes #61942
Built from https://develop.svn.wordpress.org/trunk@59724


git-svn-id: http://core.svn.wordpress.org/trunk@59066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-01-28 23:22:22 +00:00
John Blackbourn
b7a73d6a45 Security: Enable the referrer policy header on the login screen.
This sets the same referrer policy of `strict-origin-when-cross-origin` that's used in the admin area to prevent a referrer being sent to other origins. This helps prevent unwanted exposure of potentially sensitive information that may be contained within the URL.

The header can be disabled if necessary by removing the `wp_admin_headers` action from the `login_init` hook.

Props kkmuffme, sagarlakhani, albatross10

Fixes #62273
See #42036
Built from https://develop.svn.wordpress.org/trunk@59712


git-svn-id: http://core.svn.wordpress.org/trunk@59054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-01-27 14:41:22 +00:00
audrasjb
692f6d4b9e General: Stop direct loading of files in /wp-includes that should only be included.
This changeset restricts direct access call in `/wp-includes` and its sub directories.

Follow-up to [11768], [59678].

Props deepakrohilla.
Fixes #61314.



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


git-svn-id: http://core.svn.wordpress.org/trunk@59030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-01-22 19:48:25 +00:00
Pascal Birchler
cbca77642b Plugins: Load wp-admin/includes/plugin.php earlier.
Partially reverts [59479] and [59461], which previously tried to move some functions from `wp-admin/includes/plugin.php` to `wp-includes/functions.php` so they are available early, so that `get_plugin_data()` can be used.

However, other functions from that file are often used by plugins without necessarily checking whether they are available, easily causing fatal errors. Requiring this file directly is a safer approach to avoid such errors.

Props peterwilsoncc, dd32, swissspidy, johnbillion.
Fixes #62244.
Built from https://develop.svn.wordpress.org/trunk@59488


git-svn-id: http://core.svn.wordpress.org/trunk@58874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-12-05 12:13:17 +00:00
Pascal Birchler
789d1d9c2e Plugins: Make more plugin-related functions available early on.
This is a follow-up to [59461], which moved `get_plugin_data()` from `wp-admin/includes/plugin.php` to `wp-includes/functions.php` so it's available during the plugin loading process.

Related functions like `is_plugin_active()` are often used together and should therefore be moved as well, to improve backward compatibility for plugins which load `wp-admin/includes/plugin.php` only conditionally.

Props johnbillion, dd32, swissspidy.
See #62244.
Built from https://develop.svn.wordpress.org/trunk@59479


git-svn-id: http://core.svn.wordpress.org/trunk@58865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-12-02 17:10:15 +00:00
Sergey Biryukov
dd967e2a2e Coding Standards: Cast gmdate( 'w' ) to int before using as integer.
This addresses several instances of `gmdate( 'w' )` being used directly as an integer, when it's actually a numeric string. The issue is remediated by casting the value to `int` before use.

Affected functions:
* `get_calendar()`
* `get_weekstartend()`

Follow-up to [508], [1632].

Props justlevine.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@59471


git-svn-id: http://core.svn.wordpress.org/trunk@58857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-11-28 22:52:17 +00:00
Pascal Birchler
117b935b89 I18N: Load translations just-in-time for custom themes and plugins.
In #34114, just-in-time (JIT) translation loading was implemented for projects hosted on WordPress.org. This is now expanded to all other plugins/themes.

Projects with a custom `Text Domain` and `Domain Path` header no longer need to call `load_plugin_textdomain()` or `load_theme_textdomain()`.

This reduces the risk of calling them too late, after some translation calls already happened, and generally makes it easier to properly internationalize a plugin or theme.

This moves the `get_plugin_data()` from `wp-admin/includes/plugin.php` to `wp-includes/functions.php` so it's available during the plugin loading process.

Props swissspidy.
Fixes #62244.
Built from https://develop.svn.wordpress.org/trunk@59461


git-svn-id: http://core.svn.wordpress.org/trunk@58847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-11-26 10:16:17 +00:00
ramonopoly
3712752f76 Mime Types: support uploading wav files in Firefox
When uploading `wav` files in the editor, Chrome and other browsers identify the mime type of the file as `audio/wav`. Firefox, however, identifies the mime type as `audio/x-wav`.

This commit updates the `'wav'` mime type key in `wp_get_mime_types()` to support `x-wav` so that uploading wav files work in Firefox. Previously, the editor reported an unsupported mime type error.

Props imranh920, ramonopoly.
Fixes #61948.



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


git-svn-id: http://core.svn.wordpress.org/trunk@58775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-11-12 00:53:18 +00:00
Andrew Ozz
a739bf28a1 Media: Fix variable name in wp_check_filetype_and_ext().
Props peterwilsoncc.
See #62272.
Built from https://develop.svn.wordpress.org/trunk@59358


git-svn-id: http://core.svn.wordpress.org/trunk@58744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-11-06 00:39:18 +00:00
Andrew Ozz
152661c1e7 Media: Fix uploading of .heic images.
- Adds support for all HEIC/HEIF mime types: `image/heic`, `image/heif`, `image/heic-sequence`, and `image/heif-sequence`.
- Introduces `wp_is_heic_image_mime_type()`.

Props swissspidy, adamsilverstein, debarghyabanerjee, ironprogrammer, peterwilsoncc, apermo, azaozz.
Fixes #62272.
Built from https://develop.svn.wordpress.org/trunk@59315


git-svn-id: http://core.svn.wordpress.org/trunk@58701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-29 01:12:17 +00:00