Skip to content

Commit a7a7964

Browse files
committed
Upgrade MSRV and dependencies
1 parent 7548f5c commit a7a7964

File tree

15 files changed

+48
-41
lines changed

15 files changed

+48
-41
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ authors = ["PHPER Framework Team", "jmjoy <[email protected]>"]
3030
edition = "2021"
3131
license = "MulanPSL-2.0"
3232
repository = "https://github.com/phper-framework/phper"
33-
rust-version = "1.65"
33+
rust-version = "1.79"
3434

3535
[workspace.dependencies]
3636
phper = { version = "0.13.1", path = "./phper" }

examples/http-client/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ crate-type = ["lib", "cdylib"]
2323

2424
[dependencies]
2525
phper = { workspace = true }
26-
reqwest = { version = "0.11.18", features = ["blocking", "cookies"] }
27-
thiserror = "1.0.43"
26+
reqwest = { version = "0.12.5", features = ["blocking", "cookies"] }
27+
thiserror = "1.0.63"
2828

2929
[dev-dependencies]
3030
phper-test = { workspace = true }

examples/http-server/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ name = "http_server"
2222
crate-type = ["lib", "cdylib"]
2323

2424
[dependencies]
25-
hyper = { version = "0.14.27", features = ["http1", "runtime", "server"] }
26-
axum = "0.6.19"
25+
hyper = { version = "1.4.1", features = ["http1", "server"] }
26+
axum = "0.7.5"
2727
phper = { workspace = true }
28-
thiserror = "1.0.43"
29-
tokio = { version = "1.29.1", features = ["full"] }
30-
reqwest = { version = "0.11.18", features = ["blocking"] }
28+
thiserror = "1.0.63"
29+
tokio = { version = "1.39.2", features = ["full"] }
30+
reqwest = { version = "0.12.5", features = ["blocking"] }
3131

3232
[dev-dependencies]
3333
phper-test = { workspace = true }
34-
reqwest = "0.11.18"
34+
reqwest = "0.12.5"

examples/http-server/src/server.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@
1010

1111
use crate::{errors::HttpServerError, request::new_request_object, response::new_response_object};
1212
use axum::{
13-
body::Body,
13+
body::{self, Body},
1414
http::{Request, Response, StatusCode},
1515
routing::any,
16-
Router, Server,
16+
Router,
1717
};
18-
use hyper::body;
1918
use phper::{
2019
alloc::ToRefOwned,
2120
classes::{ClassEntity, Visibility},
2221
functions::Argument,
2322
values::ZVal,
2423
};
25-
use std::{cell::RefCell, collections::HashMap, net::SocketAddr};
26-
use tokio::runtime::{self};
24+
use std::{cell::RefCell, collections::HashMap, error::Error, net::SocketAddr};
25+
use tokio::{net::TcpListener, runtime};
2726

2827
const HTTP_SERVER_CLASS_NAME: &str = "HttpServer\\HttpServer";
2928

@@ -95,7 +94,9 @@ pub fn make_server_class() -> ClassEntity<()> {
9594
let (parts, body) = req.into_parts();
9695

9796
// Read all request body content.
98-
let body = body::to_bytes(body).await.map_err(HttpServerError::new)?;
97+
let body = body::to_bytes(body, usize::MAX)
98+
.await
99+
.map_err(HttpServerError::new)?;
99100

100101
// Create PHP `HttpServer\HttpRequest` object.
101102
let mut request = new_request_object()?;
@@ -148,9 +149,9 @@ pub fn make_server_class() -> ClassEntity<()> {
148149
);
149150

150151
// Start the http server.
151-
let server = Server::bind(&addr).serve(app.into_make_service());
152-
153-
server.await
152+
let listener = TcpListener::bind(addr).await?;
153+
axum::serve(listener, app).await?;
154+
Ok::<_, Box<dyn Error>>(())
154155
};
155156

156157
// Build the tokio runtime, with the current thread scheduler, block on

phper-doc/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ license = { workspace = true }
2323
phper = { workspace = true }
2424

2525
[dev-dependencies]
26-
thiserror = "1.0.43"
27-
reqwest = { version = "0.11.18", features = ["blocking", "cookies"] }
26+
thiserror = "1.0.63"
27+
reqwest = { version = "0.12.5", features = ["blocking", "cookies"] }

phper-macros/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ license = { workspace = true }
2323
proc-macro = true
2424

