After I pulled the last code updates to an AWS instance where a test environment is running, a page displayed HTTP Error 500. I'm using CodeIgniter and the AWS instance was set to run as "production" (SetEnv CI_ENV production on .htaccess), so I changed that to "development" to display PHP error messagens. That's when I get the following mesage.
An uncaught Exception was encountered
Type: ParseError
Message: syntax error, unexpected end of file
Filename: /var/www/html/flip/application/views/flip_list.php
Line Number: 58
Backtrace:
File: /var/www/html/flip/application/controllers/Flip.php Line: 131 Function: view
File: /var/www/html/flip/index.php Line: 315 Function: require_once
On my localhost environment it does not happen, the page is displayed without errors or warnings.
Localhost is running PHP 7.0.15-0ubuntu0.16.04.4. And the AWS instance is running PHP 7.0.14 on CentOS. CodeIgniter version is 3.1.3.
I checked flip_list.php and Flip.php, but I didn't find where the problem is.
The controller file (Flip.php) is 350+ lines long, so I'm posting it on a pastebin: https://pastebin.com/agyMuf1T
Below the code of the view (flip_list.php):
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<?php
$first = true;
$second = false;
foreach ($editions->result() as $edition) {
$edition_hash = $this->flip->encrypt_decrypt_edition_id($edition->edition_id, 'encrypt');
$date = date_create($edition->edition_date);
$date = date_format($date, 'd\/m\/Y');
if( $first ) {
$first = false;
$second = true;
?>
<div class="latest">
<div class="item">
<a href="<?php echo base_url('flip/'.$slug.'/view/'.$edition_hash); ?>" class="view-edition">
<img src="<?php echo $edition->edition_cover; ?>" class="edition-cover">
<span>Edição <?php echo $date; ?></span>
<span>Número <?php echo $edition->edition_number; ?></span>
</a>
</div>
</div>
<?php
}
else {
if( $second ) {
$second = false;
?>
<div class="editions">
<div class="d-flex flex-row align-content-stretch flex-wrap">
<?
}
?>
<div class="item">
<a href="<?php echo base_url('flip/'.$slug.'/view/'.$edition_hash); ?>" class="view-edition">
<img src="<?php echo $edition->edition_cover; ?>" class="edition-cover">
<span><?php echo $date; ?></span>
</a>
</div>
<?php
}
} // foreach
?>
</div><!-- .d-flex -->
</div><!-- .editions -->
I'd like some help debbuging this. Thanks!