Re: [PHP-DEV] foreach nastiness with references (bug #21702)

2003-01-22 Thread Vaclav Dvorak
Moriyoshi Koizumi wrote:

Moriyoshi Koizumi wrote:

1) Each time before entering a foreach loop, php first tries to make a 
copy of
 the array being iterated.

2) In case the array variable is either referenceing another variable or
 referenced by another variable, no copy is made here and the original
 array is used instead. Because of this behaviour, the original's 
 internal
 array pointer increases in the loop eventually.

Yes, I understand this. What I don't understand is WHY is it so? Why is 
foreach handling references specially? Why is your point 2) there?

Oh, I found this issue was pointed out pretty long time ago.

- Bug #5052
  http://bugs.php.net/5052

- Bug #5270 (deleted?)
  http://news.php.net/article.php?group=php.dev&article=22668
http://news.php.net/article.php?group=php.dev&article=22672
  http://news.php.net/article.php?group=php.dev&article=22673

[...]

Anyway, please search the database first, in order not to post the
same kind of bug twice.


I did search the database, and indeed I did see that bug (#5052) before 
posting my bug report. In fact, if you read my bug report, you will see 
that I even mention this bug, and yet another one (#14607). The bug you 
now found (#5052) is similar but NOT the same. In fact, it describes the 
opposite behaviour: the reporter there says that nested foreach's on two 
COPIES of the same array don't work, and that he can work around the bug 
by making a reference to the array. In my bug, nested foreach on a copy 
works, but not on a reference.

So there, I'm not such a complete idiot, you know. ;-)

Regards,

Vaclav Dvorak


--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] foreach nastiness with references (bug #21702)

2003-01-22 Thread Moriyoshi Koizumi
On Wed, Jan 22, 2003 at 04:12:18PM +0100, Vaclav Dvorak wrote:
> Moriyoshi Koizumi wrote:
> >I tried to answer this question in the bug report page.
> [...]
> >1) Each time before entering a foreach loop, php first tries to make a 
> >copy of
> >   the array being iterated.
> >
> >2) In case the array variable is either referenceing another variable or
> >   referenced by another variable, no copy is made here and the original
> >   array is used instead. Because of this behaviour, the original's 
> >   internal
> >   array pointer increases in the loop eventually.
> 
> Yes, I understand this. What I don't understand is WHY is it so? Why is 
> foreach handling references specially? Why is your point 2) there?
> 

Oh, I found this issue was pointed out pretty long time ago.

- Bug #5052
  http://bugs.php.net/5052

- Bug #5270 (deleted?)
  http://news.php.net/article.php?group=php.dev&article=22668
http://news.php.net/article.php?group=php.dev&article=22672
  http://news.php.net/article.php?group=php.dev&article=22673

It seems that the commit I mentioned in the previous mail was just
for those problem reports. As no much discussion took place there,
all I can guess from them is there was already a fear of breaking BC. 

Anyway, please search the database first, in order not to post the
same kind of bug twice.

Moriyoshi


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] foreach nastiness with references (bug #21702)

2003-01-22 Thread Vaclav Dvorak
Moriyoshi Koizumi wrote:

I tried to answer this question in the bug report page.

[...]

1) Each time before entering a foreach loop, php first tries to make a copy of
   the array being iterated.

2) In case the array variable is either referenceing another variable or
   referenced by another variable, no copy is made here and the original
   array is used instead. Because of this behaviour, the original's internal
   array pointer increases in the loop eventually.


Yes, I understand this. What I don't understand is WHY is it so? Why is 
foreach handling references specially? Why is your point 2) there?

I probably don't see all the consequences (I know little about PHP/Zend 
internals and have found no documentation), but wouldn't the fix be as 
simple as changing the SEPARATE_ZVAL_IF_NOT_REF into SEPARATE_ZVAL on 
line 2251 of Zend/zend_execute.c? URL: 
http://lxr.php.net/source/php4/Zend/zend_execute.c#2251 (search for 
"case ZEND_FE_RESET:" if line numbers shift).