2525
[dependencies]
26-
quote = "1.0.31"
27-
syn = { version = "2.0.26", features = ["full"] }
28-
proc-macro2 = "1.0.66"
26+
quote = "1.0.36"
27+
syn = { version = "2.0.72", features = ["full"] }
28+
proc-macro2 = "1.0.86"
2929

3030
[dev-dependencies]
31-
syn = { version = "2.0.26", features = ["full", "extra-traits"] }
31+
syn = { version = "2.0.72", features = ["full", "extra-traits"] }

phper-sys/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ repository = { workspace = true }
2020
license = { workspace = true }
2121

2222
[build-dependencies]
23-
bindgen = "0.69.1"
24-
cc = "1.0.79"
25-
regex = "1.5.6"
23+
bindgen = "0.69.4"
24+
cc = "1.1.7"
25+
regex = "1.10.6"

phper-test/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ license = { workspace = true }
2121

2222
[dependencies]
2323
fastcgi-client = "0.9.0"
24-
libc = "0.2.147"
25-
once_cell = "1.18.0"
24+
libc = "0.2.155"
25+
once_cell = "1.19.0"
2626
phper-macros = { workspace = true }
27-
tempfile = "3.6.0"
28-
tokio = { version = "1.29.1", features = ["full"] }
27+
tempfile = "3.11.0"
28+
tokio = { version = "1.39.2", features = ["full"] }
2929

3030
[package.metadata.docs.rs]
3131
rustdoc-args = ["--cfg", "docsrs"]

phper-test/src/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use tempfile::NamedTempFile;
2222

2323
pub struct Context {
2424
pub php_bin: String,
25+
#[allow(dead_code)]
2526
pub ini_content: String,
2627
}
2728

phper/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ repository = { workspace = true }
2222
license = { workspace = true }
2323

2424
[dependencies]
25-
derive_more = "0.99.17"
26-
indexmap = "2.0.0"
27-
once_cell = "1.18.0"
25+
derive_more = "0.99.18"
26+
indexmap = "2.3.0"
27+
once_cell = "1.19.0"
2828
phper-alloc = { workspace = true }
2929
phper-macros = { workspace = true }
3030
phper-sys = { workspace = true }
31-
thiserror = "1.0.43"
31+
thiserror = "1.0.63"
3232

3333
[build-dependencies]
3434
phper-build = { workspace = true }

phper/src/functions.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use phper_alloc::ToRefOwned;
2525
use std::{
2626
ffi::{CStr, CString},
2727
marker::PhantomData,
28-
mem::{transmute, zeroed},
28+
mem::{transmute, zeroed, ManuallyDrop},
2929
ptr::{self, null_mut},
3030
rc::Rc,
3131
};
@@ -473,7 +473,11 @@ unsafe extern "C" fn invoke(execute_data: *mut zend_execute_data, return_value:
473473
let mut arguments = execute_data.get_parameters_array();
474474
let arguments = arguments.as_mut_slice();
475475

476-
handler.call(execute_data, transmute(arguments), return_value);
476+
handler.call(
477+
execute_data,
478+
transmute::<&mut [ManuallyDrop<ZVal>], &mut [ZVal]>(arguments),
479+
return_value,
480+
);
477481
}
478482

479483
/// Call user function by name.

phper/src/modules.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ impl Module {
193193

194194
/// Register class to module.
195195
pub fn add_class<T>(&mut self, class: ClassEntity<T>) {
196-
self.class_entities.push(unsafe { transmute(class) });
196+
self.class_entities
197+
.push(unsafe { transmute::<ClassEntity<T>, ClassEntity<()>>(class) });
197198
}
198199

199200
/// Register interface to module.

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
# See the Mulan PSL v2 for more details.
1010

1111
[toolchain]
12-
channel = "1.65"
12+
channel = "1.79"
1313
components = ["clippy", "rustfmt"]

tests/integration/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ license = { workspace = true }
2121
crate-type = ["lib", "cdylib"]
2222

2323
[dependencies]
24-
indexmap = "2.0.0"
24+
indexmap = "2.3.0"
2525
phper = { workspace = true }
2626

2727
[dev-dependencies]

tests/integration/src/classes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn integrate_foo(module: &mut Module) {
104104
.add_method("offsetExists", Visibility::Public, |this, arguments| {
105105
let offset = arguments[0].expect_long()?;
106106
let state = this.as_state();
107-
Ok::<_, phper::Error>(state.array.get(&offset).is_some())
107+
Ok::<_, phper::Error>(state.array.contains_key(&offset))
108108
})
109109
.argument(Argument::by_val("offset"));
110110

0 commit comments

Comments
 (0)