Skip to content

preg_grep should return false when preg_match does #11936

Open
@mvorisek

Description

@mvorisek

Description

The following code:

https://3v4l.org/kihD6

<?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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions