[wp-trac] [WordPress Trac] #50573: Random PHP test failures, take 3
WordPress Trac
noreply at wordpress.org
Mon Jul 6 16:12:46 UTC 2020
#50573: Random PHP test failures, take 3
----------------------------+---------------------
Reporter: SergeyBiryukov | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.5
Component: Media | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
----------------------------+---------------------
Description changed by SergeyBiryukov:
Old description:
> Background: #48145, #50466.
>
> After [48329], there are [https://travis-ci.com/github/WordPress
> /wordpress-develop/jobs/357730740 test failures on Travis] that appear to
> be unrelated to the commit:
> {{{
> There was 1 error:
>
> 1) Tests_Image_Functions::test_pdf_preview_doesnt_overwrite_existing_jpeg
> Undefined index: sizes
>
> /var/www/tests/phpunit/tests/image/functions.php:620
>
> --
>
> There were 3 failures:
> 1) Tests_Image_Functions::test_wp_generate_attachment_metadata_pdf
> Failed asserting that two arrays are identical.
> --- Expected
> +++ Actual
> @@ @@
> -Array &0 (
> - 'sizes' => Array &1 (
> - 'full' => Array &2 (
> - 'file' => 'wordpress-gsoc-flyer-pdf.jpg'
> - 'width' => 1088
> - 'height' => 1408
> - 'mime-type' => 'image/jpeg'
> - )
> - 'medium' => Array &3 (
> - 'file' => 'wordpress-gsoc-flyer-pdf-232x300.jpg'
> - 'width' => 232
> - 'height' => 300
> - 'mime-type' => 'image/jpeg'
> - )
> - 'large' => Array &4 (
> - 'file' => 'wordpress-gsoc-flyer-pdf-791x1024.jpg'
> - 'width' => 791
> - 'height' => 1024
> - 'mime-type' => 'image/jpeg'
> - )
> - 'thumbnail' => Array &5 (
> - 'file' => 'wordpress-gsoc-flyer-pdf-116x150.jpg'
> - 'width' => 116
> - 'height' => 150
> - 'mime-type' => 'image/jpeg'
> - )
> - )
> -)
> +Array &0 ()
>
> /var/www/tests/phpunit/tests/image/functions.php:466
>
> 2) Tests_Image_Functions::test_crop_setting_for_pdf
> Failed asserting that two arrays are identical.
> --- Expected
> +++ Actual
> @@ @@
> -Array &0 (
> - 'sizes' => Array &1 (
> - 'full' => Array &2 (
> - 'file' => 'wordpress-gsoc-flyer-pdf.jpg'
> - 'width' => 1088
> - 'height' => 1408
> - 'mime-type' => 'image/jpeg'
> - )
> - 'medium' => Array &3 (
> - 'file' => 'wordpress-gsoc-flyer-pdf-300x300.jpg'
> - 'width' => 300
> - 'height' => 300
> - 'mime-type' => 'image/jpeg'
> - )
> - 'large' => Array &4 (
> - 'file' => 'wordpress-gsoc-flyer-pdf-791x1024.jpg'
> - 'width' => 791
> - 'height' => 1024
> - 'mime-type' => 'image/jpeg'
> - )
> - 'thumbnail' => Array &5 (
> - 'file' => 'wordpress-gsoc-flyer-pdf-116x150.jpg'
> - 'width' => 116
> - 'height' => 150
> - 'mime-type' => 'image/jpeg'
> - )
> - )
> -)
> +Array &0 ()
>
> /var/www/tests/phpunit/tests/image/functions.php:531
>
> 3) Tests_Image_Functions::test_fallback_intermediate_image_sizes
> The `test-size` was not added to the metadata.
> Failed asserting that false is true.
>
> /var/www/tests/phpunit/tests/image/functions.php:572
>
> }}}
>
> This appears to be caused by `wp_generate_attachment_metadata()` failing
> to generate the metadata for PDF files, due to `wp_get_image_editor()`
> returning a `WP_Error` object:
> {{{
> ["errors"]=>
> array(1) {
> ["invalid_image"]=>
> array(1) {
> [0]=>
> string(115) "attempt to perform an operation not allowed by the
> security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408"
> }
> }
> ["error_data"]=>
> array(1) {
> ["invalid_image"]=>
> string(29) "/tmp/wordpress-gsoc-flyer.pdf"
> }
> }
> }}}
>
> It's not quite clear why this suddenly started failing now, I guess
> something has changed in the environment recently.
>
> Props @enrico.sorcinelly for helping with debugging here.
New description:
Background: #48145, #50466.
After [48329], there are [https://travis-ci.com/github/WordPress
/wordpress-develop/jobs/357730740 test failures on Travis] that appear to
be unrelated to the commit:
{{{
There was 1 error:
1) Tests_Image_Functions::test_pdf_preview_doesnt_overwrite_existing_jpeg
Undefined index: sizes
/var/www/tests/phpunit/tests/image/functions.php:620
--
There were 3 failures:
1) Tests_Image_Functions::test_wp_generate_attachment_metadata_pdf
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
-Array &0 (
- 'sizes' => Array &1 (
- 'full' => Array &2 (
- 'file' => 'wordpress-gsoc-flyer-pdf.jpg'
- 'width' => 1088
- 'height' => 1408
- 'mime-type' => 'image/jpeg'
- )
- 'medium' => Array &3 (
- 'file' => 'wordpress-gsoc-flyer-pdf-232x300.jpg'
- 'width' => 232
- 'height' => 300
- 'mime-type' => 'image/jpeg'
- )
- 'large' => Array &4 (
- 'file' => 'wordpress-gsoc-flyer-pdf-791x1024.jpg'
- 'width' => 791
- 'height' => 1024
- 'mime-type' => 'image/jpeg'
- )
- 'thumbnail' => Array &5 (
- 'file' => 'wordpress-gsoc-flyer-pdf-116x150.jpg'
- 'width' => 116
- 'height' => 150
- 'mime-type' => 'image/jpeg'
- )
- )
-)
+Array &0 ()
/var/www/tests/phpunit/tests/image/functions.php:466
2) Tests_Image_Functions::test_crop_setting_for_pdf
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
-Array &0 (
- 'sizes' => Array &1 (
- 'full' => Array &2 (
- 'file' => 'wordpress-gsoc-flyer-pdf.jpg'
- 'width' => 1088
- 'height' => 1408
- 'mime-type' => 'image/jpeg'
- )
- 'medium' => Array &3 (
- 'file' => 'wordpress-gsoc-flyer-pdf-300x300.jpg'
- 'width' => 300
- 'height' => 300
- 'mime-type' => 'image/jpeg'
- )
- 'large' => Array &4 (
- 'file' => 'wordpress-gsoc-flyer-pdf-791x1024.jpg'
- 'width' => 791
- 'height' => 1024
- 'mime-type' => 'image/jpeg'
- )
- 'thumbnail' => Array &5 (
- 'file' => 'wordpress-gsoc-flyer-pdf-116x150.jpg'
- 'width' => 116
- 'height' => 150
- 'mime-type' => 'image/jpeg'
- )
- )
-)
+Array &0 ()
/var/www/tests/phpunit/tests/image/functions.php:531
3) Tests_Image_Functions::test_fallback_intermediate_image_sizes
The `test-size` was not added to the metadata.
Failed asserting that false is true.
/var/www/tests/phpunit/tests/image/functions.php:572
}}}
This appears to be caused by `wp_generate_attachment_metadata()` failing
to generate the metadata for PDF files, due to `wp_get_image_editor()`
returning a `WP_Error` object:
{{{
["errors"]=>
array(1) {
["invalid_image"]=>
array(1) {
[0]=>
string(115) "attempt to perform an operation not allowed by the
security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408"
}
}
["error_data"]=>
array(1) {
["invalid_image"]=>
string(29) "/tmp/wordpress-gsoc-flyer.pdf"
}
}
}}}
It's not quite clear why this suddenly started failing now, I guess
something has changed in the environment recently.
Props @enrico.sorcinelli for helping with debugging here.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50573#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list