BTW, what's the relation of http://lxr.php.net/source/php4/Zend/ and 
http://lxr.php.net/source/Zend/ ?

Vaclav Dvorak  <[EMAIL PROTECTED]>


--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] foreach nastiness with references (bug #21702)

2003-01-21 Thread Moriyoshi Koizumi
Just FYI, here's a relevant commit made by Andi two years ago:

http://cvs.php.net/diff.php/Zend/zend_execute.c?r1=1.222&r2=1.223&ty=h

Moriyoshi

"John Coggeshall" <[EMAIL PROTECTED]> wrote:

> Ah, I understand now... This perhaps in a documentation problem then
> after all, as there is no way to change this behavior cleanly that I can
> see... What about making a copy of the array and all of the references
> associated with that array instead of just using the real array?
> 
> Just a thought. 
> 
> John


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] foreach nastiness with references (bug #21702)

2003-01-21 Thread John Coggeshall
Ah, I understand now... This perhaps in a documentation problem then
after all, as there is no way to change this behavior cleanly that I can
see... What about making a copy of the array and all of the references
associated with that array instead of just using the real array?

Just a thought. 

John


>What I meant by this is
>
>1) Each time before entering a foreach loop, php first tries 
>to make a copy of
>   the array being iterated.
>
>2) In case the array variable is either referenceing another 
>variable or
>   referenced by another variable, no copy is made here and 
>the original
>   array is used instead. Because of this behaviour, the 
>original's internal
>   array pointer increases in the loop eventually.
>
>And once a variable is referenced by another, both are treated 
>as "reference" from then on. For example,
>
>  $test = array();
>  $test['a'] = 'a';
>  $test['b'] = &$test['a'];
>
>  debug_zval_dump($test);
>?>
>
>This script produces following output:
>
>array(2) refcount(2){
>  ["a"]=>
>  &string(1) "a" refcount(2)
>  ["b"]=>
>  &string(1) "a" refcount(2)
>}
>
>Moriyoshi
>
>


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] foreach nastiness with references (bug #21702)

2003-01-21 Thread Moriyoshi Koizumi
Hi,

>  $a = array(1,2,3);
> #$r =& $a;
> echo "current before foreach: " . current($a) . "\n";
> foreach($a as $b) {
>  echo "- value in cycle: " . $b . "\n";
>  echo "-- current in cycle: " . current($a) . "\n";
> }
> echo "current before foreach: " . current($a) . "\n";
> ?>
> 
> Try it, and the delete the hash mark and try again.

I tried to answer this question in the bug report page.

 To say more precisely, foreach statement always makes use of a copy of
 the given array instead of the original itself unless the array is a
 reference or has a reference.

What I meant by this is

1) Each time before entering a foreach loop, php first tries to make a copy of
   the array being iterated.

2) In case the array variable is either referenceing another variable or
   referenced by another variable, no copy is made here and the original
   array is used instead. Because of this behaviour, the original's internal
   array pointer increases in the loop eventually.

And once a variable is referenced by another, both are treated as "reference"
from then on. For example,



This script produces following output:

array(2) refcount(2){
  ["a"]=>
  &string(1) "a" refcount(2)
  ["b"]=>
  &string(1) "a" refcount(2)
}

Moriyoshi


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] foreach nastiness with references (bug #21702)

2003-01-21 Thread Vaclav Dvorak
John Coggeshall wrote:

To answer part of your question:

What the documentation means is that 

$val) {
	$val = "newval";
	} 
?>

Will not change every element in the $foo array to "newval". However,
although $foo cannot be modified by modifying $key and $val the internal
array pointer WILL increment as if you were actually working on that
array directly.. So in order to restore the internal array pointer back
to the start of the array you'd need a call to reset($foo) first.

If that's what the documentation means, then the documentation is wrong. 
Just try it. What you say is true ONLY when there's a reference to the 
array, but that isn't mentioned in the docs. Cut'n'paste:


