Ergebnis 1 bis 6 von 6

Thema: Attempted to call an undefined method named "parseFile"

  1. #1
    Contao-Fan Avatar von Grossvater
    Registriert seit
    20.02.2013.
    Beiträge
    509

    Standard Attempted to call an undefined method named "parseFile"

    Hallo liebe Community,
    ich habe ein Contao 4.4.20 mit php 7.1.8

    Seitdem ich das Contao von einem Arbeitsplatz auf einen anderen Umgezogen habe erhalte ich einen Fehler beim einloggen im Backend:
    Internal Server Error
    Was ist das Problem?
    Attempted to call an undefined method named "parseFile" of class "Symfony\Component\Yaml\Parser".

    Was läuft hier schief?

    Sieht so aus als ob ihm hier eine Klasse fehlt?

    Der Error.log sagt:
    Code:
    [2018-07-25 18:40:41] request.INFO: Matched route "contao_backend". {"route":"contao_backend","route_parameters":{"_scope":"backend","_token_check":true,"_controller":"Contao\\CoreBundle\\Controller\\BackendController::mainAction","_route":"contao_backend"},"request_uri":"http://buschner.local:8888/contao","method":"HEAD"} []
    [2018-07-25 18:40:41] security.INFO: Attempting SimplePreAuthentication. {"key":"backend","authenticator":"Contao\\CoreBundle\\Security\\ContaoAuthenticator"} []
    [2018-07-25 18:40:41] request.INFO: Matched route "contao_backend". {"route":"contao_backend","route_parameters":{"_scope":"backend","_token_check":true,"_controller":"Contao\\CoreBundle\\Controller\\BackendController::mainAction","_route":"contao_backend"},"request_uri":"http://buschner.local:8888/contao","method":"GET"} []
    [2018-07-25 18:40:41] security.INFO: Attempting SimplePreAuthentication. {"key":"backend","authenticator":"Contao\\CoreBundle\\Security\\ContaoAuthenticator"} []
    [2018-07-25 18:40:41] app.CRITICAL: An exception occurred. {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\UndefinedMethodException(code: 0): Attempted to call an undefined method named \"parseFile\" of class \"Symfony\\Component\\Yaml\\Parser\". at /Applications/MAMP/htdocs/buschner/vendor/symfony/symfony/src/Symfony/Component/Translation/Loader/YamlFileLoader.php:48)"} []
    Update:
    Wenn ich in der Datei: /Applications/MAMP/htdocs/buschner/vendor/symfony/symfony/src/Symfony/Component/Translation/Loader/YamlFileLoader.php die besagte Zeile 48 auskommentiere, dann funktioniert alles wieder.
    HTML-Code:
    <?php
    
    /*
     * This file is part of the Symfony package.
     *
     * (c) Fabien Potencier <fabien@symfony.com>
     *
     * For the full copyright and license information, please view the LICENSE
     * file that was distributed with this source code.
     */
    
    namespace Symfony\Component\Translation\Loader;
    
    use Symfony\Component\Translation\Exception\InvalidResourceException;
    use Symfony\Component\Translation\Exception\LogicException;
    use Symfony\Component\Yaml\Parser as YamlParser;
    use Symfony\Component\Yaml\Exception\ParseException;
    
    /**
     * YamlFileLoader loads translations from Yaml files.
     *
     * @author Fabien Potencier <fabien@symfony.com>
     */
    class YamlFileLoader extends FileLoader
    {
        private $yamlParser;
    
        /**
         * {@inheritdoc}
         */
        protected function loadResource($resource)
        {
            if (null === $this->yamlParser) {
                if (!class_exists('Symfony\Component\Yaml\Parser')) {
                    throw new LogicException('Loading translations from the YAML format requires the Symfony Yaml component.');
                }
    
                $this->yamlParser = new YamlParser();
            }
    
            $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($resource, &$prevErrorHandler) {
                $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$resource.'"$0', $message) : $message;
    
                return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false;
            });
    
            try {
                #$messages = $this->yamlParser->parseFile($resource); <!---------------- hier
            } catch (ParseException $e) {
                throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e);
            } finally {
                restore_error_handler();
            }
    
            return $messages;
        }
    }
    Geändert von Grossvater (25.07.2018 um 19:13 Uhr)

  2. #2
    Contao-Urgestein
    Registriert seit
    29.10.2009.
    Ort
    Magdeburg
    Beiträge
    2.020
    Partner-ID
    626
    User beschenken
    Wunschliste

    Standard

    Der Fehler hatten Kunden bei mir auch schon gehabt, nur konnte ich diesen bisher nie reproduzieren.

    Wenn ich es richtig sehe, verwendet der Symfony\Component\Translation\Loader\YamlFileLoade r die Method parseFile des Yaml-Parsers. Diese wurde allerdings erst in Version 3.4 eingeführt.

    Wie es möglich ist, dass unterschiedliche Versionen von symfony/translation und symfony/yaml installiert sind - da sie eigentlich mit symfony/symfony ausgeliefert werden, kann ich mir derzeit nicht erklären.

    Kannst du mal die Ausgabe von composer show hier posten?

    Code:
    # Im Hauptverzeichnis des Projekts, vorausgesetzt der contao-manager ist installiert
    /pfad/zu/php web/contao-manager.php composer show
    Desweiteren würde mich interessieren, woher die Klasse symfony/yaml geladen wird. Könntest du daher mal an der Stelle, die du auskommentiert hast, folgendes einfügen und den Pfad posten:

    PHP-Code:
    $reflector = new \ReflectionClass('Symfony\Component\Yaml\Parser');
    echo 
    $reflector->getFileName();
    die(); 

  3. #3
    Contao-Fan Avatar von Grossvater
    Registriert seit
    20.02.2013.
    Beiträge
    509

    Standard

    Danke für die Antwort

    Code:
    php composer.phar show
    clue/stream-filter                        v1.4.0    A simple and modern app...
    codefog/contao-haste                      4.20.1    haste extension for Con...
    composer/ca-bundle                        1.1.1     Lets you find a path to...
    contao-community-alliance/composer-plugin 3.0.8     Composer plugin that pr...
    contao-components/ace                     1.2.9     ACE code editor integra...
    contao-components/chosen                  1.1.10    Chosen integration for ...
    contao-components/colorbox                1.6.4     Colorbox integration fo...
    contao-components/colorpicker             1.4.0.2   Color picker integratio...
    contao-components/compass                 0.12.2.1  Compass integration for...
    contao-components/contao                  7.1.5     Contao Open Source CMS ...
    contao-components/datepicker              2.2.0.4   Date picker integration...
    contao-components/dropzone                4.3.0     DropZone integration fo...
    contao-components/highlight               8.9.1     Highlight.js integratio...
    contao-components/html5shiv               3.7.3     HTML5 Shiv integration ...
    contao-components/installer               1.2.7     Contao components insta...
    contao-components/jquery                  1.12.4    jQuery integration for ...
    contao-components/jquery-ui               1.12.1.1  jQuery UI integration f...
    contao-components/mediabox                1.5.4.2   Mediabox integration fo...
    contao-components/mediaelement            4.2.7     MediaElement.js integra...
    contao-components/mootools                1.6.0.5   MooTools integration fo...
    contao-components/respimage               1.4.2     Respimage.js integratio...
    contao-components/simplemodal             2.0.8     SimpleModal integration...
    contao-components/swipe                   2.0.6.2   A JavaScript touch slid...
    contao-components/tablesort               3.4.10    Contao Open Source CMS ...
    contao-components/tablesorter             2.0.5.6   jQuery tablesorter inte...
    contao-components/tinymce4                4.6.7.2   TinyMCE 4 integration f...
    contao/calendar-bundle                    4.4.20    Adds calendar functiona...
    contao/comments-bundle                    4.4.20    Adds comments functiona...
    contao/core-bundle                        4.4.20    Contao 4 core bundle
    contao/faq-bundle                         4.4.20    Adds FAQ functionality ...
    contao/image                              0.3.7     Contao image library
    contao/imagine-svg                        0.2.1     Contao Imagine SVG library
    contao/installation-bundle                4.4.20    Required to install and...
    contao/listing-bundle                     4.4.20    Allows to list arbitrar...
    contao/manager-bundle                     4.4.20    Contao 4 manager bundle
    contao/manager-plugin                     2.3.1     Contao 4 manager plugin
    contao/news-bundle                        4.4.20    Adds news functionality...
    contao/newsletter-bundle                  4.4.20    Adds newsletter functio...
    derhaeuptling/contao-lazy-images          3.0.3     Lazy Images delays load...
    doctrine/annotations                      v1.6.0    Docblock Annotations Pa...
    doctrine/cache                            v1.7.1    Caching library offerin...
    doctrine/collections                      v1.5.0    Collections Abstraction...
    doctrine/common                           v2.8.1    Common Library for Doct...
    doctrine/dbal                             v2.7.1    Database Abstraction Layer
    doctrine/doctrine-bundle                  1.9.1     Symfony DoctrineBundle
    doctrine/doctrine-cache-bundle            1.3.3     Symfony Bundle for Doct...
    doctrine/inflector                        v1.3.0    Common String Manipulat...
    doctrine/lexer                            v1.0.1    Base library for a lexe...
    fig/link-util                             1.0.0     Common utility implemen...
    friendsofsymfony/http-cache               2.3.0     Tools to manage HTTP ca...
    friendsofsymfony/http-cache-bundle        2.4.0     Set path based HTTP cac...
    guzzlehttp/guzzle                         6.3.3     Guzzle is a PHP HTTP cl...
    guzzlehttp/promises                       v1.3.1    Guzzle promises library
    guzzlehttp/psr7                           1.4.2     PSR-7 message implement...
    imagine/imagine                           v0.7.1    Image processing for PH...
    isotope/isotope-core                      2.5.1     Isotope is the premier ...
    jdorn/sql-formatter                       v1.2.17   a PHP SQL highlighting ...
    jeremykendall/php-domain-parser           3.0.0     Public Suffix List base...
    knplabs/knp-menu                          2.3.0     An object oriented menu...
    knplabs/knp-menu-bundle                   v2.2.1    This bundle provides an...
    knplabs/knp-time-bundle                   1.8.0     Knplabs time bundle mak...
    leafo/scssphp                             v0.6.7    scssphp is a compiler f...
    league/uri                                4.2.2     URI manipulation library
    lexik/maintenance-bundle                  v2.1.5    This bundle allows you ...
    matthiasmullie/minify                     1.3.60    CSS & JavaScript minifi...
    matthiasmullie/path-converter             1.1.1     Relative path converter
    menatwork/contao-multicolumnwizard        3.3.16    MultiColumWizard for Co...
    michelf/php-markdown                      1.8.0     PHP Markdown
    monolog/monolog                           1.23.0    Sends your logs to file...
    nelmio/cors-bundle                        1.5.4     Adds CORS (Cross-Origin...
    nelmio/security-bundle                    2.5.1     Extra security-related ...
    oyejorge/less.php                         v1.7.0.14 PHP port of the Javascr...
    paragonie/random_compat                   v2.0.15   PHP 5.x polyfill for ra...
    patchwork/utf8                            v1.3.1    Portable and performant...
    php-http/client-common                    1.7.0     Common HTTP Client impl...
    php-http/discovery                        1.4.0     Finds installed HTTPlug...
    php-http/guzzle6-adapter                  v1.1.1    Guzzle 6 HTTP Adapter
    php-http/httplug                          v1.1.0    HTTPlug, the HTTP clien...
    php-http/message                          1.6.0     HTTP Message related tools
    php-http/message-factory                  v1.0.2    Factory interfaces for ...
    php-http/promise                          v1.0.0    Promise used for asynch...
    phpspec/php-diff                          v1.1.0    A comprehensive library...
    phpunit/php-token-stream                  1.4.12    Wrapper around PHP's to...
    psr/cache                                 1.0.1     Common interface for ca...
    psr/container                             1.0.0     Common Container Interf...
    psr/http-message                          1.0.1     Common interface for HT...
    psr/link                                  1.0.0     Common interfaces for H...
    psr/log                                   1.0.2     Common interface for lo...
    psr/simple-cache                          1.0.1     Common interfaces for s...
    sensio/distribution-bundle                v5.0.22   Base bundle for Symfony...
    sensio/framework-extra-bundle             v3.0.29   This bundle provides a ...
    sensiolabs/ansi-to-html                   v1.1.3    A library to convert a ...
    sensiolabs/security-checker               v4.1.8    A security checker for ...
    simplepie/simplepie                       1.5.1     A simple Atom/RSS parsi...
    swiftmailer/swiftmailer                   v5.4.9    Swiftmailer, free featu...
    symfony/monolog-bundle                    v3.3.0    Symfony MonologBundle
    symfony/polyfill-apcu                     v1.8.0    Symfony polyfill backpo...
    symfony/polyfill-ctype                    v1.8.0    Symfony polyfill for ct...
    symfony/polyfill-intl-icu                 v1.8.0    Symfony polyfill for in...
    symfony/polyfill-mbstring                 v1.8.0    Symfony polyfill for th...
    symfony/polyfill-php56                    v1.8.0    Symfony polyfill backpo...
    symfony/polyfill-php70                    v1.8.0    Symfony polyfill backpo...
    symfony/polyfill-util                     v1.8.0    Symfony utilities for p...
    symfony/swiftmailer-bundle                v2.6.7    Symfony SwiftmailerBundle
    symfony/symfony                           v3.4.12   The Symfony PHP framework
    tecnickcom/tcpdf                          6.2.17    TCPDF is a PHP class fo...
    terminal42/contao-conditionalselectmenu   3.0.4     conditional select menu...
    terminal42/contao-tablelookupwizard       3.3.0     Contao widget to select...
    terminal42/dc_multilingual                2.1.7     DC_Multilingual extensi...
    terminal42/dcawizard                      2.4.4     dcaWizard extension for...
    terminal42/header-replay-bundle           1.5.0     Send preflight requests...
    terminal42/notification_center            1.4.5     Notification Center ext...
    true/punycode                             v2.1.1    A Bootstring encoding o...
    twig/twig                                 v1.35.3   Twig, the flexible, fas...
    ua-parser/uap-php                         v3.5.0    A multi-language port o...
    webmozart/assert                          1.3.0     Assertions to validate ...
    webmozart/path-util                       2.3.0     A robust cross-platform...
    Den php code habe ich an der erwähnten Stelle eingefügt.
    Ich erhalte:
    Code:
    /Applications/MAMP/htdocs/buschner/vendor/symfony/symfony/src/Symfony/Component/Yaml/Parser.php

  4. #4
    Contao-Urgestein
    Registriert seit
    29.10.2009.
    Ort
    Magdeburg
    Beiträge
    2.020
    Partner-ID
    626
    User beschenken
    Wunschliste

    Standard

    Zitat Zitat von Grossvater Beitrag anzeigen
    Danke für die Antwort

    Den php code habe ich an der erwähnten Stelle eingefügt.
    Ich erhalte:
    Code:
    /Applications/MAMP/htdocs/buschner/vendor/symfony/symfony/src/Symfony/Component/Yaml/Parser.php
    Danke. Leider tappe ich hier immer noch im dunkeln. Wollte ausschließen, dass irgendein Drittplugin hier einen anderen Parser lädt.

    Eine weitere Idee habe ich noch. Du scheinst composer direkt zu verwenden. Welche Version hast du installiert von Composer? php composer.phar -v sollte dir Auskunft geben.

    Hintergrund: Composer bringt selber einige Abhängigkeiten mit. Über die Composer Scripts, werden Hooks bei der Installation ausgeführt. Meine Vermutung ist, da hier Composer selbst einige Symfony-Komponenten mitbringt, es zu Konflikten kommt, wenn spezielle Klassen geladen werden.

  5. #5
    Contao-Fan Avatar von Grossvater
    Registriert seit
    20.02.2013.
    Beiträge
    509

    Standard

    Hier die Ausgabe:
    Code:
    php composer.phar -v
       ______
      / ____/___  ____ ___  ____  ____  ________  _____
     / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
    / /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
    \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                        /_/
    Composer version 1.6.5 2018-05-04 11:44:59
    
    Usage:
      command [options] [arguments]
    
    Options:
      -h, --help                     Display this help message
      -q, --quiet                    Do not output any message
      -V, --version                  Display this application version
          --ansi                     Force ANSI output
          --no-ansi                  Disable ANSI output
      -n, --no-interaction           Do not ask any interactive question
          --profile                  Display timing and memory usage information
          --no-plugins               Whether to disable plugins.
      -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
      -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
    
    Available commands:
      about                Shows the short information about Composer.
      archive              Creates an archive of this composer package.
      browse               Opens the package's repository URL or homepage in your browser.
      check-platform-reqs  Check that platform requirements are satisfied.
      clear-cache          Clears composer's internal package cache.
      clearcache           Clears composer's internal package cache.
      config               Sets config options.
      create-project       Creates new project from a package into given directory.
      depends              Shows which packages cause the given package to be installed.
      diagnose             Diagnoses the system to identify common errors.
      dump-autoload        Dumps the autoloader.
      dumpautoload         Dumps the autoloader.
      exec                 Executes a vendored binary/script.
      global               Allows running commands in the global composer dir ($COMPOSER_HOME).
      help                 Displays help for a command
      home                 Opens the package's repository URL or homepage in your browser.
      info                 Shows information about packages.
      init                 Creates a basic composer.json file in current directory.
      install              Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
      licenses             Shows information about licenses of dependencies.
      list                 Lists commands
      outdated             Shows a list of installed packages that have updates available, including their latest version.
      prohibits            Shows which packages prevent the given package from being installed.
      remove               Removes a package from the require or require-dev.
      require              Adds required packages to your composer.json and installs them.
      run-script           Runs the scripts defined in composer.json.
      search               Searches for packages.
      self-update          Updates composer.phar to the latest version.
      selfupdate           Updates composer.phar to the latest version.
      show                 Shows information about packages.
      status               Shows a list of locally modified packages, for packages installed from source.
      suggests             Shows package suggestions.
      update               Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
      upgrade              Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
      validate             Validates a composer.json and composer.lock.
      why                  Shows which packages cause the given package to be installed.
      why-not              Shows which packages prevent the given package from being installed.
    UPDATE:
    https://github.com/contao/core-bundle/issues/1650
    Geändert von Grossvater (24.08.2018 um 07:40 Uhr)

  6. #6
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.116
    Partner-ID
    10107

    Standard

    Das Problem wird von der Extension ctscto35 bzw. ctscore verursacht: https://github.com/contao/core-bundl...ment-418251466

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •