Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: deprecation warnings & github runners node/php versions #636

Merged
merged 4 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/pink-points-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@headstartwp/headstartwp": patch
---

Fix PHP 8.2 deprecation warnings
2 changes: 1 addition & 1 deletion .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.2'
- name: composer install
run: cd ./wp/headless-wp && composer install --ignore-platform-reqs
- name: Check PHPCS standard
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ jobs:
phpunit:
name: phpunit
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.4', '8.0', '8.2']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: "8.0"
php-version: ${{ matrix.php-version }}
- name: npm install
run: npm install
- name: composer install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [16.x, 18.x, 20.x]

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
6 changes: 3 additions & 3 deletions wp/headless-wp/includes/classes/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function modify_rest_params( $args, $request ) {
return $args;
}

$author = filter_input( INPUT_GET, 'author', FILTER_SANITIZE_STRING );
$author = htmlspecialchars( filter_input( INPUT_GET, 'author' ) );

if ( ! empty( $author ) && ! is_numeric( $author ) ) {
unset( $args['author__in'] );
Expand All @@ -108,10 +108,10 @@ public function modify_rest_params( $args, $request ) {
$taxonomies = wp_list_filter( get_object_taxonomies( $args['post_type'], 'objects' ), [ 'show_in_rest' => true ] );

foreach ( $taxonomies as $taxonomy ) {
$term = filter_input( INPUT_GET, $taxonomy->name, FILTER_SANITIZE_STRING );
$term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->name ) );

if ( ! $term ) {
$term = filter_input( INPUT_GET, $taxonomy->rest_base, FILTER_SANITIZE_STRING );
$term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->rest_base ) );
}

if ( ! empty( $term ) && ! is_numeric( $term ) ) {
Expand Down
3 changes: 1 addition & 2 deletions wp/headless-wp/includes/classes/Integrations/Gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public function register() {
add_filter( 'render_block', [ $this, 'render_block' ], 10, 3 );
}


/**
* Process the block with the WP_HTML_Tag_Processor
*
Expand Down Expand Up @@ -75,7 +74,7 @@ public function process_block_with_dom_document_api( $html, $block_name, $block_
try {
libxml_use_internal_errors( true );
$doc = new DomDocument( '1.0', 'UTF-8' );
$doc->loadHTML( mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' ), LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED );
$doc->loadHTML( htmlspecialchars_decode( htmlentities( $html ) ), LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED );

$root_node = $doc->documentElement; // phpcs:ignore

Expand Down
Loading