Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-69568

PHP fatal error: Object of class action_link could not be converted to string

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 3.9.1
    • Fix Version/s: None
    • Component/s: Caching
    • Labels:
      None
    • Affected Branches:
      MOODLE_39_STABLE

      Description

      Certain pages (I cannot figure out what the actual reason is) show the following error:

      Fatal error:  Uncaught coding_exception: Fehler in der Kodierung 
      gefunden, den nur ein Programmierer korrigieren kann: PHP catchable 
      fatal error (Object of class action_link could not be converted to 
      string) in /var/www/moodle/web/lib/setuplib.php:428
      Stack trace:
      #0 
      /var/www/moodle/moodledata/localcache/mustache/-1/boost/__Mustache_02b5d5a917a7c771af8e5e17d5fc48f5.php(172):
       default_error_handler(4096, 'Object of class...', '/var/www/moodle...',
       172, Array)
      #1 
      /var/www/moodle/moodledata/localcache/mustache/-1/boost/__Mustache_02b5d5a917a7c771af8e5e17d5fc48f5.php(227):
       
      __Mustache_02b5d5a917a7c771af8e5e17d5fc48f5->sectionC5f25a8b1bcc5465aed46e4190e59738(Object(Mustache_Context),
       '', Object(action_link))
      #2 
      /var/www/moodle/moodledata/localcache/mustache/-1/boost/__Mustache_02b5d5a917a7c771af8e5e17d5fc48f5.php(21):
       
      __Mustache_02b5d5a917a7c771af8e5e17d5fc48f5->section9ba644430056287981fe91d60064ed39(Object(Mustache_Context),
       '', true)
      #3 /var/www/moodle/web/lib/mustache/src/Must in /var/www/moodle/web/lib/setuplib.php on line 428

      My investigation showed, that the problem is solved once a toString()-Method is added to the class action_link in file lib/outputcomponents.php.

      When I add just the following method:

      public function __toString() {
           return "";
       }

      When the __toString()-method returns something else, the error persists.

      The following did not work:

      public function __toString() {
           return $this->url; // DID NOT WORK
       }

       

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            rschrenk Robert Schrenk
            Participants:
            Component watchers:
            Matteo Scaramuccia, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: