mirror of
https://github.com/danog/ext-php-rs.git
synced 2024-11-27 04:24:54 +01:00
Fixed incorrect build ID not letting extension run (#15)
This commit is contained in:
parent
8685b1bf1d
commit
68aecf5816
@ -1,4 +1,4 @@
|
||||
use crate::bindings::{ZEND_BUILD_TS, ZEND_MODULE_API_NO};
|
||||
use crate::bindings::{ZEND_BUILD_TS, ZEND_MODULE_API_NO, ZEND_BUILD_DEBUG, ZEND_BUILD_SYSTEM, ZEND_BUILD_EXTRA};
|
||||
use std::ffi::{CStr, CString};
|
||||
|
||||
/// Takes a Rust string object, converts it into a C string
|
||||
@ -38,9 +38,15 @@ pub(crate) fn build_id() -> String {
|
||||
// UNSAFE: reading a constant which has been translated from C, only reading and not
|
||||
// modifying.
|
||||
let zend_build_ts = unsafe { CStr::from_ptr(ZEND_BUILD_TS.as_ptr() as *const i8) };
|
||||
let zend_build_debug = unsafe { CStr::from_ptr(ZEND_BUILD_DEBUG.as_ptr() as *const i8) };
|
||||
let zend_build_system = unsafe { CStr::from_ptr(ZEND_BUILD_SYSTEM.as_ptr() as *const i8) };
|
||||
let zend_build_extra = unsafe { CStr::from_ptr(ZEND_BUILD_EXTRA.as_ptr() as *const i8) };
|
||||
format!(
|
||||
"API{}{}",
|
||||
"API{}{}{}{}{}",
|
||||
ZEND_MODULE_API_NO,
|
||||
zend_build_ts.to_str().unwrap()
|
||||
zend_build_ts.to_str().unwrap(),
|
||||
zend_build_debug.to_str().unwrap(),
|
||||
zend_build_system.to_str().unwrap(),
|
||||
zend_build_extra.to_str().unwrap()
|
||||
)
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
#include "php.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "zend_extensions.h"
|
||||
#include "zend_exceptions.h"
|
||||
|
||||
// Need to define these as empty strings to ensure that
|
||||
// bindgen generates them.
|
||||
#define ZEND_BUILD_DEBUG ""
|
||||
#define ZEND_BUILD_SYSTEM ""
|
||||
#define ZEND_BUILD_EXTRA ""
|
||||
|
Loading…
Reference in New Issue
Block a user