PHP7.3 compatibility: Fix compact throwing notices.

In PHP 7.3, the `compact()` function has been changed to issue an `E_NOTICE` level error if a passed string refers to an unset variable. In previous versions of PHP, this notice was silently skipped. The full RFC can be viewed here: https://wiki.php.net/rfc/compact.

Props jorbin, desrosj.

Merges [43819] and [43832] to trunk.

Fixes #44416.

git-svn-id: https://develop.svn.wordpress.org/trunk@44166 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers
2018-12-14 05:12:12 +00:00
parent 3011f8c8e7
commit 89d76b9884
8 changed files with 75 additions and 50 deletions
@@ -867,6 +867,7 @@ class Tests_Dependencies_Scripts extends WP_UnitTestCase {
* @covers ::wp_enqueue_code_editor()
*/
public function test_wp_enqueue_code_editor_when_generated_array_by_compact_will_be_passed() {
$file = '';
$wp_enqueue_code_editor = wp_enqueue_code_editor( compact( 'file' ) );
$this->assertNonEmptyMultidimensionalArray( $wp_enqueue_code_editor );