$a = array(1,2,3);
#$r =& $a;
echo "current before foreach: " . current($a) . "\n";
foreach($a as $b) {
echo "- value in cycle: " . $b . "\n";
echo "-- current in cycle: " . current($a) . "\n";
}
echo "current before foreach: " . current($a) . "\n";
?>

Try it, and the delete the hash mark and try again.

Regards,

Vaclav Dvorak


--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] foreach nastiness with references (bug #21702)

2003-01-21 Thread John Coggeshall

To answer part of your question:

>One more thing: whether this bug is fixed or not, the 
>documentation must 
>be clarified! I don't know about you, but I simply don't 
>understand what 
>it's supposed to say. Quoting: "Note:  Also note that foreach operates 

What the documentation means is that 

$val) {
$val = "newval";
} 
?>

Will not change every element in the $foo array to "newval". However,
although $foo cannot be modified by modifying $key and $val the internal
array pointer WILL increment as if you were actually working on that
array directly.. So in order to restore the internal array pointer back
to the start of the array you'd need a call to reset($foo) first. 

Side note: You can still modify the values within $foo by:

$val) {
$foo[$key] = "newval";
}
?>


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] foreach nastiness with references (bug #21702)

2003-01-21 Thread Vaclav Dvorak
Hi,

there's a problem with foreach when the array it iterates over is a 
reference or has a reference: contrary to what was clearly written in 
the documentation for over two years until about two months ago, the 
foreach doesn't make a copy of the array, and so nested foreach's don't 
work because the inner foreach moves the array pointer to the end of the 
array already in the first iteration of the outer array.

About two months ago, the documentation was changed, so that now it 
isn't obviously incorrect; rather, it is confusing.

I think that the current foreach behaviour is seriously broken. Foreach 
should never tamper with the internal pointer of the array it iterates 
over, whether it is a reference or not. Nested foreach's should just work.

I filed bug #21702 on this, but you people are way too quick on the 
wontfix trigger: one says Bogus without an explanation, after reopening 
another says Wontfix because of backwards compatibility. He may be 
right, of course, but I would expect some kind of a discussion. This 
_is_ an open source project, right?

Obviously, the bugbase is not a good place for discussions, so I'll try 
it here.

I, personally, find it hard to imagine how someone could knowingly write 
a script that depends on this broken, undocumented behaviour. Is there 
some way to find out? Surely there must have been questions like this 
before. How about releasing a corrected alpha release and seeing if 
anyone complains?

One more thing: whether this bug is fixed or not, the documentation must 
be clarified! I don't know about you, but I simply don't understand what 
it's supposed to say. Quoting: "Note:  Also note that foreach operates 
on a copy of the specified array, not the array itself, therefore the 
array pointer is not modified as with the each()  construct and changes 
to the array element returned are not reflected in the original array. 
However, the internal pointer of the original array is advanced with the 
processing of the array. Assuming the foreach loop runs to completion, 
the array's internal pointer will be at the end of the array."

Regards,

Vaclav Dvorak  <[EMAIL PROTECTED]>


--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] foreach

2002-04-25 Thread Rose, Billy

I feel like an idiot, I overlooked the *_fetch__array(). It's been a long
week...

Billy Rose 
[EMAIL PROTECTED]

