WordPress.org

Make WordPress Core

Ticket #37082: 0002-Remove-unnecessary-use-of-create_function-in-PO-read.patch

File 0002-Remove-unnecessary-use-of-create_function-in-PO-read.patch, 655 bytes (added by sgolemon, 3 years ago)

0002-Remove-unnecessary-use-of-create_function-in-PO-read.patch

  • wp-includes/pomo/po.php

    diff --git wp-includes/pomo/po.php wp-includes/pomo/po.php
    index 6f06148..f9b1623 100644
    class PO extends Gettext_Translations { 
    391391                                return false;
    392392                        }
    393393                }
    394                 if (array() == array_filter($entry->translations, create_function('$t', 'return $t || "0" === $t;'))) {
     394
     395                $have_translations = false;
     396                foreach ( $entry->translations as $t ) {
     397                        if ( $t || ('0' === $t) ) {
     398                                $have_translations = true;
     399                                break;
     400                        }
     401                }
     402                if ( false === $have_translations ) {
    395403                        $entry->translations = array();
    396404                }
     405
    397406                return array('entry' => $entry, 'lineno' => $lineno);
    398407        }
    399408