#19140 [Bgs]: pg_pconnect opens a new connection even when and old one is available
| From: | derick@php.net | Date: | Wed, 28 Aug 2002 09:41:04 +0000 |
| Subject: | #19140 [Bgs]: pg_pconnect opens a new connection even when and old one is available | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18014@lists.php.net to get a copy of this message | ||
ID: 19140
Updated by: derick@php.net
Reported By: jc@mega-bucks.co.jp
Status: Bogus
Bug Type: Arrays related
Operating System: Red Hat Linux 7.2
PHP Version: 4.2.2
New Comment:
FYI: I clearified this in the manual, it will show up in a few days
online.
Derick
Previous Comments:
------------------------------------------------------------------------
[2002-08-28 05:32:48] jc@mega-bucks.co.jp
Neglectful coding? Why do you consider it neglectful coding if I do
this for an array but good coding for a string? PHP treats null strings
as empty strings, why doesn't it do the same for arrays?
All I want to know is, what is the documented behaviour for foreach on
a null array. If there is no documented behaviour, let's add to the
documentation. Something like:
"foreach will fail on an unitialized (null) array".
I had assumed that since PHP is usually treats null strings as empty
strings it would do the same with null arrays. I was wrong. I tried to
find documentation on what foreach will do in the case of a null array
and could not find any.
I agree with you that this is neglectfull coding. It would be nice if
there was documentation to back it up :)
------------------------------------------------------------------------
[2002-08-28 05:17:20] cynic@php.net
if you insist on neglectful coding, lower your error_reporting level.
------------------------------------------------------------------------
[2002-08-28 05:11:43] jc@mega-bucks.co.jp
What is the documented/expected behaviour for foreach on "null"
arrays?
PHP has not problems with statements such as:
echo "$a";
So I don't see why it should have a problem with:
foreach ($a as $val) {};
Actaully I *do* understand why it is a problem :) I just would like it
to suggest that foreach be able to handle null arrays. It would be
*such* a nice feature ;)
------------------------------------------------------------------------
[2002-08-28 04:48:58] jc@mega-bucks.co.jp
$a is an unitialized variable. It is not an empty variable ($a = "").
It is declared but not initialized. It has no value since the function
returns nothing.
The problem is that PHP cannot tell that $a is supposed to be an array
since $a has no value or content whatsoever.
------------------------------------------------------------------------
[2002-08-28 04:41:31] cynic@php.net
"an uninitialized array"? i don't see anything like that in your
example.
there's just one nonexistent (null, if you must) variable. no array.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/19140
--
Edit this bug report at http://bugs.php.net/?id=19140&edit=1