Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8140323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:07:30+00:00 2026-06-06T12:07:30+00:00

I am using concrete to render my site, it uses the following error system;

  • 0

I am using concrete to render my site, it uses the following error system;

if (isset($error) && $error != '') {
    if ($error instanceof Exception) {
        $_error[] = $error->getMessage();
    } else if ($error instanceof ValidationErrorHelper) { 
        $_error = $error->getList();
    } else if (is_array($error)) {
        $_error = $error;
    } else if (is_string($error)) {
        $_error[] = $error;
    }
    ?>
    <?php  if ($format == 'block') { ?>
    <div class="alert-message error">
    <?php  foreach($_error as $e): ?>
        <?php  echo $e?><br/>
    <?php  endforeach; ?>
    </div>

    <?php  } else { ?>

    <ul class="ccm-error">
    <?php  foreach($_error as $e): ?>
        <li><?php  echo $e?></li>
    <?php  endforeach; ?>
    </ul>
    <?php  } ?>


<?php  } ?>

This is used to detect errors in the system, or validation errors.

My problem is that the error div is being displayed but there is no errors, e.g.:

Error DIV

I have tried dumping the variables and this is the result (in this case):

Array    object(ValidationErrorHelper)#89 (1) { ["error:protected"]=> array(0) { } }

This is the ValidationErrorHelper system:

<?php
    defined('C5_EXECUTE') or die("Access Denied.");
    class ValidationErrorHelper {

        protected $error = array();


        public function reset() {
            $this->error = array();
        }


        public function add($e) {
            if ($e instanceof ValidationErrorHelper) {
                $this->error = array_merge($e->getList(), $this->error);            
            } else if (is_object($e) && ($e instanceof Exception)) {
                $this->error[] = $e->getMessage();
            } else {
                $this->error[] = $e;
            }
        }


        public function getList() {
            return $this->error;
        }


        public function has() {
            return (count($this->error) > 0);
        }


        public function output() {
            if ($this->has()) {
                print '<ul class="ccm-error">';
                foreach($this->getList() as $error) {
                    print '<li>' . $error . '</li>';
                }
                print '</ul>';
            }
        }
    }

?>

Is there any way to remove this? or diagnose it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:07:32+00:00Added an answer on June 6, 2026 at 12:07 pm

    Sometimes the error object is set, but doesn’t have any errors in it. If you look at the very top “if” statement, you’ll see this:

    if (isset($error) && $error != '') {
    

    So what’s happening is the $error variable is an object or an array and has been set by the system, but it doesn’t have any errors in it. But your code is always outputting the container <div> as long as the $error variable is set (or not an empty string). What you need to do is add an additional check on the $_error variable (the one that is created in the first dozen or so lines of the code) to see if it’s empty or not.

    Try this:

    if (isset($error) && $error != '') {
        if ($error instanceof Exception) {
            $_error[] = $error->getMessage();
        } else if ($error instanceof ValidationErrorHelper) { 
            $_error = $error->getList();
        } else if (is_array($error)) {
            $_error = $error;
        } else if (is_string($error)) {
            $_error[] = $error;
        }
    
        if (!empty($_error)) {
            if ($format == 'block') { ?>
                <div class="alert-message error">
                <?php  foreach($_error as $e): ?>
                    <?php  echo $e?><br/>
                <?php  endforeach; ?>
                </div>
            <?php  } else { ?>
                <ul class="ccm-error">
                <?php  foreach($_error as $e): ?>
                    <li><?php  echo $e?></li>
                <?php  endforeach; ?>
                </ul>
            <?php }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using CakePHP 2.0 and I want to load a concrete CSS style
I'd like to keep my concrete classes separate from my views. Without using strongly
Using LINQ on collections, what is the difference between the following lines of code?
[using Moq] I am trying to mock a concrete class and mock a virtual
I'm using a factory to create different concrete instances of an interface. One of
I am using the concrete table inheritance with SQLAlchemy. In declartive style model class,
If a 3rd party dependency logs using a concrete framework (such as log4j), and
Do you have concrete step to know if an app is using C2DM? According
We are using Unity framework for Dependency injection. I am registerring two concrete implementations
Is it possible to mock a concrete class using EaskMock? If so, how do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.