preg_match
symfony/var-dumper
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Perform a regular expression match
preg_match
(
string $pattern
,
string $subject
,
array
&
$matches
=
null
,
int $flags
=
0
,
int $offset
=
0
):
int
|
false
case
'string'
:
$this
->
type
=
self
::
TYPE_STRING
;
$this
->
class
=
preg_match
(
'//u'
,
$value
) ?
self
::
STRING_UTF8
:
self
::
STRING_BINARY
;
$this
->
cut
=
self
::
STRING_BINARY
===
$this
->
class
?
\strlen
(
$value
) :
mb_strlen
(
$value
,
'UTF-8'
);
$this
->
value
=
''
;
break;
Caster/CutStub.php
if (isset(
self
::
$framesCache
[
$cacheKey
])) {
$a
[
$prefix
.
'src'
] =
self
::
$framesCache
[
$cacheKey
];
} else {
if (
preg_match
(
'/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/'
,
$f
[
'file'
],
$match
)) {
$f
[
'file'
] =
substr
(
$f
[
'file'
],
0
, -
\strlen
(
$match
[
0
]));
$f
[
'line'
] = (int)
$match
[
1
];
}
Caster/ExceptionCaster.php
$stub
->
cut
=
$c
->
cut
;
$stub
->
attr
=
$c
->
attr
;
if (
Stub
::
TYPE_REF
===
$c
->
type
&& !
$c
->
class
&&
\is_string
(
$c
->
value
) && !
preg_match
(
'//u'
,
$c
->
value
)) {
$stub
->
type
=
Stub
::
TYPE_STRING
;
$stub
->
class
=
Stub
::
STRING_BINARY
;
}
Caster/StubCaster.php
$cursor
->
hashLength
=
\count
(
$children
);
$cursor
->
hashCut
=
$hashCut
;
foreach (
$children
as
$key
=>
$child
) {
$cursor
->
hashKeyIsBinary
= isset(
$key
[
0
]) && !
preg_match
(
'//u'
,
$key
);
$cursor
->
hashKey
=
$dumpKeys
?
$key
:
null
;
$this
->
dumpItem
(
$dumper
,
$cursor
,
$refs
,
$child
);
if (++
$cursor
->
hashIndex
===
$this
->
maxItemsPerDepth
||
$cursor
->
stop
) {
Cloner/Data.php
if (
''
===
$v
) {
continue
2
;
}
if (!
preg_match
(
'//u'
,
$v
)) {
$stub
= new
Stub
();
$stub
->
type
=
Stub
::
TYPE_STRING
;
$stub
->
class
=
Stub
::
STRING_BINARY
;
Cloner/VarCloner.php
protected function
utf8Encode
(?
string $s
)
{
if (
null
===
$s
||
preg_match
(
'//u'
,
$s
)) {
return
$s
;
}
Dumper/AbstractDumper.php
$out
=
preg_replace
(
'/[ \t]+$/m'
,
''
,
$out
);
$var
[
'file'
] =
htmlspecialchars
(
$var
[
'file'
],
\ENT_QUOTES
,
'UTF-8'
);
$intMax
=
\PHP_INT_MAX
;
preg_match
(
'/sf-dump-\d+/'
,
$out
,
$dumpId
);
$dumpId
=
$dumpId
[
0
];
$res
= (int)
$var
[
'res'
];
Tests/Dumper/HtmlDumperTest.php