Req #32192 [Opn->Csd]: preg_grep does not work with arrays containing references to themselves.

From: Date: Mon, 18 Mar 2019 16:15:05 +0000
Subject: Req #32192 [Opn->Csd]: preg_grep does not work with arrays containing references to themselves.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220055@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=32192&edit=1 ID: 32192 Updated by: nikic@php.net Reported by: bolk at hitv dot ru Summary: preg_grep does not work with arrays containing references to themselves. -Status: Open +Status: Closed Type: Feature/Change Request Package: PCRE related Operating System: Linux RH 9 and Windows XP PHP Version: 5.0.3 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: Looks like this has been fixed a long time ago: https://3v4l.org/0f1ba Previous Comments: ------------------------------------------------------------------------ [2005-03-04 19:18:35] bolk at hitv dot ru Why not introduce a function that converts refs to non-refs in array? Say, array_flatten ($array) or something? ------------------------------------------------------------------------ [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" :-) ------------------------------------------------------------------------ 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 https://bugs.php.net/bug.php?id=32192 -- Edit this bug report at https://bugs.php.net/bug.php?id=32192&edit=1

« previous php.bugs (#220055) next »