Details
-
Bug
-
Resolution: Fixed
-
Medium
-
None
-
4.0.6, 4.1.3
-
None
Description
If no database connection could be made eZ Publish returns KERNEL_NOT_AVAILABLE error code.
Then KERNEL_NOT_AVAILABLE code causes 404 http error code for an end user.
But it is not correct to return 404 http error code for a database unavailability. 404 could provoke a website removal from a search engine index.
Correct http code is 503 (Service Unavailable) to inform a search engine about a temporary problem).
So, my proposal is to return KERNEL_NO_DB_CONNECTION in this case changing kernel/classes/eznodeviewfunctions.php
from
if ( !is_object( $node ) ) { return array( 'content' => $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' ), 'store' => false ); }
to
if ( !is_object( $node ) ) { if ( !$db->isConnected()) { return array( 'content' => $Module->handleError( eZError::KERNEL_NO_DB_CONNECTION, 'kernel' ), 'store' => false ); } return array( 'content' => $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' ), 'store' => false ); }
Steps to reproduce
1. Switch off the database
2. See eZ Publish error code and http error code
Attachments
Issue Links
- is duplicated by
-
EZP-9410 Wrong Error Code Kernel (1) when DB not available - should be Kernel(50)
- Closed