Author:
rainerborene
Version:
0.2
Released:
23 November 2010
Category:
Events

Closed#1: Invalid argument supplied for foreach()

If no section is present and the button to create a section is clicked:

Error message:

Invalid argument supplied for foreach() An error occurred in /extensions/meta_section/extension.driver.php around line 131

extension.driver.php

Line 131:

foreach ($sections as $section) {

Line 120:

$sections = $sectionManager->fetch(NULL, 'ASC', 'name');
// $sections is “false“

Solution:

public function customizeEssentials($context) {
    // Get sections
    $sectionManager = new SectionManager($this->_Parent);
    $sections = $sectionManager->fetch(NULL, 'ASC', 'name');

    // Check whether sections are available
    if (false === $sections) {
        return null;
    }

    // Load HTML from context
    $dom = @DOMDocument::loadHTML($context['output']);
    $xpath = new DOMXPath($dom);

Hope this commit fixes it.

This issue is closed.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details