diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4ae778c..5590792 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,26 +17,42 @@ jobs: target: x86_64-unknown-linux-gnu platform: linux/amd64 php-version: '8.0' + distro: bullseye - target: aarch64-unknown-linux-gnu platform: linux/arm64 php-version: '8.0' + distro: bullseye - target: x86_64-unknown-linux-gnu platform: linux/amd64 php-version: '8.1' + distro: bookworm - target: aarch64-unknown-linux-gnu platform: linux/arm64 php-version: '8.1' + distro: bookworm - target: x86_64-unknown-linux-gnu platform: linux/amd64 php-version: '8.2' + distro: bookworm - target: aarch64-unknown-linux-gnu platform: linux/arm64 php-version: '8.2' + distro: bookworm + - + target: aarch64-unknown-linux-gnu + platform: linux/arm64 + php-version: '8.3' + distro: bookworm + - + target: aarch64-unknown-linux-gnu + platform: linux/amd64 + php-version: '8.3' + distro: bookworm steps: - name: Checkout uses: actions/checkout@v1 @@ -67,6 +83,7 @@ jobs: tags: localhost:5000/phpv8js-build:latest build-args: | FROM_PHP=${{ matrix.php-version }} + FROM_DISTRO=${{ matrix.distro }} - run: mkdir ~/.cargo-registry @@ -112,6 +129,12 @@ jobs: - target: x86_64-apple-darwin php-version: '8.2' + - + target: aarch64-apple-darwin + php-version: '8.3' + - + target: x86_64-apple-darwin + php-version: '8.3' steps: - name: Checkout uses: actions/checkout@v1 @@ -124,7 +147,7 @@ jobs: default: true override: true - name: Setup PHP version - run: brew install php@${{ matrix.php-version }} && brew unlink php && brew link --force php@${{ matrix.php-version }} + run: brew tap shivammathur/php && brew install shivammathur/php/php@${{ matrix.php-version }} && brew unlink php && brew link --force shivammathur/php/php@${{ matrix.php-version }} - name: Build uses: actions-rs/cargo@v1 diff --git a/Cargo.lock b/Cargo.lock index 182debc..d4da472 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,23 +46,24 @@ checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" [[package]] name = "bindgen" -version = "0.63.0" +version = "0.68.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885" +checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" dependencies = [ - "bitflags", + "bitflags 2.4.1", "cexpr", "clang-sys", "lazy_static", "lazycell", "log", "peeking_take_while", + "prettyplease", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn", + "syn 2.0.39", "which", ] @@ -72,6 +73,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "block-buffer" version = "0.10.3" @@ -269,7 +276,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 1.0.107", ] [[package]] @@ -280,7 +287,7 @@ checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" dependencies = [ "darling_core", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -311,13 +318,13 @@ dependencies = [ [[package]] name = "ext-php-rs" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def7d5719d19e668640a49c8b6adc82d12c4beb7393ec315d1fe7b6d32d571e4" +checksum = "6429125ec633778d4c6d6ebf2fac9105d9d904d02b445208ea00b71e6c9d2ca7" dependencies = [ "anyhow", "bindgen", - "bitflags", + "bitflags 2.4.1", "cc", "cfg-if", "ext-php-rs-derive", @@ -331,9 +338,9 @@ dependencies = [ [[package]] name = "ext-php-rs-derive" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88979a9b357bdd9b8ffea208133f0bd0fa7e4d4e18bed3242335ed7b27033cf2" +checksum = "6c10abd08571f7d63177a21de9a291a28c21b0d65df8ffb3e9cb1fc4b0722d69" dependencies = [ "anyhow", "darling", @@ -341,7 +348,7 @@ dependencies = [ "lazy_static", "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -567,9 +574,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.8.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -583,7 +590,7 @@ version = "0.10.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "foreign-types", "libc", @@ -600,7 +607,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -686,11 +693,21 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +[[package]] +name = "prettyplease" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +dependencies = [ + "proc-macro2", + "syn 2.0.39", +] + [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] @@ -701,16 +718,16 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "memchr", "unicase", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -727,7 +744,7 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -796,7 +813,7 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -839,7 +856,7 @@ checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -925,6 +942,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.3.0" @@ -1048,7 +1076,7 @@ version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "684e95fe02e0acfeaf630df3a1623f6ad02145f9a92c54ceae8a1923319d3273" dependencies = [ - "bitflags", + "bitflags 1.3.2", "fslock", "lazy_static", "libc", @@ -1057,7 +1085,7 @@ dependencies = [ [[package]] name = "v8js" -version = "0.1.0" +version = "0.5.0" dependencies = [ "ext-php-rs", "v8", diff --git a/Cargo.toml b/Cargo.toml index 36c4861..0bb724f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "v8js" -version = "0.1.0" +version = "0.5.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ext-php-rs = "0.10.0" +ext-php-rs = "0.11.1" v8 = "0.38.1" [lib] diff --git a/src/lib.rs b/src/lib.rs index f901a2b..1e44c8b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -104,20 +104,12 @@ pub fn js_value_from_zval<'a>( let zend_array = zval.array().unwrap(); let mut values: Vec> = Vec::new(); let mut keys: Vec> = Vec::new(); - let mut has_string_keys = false; - for (index, key, elem) in zend_array.iter() { - let key = match key { - Some(key) => { - has_string_keys = true; - key - } - None => index.to_string(), - }; - keys.push(v8::String::new(scope, key.as_str()).unwrap().into()); + for (key, elem) in zend_array.iter() { + keys.push(v8::String::new(scope, key.to_string().as_str()).unwrap().into()); values.push(js_value_from_zval(scope, elem)); } - if has_string_keys { + if ! zend_array.has_numerical_keys() { let null: v8::Local = v8::null(scope).into(); return v8::Object::with_prototype_and_properties(scope, null, &keys[..], &values[..]) .into();