diff --git a/CHANGELOG.md b/CHANGELOG.md index 06367a4385..6429752a66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,10 @@ - `PhpException` no longer requires a lifetime [#80]. - Added `PhpException` and `PhpResult` to prelude [#80]. +- Fixed `ZendString` missing last character [#82]. [#80]: https://github.com/davidcole1340/ext-php-rs/pull/80 +[#82]: https://github.com/davidcole1340/ext-php-rs/pull/82 ## Version 0.5.0 diff --git a/src/php/types/string.rs b/src/php/types/string.rs index aae92f4392..8c5e7f75c7 100644 --- a/src/php/types/string.rs +++ b/src/php/types/string.rs @@ -54,7 +54,7 @@ impl ZendStr { pub fn as_c_str(&self) -> &CStr { // SAFETY: Zend strings store their readable length in a fat pointer. unsafe { - let slice = slice::from_raw_parts(self.val.as_ptr() as *const u8, self.len()); + let slice = slice::from_raw_parts(self.val.as_ptr() as *const u8, self.len() + 1); CStr::from_bytes_with_nul_unchecked(slice) } }