> -Original Message-
> From: Gabriel Ricard [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 11:53 AM
> To: Rose, Billy
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DEV] foreach
> 
> 
> This is neither a problem with PHP nor FreeTDS. From the manual:
> 
> " sybase_fetch_array() is an extended version of 
> sybase_fetch_row(). In 
> addition to storing the data in the numeric indices of the 
> result array, 
> it also stores the data in associative indices, using the 
> field names as 
> keys. "
> 
> Therefore each row contains duplicates of each value. Use 
> sybase_fetch_row() instead.
> 
> And, btw, this question really belongs on the php-general list. ;)
> 
> - Gabriel
> 
> Rose, Billy wrote:
> > Environment:
> > 
> >   Apache 2.0.35
> >   PHP 4.2.0RC2
> >   FreeTDS used in place of Sybase libraries to connect to 
> MS SQL 2000
> >   RedHat Linux 7.1
> >   PII 233
> > 
> > Problem:
> > 
> >   Using foreach retrieves a duplicate of each database column.
> > 
> > Code tested:
> > 
> > 
> > 
> > Test
> > 
> > 
> >  > $link = sybase_connect($dbhost,$dbuser,$dbpass)
> >   or die("Error connecting");
> > sybase_select_db($dbname)
> >   or die("Error selecting database");
> > $result = sybase_query($query)
> >   or die("Error running query");
> > print(" cellspacing='4'>\n");
> > while ($row = sybase_fetch_array($result)) {
> >   print("\n");
> >   foreach ($row as $col) {
> > print("".$col."\n");
> >   }
> >   print("\n");
> > }
> > print("\n");
> > sybase_free_result($result);
> > sybase_close($link);
> > ?>
> > 
> > 
> > 
> > Is this a PHP issue, or a FreeTDS problem?
> > 
> > Billy Rose 
> > [EMAIL PROTECTED]
> > 
> 
> 
> 
> -- 
> Gabriel Ricard
> [EMAIL PROTECTED]
> 

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] foreach

2002-04-25 Thread Gabriel Ricard

This is neither a problem with PHP nor FreeTDS. From the manual:

" sybase_fetch_array() is an extended version of sybase_fetch_row(). In 
addition to storing the data in the numeric indices of the result array, 
it also stores the data in associative indices, using the field names as 
keys. "

Therefore each row contains duplicates of each value. Use 
sybase_fetch_row() instead.

And, btw, this question really belongs on the php-general list. ;)

- Gabriel

Rose, Billy wrote:
> Environment:
> 
>   Apache 2.0.35
>   PHP 4.2.0RC2
>   FreeTDS used in place of Sybase libraries to connect to MS SQL 2000
>   RedHat Linux 7.1
>   PII 233
> 
> Problem:
> 
>   Using foreach retrieves a duplicate of each database column.
> 
> Code tested:
> 
> 
> 
> Test
> 
> 
>  $link = sybase_connect($dbhost,$dbuser,$dbpass)
>   or die("Error connecting");
> sybase_select_db($dbname)
>   or die("Error selecting database");
> $result = sybase_query($query)
>   or die("Error running query");
> print("\n");
> while ($row = sybase_fetch_array($result)) {
>   print("\n");
>   foreach ($row as $col) {
> print("".$col."\n");
>   }
>   print("\n");
> }
> print("\n");
> sybase_free_result($result);
> sybase_close($link);
> ?>
> 
> 
> 
> Is this a PHP issue, or a FreeTDS problem?
> 
> Billy Rose 
> [EMAIL PROTECTED]
> 



-- 
Gabriel Ricard
[EMAIL PROTECTED]


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] foreach

2002-04-25 Thread Rose, Billy

Environment:

  Apache 2.0.35
  PHP 4.2.0RC2
  FreeTDS used in place of Sybase libraries to connect to MS SQL 2000
  RedHat Linux 7.1
  PII 233

Problem:

  Using foreach retrieves a duplicate of each database column.

Code tested:



Test


\n");
while ($row = sybase_fetch_array($result)) {
  print("\n");
  foreach ($row as $col) {
print("".$col."\n");
  }
  print("\n");
}
print("\n");
sybase_free_result($result);
sybase_close($link);
?>



Is this a PHP issue, or a FreeTDS problem?

Billy Rose 
[EMAIL PROTECTED]

-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] foreach() enhancement (not too serious ;)

2001-08-20 Thread Markus Fischer

While hacking around I came up with another variation for
foreach() feature request ...

