diff options
Diffstat (limited to 'crates/shirabe-php-shim')
| -rw-r--r-- | crates/shirabe-php-shim/src/var.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/shirabe-php-shim/src/var.rs b/crates/shirabe-php-shim/src/var.rs index 3fba9d6..f0e55d5 100644 --- a/crates/shirabe-php-shim/src/var.rs +++ b/crates/shirabe-php-shim/src/var.rs @@ -443,6 +443,11 @@ fn var_export_string(s: &str) -> String { let mut out = String::with_capacity(s.len() + 2); out.push('\''); for c in s.chars() { + // PHP var_export breaks NUL bytes out of the single-quoted literal as `' . "\0" . '`. + if c == '\0' { + out.push_str("' . \"\\0\" . '"); + continue; + } if c == '\'' || c == '\\' { out.push('\\'); } |
