A
A
Andrey Salnikov2016-03-16 14:02:53
PHP
Andrey Salnikov, 2016-03-16 14:02:53

Where can the error come from?

When trying to open a non-existent page instead of 404, it gives 500 with this error:
Fatal error: Call to a member function getOne() on null in /core/model/modx/modresponse.class.php on line 68

if (!($this->contentType = $this->modx->resource->getOne('ContentType'))) {
            if ($this->modx->getDebug() === true) {
                $this->modx->log(modX::LOG_LEVEL_DEBUG, "No valid content type for RESOURCE: " . print_r($this->modx->resource->toArray(), true));
            }
            $this->modx->log(modX::LOG_LEVEL_FATAL, "The requested resource has no valid content type specified.");
        }

This is a piece of code from line 68. What could be the problem? In a dozen other sites on Modx, this did not occur, but now it has.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander N++, 2016-03-16
@sanchezzzhak

$this->modx->resource does not have a given getOne method
var_dump($this->modx->resource ); what does it return?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question