473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
4 2168
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Google alias | last post by:
My trial period for Zend studio has just ended, I've requested a personal licence, and got it. After I've entered and rebooted by computer I still get a popup saying "Licence expired!" everytime I...
8
by: Andy Jacobs | last post by:
Evening folks This has probably been asked before so apologies for that. I'm using Dreamweaver for PHP and have been for nearly a year. I've done some stuff that I'm very happy with but I'm...
5
by: news | last post by:
I'm trying out the Zend Development Environment 4, and for the most part I like it, except for two things. It seems to think certain lines that are perfectly valid are bugs. Like this: while...
0
by: writeson | last post by:
Hi all, At work I'm using Zend Studio 3.5.2 to develop PHP files on my Win2K desktop machine. I've got Zend Studio setup with a secure FTP (SFTP) connection to a RedHat Enterprise Linux machine....
1
by: Ryan Lange | last post by:
Well, I can connect to my Pg database through ZS just fine. It lists all the databases, all the schemas, and quite a few items under each schema. Unfortunately, all of *those* items are empty when...
8
by: smorrey | last post by:
Hello everyone, just wanted to share my experiences with Zend "the php company". I decided to do the test drive of the Enterprise grade developer studio. Big mistake! >From day one I had nothing...
1
by: buts101 | last post by:
I've install XAMPP for php,mysql. I use Zend Studio for writing php,mysql codes. I know Zend Studio 5.5 has debug feature for php codes. How can i use the debug feature of zend studio with...
0
by: JoeT | last post by:
Hi... OK...I'm having difficulty understanding a problem with installing Zend Studio 5.5 on an Intel Mac. Prior to the install, I had the zend /library installed, and was able to...
8
by: mechphisto | last post by:
(The Zend Web site doesn't have any forum; if someone knows of a Web forum for Zend, please let me know.) I'm using the latest Zend Studio 5.5.1. Just installed it on a fresh Fedora 9 box. I've...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.