Skip to content

Commit 775d004

Browse files
committed
Check offset in camelize
1 parent fe26644 commit 775d004

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Stringy.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ public function camelize()
139139
$stringy->str = preg_replace_callback(
140140
'/[-_\s]+(.)?/u',
141141
function ($match) use ($encoding) {
142-
return $match[1] ? mb_strtoupper($match[1], $encoding) : '';
142+
if (isset($match[1])) {
143+
return mb_strtoupper($match[1], $encoding);
144+
} else {
145+
return '';
146+
}
143147
},
144148
$stringy->str
145149
);

0 commit comments

Comments
 (0)