Skip to content

Commit d73788e

Browse files
committed
Fixed extension panicing with invalid string
1 parent e5a092d commit d73788e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/php/types/zval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<'a> Zval {
7777
unsafe {
7878
let len = (*self.value.str_).len;
7979
let ptr = (*self.value.str_).val.as_ptr() as *const u8;
80-
let _str = std::str::from_utf8(slice::from_raw_parts(ptr, len as usize)).unwrap();
80+
let _str = std::str::from_utf8(slice::from_raw_parts(ptr, len as usize)).ok()?;
8181

8282
Some(_str.to_string())
8383
}

0 commit comments

Comments
 (0)