Make WordPress Core

Ticket #48074: 48074-tests-Remove-work-arounds-for-str_getcsv.patch

File 48074-tests-Remove-work-arounds-for-str_getcsv.patch, 1.1 KB (added by jrf, 5 years ago)

The str_getcsv() function was introduced in PHP 5.3.0, so no longer needs a polyfill. See: https://www.php.net/manual/en/function.str-getcsv.php

  • tests/phpunit/includes/utils.php

    From cf4150f1a96f125204326ad46a3da202c792ecc9 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Sat, 27 Jul 2019 04:34:09 +0200
    Subject: [PATCH] [tests] Remove work-arounds for str_getcsv()
    
    ---
     tests/phpunit/includes/utils.php | 11 -----------
     1 file changed, 11 deletions(-)
    
    diff --git a/tests/phpunit/includes/utils.php b/tests/phpunit/includes/utils.php
    index 9a03250f6a..8fa1acd9aa 100644
    a b function mask_input_value( $in, $name = '_wpnonce' ) { 
    372372        return preg_replace( '@<input([^>]*) name="' . preg_quote( $name ) . '"([^>]*) value="[^>]*" />@', '<input$1 name="' . preg_quote( $name ) . '"$2 value="***" />', $in );
    373373}
    374374
    375 if ( ! function_exists( 'str_getcsv' ) ) {
    376         function str_getcsv( $input, $delimiter = ',', $enclosure = '"', $escape = '\\' ) {
    377                 $fp = fopen( 'php://temp/', 'r+' );
    378                 fputs( $fp, $input );
    379                 rewind( $fp );
    380                 $data = fgetcsv( $fp, strlen( $input ), $delimiter, $enclosure );
    381                 fclose( $fp );
    382                 return $data;
    383         }
    384 }
    385 
    386375/**
    387376 * Removes the post type and its taxonomy associations.
    388377 */