php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36751 Odd Unexpected T_ELSE
Submitted: 2006-03-15 23:08 UTC Modified: 2006-03-16 00:59 UTC
From: adamaflynn at thousandmonkeys dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.2 OS: Linux
Private report: No CVE-ID: None
 [2006-03-15 23:08 UTC] adamaflynn at thousandmonkeys dot net
Description:
------------
I'm getting a weird error in PHP 5.1.2. When I run XMB Forum, I get a parse error saying unexpected T_ELSE when there is no reason that there should be an unexpected T_ELSE.

I had the issue yesterday, and, after discovering that my php.ini wasn't in the right path and fixing that, it fixed itself. Now again today I'm running into the bug. So, I'm assuming the issue is with PHP and not the code I'm using.

My ./configure line is:
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-config-file-path=/etc/' '--disable-short-tags' '--with-zlib' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--with-curl' '--with-ftp' '--with-gd' '--with-mysql=/var/lib/mysql' '--with-mysqli' '--enable-sockets' '--without-sqlite'

Reproduce code:
---------------
    if (!$db->error()) {
        $count = $db->num_fields($resource);
        if ($header) {
            ?><tr class="category" bgcolor="<?php echo $altbg2;?>" align="center"><?php
            for($i=0;$i<$count;$i++) {
                echo '<td align="left">';
                echo '<strong><font color='.$cattext.'>'.$db->field_name($resource, $i).'</font></strong>';
                echo '</td>';
            }
            echo '</tr>';
        }

        while($a = $db->fetch_array($resource, SQL_NUM)) {
            ?><tr bgcolor="<?php echo $altbg1;?>" class="ctrtablerow"><?php
            for($i=0;$i<$count;$i++) {
                echo '<td align="left">';

                if (trim($a[$i]) == '') {
                    echo '&nbsp;';
                }else{
                    echo nl2br($a[$i]);
                }
                echo '</td>';
            }
            echo '</tr>';
        }
    } else {
      error($db->error());
    }

Expected result:
----------------
I shouldn't get the unexpected T_ELSE error

Actual result:
--------------
I get the unexpected T_ELSE error.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-16 00:59 UTC] rasmus@php.net
There is no such error in the reproducing script you provided.  You probably have a problem in your script above this snippet.  
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 27 18:00:02 2025 UTC