[php-src] Issue #11936: `preg_grep` should return false when `preg_match` does

From: Date: Fri, 11 Aug 2023 08:50:47 +0000
Subject: [php-src] Issue #11936: `preg_grep` should return false when `preg_match` does
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245156@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11936
Author: mvorisek

### Description

The following code:

https://3v4l.org/kihD6

```php
<?php

var_dump(preg_match('/.*/', hex2bin('ff')));
var_dump(preg_match('/^$/', hex2bin('ff')));
var_dump(preg_match('/.*/u', hex2bin('ff')));
var_dump(preg_grep('/.*/u', [hex2bin('ff')]));
```

Resulted in this output:
```
int(1)
int(0)
bool(false)
array(0) {
}
```

But I expected this output instead:
```
int(1)
int(0)
bool(false)
bool(false)
```


### PHP Version

any

### Operating System

any


Thread (1 message)

  • mvorisek
« previous php.bugs (#245156) next »