php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12401 "break;" doesn't seem to work propery
Submitted: 2001-07-26 10:10 UTC Modified: 2002-04-13 08:44 UTC
From: alenkei at easy2tel dot com Assigned:
Status: Not a bug Package: OCI8 related
PHP Version: 4.0.6 OS: Linux Server 2.2.14-6.1.1
Private report: No CVE-ID:
 [2001-07-26 10:10 UTC] alenkei at easy2tel dot com
I'm not sure this is a bug.

Maybe one cannot just "break" out of an "if" or "else" block.

I have a html page that accepts a username and password and then calls the code below.


<?php

if ((!$username) || (!$password)) {
	header("Location: https://192.168.1.3/easy2chat.html");
	exit;
} 

$db="";

$connection = OCILogon($username, $password, $db);
if ($connection == false){
   $msg = OCIError($connection)."<BR>";
}    
else do {
	// Looks like we need the "do..while()" so we can "break;" below!
	$stmt = "select * from \"Person\"";
	$cursor = OCIParse($connection, $stmt);
	if (false == $cursor){
		$msg = OCIError($cursor)."<BR>";
		OCILogoff($connection);
		break; 
	}

	$result = OCIExecute($cursor);
	if (false == $result) {
		$msg = OCIError($cursor)."<BR>";
		OCILogoff($connection);
		break;
	}

	echo "<table border=1>";
	echo "
		<tr>
			<td><b>LegalEntityID</b></td>
			<td><b>Person Name</b></td>
			<td><b>Person Information</b></td>
		</tr>";

	while (OCIFetchInto ($cursor, $values)){
		$leID = $values[0];
		$pName = $values[1];
		$pInfo = $values[2];

		echo "
			<tr>
				<td>$leID</td>
				<td>$pName</td>
				<td>$pInfo</td>
			</tr>";
	}

	echo "</table>";

	OCILogoff($connection);
} while (false);
?> 

<HTML>
<HEAD>
<TITLE>Secret Area</TITLE>
</HEAD>
	<BODY>

		<? echo "$msg"; ?>

	  	<form method="POST" action="https://192.168.1.3/easy2chat.html");>
		<input type="submit" name="logon" value="Back">
	  	</form>

	</BODY>
</HTML>

The problem is that if I use a user which doesn't have the
"Person" table in its schema the second "break;" (OCIExecute()) causes the following error:


Warning: OCIStmtExecute: ORA-00942: table or view does not exist in /home/httpd/html/sec_html/logon.php on line 25

Fatal error: Cannot break/continue 1 levels in /home/httpd/html/sec_html/logon.php on line 29

My configure line was:
./configure  --without-mysql --with-oci8 --with-apache=../apache_1.3.20 --enable-track-vars --with-openssl

Best regards,
Andrei Lenkei

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-13 08:44 UTC] thies@php.net
i'm sure you found this out in the meantime

 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 17:01:54 2014 UTC