Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-15070

Wrong error code if database is unavailable

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • None
    • 4.0.6, 4.1.3
    • Misc
    • 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

        Activity

          People

            bd bd
            paranorm paranorm
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: