General: Replace older-style PHP type conversion functions with type casts.

This improves performance, readability, and consistency throughout core.

* `intval()` → `(int)`
* `strval()` → `(string)`
* `floatval()` → `(float)`

Props ayeshrajans.
Fixes #42918.
Built from https://develop.svn.wordpress.org/trunk@49108


git-svn-id: http://core.svn.wordpress.org/trunk@48870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2020-10-08 21:15:13 +00:00
parent f25804699f
commit 897f004a9c
79 changed files with 273 additions and 274 deletions

View File

@@ -46,7 +46,7 @@ $request_array = 'HTTP_POST_VARS';
if ( ! isset( $_GET['tb_id'] ) || ! $_GET['tb_id'] ) {
$tb_id = explode( '/', $_SERVER['REQUEST_URI'] );
$tb_id = intval( $tb_id[ count( $tb_id ) - 1 ] );
$tb_id = (int) $tb_id[ count( $tb_id ) - 1 ];
}
$tb_url = isset( $_POST['url'] ) ? $_POST['url'] : '';
@@ -84,7 +84,7 @@ if ( is_single() || is_page() ) {
$tb_id = $posts[0]->ID;
}
if ( ! isset( $tb_id ) || ! intval( $tb_id ) ) {
if ( ! isset( $tb_id ) || ! (int) $tb_id ) {
trackback_response( 1, __( 'I really need an ID for this to work.' ) );
}