Skip to content

Commit ab03fa7

Browse files
authored
Fix phpinfo segfaults (#183)
1 parent 1ab3c17 commit ab03fa7

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

phper/src/modules.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ unsafe extern "C" fn module_info(zend_module: *mut zend_module_entry) {
113113

114114
php_info_print_table_start();
115115
if !module.version.as_bytes().is_empty() {
116-
php_info_print_table_row(2, c"version", module.version.as_ptr());
116+
php_info_print_table_row(2, c"version".as_ptr(), module.version.as_ptr());
117117
}
118118
if !module.author.as_bytes().is_empty() {
119-
php_info_print_table_row(2, c"authors", module.author.as_ptr());
119+
php_info_print_table_row(2, c"authors".as_ptr(), module.author.as_ptr());
120120
}
121121
for (key, value) in &module.infos {
122122
php_info_print_table_row(2, key.as_ptr(), value.as_ptr());

tests/integration/tests/integration.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ fn test_cli() {
2929
"integration",
3030
),
3131
&[
32+
&tests_php_dir.join("phpinfo.php"),
3233
&tests_php_dir.join("arguments.php"),
3334
&tests_php_dir.join("arrays.php"),
3435
&tests_php_dir.join("classes.php"),
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
// Copyright (c) 2022 PHPER Framework Team
4+
// PHPER is licensed under Mulan PSL v2.
5+
// You can use this software according to the terms and conditions of the Mulan
6+
// PSL v2. You may obtain a copy of Mulan PSL v2 at:
7+
// http://license.coscl.org.cn/MulanPSL2
8+
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
9+
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
10+
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11+
// See the Mulan PSL v2 for more details.
12+
13+
phpinfo();

0 commit comments

Comments
 (0)