From 6965f4a198982649c1c3766adc0a74d7c9610b0a Mon Sep 17 00:00:00 2001 From: Pierre Tondereau Date: Sun, 11 Dec 2022 22:10:25 +0100 Subject: [PATCH] Prepare v0.9.0 (#211) --- .github/actions/zts/Dockerfile | 2 +- CHANGELOG.md | 34 ++++++++++++++ Cargo.toml | 7 ++- build.rs | 2 + crates/macros/Cargo.toml | 2 +- docsrs_bindings.rs | 57 ++++++++++++++--------- guide/src/getting-started/installation.md | 2 +- src/builders/class.rs | 2 +- src/types/array.rs | 9 +--- 9 files changed, 78 insertions(+), 39 deletions(-) diff --git a/.github/actions/zts/Dockerfile b/.github/actions/zts/Dockerfile index 75c6ffce31..1a87d082a6 100644 --- a/.github/actions/zts/Dockerfile +++ b/.github/actions/zts/Dockerfile @@ -1,4 +1,4 @@ -FROM php:zts +FROM php:8.1-zts WORKDIR /tmp diff --git a/CHANGELOG.md b/CHANGELOG.md index 047fad472e..37c0a3ce47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/Cargo.toml b/Cargo.toml index a0ca45e765..874409301f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 "] edition = "2018" categories = ["api-bindings"] @@ -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" diff --git a/build.rs b/build.rs index 8a06ba2ea6..c2c5b9e564 100644 --- a/build.rs +++ b/build.rs @@ -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"); diff --git a/crates/macros/Cargo.toml b/crates/macros/Cargo.toml index 8137816f71..dadcb83dec 100644 --- a/crates/macros/Cargo.toml +++ b/crates/macros/Cargo.toml @@ -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 "] edition = "2018" diff --git a/docsrs_bindings.rs b/docsrs_bindings.rs index 0971cc57be..ff121e3fc7 100644 --- a/docsrs_bindings.rs +++ b/docsrs_bindings.rs @@ -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; @@ -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; @@ -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)] @@ -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, @@ -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, >; @@ -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; } @@ -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" { @@ -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" { @@ -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, >, @@ -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, >, @@ -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; @@ -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, @@ -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, @@ -1147,7 +1158,7 @@ pub struct _zend_module_entry { >, pub info_func: ::std::option::Option, 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, @@ -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, ); @@ -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, ); } @@ -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)] @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/guide/src/getting-started/installation.md b/guide/src/getting-started/installation.md index f3089f6d11..d286c34751 100644 --- a/guide/src/getting-started/installation.md +++ b/guide/src/getting-started/installation.md @@ -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)" diff --git a/src/builders/class.rs b/src/builders/class.rs index b249506e9a..76094455e5 100644 --- a/src/builders/class.rs +++ b/src/builders/class.rs @@ -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, ) }; diff --git a/src/types/array.rs b/src/types/array.rs index d39105e497..cfd99cda2f 100644 --- a/src/types/array.rs +++ b/src/types/array.rs @@ -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(()) }