foreach( $somearary as list($ene, $mene, $muh)) {

or

foreach( $somearray as $somekey => list($ene, $mene, $muh)) {

given that

$somearray = array(
'key1' => array('1','2','3'),
[...]
);

:)

Markus

-- 
Markus Fischer,  http://guru.josefine.at/~mfischer/
EMail: [EMAIL PROTECTED]
PGP Public  Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1  C2B5 D674 B445 C227 2BD0
  -All your scripts are belong to Zend-

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] foreach behavior and error suppression (@foo)

2001-07-03 Thread Stanislav Malyshev

>> What looks better and is easier to read?:

For me - the first one. Go figure what that @ is about. Also, 'if' allows
you for 'else'.

>> it. But, making foreach threat NULL variables as empty arrays, would
>> be a goof thing IMO.

Maybe it is worth to demote this warning to E_NOTICE? I personally don't
have a strong opinion on this.
-- 
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.115



-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] foreach behavior and error suppression (@foo)

2001-07-03 Thread derick

On Tue, 3 Jul 2001, Stanislav Malyshev wrote:

> Well, if you are around this with @, why not with if(is_array())?

What looks better and is easier to read?:

1.:
if (is_array($ar)) {
foreach ($ar as $element) {
}
}

2.:
@foreach ($ar as $element) {
}

I clearly see some usefulness here. It makes code less cluttered. However,
as foreach is a language construct, I do not think the @ should work on
it. But, making foreach threat NULL variables as empty arrays, would be a
goof thing IMO.

regards,
Derick


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] foreach behavior and error suppression (@foo)

2001-07-03 Thread Stanislav Malyshev

DB>> There are several open feature requests in the bug system to
DB>> allow the use of @ to suppress warnings when using a non array
DB>> with foreach.  What's the status of this?  Is this a "hell no!",
DB>> "not possible with the current state of the code" or a "when we
DB>> get around to it"?

Well, if you are around this with @, why not with if(is_array())?

-- 
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.115




-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] foreach behavior and error suppression (@foo)

2001-07-02 Thread Zeev Suraski

We may actually make an attempt at it in the engine 2 :)

At 00:33 3/7/2001, Daniel Beckham wrote:
>I know this will be also shot down, but at least I tried.  What about the
>possiblity of foreach simply acting on the variable as if it was list($var)
>or array($var)?  It seems that it wouldn't break any existing behavior, but
>would only make foreach more flexible.
>
>Daniel
>
>- Original Message -
>From: "Zeev Suraski" <[EMAIL PROTECTED]>
>To: "Daniel Beckham" <[EMAIL PROTECTED]>
>Cc: "php-dev" <[EMAIL PROTECTED]>
>Sent: Monday, July 02, 2001 4:19 PM
>Subject: Re: [PHP-DEV] foreach behavior and error suppression (@foo)
>
>
> > If the question is about
> > @foreach(...) ...
> >
> > Then the answer is somewhere between 'hell no!' and 'not possible with the
> > current state of the code'.  foreach is a statement, whereas @ is an
> > operator that works on expressions...
> >
> > At 00:16 3/7/2001, Daniel Beckham wrote:
> > >There are several open feature requests in the bug system to allow the
>use
> > >of @ to suppress warnings when using a non array with foreach.  What's
>the
> > >status of this?  Is this a "hell no!", "not possible with the current
>state
> > >of the code" or a "when we get around to it"?
> > >
> > >Thanks,
> > >
> > >Daniel
> > >
> > >
> > >--
> > >PHP Development Mailing List <http://www.php.net/>
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> > --
> > Zeev Suraski <[EMAIL PROTECTED]>
> > CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
Zeev Suraski <[EMAIL PROTECTED]>
CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] foreach behavior and error suppression (@foo)

2001-07-02 Thread Daniel Beckham

I know this will be also shot down, but at least I tried.  What about the
possiblity of foreach simply acting on the variable as if it was list($var)
or array($var)?  It seems that it wouldn't break any existing behavior, but
would only make foreach more flexible.

Daniel

