Skip to content

Commit d0eb529

Browse files
committed
feat(error): deprecate E_USER_ERROR in PHP 8.4
Refs: #476
1 parent 3ed3ba4 commit d0eb529

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/embed/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ mod sapi;
1010

1111
use crate::boxed::ZBox;
1212
use crate::ffi::{
13-
_zend_file_handle__bindgen_ty_1, php_execute_script, zend_eval_string, zend_file_handle,
14-
zend_stream_init_filename, ZEND_RESULT_CODE_SUCCESS,
13+
_zend_file_handle__bindgen_ty_1, ZEND_RESULT_CODE_SUCCESS, php_execute_script,
14+
zend_eval_string, zend_file_handle, zend_stream_init_filename,
1515
};
1616
use crate::types::{ZendObject, Zval};
17-
use crate::zend::{panic_wrapper, try_catch, ExecutorGlobals};
18-
use parking_lot::{const_rwlock, RwLock};
19-
use std::ffi::{c_char, c_void, CString, NulError};
20-
use std::panic::{resume_unwind, RefUnwindSafe};
17+
use crate::zend::{ExecutorGlobals, panic_wrapper, try_catch};
18+
use parking_lot::{RwLock, const_rwlock};
19+
use std::ffi::{CString, NulError, c_char, c_void};
20+
use std::panic::{RefUnwindSafe, resume_unwind};
2121
use std::path::Path;
2222
use std::ptr::null_mut;
2323

@@ -287,6 +287,8 @@ mod tests {
287287
#[test]
288288
fn test_eval_bailout() {
289289
Embed::run(|| {
290+
// TODO: For PHP 8.5, this needs to be replaced, as `E_USER_ERROR` is deprecated
291+
// Currently, this seems to still be the best way to trigger a bailout
290292
let result = Embed::eval("trigger_error(\"Fatal error\", E_USER_ERROR);");
291293

292294
assert!(result.is_err());

src/flags.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ bitflags! {
308308
/// Compile warning
309309
const CompileWarning = E_COMPILE_WARNING;
310310
/// User error
311+
#[cfg_attr(php84, deprecated = "`E_USER_ERROR` is deprecated since PHP 8.4. Throw an exception instead.")]
311312
const UserError = E_USER_ERROR;
312313
/// User warning
313314
const UserWarning = E_USER_WARNING;

0 commit comments

Comments
 (0)