By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 990 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

Zend Studio calling something valid a bug...or IS it a bug?

P: n/a
I have lines of code that look like this:

while ($row2sx = mysql_fetch_array($result2sx)) {

Now that's the way I've always learned to create an array from a mySQL
querey.

I just started trying the Zend Studio (and to be honest, except for the
debugger I'm seeing that it has less features than EditPlus.)
And the debugger calls all my WHERE() functions bugged because I'm
using one = instead of two as in ==.

a) Is there a better way of formatting a mysql_fetch_array, or
b) Is there a way to tell Zend Studio that hey, that's a-ok code?
(I haven't been able to find an option to allow that.)

While on the subject, I'll have includes like this:
include_once("includes/connect.php");
which will have in it lines that establish variables like:
$dbh=mysql_connect ("localhost", "username", "password") or die ('I
cannot connect to the database because: ' . mysql_error());

but in the main page it will say $dbh in the line:
$result_home_feature = @mysql_query($sql_home_feature, $dbh);
is an error because $dbh is being used before it's defined.
Yet, in the little Studio file list of included files it shows the
connect.php file that establishes what $dbh is.

Is there something that needs to be set that I can't find for it to
recognize its...set-ness?

Thanks for any help!
Liam

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
What version of Zend are you using? Is it giving you an error message or
showing you the red "bad syntax squiggle". My version of ZS doesn't compain
about the sample line you gave when I drop into a script, nor does it
complain if variables are defined in includes.

- Kevin

<ne**@celticbear.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I have lines of code that look like this:

while ($row2sx = mysql_fetch_array($result2sx)) {

Now that's the way I've always learned to create an array from a mySQL
querey.

I just started trying the Zend Studio (and to be honest, except for the
debugger I'm seeing that it has less features than EditPlus.)
And the debugger calls all my WHERE() functions bugged because I'm
using one = instead of two as in ==.

a) Is there a better way of formatting a mysql_fetch_array, or
b) Is there a way to tell Zend Studio that hey, that's a-ok code?
(I haven't been able to find an option to allow that.)

While on the subject, I'll have includes like this:
include_once("includes/connect.php");
which will have in it lines that establish variables like:
$dbh=mysql_connect ("localhost", "username", "password") or die ('I
cannot connect to the database because: ' . mysql_error());

but in the main page it will say $dbh in the line:
$result_home_feature = @mysql_query($sql_home_feature, $dbh);
is an error because $dbh is being used before it's defined.
Yet, in the little Studio file list of included files it shows the
connect.php file that establishes what $dbh is.

Is there something that needs to be set that I can't find for it to
recognize its...set-ness?

Thanks for any help!
Liam

Jul 17 '05 #2

P: n/a
LRW
(top post :-P *grin*)
Thanks for replying!
I'm using Zend Studio 3.5.2 Plus.
Unfortunately the error it gives me down in the bottom right window is an
image, and not text, or I'd cut and paste it.
I'll just retype it here:

For the $dbh example=
"Category: Security
Description:
A global variable is used before it is defined. You may see this warning if
you rely on register_globals or variables defined in external include files,
in which you may chose to ignore it. However, note that this may cause the
code to behave in unpredictable ways when run in certain contexts."

The while ($row_hfeat = mysql_fetch_array($result_home_feature)) { example:
"Category: Bug
Description:
Assignments in a conditional statement are sometimes the result of a typo.
In many cases, instead of the assigned operator =, the equality operator ==
should be used...."

Thanks!
Liam
"Kevin Lin" <ke***@wx3REMOVE4SPAM.com> wrote in message
news:ig3ud.470557$wV.258233@attbi_s54...
What version of Zend are you using? Is it giving you an error message or
showing you the red "bad syntax squiggle". My version of ZS doesn't
compain
about the sample line you gave when I drop into a script, nor does it
complain if variables are defined in includes.

- Kevin

<ne**@celticbear.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I have lines of code that look like this:

while ($row2sx = mysql_fetch_array($result2sx)) {

Now that's the way I've always learned to create an array from a mySQL
querey.

I just started trying the Zend Studio (and to be honest, except for the
debugger I'm seeing that it has less features than EditPlus.)
And the debugger calls all my WHERE() functions bugged because I'm
using one = instead of two as in ==.

a) Is there a better way of formatting a mysql_fetch_array, or
b) Is there a way to tell Zend Studio that hey, that's a-ok code?
(I haven't been able to find an option to allow that.)

While on the subject, I'll have includes like this:
include_once("includes/connect.php");
which will have in it lines that establish variables like:
$dbh=mysql_connect ("localhost", "username", "password") or die ('I
cannot connect to the database because: ' . mysql_error());

but in the main page it will say $dbh in the line:
$result_home_feature = @mysql_query($sql_home_feature, $dbh);
is an error because $dbh is being used before it's defined.
Yet, in the little Studio file list of included files it shows the
connect.php file that establishes what $dbh is.

Is there something that needs to be set that I can't find for it to
recognize its...set-ness?

Thanks for any help!
Liam


Jul 17 '05 #3

P: n/a
Okay, I see what you're talking about now-- Zend's "code analyzer" tool.

I'd consider it's reports suggestions of things you might want to fix.
Assignments in conditions are fine for the way you're using them. It's
trying to warn you away from this common mistake: "if ($user_id = 'admin')
{...}"

As for the $dbh variable, I'm not sure why it doesn't pick that it's getting
assigned in your include file. It seems to recognize defines okay.
"LRW" <de**@celticbear.com> wrote in message
news:mw6ud.232375$R05.10431@attbi_s53...
(top post :-P *grin*)
Thanks for replying!
I'm using Zend Studio 3.5.2 Plus.
Unfortunately the error it gives me down in the bottom right window is an
image, and not text, or I'd cut and paste it.
I'll just retype it here:

For the $dbh example=
"Category: Security
Description:
A global variable is used before it is defined. You may see this warning if you rely on register_globals or variables defined in external include files, in which you may chose to ignore it. However, note that this may cause the
code to behave in unpredictable ways when run in certain contexts."

The while ($row_hfeat = mysql_fetch_array($result_home_feature)) { example: "Category: Bug
Description:
Assignments in a conditional statement are sometimes the result of a typo.
In many cases, instead of the assigned operator =, the equality operator == should be used...."

Thanks!
Liam
"Kevin Lin" <ke***@wx3REMOVE4SPAM.com> wrote in message
news:ig3ud.470557$wV.258233@attbi_s54...
What version of Zend are you using? Is it giving you an error message or showing you the red "bad syntax squiggle". My version of ZS doesn't
compain
about the sample line you gave when I drop into a script, nor does it
complain if variables are defined in includes.

- Kevin

<ne**@celticbear.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I have lines of code that look like this:

while ($row2sx = mysql_fetch_array($result2sx)) {

Now that's the way I've always learned to create an array from a mySQL
querey.

I just started trying the Zend Studio (and to be honest, except for the
debugger I'm seeing that it has less features than EditPlus.)
And the debugger calls all my WHERE() functions bugged because I'm
using one = instead of two as in ==.

a) Is there a better way of formatting a mysql_fetch_array, or
b) Is there a way to tell Zend Studio that hey, that's a-ok code?
(I haven't been able to find an option to allow that.)

While on the subject, I'll have includes like this:
include_once("includes/connect.php");
which will have in it lines that establish variables like:
$dbh=mysql_connect ("localhost", "username", "password") or die ('I
cannot connect to the database because: ' . mysql_error());

but in the main page it will say $dbh in the line:
$result_home_feature = @mysql_query($sql_home_feature, $dbh);
is an error because $dbh is being used before it's defined.
Yet, in the little Studio file list of included files it shows the
connect.php file that establishes what $dbh is.

Is there something that needs to be set that I can't find for it to
recognize its...set-ness?

Thanks for any help!
Liam



Jul 17 '05 #4

P: n/a
while ($row2sx = mysql_fetch_array($result2sx)) {


is no "good"

$row2sx = mysql_fetch_array($result2sx)
while ($row2sx) {
// ....
$row2sx = mysql_fetch_array($result2sx)

would be correct, but i do it as you do
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.