#32192 [Opn]: preg_grep & GLOBALS
| From: | bolk at hitv dot ru | Date: | Fri, 04 Mar 2005 18:18:36 +0000 |
| Subject: | #32192 [Opn]: preg_grep & GLOBALS | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-74849@lists.php.net to get a copy of this message | ||
ID: 32192
User updated by: bolk at hitv dot ru
Reported By: bolk at hitv dot ru
Status: Open
Bug Type: PCRE related
Operating System: Linux RH 9 and Windows XP
PHP Version: 5.0.3
New Comment:
Why not introduce a function that converts refs to non-refs in array?
Say, array_flatten ($array) or something?
Previous Comments:
------------------------------------------------------------------------
[2005-03-04 19:08:43] bolk at hitv dot ru
I see that the zend_print_zval_r_ex() detects recursive references.
------------------------------------------------------------------------
[2005-03-04 19:01:30] bolk at hitv dot ru
I belive this situation must be detected. I think it is a bug.
preg_grep() should not change its agruments.
------------------------------------------------------------------------
[2005-03-04 18:56:19] tony2001@php.net
bolk:
yup, this is the very same behaviour.
all elements of the target array get converted to strings, that's what
you see.
plintus:
propose your own solution instead of useless comments?
recursive references should be carefully used and current situation
looks like a user fault to me.
------------------------------------------------------------------------
[2005-03-04 18:37:12] plintus at smtp dot ru
Tony, if a bug occurs in some other situations, it's still a bug.
However, Microsoft can use this trick: "Bugs are expected behaviour in
Windows" :-)
------------------------------------------------------------------------
[2005-03-04 18:36:12] bolk at hitv dot ru
Is it "expected behaviour" too? I think no.
<?
$b = array(1,2,3);
$a = array();
$a[] = &$b;
preg_grep('/^T_/', $a);
var_dump($a);
var_dump($b);
?>
array(1) {
[0]=>
&string(5) "Array"
}
string(5) "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/32192
--
Edit this bug report at http://bugs.php.net/?id=32192&edit=1