[Bug 823065] Review Request: php-symfony2-Translation - Symfony2 Translation Component

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=823065

--- Comment #4 from Shawn Iwinski <shawn.iwinski@xxxxxxxxx> ---
Issue: XSD files installed as doc, but referenced by code.

-- XSD files --
*
Symfony/Component/Translation/Loader/schema/dic/xliff-core/xliff-core-1.2-strict.xsd
* Symfony/Component/Translation/Loader/schema/dic/xliff-core/xml.xsd

-- Code (from Translation/Loader/XliffFileLoader.php) --
    private function parseFile($file)
    {
         $dom = new \DOMDocument();
        $current = libxml_use_internal_errors(true);
        if (!@$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT :
0)) {
            throw new \RuntimeException(implode("\n", $this->getXmlErrors()));
        }

    $location = str_replace('\\', '/',
__DIR__).'/schema/dic/xliff-core/xml.xsd';
           $parts = explode('/', $location);
        if (0 === stripos($location, 'phar://')) {
            $tmpfile = tempnam(sys_get_temp_dir(), 'sf2');
            if ($tmpfile) {
                   copy($location, $tmpfile);
                   $parts = explode('/', str_replace('\\', '/', $tmpfile));
            }
        }
         $drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
        $location = 'file:///'.$drive.implode('/', array_map('rawurlencode',
$parts));

        $source =
file_get_contents(__DIR__.'/schema/dic/xliff-core/xliff-core-1.2-strict.xsd');
    $source = str_replace('http://www.w3.org/2001/xml.xsd', $location,
$source);

        if (!@$dom->schemaValidateSource($source)) {
            throw new \RuntimeException(implode("\n", $this->getXmlErrors()));
        }
        $dom->validateOnParse = true;
        $dom->normalizeDocument();
    libxml_use_internal_errors($current);

        return simplexml_import_dom($dom);
    }



See original finding of this issue at
https://bugzilla.redhat.com/show_bug.cgi?id=823046#c8

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
package-review mailing list
package-review@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/package-review



[Index of Archives]     [Fedora Legacy]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]