Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/zts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:zts
FROM php:8.1-zts

WORKDIR /tmp

Expand Down
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## Version 0.9.0

- ci+docs: honour PHP_CONFIG & rebuild automatically when env vars change by @julius [#210]
- chore: Update generated FFI bindings with bindgen 0.63 by @ptondereau [#211]

**BC changes**
- feat: allows ZendStr to contain null bytes by @julius [#202]

**Migration**
See: [#202]

[#202]: https://github.com/davidcole1340/ext-php-rs/pull/202
[#210]: https://github.com/davidcole1340/ext-php-rs/pull/210
[#211]: https://github.com/davidcole1340/ext-php-rs/pull/211


## Version 0.8.3

- build: Check docs warnings in CI by @davidcole1340 in [#180]
- fix: Fixes inifinte loop in ClassEntry::instance_of() by @ju1ius in [#188]
- fix: Fix binary slice lifetimes by @davidcole1340 in [#181]
- build: Fixes CI workflow configuration by @ju1ius in [#195]
- feat: Add get_id() and hash() methods on ZendObject by @ju1ius in [#196]
- docs: Describes restrictions on generic parameters for `php_class` by @ju1ius in [#194]
- feat: Add instance_of() and get_class_entry() methods on ZendObject by @ju1ius in [#197]

[#180]: https://github.com/davidcole1340/ext-php-rs/pull/180
[#188]: https://github.com/davidcole1340/ext-php-rs/pull/188
[#181]: https://github.com/davidcole1340/ext-php-rs/pull/181
[#195]: https://github.com/davidcole1340/ext-php-rs/pull/195
[#196]: https://github.com/davidcole1340/ext-php-rs/pull/196
[#194]: https://github.com/davidcole1340/ext-php-rs/pull/194
[#197]: https://github.com/davidcole1340/ext-php-rs/pull/197

## Version 0.8.2

- Update changelog for latest versions by @striezel in [#161]
Expand Down
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repository = "https://github.com/davidcole1340/ext-php-rs"
homepage = "https://github.com/davidcole1340/ext-php-rs"
license = "MIT OR Apache-2.0"
keywords = ["php", "ffi", "zend"]
version = "0.8.3"
version = "0.9.0"
authors = ["David Cole <david.cole1340@gmail.com>"]
edition = "2018"
categories = ["api-bindings"]
Expand All @@ -17,15 +17,14 @@ parking_lot = "0.12.1"
cfg-if = "1.0"
once_cell = "1.8.0"
anyhow = { version = "1", optional = true }
ext-php-rs-derive = { version = "=0.8.2", path = "./crates/macros" }
ext-php-rs-derive = { version = "=0.9.0", path = "./crates/macros" }

[dev-dependencies]
skeptic = "0.13"

[build-dependencies]
anyhow = "1"
# bindgen = { version = "0.59" }
bindgen = "0.60"
bindgen = "0.63"
cc = "1.0"
skeptic = "0.13"

Expand Down
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ fn main() -> Result<()> {
println!("cargo:rerun-if-env-changed={}", env_var);
}

println!("cargo:rerun-if-changed=build.rs");

// docs.rs runners only have PHP 7.4 - use pre-generated bindings
if env::var("DOCS_RS").is_ok() {
println!("cargo:warning=docs.rs detected - using stub bindings");
Expand Down
2 changes: 1 addition & 1 deletion crates/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "Derive macros for ext-php-rs."
repository = "https://github.com/davidcole1340/ext-php-rs"
homepage = "https://github.com/davidcole1340/ext-php-rs"
license = "MIT OR Apache-2.0"
version = "0.8.2"
version = "0.9.0"
authors = ["David Cole <david.cole1340@gmail.com>"]
edition = "2018"

Expand Down
57 changes: 34 additions & 23 deletions docsrs_bindings.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.60.1 */
/* automatically generated by rust-bindgen 0.63.0 */

pub const ZEND_DEBUG: u32 = 1;
pub const _ZEND_TYPE_NAME_BIT: u32 = 16777216;
Expand Down Expand Up @@ -88,8 +88,11 @@ pub const CONST_CS: u32 = 0;
pub const CONST_PERSISTENT: u32 = 1;
pub const CONST_NO_FILE_CACHE: u32 = 2;
pub const CONST_DEPRECATED: u32 = 4;
pub type __darwin_size_t = ::std::os::raw::c_ulong;
pub type size_t = __darwin_size_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __sigset_t {
pub __val: [::std::os::raw::c_ulong; 16usize],
}
pub type zend_long = i64;
pub type zend_ulong = u64;
pub type zend_uchar = ::std::os::raw::c_uchar;
Expand Down Expand Up @@ -200,7 +203,7 @@ pub struct _zend_refcounted {
pub struct _zend_string {
pub gc: zend_refcounted_h,
pub h: zend_ulong,
pub len: size_t,
pub len: usize,
pub val: [::std::os::raw::c_char; 1usize],
}
#[repr(C)]
Expand Down Expand Up @@ -282,7 +285,7 @@ pub struct _zend_ast_ref {
}
extern "C" {
pub fn _emalloc(
size: size_t,
size: usize,
__zend_filename: *const ::std::os::raw::c_char,
__zend_lineno: u32,
__zend_orig_filename: *const ::std::os::raw::c_char,
Expand All @@ -299,12 +302,12 @@ extern "C" {
);
}
extern "C" {
pub fn __zend_malloc(len: size_t) -> *mut ::std::os::raw::c_void;
pub fn __zend_malloc(len: usize) -> *mut ::std::os::raw::c_void;
}
pub type zend_string_init_interned_func_t = ::std::option::Option<
unsafe extern "C" fn(
str_: *const ::std::os::raw::c_char,
size: size_t,
size: usize,
permanent: bool,
) -> *mut zend_string,
>;
Expand All @@ -318,7 +321,7 @@ extern "C" {
pub fn zend_hash_str_update(
ht: *mut HashTable,
key: *const ::std::os::raw::c_char,
len: size_t,
len: usize,
pData: *mut zval,
) -> *mut zval;
}
Expand All @@ -333,7 +336,7 @@ extern "C" {
pub fn zend_hash_str_del(
ht: *mut HashTable,
key: *const ::std::os::raw::c_char,
len: size_t,
len: usize,
) -> zend_result;
}
extern "C" {
Expand All @@ -343,7 +346,7 @@ extern "C" {
pub fn zend_hash_str_find(
ht: *const HashTable,
key: *const ::std::os::raw::c_char,
len: size_t,
len: usize,
) -> *mut zval;
}
extern "C" {
Expand Down Expand Up @@ -546,7 +549,7 @@ pub struct _zend_class_entry {
unsafe extern "C" fn(
object: *mut zval,
buffer: *mut *mut ::std::os::raw::c_uchar,
buf_len: *mut size_t,
buf_len: *mut usize,
data: *mut zend_serialize_data,
) -> ::std::os::raw::c_int,
>,
Expand All @@ -555,7 +558,7 @@ pub struct _zend_class_entry {
object: *mut zval,
ce: *mut zend_class_entry,
buf: *const ::std::os::raw::c_uchar,
buf_len: size_t,
buf_len: usize,
data: *mut zend_unserialize_data,
) -> ::std::os::raw::c_int,
>,
Expand Down Expand Up @@ -980,7 +983,15 @@ pub struct _zend_execute_data {
pub run_time_cache: *mut *mut ::std::os::raw::c_void,
pub extra_named_params: *mut zend_array,
}
pub type sigjmp_buf = [::std::os::raw::c_int; 49usize];
pub type __jmp_buf = [::std::os::raw::c_long; 8usize];
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __jmp_buf_tag {
pub __jmpbuf: __jmp_buf,
pub __mask_was_saved: ::std::os::raw::c_int,
pub __saved_mask: __sigset_t,
}
pub type jmp_buf = [__jmp_buf_tag; 1usize];
pub type zend_executor_globals = _zend_executor_globals;
extern "C" {
pub static mut executor_globals: zend_executor_globals;
Expand Down Expand Up @@ -1041,7 +1052,7 @@ pub struct _zend_executor_globals {
pub symtable_cache_ptr: *mut *mut zend_array,
pub symbol_table: zend_array,
pub included_files: HashTable,
pub bailout: *mut sigjmp_buf,
pub bailout: *mut jmp_buf,
pub error_reporting: ::std::os::raw::c_int,
pub exit_status: ::std::os::raw::c_int,
pub function_table: *mut HashTable,
Expand All @@ -1050,7 +1061,7 @@ pub struct _zend_executor_globals {
pub vm_stack_top: *mut zval,
pub vm_stack_end: *mut zval,
pub vm_stack: zend_vm_stack,
pub vm_stack_page_size: size_t,
pub vm_stack_page_size: usize,
pub current_execute_data: *mut _zend_execute_data,
pub fake_scope: *mut zend_class_entry,
pub jit_trace_num: u32,
Expand Down Expand Up @@ -1147,7 +1158,7 @@ pub struct _zend_module_entry {
>,
pub info_func: ::std::option::Option<unsafe extern "C" fn(zend_module: *mut zend_module_entry)>,
pub version: *const ::std::os::raw::c_char,
pub globals_size: size_t,
pub globals_size: usize,
pub globals_ptr: *mut ::std::os::raw::c_void,
pub globals_ctor:
::std::option::Option<unsafe extern "C" fn(global: *mut ::std::os::raw::c_void)>,
Expand Down Expand Up @@ -1209,7 +1220,7 @@ extern "C" {
pub fn zend_declare_property(
ce: *mut zend_class_entry,
name: *const ::std::os::raw::c_char,
name_length: size_t,
name_length: usize,
property: *mut zval,
access_type: ::std::os::raw::c_int,
);
Expand All @@ -1218,7 +1229,7 @@ extern "C" {
pub fn zend_declare_class_constant(
ce: *mut zend_class_entry,
name: *const ::std::os::raw::c_char,
name_length: size_t,
name_length: usize,
value: *mut zval,
);
}
Expand Down Expand Up @@ -1284,7 +1295,7 @@ extern "C" {
pub fn zend_wrong_parameters_count_error(min_num_args: u32, max_num_args: u32);
}
extern "C" {
pub fn php_printf(format: *const ::std::os::raw::c_char, ...) -> size_t;
pub fn php_printf(format: *const ::std::os::raw::c_char, ...) -> usize;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
Expand Down Expand Up @@ -1316,7 +1327,7 @@ pub struct _zend_ini_entry {
extern "C" {
pub fn zend_register_bool_constant(
name: *const ::std::os::raw::c_char,
name_len: size_t,
name_len: usize,
bval: bool,
flags: ::std::os::raw::c_int,
module_number: ::std::os::raw::c_int,
Expand All @@ -1325,7 +1336,7 @@ extern "C" {
extern "C" {
pub fn zend_register_long_constant(
name: *const ::std::os::raw::c_char,
name_len: size_t,
name_len: usize,
lval: zend_long,
flags: ::std::os::raw::c_int,
module_number: ::std::os::raw::c_int,
Expand All @@ -1334,7 +1345,7 @@ extern "C" {
extern "C" {
pub fn zend_register_double_constant(
name: *const ::std::os::raw::c_char,
name_len: size_t,
name_len: usize,
dval: f64,
flags: ::std::os::raw::c_int,
module_number: ::std::os::raw::c_int,
Expand All @@ -1343,7 +1354,7 @@ extern "C" {
extern "C" {
pub fn zend_register_string_constant(
name: *const ::std::os::raw::c_char,
name_len: size_t,
name_len: usize,
strval: *const ::std::os::raw::c_char,
flags: ::std::os::raw::c_int,
module_number: ::std::os::raw::c_int,
Expand Down
2 changes: 1 addition & 1 deletion guide/src/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cd php-src
git checkout PHP-8.1
./buildconf
PREFIX="${HOME}/build/php"
.configure --prefix="${PREFIX}" \
./configure --prefix="${PREFIX}" \
--enable-debug \
--disable-all --disable-cgi
make -j "$(nproc)"
Expand Down
2 changes: 1 addition & 1 deletion src/builders/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ impl ClassBuilder {
zend_declare_class_constant(
class,
CString::new(name.as_str())?.as_ptr(),
name.len() as u64,
name.len(),
value,
)
};
Expand Down
9 changes: 1 addition & 8 deletions src/types/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,7 @@ impl ZendHashTable {
V: IntoZval,
{
let mut val = val.into_zval(false)?;
unsafe {
zend_hash_str_update(
self,
CString::new(key)?.as_ptr(),
key.len() as u64,
&mut val,
)
};
unsafe { zend_hash_str_update(self, CString::new(key)?.as_ptr(), key.len(), &mut val) };
val.release();
Ok(())
}
Expand Down