- Original Message -
From: "Zeev Suraski" <[EMAIL PROTECTED]>
To: "Daniel Beckham" <[EMAIL PROTECTED]>
Cc: "php-dev" <[EMAIL PROTECTED]>
Sent: Monday, July 02, 2001 4:19 PM
Subject: Re: [PHP-DEV] foreach behavior and error suppression (@foo)


> If the question is about
> @foreach(...) ...
>
> Then the answer is somewhere between 'hell no!' and 'not possible with the
> current state of the code'.  foreach is a statement, whereas @ is an
> operator that works on expressions...
>
> At 00:16 3/7/2001, Daniel Beckham wrote:
> >There are several open feature requests in the bug system to allow the
use
> >of @ to suppress warnings when using a non array with foreach.  What's
the
> >status of this?  Is this a "hell no!", "not possible with the current
state
> >of the code" or a "when we get around to it"?
> >
> >Thanks,
> >
> >Daniel
> >
> >
> >--
> >PHP Development Mailing List <http://www.php.net/>
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> Zeev Suraski <[EMAIL PROTECTED]>
> CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] foreach behavior and error suppression (@foo)

2001-07-02 Thread Daniel Beckham

Yes, it would be nice for foreach to be a little more forgiving even if it
is far in the future.

Daniel

- Original Message -
From: "Zak Greant" <[EMAIL PROTECTED]>
To: "Daniel Beckham" <[EMAIL PROTECTED]>; "php-dev"
<[EMAIL PROTECTED]>
Sent: Monday, July 02, 2001 4:18 PM
Subject: Re: [PHP-DEV] foreach behavior and error suppression (@foo)


> Perhaps we want to roll this request into the list of proposed changes for
> PHP 5?
>
> --zak
>
> - Original Message -
> From: "Daniel Beckham" <[EMAIL PROTECTED]>
> To: "php-dev" <[EMAIL PROTECTED]>
> Sent: Monday, July 02, 2001 3:16 PM
> Subject: [PHP-DEV] foreach behavior and error suppression (@foo)
>
>
> > There are several open feature requests in the bug system to allow the
use
> > of @ to suppress warnings when using a non array with foreach.  What's
the
> > status of this?  Is this a "hell no!", "not possible with the current
> state
> > of the code" or a "when we get around to it"?
> >
> > Thanks,
> >
> > Daniel
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] foreach behavior and error suppression (@foo)

2001-07-02 Thread Zeev Suraski

If the question is about
@foreach(...) ...

Then the answer is somewhere between 'hell no!' and 'not possible with the 
current state of the code'.  foreach is a statement, whereas @ is an 
operator that works on expressions...

At 00:16 3/7/2001, Daniel Beckham wrote:
>There are several open feature requests in the bug system to allow the use
>of @ to suppress warnings when using a non array with foreach.  What's the
>status of this?  Is this a "hell no!", "not possible with the current state
>of the code" or a "when we get around to it"?
>
>Thanks,
>
>Daniel
>
>
>--
>PHP Development Mailing List 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
Zeev Suraski <[EMAIL PROTECTED]>
CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] foreach behavior and error suppression (@foo)

2001-07-02 Thread Zak Greant

Perhaps we want to roll this request into the list of proposed changes for
PHP 5?

--zak

- Original Message -
From: "Daniel Beckham" <[EMAIL PROTECTED]>
To: "php-dev" <[EMAIL PROTECTED]>
Sent: Monday, July 02, 2001 3:16 PM
Subject: [PHP-DEV] foreach behavior and error suppression (@foo)


> There are several open feature requests in the bug system to allow the use
> of @ to suppress warnings when using a non array with foreach.  What's the
> status of this?  Is this a "hell no!", "not possible with the current
state
> of the code" or a "when we get around to it"?
>
> Thanks,
>
> Daniel
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] foreach behavior and error suppression (@foo)

2001-07-02 Thread Daniel Beckham

There are several open feature requests in the bug system to allow the use
of @ to suppress warnings when using a non array with foreach.  What's the
status of this?  Is this a "hell no!", "not possible with the current state
of the code" or a "when we get around to it"?

Thanks,

Daniel


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]