├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── Readme.md ├── src ├── attach.rs ├── debuginfo.rs ├── main.rs ├── php56.rs ├── php72.rs ├── php73.rs └── process_reader.rs └── wrapper.h /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | **/*.rs.bk 3 | /ref/ 4 | .vscode 5 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "aho-corasick" 5 | version = "0.7.10" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | dependencies = [ 8 | "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 9 | ] 10 | 11 | [[package]] 12 | name = "ansi_term" 13 | version = "0.11.0" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | dependencies = [ 16 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 17 | ] 18 | 19 | [[package]] 20 | name = "atty" 21 | version = "0.2.11" 22 | source = "registry+https://github.com/rust-lang/crates.io-index" 23 | dependencies = [ 24 | "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", 25 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 26 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 27 | ] 28 | 29 | [[package]] 30 | name = "bitflags" 31 | version = "1.0.4" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | 34 | [[package]] 35 | name = "cfg-if" 36 | version = "0.1.6" 37 | source = "registry+https://github.com/rust-lang/crates.io-index" 38 | 39 | [[package]] 40 | name = "clap" 41 | version = "2.33.0" 42 | source = "registry+https://github.com/rust-lang/crates.io-index" 43 | dependencies = [ 44 | "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 45 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 46 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 47 | "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 48 | "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 49 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 50 | "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 51 | ] 52 | 53 | [[package]] 54 | name = "kernel32-sys" 55 | version = "0.2.2" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | dependencies = [ 58 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 59 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 60 | ] 61 | 62 | [[package]] 63 | name = "lazy_static" 64 | version = "1.2.0" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | 67 | [[package]] 68 | name = "libc" 69 | version = "0.2.69" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | 72 | [[package]] 73 | name = "log" 74 | version = "0.3.9" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | dependencies = [ 77 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 78 | ] 79 | 80 | [[package]] 81 | name = "log" 82 | version = "0.4.6" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | dependencies = [ 85 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 86 | ] 87 | 88 | [[package]] 89 | name = "mach" 90 | version = "0.0.5" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | dependencies = [ 93 | "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", 94 | ] 95 | 96 | [[package]] 97 | name = "memchr" 98 | version = "2.3.3" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | 101 | [[package]] 102 | name = "php-stacktrace" 103 | version = "0.1.2" 104 | dependencies = [ 105 | "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", 106 | "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", 107 | "read-process-memory 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 108 | "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 109 | ] 110 | 111 | [[package]] 112 | name = "read-process-memory" 113 | version = "0.1.2" 114 | source = "registry+https://github.com/rust-lang/crates.io-index" 115 | dependencies = [ 116 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 117 | "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", 118 | "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 119 | "mach 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 120 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 121 | ] 122 | 123 | [[package]] 124 | name = "redox_syscall" 125 | version = "0.1.50" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | 128 | [[package]] 129 | name = "redox_termios" 130 | version = "0.1.1" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | dependencies = [ 133 | "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", 134 | ] 135 | 136 | [[package]] 137 | name = "regex" 138 | version = "1.3.7" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | dependencies = [ 141 | "aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", 142 | "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 143 | "regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", 144 | "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 145 | ] 146 | 147 | [[package]] 148 | name = "regex-syntax" 149 | version = "0.6.17" 150 | source = "registry+https://github.com/rust-lang/crates.io-index" 151 | 152 | [[package]] 153 | name = "strsim" 154 | version = "0.8.0" 155 | source = "registry+https://github.com/rust-lang/crates.io-index" 156 | 157 | [[package]] 158 | name = "termion" 159 | version = "1.5.1" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | dependencies = [ 162 | "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", 163 | "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", 164 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 165 | ] 166 | 167 | [[package]] 168 | name = "textwrap" 169 | version = "0.11.0" 170 | source = "registry+https://github.com/rust-lang/crates.io-index" 171 | dependencies = [ 172 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 173 | ] 174 | 175 | [[package]] 176 | name = "thread_local" 177 | version = "1.0.1" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | dependencies = [ 180 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 181 | ] 182 | 183 | [[package]] 184 | name = "unicode-width" 185 | version = "0.1.5" 186 | source = "registry+https://github.com/rust-lang/crates.io-index" 187 | 188 | [[package]] 189 | name = "vec_map" 190 | version = "0.8.1" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | 193 | [[package]] 194 | name = "winapi" 195 | version = "0.2.8" 196 | source = "registry+https://github.com/rust-lang/crates.io-index" 197 | 198 | [[package]] 199 | name = "winapi" 200 | version = "0.3.6" 201 | source = "registry+https://github.com/rust-lang/crates.io-index" 202 | dependencies = [ 203 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 204 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 205 | ] 206 | 207 | [[package]] 208 | name = "winapi-build" 209 | version = "0.1.1" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | 212 | [[package]] 213 | name = "winapi-i686-pc-windows-gnu" 214 | version = "0.4.0" 215 | source = "registry+https://github.com/rust-lang/crates.io-index" 216 | 217 | [[package]] 218 | name = "winapi-x86_64-pc-windows-gnu" 219 | version = "0.4.0" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | 222 | [metadata] 223 | "checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" 224 | "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 225 | "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" 226 | "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" 227 | "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" 228 | "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" 229 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 230 | "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" 231 | "checksum libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" 232 | "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" 233 | "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" 234 | "checksum mach 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "196697f416cf23cf0d3319cf5b2904811b035c82df1dfec2117fb457699bf277" 235 | "checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" 236 | "checksum read-process-memory 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "950b829b2477880c74aaed706d681bc8d50d4e2b15b5e4d98ed33d5d4f93712e" 237 | "checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" 238 | "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" 239 | "checksum regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692" 240 | "checksum regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" 241 | "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 242 | "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" 243 | "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 244 | "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" 245 | "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 246 | "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" 247 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 248 | "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" 249 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 250 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 251 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 252 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "php-stacktrace" 3 | version = "0.1.2" 4 | authors = ["Oraoto "] 5 | repository = "https://github.com/oraoto/php-stacktrace" 6 | keywords = ["php", "debug", "stacktrace"] 7 | readme = "Readme.md" 8 | license = "MIT" 9 | description = "Read stacktrace from outside PHP process" 10 | edition = "2018" 11 | 12 | [dependencies] 13 | regex = "1.3.6" 14 | read-process-memory = "0.1.2" 15 | libc = "0.2.69" 16 | clap = "2.33.0" 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Oraoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # php-stacktrace 2 | 3 | Read stacktrace from outside PHP process, inspired by [ruby-stacktrace](https://github.com/jvns/ruby-stacktrace). 4 | 5 | # Install 6 | 7 | 1. [Download](https://github.com/oraoto/php-stacktrace/releases) or build `php-stacktrace` from source 8 | 9 | ## Build from source 10 | 11 | Clone and build this project: 12 | 13 | ``` 14 | git clone https://github.com/oraoto/php-stacktrace.git 15 | cd php-stacktrace 16 | cargo build 17 | ``` 18 | 19 | # Usage 20 | 21 | ``` 22 | ./php-stacktrace --help 23 | php-stacktrace 0.2.0 24 | Read stacktrace from outside PHP process 25 | 26 | USAGE: 27 | php-stacktrace [OPTIONS] 28 | 29 | FLAGS: 30 | -h, --help Prints help information 31 | -V, --version Prints version information 32 | 33 | OPTIONS: 34 | -v PHP Version (5.6, 7.2, 7.3) [default: 7.3] 35 | 36 | ARGS: 37 | PID of the PHP process 38 | 39 | ``` 40 | 41 | For a running Laravel queue worker, the output looks like: 42 | 43 | ~~~ 44 | stream_select() 45 | Symfony\Component\Process\Pipes\UnixPipes::readAndWrite() 46 | Symfony\Component\Process\Process::readPipes() 47 | Symfony\Component\Process\Process::wait() 48 | Symfony\Component\Process\Process::run() 49 | Illuminate\Queue\Listener::runProcess() 50 | Illuminate\Queue\Listener::listen() 51 | Illuminate\Queue\Console\ListenCommand::handle() 52 | call_user_func_array() 53 | Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() 54 | Illuminate\Container\Util::unwrapIfClosure() 55 | Illuminate\Container\BoundMethod::callBoundMethod() 56 | Illuminate\Container\BoundMethod::call() 57 | Illuminate\Container\Container::call() 58 | Illuminate\Console\Command::execute() 59 | Symfony\Component\Console\Command\Command::run() 60 | Illuminate\Console\Command::run() 61 | Symfony\Component\Console\Application::doRunCommand() 62 | Symfony\Component\Console\Application::doRun() 63 | Symfony\Component\Console\Application::run() 64 | Illuminate\Console\Application::run() 65 | Laravel\Lumen\Console\Kernel::handle() 66 | main() 67 | Time 124.716µs 68 | ~~~ 69 | -------------------------------------------------------------------------------- /src/attach.rs: -------------------------------------------------------------------------------- 1 | use libc; 2 | use read_process_memory; 3 | 4 | use libc::{c_int, c_long}; 5 | 6 | #[cfg(target_os = "linux")] 7 | extern { 8 | // addr and data should be c_void? 9 | fn ptrace(request: c_int, pid: libc::pid_t, addr: usize, data: usize) -> c_long; 10 | } 11 | 12 | #[cfg(target_os = "linux")] 13 | pub fn attach(pid: read_process_memory::Pid) { 14 | unsafe { 15 | ptrace(0x4206, pid, 0, 0); // PTRACE_SEIZE 16 | ptrace(0x4207, pid, 0, 0); // PTRACE_INTERRUPT 17 | } 18 | } 19 | 20 | #[cfg(target_os = "linux")] 21 | pub fn detach(pid: read_process_memory::Pid) { 22 | unsafe { 23 | ptrace(17, pid, 0, 0); // PTRACE_DETACH 24 | } 25 | } 26 | 27 | #[cfg(not(target_os = "linux"))] 28 | #[allow(dead_code)] 29 | pub fn detach(_: read_process_memory::Pid) { 30 | 31 | } 32 | 33 | #[cfg(not(target_os = "linux"))] 34 | #[allow(dead_code)] 35 | pub fn attach(_: read_process_memory::Pid) { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/debuginfo.rs: -------------------------------------------------------------------------------- 1 | use std; 2 | use std::fs; 3 | use std::fs::File; 4 | use std::io::{self, BufRead}; 5 | use std::process; 6 | use std::process::{Command, Stdio}; 7 | use regex::Regex; 8 | use read_process_memory::*; 9 | 10 | pub fn get_executor_globals_address(pid: Pid) -> usize 11 | where 12 | Pid: TryIntoProcessHandle + std::fmt::Display + Copy, 13 | { 14 | get_maps_address(pid) + get_nm_address(pid) 15 | } 16 | 17 | fn get_nm_address(pid: Pid) -> usize 18 | where 19 | Pid: TryIntoProcessHandle + std::fmt::Display, 20 | { 21 | let nm_command = Command::new("nm") 22 | .arg("-D") 23 | .arg(format!("/proc/{}/exe", pid)) 24 | .stdout(Stdio::piped()) 25 | .stdin(Stdio::null()) 26 | .stderr(Stdio::piped()) 27 | .output() 28 | .unwrap_or_else(|e| panic!("failed to execute process: {}", e)); 29 | if !nm_command.status.success() { 30 | panic!( 31 | "failed to execute process: {}", 32 | String::from_utf8(nm_command.stderr).unwrap() 33 | ) 34 | } 35 | 36 | let nm_output = String::from_utf8(nm_command.stdout).unwrap(); 37 | let re = Regex::new(r"(\w+) [B] executor_globals").unwrap(); 38 | let cap = re.captures(&nm_output).unwrap_or_else(|| { 39 | println!("Cannot find executor_globals in php process"); 40 | process::exit(1) 41 | }); 42 | let address_str = cap.get(1).unwrap().as_str(); 43 | usize::from_str_radix(address_str, 16).unwrap() 44 | } 45 | 46 | fn get_maps_address(pid: Pid) -> usize 47 | where 48 | Pid: TryIntoProcessHandle + std::fmt::Display, 49 | { 50 | let map_path = format!("/proc/{}/maps", pid); 51 | let exe_path = fs::read_link(format!("/proc/{}/exe", pid)).unwrap().to_string_lossy().to_string(); 52 | 53 | let file = File::open(map_path).unwrap(); 54 | for line in io::BufReader::new(file).lines() { 55 | let line = line.unwrap(); 56 | if line.contains(&exe_path) { 57 | let address_str = line.split("-").collect::>()[0]; 58 | return usize::from_str_radix(address_str, 16).unwrap(); 59 | } 60 | } 61 | 0 62 | } 63 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | mod debuginfo; 2 | mod attach; 3 | mod process_reader; 4 | mod php73; 5 | mod php72; 6 | mod php56; 7 | 8 | use read_process_memory::*; 9 | use std::time; 10 | use clap::{App, Arg, ArgMatches}; 11 | use crate::debuginfo::*; 12 | use crate::process_reader::ProcessReader; 13 | 14 | fn create_reader(version: &str, source: ProcessHandle) -> Box 15 | { 16 | if version == "5.6" { 17 | Box::new(process_reader::PHP560{source}) 18 | } else if version == "7.2" { 19 | Box::new(process_reader::PHP720{source}) 20 | } else { 21 | Box::new(process_reader::PHP730{source}) 22 | } 23 | } 24 | 25 | fn main() 26 | { 27 | let matches = parse_args(); 28 | 29 | let pid: Pid = matches.value_of("PID").unwrap().parse().unwrap(); 30 | 31 | let source = pid.try_into_process_handle().unwrap(); 32 | 33 | let addr = get_executor_globals_address(source); 34 | 35 | let php_version = matches.value_of("PHP Version").unwrap(); 36 | let php = create_reader(php_version, source); 37 | 38 | let start_time = time::SystemTime::now().duration_since(time::UNIX_EPOCH).unwrap(); 39 | 40 | attach::attach(pid); 41 | 42 | php.read(addr); 43 | 44 | attach::detach(pid); 45 | 46 | let end_time = time::SystemTime::now().duration_since(time::UNIX_EPOCH).unwrap(); 47 | let dur = end_time - start_time; 48 | println!("Time {:?}", dur); 49 | } 50 | 51 | fn parse_args() -> ArgMatches<'static> { 52 | App::new("php-stacktrace") 53 | .version("0.2.0") 54 | .about("Read stacktrace from outside PHP process") 55 | .arg( 56 | Arg::with_name("PHP Version") 57 | .value_name("php_version") 58 | .short("v") 59 | .help("PHP Version (5.6, 7.2, 7.3)") 60 | .default_value("7.3") 61 | .required(false), 62 | ) 63 | .arg( 64 | Arg::with_name("PID") 65 | .help("PID of the PHP process") 66 | .required(true) 67 | .index(1), 68 | ) 69 | .get_matches() 70 | } 71 | -------------------------------------------------------------------------------- /src/php56.rs: -------------------------------------------------------------------------------- 1 | /* automatically generated by rust-bindgen */ 2 | 3 | #![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, unused)] 4 | 5 | pub type ulong = ::std::os::raw::c_ulong; 6 | pub type uint = ::std::os::raw::c_uint; 7 | #[repr(C)] 8 | #[derive(Debug, Copy, Clone)] 9 | pub struct __sigset_t { 10 | pub __val: [::std::os::raw::c_ulong; 16usize], 11 | } 12 | pub type zend_bool = ::std::os::raw::c_uchar; 13 | pub type zend_uchar = ::std::os::raw::c_uchar; 14 | pub type zend_uint = ::std::os::raw::c_uint; 15 | pub type zend_ulong = ::std::os::raw::c_ulong; 16 | pub type zend_object_handle = ::std::os::raw::c_uint; 17 | pub type zend_object_handlers = _zend_object_handlers; 18 | pub type zval = _zval_struct; 19 | #[repr(C)] 20 | #[derive(Debug, Copy, Clone)] 21 | pub struct _zend_object_value { 22 | pub handle: zend_object_handle, 23 | pub handlers: *const zend_object_handlers, 24 | } 25 | pub type zend_object_value = _zend_object_value; 26 | pub type dtor_func_t = 27 | ::std::option::Option; 28 | #[repr(C)] 29 | #[derive(Debug, Copy, Clone)] 30 | pub struct bucket { 31 | pub h: ulong, 32 | pub nKeyLength: uint, 33 | pub pData: *mut ::std::os::raw::c_void, 34 | pub pDataPtr: *mut ::std::os::raw::c_void, 35 | pub pListNext: *mut bucket, 36 | pub pListLast: *mut bucket, 37 | pub pNext: *mut bucket, 38 | pub pLast: *mut bucket, 39 | pub arKey: *const ::std::os::raw::c_char, 40 | } 41 | pub type Bucket = bucket; 42 | #[repr(C)] 43 | #[derive(Debug, Copy, Clone)] 44 | pub struct _hashtable { 45 | pub nTableSize: uint, 46 | pub nTableMask: uint, 47 | pub nNumOfElements: uint, 48 | pub nNextFreeElement: ulong, 49 | pub pInternalPointer: *mut Bucket, 50 | pub pListHead: *mut Bucket, 51 | pub pListTail: *mut Bucket, 52 | pub arBuckets: *mut *mut Bucket, 53 | pub pDestructor: dtor_func_t, 54 | pub persistent: zend_bool, 55 | pub nApplyCount: ::std::os::raw::c_uchar, 56 | pub bApplyProtection: zend_bool, 57 | } 58 | pub type HashTable = _hashtable; 59 | pub type zend_class_entry = _zend_class_entry; 60 | pub type zend_object_read_property_t = ::std::option::Option< 61 | unsafe extern "C" fn( 62 | object: *mut zval, 63 | member: *mut zval, 64 | type_: ::std::os::raw::c_int, 65 | key: *const _zend_literal, 66 | ) -> *mut zval, 67 | >; 68 | pub type zend_object_read_dimension_t = ::std::option::Option< 69 | unsafe extern "C" fn( 70 | object: *mut zval, 71 | offset: *mut zval, 72 | type_: ::std::os::raw::c_int, 73 | ) -> *mut zval, 74 | >; 75 | pub type zend_object_write_property_t = ::std::option::Option< 76 | unsafe extern "C" fn( 77 | object: *mut zval, 78 | member: *mut zval, 79 | value: *mut zval, 80 | key: *const _zend_literal, 81 | ), 82 | >; 83 | pub type zend_object_write_dimension_t = ::std::option::Option< 84 | unsafe extern "C" fn(object: *mut zval, offset: *mut zval, value: *mut zval), 85 | >; 86 | pub type zend_object_get_property_ptr_ptr_t = ::std::option::Option< 87 | unsafe extern "C" fn( 88 | object: *mut zval, 89 | member: *mut zval, 90 | type_: ::std::os::raw::c_int, 91 | key: *const _zend_literal, 92 | ) -> *mut *mut zval, 93 | >; 94 | pub type zend_object_set_t = 95 | ::std::option::Option; 96 | pub type zend_object_get_t = 97 | ::std::option::Option *mut zval>; 98 | pub type zend_object_has_property_t = ::std::option::Option< 99 | unsafe extern "C" fn( 100 | object: *mut zval, 101 | member: *mut zval, 102 | has_set_exists: ::std::os::raw::c_int, 103 | key: *const _zend_literal, 104 | ) -> ::std::os::raw::c_int, 105 | >; 106 | pub type zend_object_has_dimension_t = ::std::option::Option< 107 | unsafe extern "C" fn( 108 | object: *mut zval, 109 | member: *mut zval, 110 | check_empty: ::std::os::raw::c_int, 111 | ) -> ::std::os::raw::c_int, 112 | >; 113 | pub type zend_object_unset_property_t = ::std::option::Option< 114 | unsafe extern "C" fn(object: *mut zval, member: *mut zval, key: *const _zend_literal), 115 | >; 116 | pub type zend_object_unset_dimension_t = 117 | ::std::option::Option; 118 | pub type zend_object_get_properties_t = 119 | ::std::option::Option *mut HashTable>; 120 | pub type zend_object_get_debug_info_t = ::std::option::Option< 121 | unsafe extern "C" fn(object: *mut zval, is_temp: *mut ::std::os::raw::c_int) -> *mut HashTable, 122 | >; 123 | pub type zend_object_call_method_t = ::std::option::Option< 124 | unsafe extern "C" fn( 125 | method: *const ::std::os::raw::c_char, 126 | ht: ::std::os::raw::c_int, 127 | return_value: *mut zval, 128 | return_value_ptr: *mut *mut zval, 129 | this_ptr: *mut zval, 130 | return_value_used: ::std::os::raw::c_int, 131 | ) -> ::std::os::raw::c_int, 132 | >; 133 | pub type zend_object_get_method_t = ::std::option::Option< 134 | unsafe extern "C" fn( 135 | object_ptr: *mut *mut zval, 136 | method: *mut ::std::os::raw::c_char, 137 | method_len: ::std::os::raw::c_int, 138 | key: *const _zend_literal, 139 | ) -> *mut _zend_function, 140 | >; 141 | pub type zend_object_get_constructor_t = 142 | ::std::option::Option *mut _zend_function>; 143 | pub type zend_object_add_ref_t = ::std::option::Option; 144 | pub type zend_object_del_ref_t = ::std::option::Option; 145 | pub type zend_object_clone_obj_t = 146 | ::std::option::Option zend_object_value>; 147 | pub type zend_object_get_class_entry_t = 148 | ::std::option::Option *mut zend_class_entry>; 149 | pub type zend_object_get_class_name_t = ::std::option::Option< 150 | unsafe extern "C" fn( 151 | object: *const zval, 152 | class_name: *mut *const ::std::os::raw::c_char, 153 | class_name_len: *mut zend_uint, 154 | parent: ::std::os::raw::c_int, 155 | ) -> ::std::os::raw::c_int, 156 | >; 157 | pub type zend_object_compare_t = ::std::option::Option< 158 | unsafe extern "C" fn(object1: *mut zval, object2: *mut zval) -> ::std::os::raw::c_int, 159 | >; 160 | pub type zend_object_compare_zvals_t = ::std::option::Option< 161 | unsafe extern "C" fn(resul: *mut zval, op1: *mut zval, op2: *mut zval) -> ::std::os::raw::c_int, 162 | >; 163 | pub type zend_object_cast_t = ::std::option::Option< 164 | unsafe extern "C" fn( 165 | readobj: *mut zval, 166 | retval: *mut zval, 167 | type_: ::std::os::raw::c_int, 168 | ) -> ::std::os::raw::c_int, 169 | >; 170 | pub type zend_object_count_elements_t = ::std::option::Option< 171 | unsafe extern "C" fn( 172 | object: *mut zval, 173 | count: *mut ::std::os::raw::c_long, 174 | ) -> ::std::os::raw::c_int, 175 | >; 176 | pub type zend_object_get_closure_t = ::std::option::Option< 177 | unsafe extern "C" fn( 178 | obj: *mut zval, 179 | ce_ptr: *mut *mut zend_class_entry, 180 | fptr_ptr: *mut *mut _zend_function, 181 | zobj_ptr: *mut *mut zval, 182 | ) -> ::std::os::raw::c_int, 183 | >; 184 | pub type zend_object_get_gc_t = ::std::option::Option< 185 | unsafe extern "C" fn( 186 | object: *mut zval, 187 | table: *mut *mut *mut zval, 188 | n: *mut ::std::os::raw::c_int, 189 | ) -> *mut HashTable, 190 | >; 191 | pub type zend_object_do_operation_t = ::std::option::Option< 192 | unsafe extern "C" fn( 193 | opcode: zend_uchar, 194 | result: *mut zval, 195 | op1: *mut zval, 196 | op2: *mut zval, 197 | ) -> ::std::os::raw::c_int, 198 | >; 199 | #[repr(C)] 200 | #[derive(Debug, Copy, Clone)] 201 | pub struct _zend_object_handlers { 202 | pub add_ref: zend_object_add_ref_t, 203 | pub del_ref: zend_object_del_ref_t, 204 | pub clone_obj: zend_object_clone_obj_t, 205 | pub read_property: zend_object_read_property_t, 206 | pub write_property: zend_object_write_property_t, 207 | pub read_dimension: zend_object_read_dimension_t, 208 | pub write_dimension: zend_object_write_dimension_t, 209 | pub get_property_ptr_ptr: zend_object_get_property_ptr_ptr_t, 210 | pub get: zend_object_get_t, 211 | pub set: zend_object_set_t, 212 | pub has_property: zend_object_has_property_t, 213 | pub unset_property: zend_object_unset_property_t, 214 | pub has_dimension: zend_object_has_dimension_t, 215 | pub unset_dimension: zend_object_unset_dimension_t, 216 | pub get_properties: zend_object_get_properties_t, 217 | pub get_method: zend_object_get_method_t, 218 | pub call_method: zend_object_call_method_t, 219 | pub get_constructor: zend_object_get_constructor_t, 220 | pub get_class_entry: zend_object_get_class_entry_t, 221 | pub get_class_name: zend_object_get_class_name_t, 222 | pub compare_objects: zend_object_compare_t, 223 | pub cast_object: zend_object_cast_t, 224 | pub count_elements: zend_object_count_elements_t, 225 | pub get_debug_info: zend_object_get_debug_info_t, 226 | pub get_closure: zend_object_get_closure_t, 227 | pub get_gc: zend_object_get_gc_t, 228 | pub do_operation: zend_object_do_operation_t, 229 | pub compare: zend_object_compare_zvals_t, 230 | } 231 | pub type zend_ast = _zend_ast; 232 | #[repr(C)] 233 | #[derive(Copy, Clone)] 234 | pub struct _zend_ast { 235 | pub kind: ::std::os::raw::c_ushort, 236 | pub children: ::std::os::raw::c_ushort, 237 | pub u: _zend_ast__bindgen_ty_1, 238 | } 239 | #[repr(C)] 240 | #[derive(Copy, Clone)] 241 | pub union _zend_ast__bindgen_ty_1 { 242 | pub val: *mut zval, 243 | pub child: *mut zend_ast, 244 | _bindgen_union_align: u64, 245 | } 246 | #[repr(C)] 247 | #[derive(Copy, Clone)] 248 | pub union _zvalue_value { 249 | pub lval: ::std::os::raw::c_long, 250 | pub dval: f64, 251 | pub str: _zvalue_value__bindgen_ty_1, 252 | pub ht: *mut HashTable, 253 | pub obj: zend_object_value, 254 | pub ast: *mut zend_ast, 255 | _bindgen_union_align: [u64; 2usize], 256 | } 257 | #[repr(C)] 258 | #[derive(Debug, Copy, Clone)] 259 | pub struct _zvalue_value__bindgen_ty_1 { 260 | pub val: *mut ::std::os::raw::c_char, 261 | pub len: ::std::os::raw::c_int, 262 | } 263 | pub type zvalue_value = _zvalue_value; 264 | #[repr(C)] 265 | #[derive(Copy, Clone)] 266 | pub struct _zval_struct { 267 | pub value: zvalue_value, 268 | pub refcount__gc: zend_uint, 269 | pub type_: zend_uchar, 270 | pub is_ref__gc: zend_uchar, 271 | } 272 | pub type zend_object_iterator = _zend_object_iterator; 273 | #[repr(C)] 274 | #[derive(Debug, Copy, Clone)] 275 | pub struct _zend_object_iterator_funcs { 276 | pub dtor: ::std::option::Option, 277 | pub valid: ::std::option::Option< 278 | unsafe extern "C" fn(iter: *mut zend_object_iterator) -> ::std::os::raw::c_int, 279 | >, 280 | pub get_current_data: ::std::option::Option< 281 | unsafe extern "C" fn(iter: *mut zend_object_iterator, data: *mut *mut *mut zval), 282 | >, 283 | pub get_current_key: ::std::option::Option< 284 | unsafe extern "C" fn(iter: *mut zend_object_iterator, key: *mut zval), 285 | >, 286 | pub move_forward: ::std::option::Option, 287 | pub rewind: ::std::option::Option, 288 | pub invalidate_current: 289 | ::std::option::Option, 290 | } 291 | pub type zend_object_iterator_funcs = _zend_object_iterator_funcs; 292 | #[repr(C)] 293 | #[derive(Debug, Copy, Clone)] 294 | pub struct _zend_object_iterator { 295 | pub data: *mut ::std::os::raw::c_void, 296 | pub funcs: *mut zend_object_iterator_funcs, 297 | pub index: ulong, 298 | } 299 | #[repr(C)] 300 | #[derive(Debug, Copy, Clone)] 301 | pub struct _zend_class_iterator_funcs { 302 | pub funcs: *mut zend_object_iterator_funcs, 303 | pub zf_new_iterator: *mut _zend_function, 304 | pub zf_valid: *mut _zend_function, 305 | pub zf_current: *mut _zend_function, 306 | pub zf_key: *mut _zend_function, 307 | pub zf_next: *mut _zend_function, 308 | pub zf_rewind: *mut _zend_function, 309 | } 310 | pub type zend_class_iterator_funcs = _zend_class_iterator_funcs; 311 | #[repr(C)] 312 | #[derive(Debug, Copy, Clone)] 313 | pub struct _zend_serialize_data { 314 | _unused: [u8; 0], 315 | } 316 | #[repr(C)] 317 | #[derive(Debug, Copy, Clone)] 318 | pub struct _zend_unserialize_data { 319 | _unused: [u8; 0], 320 | } 321 | pub type zend_serialize_data = _zend_serialize_data; 322 | pub type zend_unserialize_data = _zend_unserialize_data; 323 | #[repr(C)] 324 | #[derive(Debug, Copy, Clone)] 325 | pub struct _zend_trait_method_reference { 326 | pub method_name: *const ::std::os::raw::c_char, 327 | pub mname_len: ::std::os::raw::c_uint, 328 | pub ce: *mut zend_class_entry, 329 | pub class_name: *const ::std::os::raw::c_char, 330 | pub cname_len: ::std::os::raw::c_uint, 331 | } 332 | pub type zend_trait_method_reference = _zend_trait_method_reference; 333 | #[repr(C)] 334 | #[derive(Debug, Copy, Clone)] 335 | pub struct _zend_trait_precedence { 336 | pub trait_method: *mut zend_trait_method_reference, 337 | pub exclude_from_classes: *mut *mut zend_class_entry, 338 | } 339 | pub type zend_trait_precedence = _zend_trait_precedence; 340 | #[repr(C)] 341 | #[derive(Debug, Copy, Clone)] 342 | pub struct _zend_trait_alias { 343 | pub trait_method: *mut zend_trait_method_reference, 344 | #[doc = " name for method to be added"] 345 | pub alias: *const ::std::os::raw::c_char, 346 | pub alias_len: ::std::os::raw::c_uint, 347 | #[doc = " modifiers to be set on trait method"] 348 | pub modifiers: zend_uint, 349 | } 350 | pub type zend_trait_alias = _zend_trait_alias; 351 | #[repr(C)] 352 | #[derive(Copy, Clone)] 353 | pub struct _zend_class_entry { 354 | pub type_: ::std::os::raw::c_char, 355 | pub name: *const ::std::os::raw::c_char, 356 | pub name_length: zend_uint, 357 | pub parent: *mut _zend_class_entry, 358 | pub refcount: ::std::os::raw::c_int, 359 | pub ce_flags: zend_uint, 360 | pub function_table: HashTable, 361 | pub properties_info: HashTable, 362 | pub default_properties_table: *mut *mut zval, 363 | pub default_static_members_table: *mut *mut zval, 364 | pub static_members_table: *mut *mut zval, 365 | pub constants_table: HashTable, 366 | pub default_properties_count: ::std::os::raw::c_int, 367 | pub default_static_members_count: ::std::os::raw::c_int, 368 | pub constructor: *mut _zend_function, 369 | pub destructor: *mut _zend_function, 370 | pub clone: *mut _zend_function, 371 | pub __get: *mut _zend_function, 372 | pub __set: *mut _zend_function, 373 | pub __unset: *mut _zend_function, 374 | pub __isset: *mut _zend_function, 375 | pub __call: *mut _zend_function, 376 | pub __callstatic: *mut _zend_function, 377 | pub __tostring: *mut _zend_function, 378 | pub __debugInfo: *mut _zend_function, 379 | pub serialize_func: *mut _zend_function, 380 | pub unserialize_func: *mut _zend_function, 381 | pub iterator_funcs: zend_class_iterator_funcs, 382 | pub create_object: ::std::option::Option< 383 | unsafe extern "C" fn(class_type: *mut zend_class_entry) -> zend_object_value, 384 | >, 385 | pub get_iterator: ::std::option::Option< 386 | unsafe extern "C" fn( 387 | ce: *mut zend_class_entry, 388 | object: *mut zval, 389 | by_ref: ::std::os::raw::c_int, 390 | ) -> *mut zend_object_iterator, 391 | >, 392 | pub interface_gets_implemented: ::std::option::Option< 393 | unsafe extern "C" fn( 394 | iface: *mut zend_class_entry, 395 | class_type: *mut zend_class_entry, 396 | ) -> ::std::os::raw::c_int, 397 | >, 398 | pub get_static_method: ::std::option::Option< 399 | unsafe extern "C" fn( 400 | ce: *mut zend_class_entry, 401 | method: *mut ::std::os::raw::c_char, 402 | method_len: ::std::os::raw::c_int, 403 | ) -> *mut _zend_function, 404 | >, 405 | pub serialize: ::std::option::Option< 406 | unsafe extern "C" fn( 407 | object: *mut zval, 408 | buffer: *mut *mut ::std::os::raw::c_uchar, 409 | buf_len: *mut zend_uint, 410 | data: *mut zend_serialize_data, 411 | ) -> ::std::os::raw::c_int, 412 | >, 413 | pub unserialize: ::std::option::Option< 414 | unsafe extern "C" fn( 415 | object: *mut *mut zval, 416 | ce: *mut zend_class_entry, 417 | buf: *const ::std::os::raw::c_uchar, 418 | buf_len: zend_uint, 419 | data: *mut zend_unserialize_data, 420 | ) -> ::std::os::raw::c_int, 421 | >, 422 | pub interfaces: *mut *mut zend_class_entry, 423 | pub num_interfaces: zend_uint, 424 | pub traits: *mut *mut zend_class_entry, 425 | pub num_traits: zend_uint, 426 | pub trait_aliases: *mut *mut zend_trait_alias, 427 | pub trait_precedences: *mut *mut zend_trait_precedence, 428 | pub info: _zend_class_entry__bindgen_ty_1, 429 | } 430 | #[repr(C)] 431 | #[derive(Copy, Clone)] 432 | pub union _zend_class_entry__bindgen_ty_1 { 433 | pub user: _zend_class_entry__bindgen_ty_1__bindgen_ty_1, 434 | pub internal: _zend_class_entry__bindgen_ty_1__bindgen_ty_2, 435 | _bindgen_union_align: [u64; 4usize], 436 | } 437 | #[repr(C)] 438 | #[derive(Debug, Copy, Clone)] 439 | pub struct _zend_class_entry__bindgen_ty_1__bindgen_ty_1 { 440 | pub filename: *const ::std::os::raw::c_char, 441 | pub line_start: zend_uint, 442 | pub line_end: zend_uint, 443 | pub doc_comment: *const ::std::os::raw::c_char, 444 | pub doc_comment_len: zend_uint, 445 | } 446 | #[repr(C)] 447 | #[derive(Debug, Copy, Clone)] 448 | pub struct _zend_class_entry__bindgen_ty_1__bindgen_ty_2 { 449 | pub builtin_functions: *const _zend_function_entry, 450 | pub module: *mut _zend_module_entry, 451 | } 452 | #[repr(C)] 453 | #[derive(Copy, Clone)] 454 | pub struct _gc_root_buffer { 455 | pub prev: *mut _gc_root_buffer, 456 | pub next: *mut _gc_root_buffer, 457 | pub handle: zend_object_handle, 458 | pub u: _gc_root_buffer__bindgen_ty_1, 459 | } 460 | #[repr(C)] 461 | #[derive(Copy, Clone)] 462 | pub union _gc_root_buffer__bindgen_ty_1 { 463 | pub pz: *mut zval, 464 | pub handlers: *const zend_object_handlers, 465 | _bindgen_union_align: u64, 466 | } 467 | pub type gc_root_buffer = _gc_root_buffer; 468 | pub const zend_error_handling_t_EH_NORMAL: zend_error_handling_t = 0; 469 | pub const zend_error_handling_t_EH_SUPPRESS: zend_error_handling_t = 1; 470 | pub const zend_error_handling_t_EH_THROW: zend_error_handling_t = 2; 471 | pub type zend_error_handling_t = u32; 472 | pub type zend_op_array = _zend_op_array; 473 | pub type zend_op = _zend_op; 474 | #[repr(C)] 475 | #[derive(Copy, Clone)] 476 | pub struct _zend_literal { 477 | pub constant: zval, 478 | pub hash_value: zend_ulong, 479 | pub cache_slot: zend_uint, 480 | } 481 | pub type zend_literal = _zend_literal; 482 | #[repr(C)] 483 | #[derive(Copy, Clone)] 484 | pub union _znode_op { 485 | pub constant: zend_uint, 486 | pub var: zend_uint, 487 | pub num: zend_uint, 488 | pub hash: zend_ulong, 489 | pub opline_num: zend_uint, 490 | pub jmp_addr: *mut zend_op, 491 | pub zv: *mut zval, 492 | pub literal: *mut zend_literal, 493 | pub ptr: *mut ::std::os::raw::c_void, 494 | _bindgen_union_align: u64, 495 | } 496 | pub type znode_op = _znode_op; 497 | pub type zend_execute_data = _zend_execute_data; 498 | pub type opcode_handler_t = ::std::option::Option< 499 | unsafe extern "C" fn(execute_data: *mut zend_execute_data) -> ::std::os::raw::c_int, 500 | >; 501 | #[repr(C)] 502 | #[derive(Copy, Clone)] 503 | pub struct _zend_op { 504 | pub handler: opcode_handler_t, 505 | pub op1: znode_op, 506 | pub op2: znode_op, 507 | pub result: znode_op, 508 | pub extended_value: ulong, 509 | pub lineno: uint, 510 | pub opcode: zend_uchar, 511 | pub op1_type: zend_uchar, 512 | pub op2_type: zend_uchar, 513 | pub result_type: zend_uchar, 514 | } 515 | #[repr(C)] 516 | #[derive(Debug, Copy, Clone)] 517 | pub struct _zend_brk_cont_element { 518 | pub start: ::std::os::raw::c_int, 519 | pub cont: ::std::os::raw::c_int, 520 | pub brk: ::std::os::raw::c_int, 521 | pub parent: ::std::os::raw::c_int, 522 | } 523 | pub type zend_brk_cont_element = _zend_brk_cont_element; 524 | #[repr(C)] 525 | #[derive(Debug, Copy, Clone)] 526 | pub struct _zend_try_catch_element { 527 | pub try_op: zend_uint, 528 | pub catch_op: zend_uint, 529 | pub finally_op: zend_uint, 530 | pub finally_end: zend_uint, 531 | } 532 | pub type zend_try_catch_element = _zend_try_catch_element; 533 | #[repr(C)] 534 | #[derive(Debug, Copy, Clone)] 535 | pub struct _zend_property_info { 536 | pub flags: zend_uint, 537 | pub name: *const ::std::os::raw::c_char, 538 | pub name_length: ::std::os::raw::c_int, 539 | pub h: ulong, 540 | pub offset: ::std::os::raw::c_int, 541 | pub doc_comment: *const ::std::os::raw::c_char, 542 | pub doc_comment_len: ::std::os::raw::c_int, 543 | pub ce: *mut zend_class_entry, 544 | } 545 | pub type zend_property_info = _zend_property_info; 546 | #[repr(C)] 547 | #[derive(Debug, Copy, Clone)] 548 | pub struct _zend_arg_info { 549 | pub name: *const ::std::os::raw::c_char, 550 | pub name_len: zend_uint, 551 | pub class_name: *const ::std::os::raw::c_char, 552 | pub class_name_len: zend_uint, 553 | pub type_hint: zend_uchar, 554 | pub pass_by_reference: zend_uchar, 555 | pub allow_null: zend_bool, 556 | pub is_variadic: zend_bool, 557 | } 558 | pub type zend_arg_info = _zend_arg_info; 559 | #[repr(C)] 560 | #[derive(Debug, Copy, Clone)] 561 | pub struct _zend_compiled_variable { 562 | pub name: *const ::std::os::raw::c_char, 563 | pub name_len: ::std::os::raw::c_int, 564 | pub hash_value: ulong, 565 | } 566 | pub type zend_compiled_variable = _zend_compiled_variable; 567 | #[repr(C)] 568 | #[derive(Debug, Copy, Clone)] 569 | pub struct _zend_op_array { 570 | pub type_: zend_uchar, 571 | pub function_name: *const ::std::os::raw::c_char, 572 | pub scope: *mut zend_class_entry, 573 | pub fn_flags: zend_uint, 574 | pub prototype: *mut _zend_function, 575 | pub num_args: zend_uint, 576 | pub required_num_args: zend_uint, 577 | pub arg_info: *mut zend_arg_info, 578 | pub refcount: *mut zend_uint, 579 | pub opcodes: *mut zend_op, 580 | pub last: zend_uint, 581 | pub vars: *mut zend_compiled_variable, 582 | pub last_var: ::std::os::raw::c_int, 583 | pub T: zend_uint, 584 | pub nested_calls: zend_uint, 585 | pub used_stack: zend_uint, 586 | pub brk_cont_array: *mut zend_brk_cont_element, 587 | pub last_brk_cont: ::std::os::raw::c_int, 588 | pub try_catch_array: *mut zend_try_catch_element, 589 | pub last_try_catch: ::std::os::raw::c_int, 590 | pub has_finally_block: zend_bool, 591 | pub static_variables: *mut HashTable, 592 | pub this_var: zend_uint, 593 | pub filename: *const ::std::os::raw::c_char, 594 | pub line_start: zend_uint, 595 | pub line_end: zend_uint, 596 | pub doc_comment: *const ::std::os::raw::c_char, 597 | pub doc_comment_len: zend_uint, 598 | pub early_binding: zend_uint, 599 | pub literals: *mut zend_literal, 600 | pub last_literal: ::std::os::raw::c_int, 601 | pub run_time_cache: *mut *mut ::std::os::raw::c_void, 602 | pub last_cache_slot: ::std::os::raw::c_int, 603 | pub reserved: [*mut ::std::os::raw::c_void; 4usize], 604 | } 605 | #[repr(C)] 606 | #[derive(Debug, Copy, Clone)] 607 | pub struct _zend_internal_function { 608 | pub type_: zend_uchar, 609 | pub function_name: *const ::std::os::raw::c_char, 610 | pub scope: *mut zend_class_entry, 611 | pub fn_flags: zend_uint, 612 | pub prototype: *mut _zend_function, 613 | pub num_args: zend_uint, 614 | pub required_num_args: zend_uint, 615 | pub arg_info: *mut zend_arg_info, 616 | pub handler: ::std::option::Option< 617 | unsafe extern "C" fn( 618 | ht: ::std::os::raw::c_int, 619 | return_value: *mut zval, 620 | return_value_ptr: *mut *mut zval, 621 | this_ptr: *mut zval, 622 | return_value_used: ::std::os::raw::c_int, 623 | ), 624 | >, 625 | pub module: *mut _zend_module_entry, 626 | } 627 | pub type zend_internal_function = _zend_internal_function; 628 | #[repr(C)] 629 | #[derive(Copy, Clone)] 630 | pub union _zend_function { 631 | pub type_: zend_uchar, 632 | pub common: _zend_function__bindgen_ty_1, 633 | pub op_array: zend_op_array, 634 | pub internal_function: zend_internal_function, 635 | _bindgen_union_align: [u64; 31usize], 636 | } 637 | #[repr(C)] 638 | #[derive(Debug, Copy, Clone)] 639 | pub struct _zend_function__bindgen_ty_1 { 640 | pub type_: zend_uchar, 641 | pub function_name: *const ::std::os::raw::c_char, 642 | pub scope: *mut zend_class_entry, 643 | pub fn_flags: zend_uint, 644 | pub prototype: *mut _zend_function, 645 | pub num_args: zend_uint, 646 | pub required_num_args: zend_uint, 647 | pub arg_info: *mut zend_arg_info, 648 | } 649 | pub type zend_function = _zend_function; 650 | #[repr(C)] 651 | #[derive(Debug, Copy, Clone)] 652 | pub struct _zend_function_state { 653 | pub function: *mut zend_function, 654 | pub arguments: *mut *mut ::std::os::raw::c_void, 655 | } 656 | pub type zend_function_state = _zend_function_state; 657 | #[repr(C)] 658 | #[derive(Debug, Copy, Clone)] 659 | pub struct _call_slot { 660 | pub fbc: *mut zend_function, 661 | pub object: *mut zval, 662 | pub called_scope: *mut zend_class_entry, 663 | pub num_additional_args: zend_uint, 664 | pub is_ctor_call: zend_bool, 665 | pub is_ctor_result_used: zend_bool, 666 | } 667 | pub type call_slot = _call_slot; 668 | #[repr(C)] 669 | #[derive(Debug, Copy, Clone)] 670 | pub struct _zend_execute_data { 671 | pub opline: *mut _zend_op, 672 | pub function_state: zend_function_state, 673 | pub op_array: *mut zend_op_array, 674 | pub object: *mut zval, 675 | pub symbol_table: *mut HashTable, 676 | pub prev_execute_data: *mut _zend_execute_data, 677 | pub old_error_reporting: *mut zval, 678 | pub nested: zend_bool, 679 | pub original_return_value: *mut *mut zval, 680 | pub current_scope: *mut zend_class_entry, 681 | pub current_called_scope: *mut zend_class_entry, 682 | pub current_this: *mut zval, 683 | pub fast_ret: *mut _zend_op, 684 | pub delayed_exception: *mut zval, 685 | pub call_slots: *mut call_slot, 686 | pub call: *mut call_slot, 687 | } 688 | pub type __jmp_buf = [::std::os::raw::c_long; 8usize]; 689 | #[repr(C)] 690 | #[derive(Debug, Copy, Clone)] 691 | pub struct __jmp_buf_tag { 692 | pub __jmpbuf: __jmp_buf, 693 | pub __mask_was_saved: ::std::os::raw::c_int, 694 | pub __saved_mask: __sigset_t, 695 | } 696 | pub type jmp_buf = [__jmp_buf_tag; 1usize]; 697 | pub type zend_executor_globals = _zend_executor_globals; 698 | #[repr(C)] 699 | #[derive(Debug, Copy, Clone)] 700 | pub struct _zend_stack { 701 | pub top: ::std::os::raw::c_int, 702 | pub max: ::std::os::raw::c_int, 703 | pub elements: *mut *mut ::std::os::raw::c_void, 704 | } 705 | pub type zend_stack = _zend_stack; 706 | #[repr(C)] 707 | #[derive(Debug, Copy, Clone)] 708 | pub struct _zend_ptr_stack { 709 | pub top: ::std::os::raw::c_int, 710 | pub max: ::std::os::raw::c_int, 711 | pub elements: *mut *mut ::std::os::raw::c_void, 712 | pub top_element: *mut *mut ::std::os::raw::c_void, 713 | pub persistent: zend_bool, 714 | } 715 | pub type zend_ptr_stack = _zend_ptr_stack; 716 | pub type zend_objects_store_dtor_t = ::std::option::Option< 717 | unsafe extern "C" fn(object: *mut ::std::os::raw::c_void, handle: zend_object_handle), 718 | >; 719 | pub type zend_objects_free_object_storage_t = 720 | ::std::option::Option; 721 | pub type zend_objects_store_clone_t = ::std::option::Option< 722 | unsafe extern "C" fn( 723 | object: *mut ::std::os::raw::c_void, 724 | object_clone: *mut *mut ::std::os::raw::c_void, 725 | ), 726 | >; 727 | #[repr(C)] 728 | #[derive(Copy, Clone)] 729 | pub struct _zend_object_store_bucket { 730 | pub destructor_called: zend_bool, 731 | pub valid: zend_bool, 732 | pub apply_count: zend_uchar, 733 | pub bucket: _zend_object_store_bucket__store_bucket, 734 | } 735 | #[repr(C)] 736 | #[derive(Copy, Clone)] 737 | pub union _zend_object_store_bucket__store_bucket { 738 | pub obj: _zend_object_store_bucket__store_bucket__store_object, 739 | pub free_list: _zend_object_store_bucket__store_bucket__bindgen_ty_1, 740 | _bindgen_union_align: [u64; 7usize], 741 | } 742 | #[repr(C)] 743 | #[derive(Debug, Copy, Clone)] 744 | pub struct _zend_object_store_bucket__store_bucket__store_object { 745 | pub object: *mut ::std::os::raw::c_void, 746 | pub dtor: zend_objects_store_dtor_t, 747 | pub free_storage: zend_objects_free_object_storage_t, 748 | pub clone: zend_objects_store_clone_t, 749 | pub handlers: *const zend_object_handlers, 750 | pub refcount: zend_uint, 751 | pub buffered: *mut gc_root_buffer, 752 | } 753 | #[repr(C)] 754 | #[derive(Debug, Copy, Clone)] 755 | pub struct _zend_object_store_bucket__store_bucket__bindgen_ty_1 { 756 | pub next: ::std::os::raw::c_int, 757 | } 758 | pub type zend_object_store_bucket = _zend_object_store_bucket; 759 | #[repr(C)] 760 | #[derive(Debug, Copy, Clone)] 761 | pub struct _zend_objects_store { 762 | pub object_buckets: *mut zend_object_store_bucket, 763 | pub top: zend_uint, 764 | pub size: zend_uint, 765 | pub free_list_head: ::std::os::raw::c_int, 766 | } 767 | pub type zend_objects_store = _zend_objects_store; 768 | pub type fpu_control_t = ::std::os::raw::c_ushort; 769 | pub type zend_vm_stack = *mut _zend_vm_stack; 770 | pub type zend_ini_entry = _zend_ini_entry; 771 | #[repr(C)] 772 | #[derive(Copy, Clone)] 773 | pub struct _zend_executor_globals { 774 | pub return_value_ptr_ptr: *mut *mut zval, 775 | pub uninitialized_zval: zval, 776 | pub uninitialized_zval_ptr: *mut zval, 777 | pub error_zval: zval, 778 | pub error_zval_ptr: *mut zval, 779 | pub symtable_cache: [*mut HashTable; 32usize], 780 | pub symtable_cache_limit: *mut *mut HashTable, 781 | pub symtable_cache_ptr: *mut *mut HashTable, 782 | pub opline_ptr: *mut *mut zend_op, 783 | pub active_symbol_table: *mut HashTable, 784 | pub symbol_table: HashTable, 785 | pub included_files: HashTable, 786 | pub bailout: *mut jmp_buf, 787 | pub error_reporting: ::std::os::raw::c_int, 788 | pub orig_error_reporting: ::std::os::raw::c_int, 789 | pub exit_status: ::std::os::raw::c_int, 790 | pub active_op_array: *mut zend_op_array, 791 | pub function_table: *mut HashTable, 792 | pub class_table: *mut HashTable, 793 | pub zend_constants: *mut HashTable, 794 | pub scope: *mut zend_class_entry, 795 | pub called_scope: *mut zend_class_entry, 796 | pub This: *mut zval, 797 | pub precision: ::std::os::raw::c_long, 798 | pub ticks_count: ::std::os::raw::c_int, 799 | pub in_execution: zend_bool, 800 | pub in_autoload: *mut HashTable, 801 | pub autoload_func: *mut zend_function, 802 | pub full_tables_cleanup: zend_bool, 803 | pub no_extensions: zend_bool, 804 | pub regular_list: HashTable, 805 | pub persistent_list: HashTable, 806 | pub argument_stack: zend_vm_stack, 807 | pub user_error_handler_error_reporting: ::std::os::raw::c_int, 808 | pub user_error_handler: *mut zval, 809 | pub user_exception_handler: *mut zval, 810 | pub user_error_handlers_error_reporting: zend_stack, 811 | pub user_error_handlers: zend_ptr_stack, 812 | pub user_exception_handlers: zend_ptr_stack, 813 | pub error_handling: zend_error_handling_t, 814 | pub exception_class: *mut zend_class_entry, 815 | pub timeout_seconds: ::std::os::raw::c_int, 816 | pub lambda_count: ::std::os::raw::c_int, 817 | pub ini_directives: *mut HashTable, 818 | pub modified_ini_directives: *mut HashTable, 819 | pub error_reporting_ini_entry: *mut zend_ini_entry, 820 | pub objects_store: zend_objects_store, 821 | pub exception: *mut zval, 822 | pub prev_exception: *mut zval, 823 | pub opline_before_exception: *mut zend_op, 824 | pub exception_op: [zend_op; 3usize], 825 | pub current_execute_data: *mut _zend_execute_data, 826 | pub current_module: *mut _zend_module_entry, 827 | pub std_property_info: zend_property_info, 828 | pub active: zend_bool, 829 | pub start_op: *mut zend_op, 830 | pub saved_fpu_cw_ptr: *mut ::std::os::raw::c_void, 831 | pub saved_fpu_cw: fpu_control_t, 832 | pub reserved: [*mut ::std::os::raw::c_void; 4usize], 833 | } 834 | pub type zend_module_entry = _zend_module_entry; 835 | #[repr(C)] 836 | #[derive(Debug, Copy, Clone)] 837 | pub struct _zend_module_entry { 838 | pub size: ::std::os::raw::c_ushort, 839 | pub zend_api: ::std::os::raw::c_uint, 840 | pub zend_debug: ::std::os::raw::c_uchar, 841 | pub zts: ::std::os::raw::c_uchar, 842 | pub ini_entry: *const _zend_ini_entry, 843 | pub deps: *const _zend_module_dep, 844 | pub name: *const ::std::os::raw::c_char, 845 | pub functions: *const _zend_function_entry, 846 | pub module_startup_func: ::std::option::Option< 847 | unsafe extern "C" fn( 848 | type_: ::std::os::raw::c_int, 849 | module_number: ::std::os::raw::c_int, 850 | ) -> ::std::os::raw::c_int, 851 | >, 852 | pub module_shutdown_func: ::std::option::Option< 853 | unsafe extern "C" fn( 854 | type_: ::std::os::raw::c_int, 855 | module_number: ::std::os::raw::c_int, 856 | ) -> ::std::os::raw::c_int, 857 | >, 858 | pub request_startup_func: ::std::option::Option< 859 | unsafe extern "C" fn( 860 | type_: ::std::os::raw::c_int, 861 | module_number: ::std::os::raw::c_int, 862 | ) -> ::std::os::raw::c_int, 863 | >, 864 | pub request_shutdown_func: ::std::option::Option< 865 | unsafe extern "C" fn( 866 | type_: ::std::os::raw::c_int, 867 | module_number: ::std::os::raw::c_int, 868 | ) -> ::std::os::raw::c_int, 869 | >, 870 | pub info_func: ::std::option::Option, 871 | pub version: *const ::std::os::raw::c_char, 872 | pub globals_size: usize, 873 | pub globals_ptr: *mut ::std::os::raw::c_void, 874 | pub globals_ctor: 875 | ::std::option::Option, 876 | pub globals_dtor: 877 | ::std::option::Option, 878 | pub post_deactivate_func: 879 | ::std::option::Option ::std::os::raw::c_int>, 880 | pub module_started: ::std::os::raw::c_int, 881 | pub type_: ::std::os::raw::c_uchar, 882 | pub handle: *mut ::std::os::raw::c_void, 883 | pub module_number: ::std::os::raw::c_int, 884 | pub build_id: *const ::std::os::raw::c_char, 885 | } 886 | #[repr(C)] 887 | #[derive(Debug, Copy, Clone)] 888 | pub struct _zend_module_dep { 889 | pub name: *const ::std::os::raw::c_char, 890 | pub rel: *const ::std::os::raw::c_char, 891 | pub version: *const ::std::os::raw::c_char, 892 | pub type_: ::std::os::raw::c_uchar, 893 | } 894 | #[repr(C)] 895 | #[derive(Debug, Copy, Clone)] 896 | pub struct _zend_vm_stack { 897 | pub top: *mut *mut ::std::os::raw::c_void, 898 | pub end: *mut *mut ::std::os::raw::c_void, 899 | pub prev: zend_vm_stack, 900 | } 901 | #[repr(C)] 902 | #[derive(Debug, Copy, Clone)] 903 | pub struct _zend_function_entry { 904 | pub fname: *const ::std::os::raw::c_char, 905 | pub handler: ::std::option::Option< 906 | unsafe extern "C" fn( 907 | ht: ::std::os::raw::c_int, 908 | return_value: *mut zval, 909 | return_value_ptr: *mut *mut zval, 910 | this_ptr: *mut zval, 911 | return_value_used: ::std::os::raw::c_int, 912 | ), 913 | >, 914 | pub arg_info: *const _zend_arg_info, 915 | pub num_args: zend_uint, 916 | pub flags: zend_uint, 917 | } 918 | #[repr(C)] 919 | #[derive(Debug, Copy, Clone)] 920 | pub struct _zend_ini_entry { 921 | pub module_number: ::std::os::raw::c_int, 922 | pub modifiable: ::std::os::raw::c_int, 923 | pub name: *mut ::std::os::raw::c_char, 924 | pub name_length: uint, 925 | pub on_modify: ::std::option::Option< 926 | unsafe extern "C" fn( 927 | entry: *mut zend_ini_entry, 928 | new_value: *mut ::std::os::raw::c_char, 929 | new_value_length: uint, 930 | mh_arg1: *mut ::std::os::raw::c_void, 931 | mh_arg2: *mut ::std::os::raw::c_void, 932 | mh_arg3: *mut ::std::os::raw::c_void, 933 | stage: ::std::os::raw::c_int, 934 | ) -> ::std::os::raw::c_int, 935 | >, 936 | pub mh_arg1: *mut ::std::os::raw::c_void, 937 | pub mh_arg2: *mut ::std::os::raw::c_void, 938 | pub mh_arg3: *mut ::std::os::raw::c_void, 939 | pub value: *mut ::std::os::raw::c_char, 940 | pub value_length: uint, 941 | pub orig_value: *mut ::std::os::raw::c_char, 942 | pub orig_value_length: uint, 943 | pub orig_modifiable: ::std::os::raw::c_int, 944 | pub modified: ::std::os::raw::c_int, 945 | pub displayer: ::std::option::Option< 946 | unsafe extern "C" fn(ini_entry: *mut zend_ini_entry, type_: ::std::os::raw::c_int), 947 | >, 948 | } 949 | -------------------------------------------------------------------------------- /src/php72.rs: -------------------------------------------------------------------------------- 1 | /* automatically generated by rust-bindgen */ 2 | 3 | #![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, unused)] 4 | 5 | pub type __uint16_t = ::std::os::raw::c_ushort; 6 | pub type __uint32_t = ::std::os::raw::c_uint; 7 | pub type __int64_t = ::std::os::raw::c_long; 8 | pub type __uint64_t = ::std::os::raw::c_ulong; 9 | #[repr(C)] 10 | #[derive(Debug, Copy, Clone)] 11 | pub struct __sigset_t { 12 | pub __val: [::std::os::raw::c_ulong; 16usize], 13 | } 14 | pub type zend_long = i64; 15 | pub type zend_ulong = u64; 16 | pub type zend_bool = ::std::os::raw::c_uchar; 17 | pub type zend_uchar = ::std::os::raw::c_uchar; 18 | pub type zend_object_handlers = _zend_object_handlers; 19 | pub type zend_class_entry = _zend_class_entry; 20 | pub type zend_function = _zend_function; 21 | pub type zend_execute_data = _zend_execute_data; 22 | pub type zval = _zval_struct; 23 | pub type zend_refcounted = _zend_refcounted; 24 | pub type zend_string = _zend_string; 25 | pub type zend_array = _zend_array; 26 | pub type zend_object = _zend_object; 27 | pub type zend_resource = _zend_resource; 28 | pub type zend_reference = _zend_reference; 29 | pub type zend_ast_ref = _zend_ast_ref; 30 | pub type zend_ast = _zend_ast; 31 | pub type dtor_func_t = ::std::option::Option; 32 | pub type zend_type = usize; 33 | #[repr(C)] 34 | #[derive(Copy, Clone)] 35 | pub union _zend_value { 36 | pub lval: zend_long, 37 | pub dval: f64, 38 | pub counted: *mut zend_refcounted, 39 | pub str: *mut zend_string, 40 | pub arr: *mut zend_array, 41 | pub obj: *mut zend_object, 42 | pub res: *mut zend_resource, 43 | pub ref_: *mut zend_reference, 44 | pub ast: *mut zend_ast_ref, 45 | pub zv: *mut zval, 46 | pub ptr: *mut ::std::os::raw::c_void, 47 | pub ce: *mut zend_class_entry, 48 | pub func: *mut zend_function, 49 | pub ww: _zend_value__bindgen_ty_1, 50 | _bindgen_union_align: u64, 51 | } 52 | #[repr(C)] 53 | #[derive(Debug, Copy, Clone)] 54 | pub struct _zend_value__bindgen_ty_1 { 55 | pub w1: u32, 56 | pub w2: u32, 57 | } 58 | pub type zend_value = _zend_value; 59 | #[repr(C)] 60 | #[derive(Copy, Clone)] 61 | pub struct _zval_struct { 62 | pub value: zend_value, 63 | pub u1: _zval_struct__bindgen_ty_1, 64 | pub u2: _zval_struct__bindgen_ty_2, 65 | } 66 | #[repr(C)] 67 | #[derive(Copy, Clone)] 68 | pub union _zval_struct__bindgen_ty_1 { 69 | pub v: _zval_struct__bindgen_ty_1__bindgen_ty_1, 70 | pub type_info: u32, 71 | _bindgen_union_align: u32, 72 | } 73 | #[repr(C)] 74 | #[derive(Debug, Copy, Clone)] 75 | pub struct _zval_struct__bindgen_ty_1__bindgen_ty_1 { 76 | pub type_: zend_uchar, 77 | pub type_flags: zend_uchar, 78 | pub const_flags: zend_uchar, 79 | pub reserved: zend_uchar, 80 | } 81 | #[repr(C)] 82 | #[derive(Copy, Clone)] 83 | pub union _zval_struct__bindgen_ty_2 { 84 | pub next: u32, 85 | pub cache_slot: u32, 86 | pub lineno: u32, 87 | pub num_args: u32, 88 | pub fe_pos: u32, 89 | pub fe_iter_idx: u32, 90 | pub access_flags: u32, 91 | pub property_guard: u32, 92 | pub extra: u32, 93 | _bindgen_union_align: u32, 94 | } 95 | #[repr(C)] 96 | #[derive(Copy, Clone)] 97 | pub struct _zend_refcounted_h { 98 | pub refcount: u32, 99 | pub u: _zend_refcounted_h__bindgen_ty_1, 100 | } 101 | #[repr(C)] 102 | #[derive(Copy, Clone)] 103 | pub union _zend_refcounted_h__bindgen_ty_1 { 104 | pub v: _zend_refcounted_h__bindgen_ty_1__bindgen_ty_1, 105 | pub type_info: u32, 106 | _bindgen_union_align: u32, 107 | } 108 | #[repr(C)] 109 | #[derive(Debug, Copy, Clone)] 110 | pub struct _zend_refcounted_h__bindgen_ty_1__bindgen_ty_1 { 111 | pub type_: zend_uchar, 112 | pub flags: zend_uchar, 113 | pub gc_info: u16, 114 | } 115 | pub type zend_refcounted_h = _zend_refcounted_h; 116 | #[repr(C)] 117 | #[derive(Copy, Clone)] 118 | pub struct _zend_refcounted { 119 | pub gc: zend_refcounted_h, 120 | } 121 | #[repr(C)] 122 | #[derive(Copy, Clone)] 123 | pub struct _zend_string { 124 | pub gc: zend_refcounted_h, 125 | pub h: zend_ulong, 126 | pub len: usize, 127 | pub val: [::std::os::raw::c_char; 1usize], 128 | } 129 | #[repr(C)] 130 | #[derive(Copy, Clone)] 131 | pub struct _Bucket { 132 | pub val: zval, 133 | pub h: zend_ulong, 134 | pub key: *mut zend_string, 135 | } 136 | pub type Bucket = _Bucket; 137 | pub type HashTable = _zend_array; 138 | #[repr(C)] 139 | #[derive(Copy, Clone)] 140 | pub struct _zend_array { 141 | pub gc: zend_refcounted_h, 142 | pub u: _zend_array__bindgen_ty_1, 143 | pub nTableMask: u32, 144 | pub arData: *mut Bucket, 145 | pub nNumUsed: u32, 146 | pub nNumOfElements: u32, 147 | pub nTableSize: u32, 148 | pub nInternalPointer: u32, 149 | pub nNextFreeElement: zend_long, 150 | pub pDestructor: dtor_func_t, 151 | } 152 | #[repr(C)] 153 | #[derive(Copy, Clone)] 154 | pub union _zend_array__bindgen_ty_1 { 155 | pub v: _zend_array__bindgen_ty_1__bindgen_ty_1, 156 | pub flags: u32, 157 | _bindgen_union_align: u32, 158 | } 159 | #[repr(C)] 160 | #[derive(Debug, Copy, Clone)] 161 | pub struct _zend_array__bindgen_ty_1__bindgen_ty_1 { 162 | pub flags: zend_uchar, 163 | pub nApplyCount: zend_uchar, 164 | pub nIteratorsCount: zend_uchar, 165 | pub consistency: zend_uchar, 166 | } 167 | pub type HashPosition = u32; 168 | #[repr(C)] 169 | #[derive(Debug, Copy, Clone)] 170 | pub struct _HashTableIterator { 171 | pub ht: *mut HashTable, 172 | pub pos: HashPosition, 173 | } 174 | pub type HashTableIterator = _HashTableIterator; 175 | #[repr(C)] 176 | #[derive(Copy, Clone)] 177 | pub struct _zend_object { 178 | pub gc: zend_refcounted_h, 179 | pub handle: u32, 180 | pub ce: *mut zend_class_entry, 181 | pub handlers: *const zend_object_handlers, 182 | pub properties: *mut HashTable, 183 | pub properties_table: [zval; 1usize], 184 | } 185 | #[repr(C)] 186 | #[derive(Copy, Clone)] 187 | pub struct _zend_resource { 188 | pub gc: zend_refcounted_h, 189 | pub handle: ::std::os::raw::c_int, 190 | pub type_: ::std::os::raw::c_int, 191 | pub ptr: *mut ::std::os::raw::c_void, 192 | } 193 | #[repr(C)] 194 | #[derive(Copy, Clone)] 195 | pub struct _zend_reference { 196 | pub gc: zend_refcounted_h, 197 | pub val: zval, 198 | } 199 | #[repr(C)] 200 | #[derive(Copy, Clone)] 201 | pub struct _zend_ast_ref { 202 | pub gc: zend_refcounted_h, 203 | pub ast: *mut zend_ast, 204 | } 205 | pub type zend_ast_kind = u16; 206 | pub type zend_ast_attr = u16; 207 | #[repr(C)] 208 | #[derive(Debug, Copy, Clone)] 209 | pub struct _zend_ast { 210 | pub kind: zend_ast_kind, 211 | pub attr: zend_ast_attr, 212 | pub lineno: u32, 213 | pub child: [*mut zend_ast; 1usize], 214 | } 215 | pub type zend_object_iterator = _zend_object_iterator; 216 | #[repr(C)] 217 | #[derive(Debug, Copy, Clone)] 218 | pub struct _zend_object_iterator_funcs { 219 | pub dtor: ::std::option::Option, 220 | pub valid: ::std::option::Option< 221 | unsafe extern "C" fn(iter: *mut zend_object_iterator) -> ::std::os::raw::c_int, 222 | >, 223 | pub get_current_data: 224 | ::std::option::Option *mut zval>, 225 | pub get_current_key: ::std::option::Option< 226 | unsafe extern "C" fn(iter: *mut zend_object_iterator, key: *mut zval), 227 | >, 228 | pub move_forward: ::std::option::Option, 229 | pub rewind: ::std::option::Option, 230 | pub invalidate_current: 231 | ::std::option::Option, 232 | } 233 | pub type zend_object_iterator_funcs = _zend_object_iterator_funcs; 234 | #[repr(C)] 235 | #[derive(Copy, Clone)] 236 | pub struct _zend_object_iterator { 237 | pub std: zend_object, 238 | pub data: zval, 239 | pub funcs: *mut zend_object_iterator_funcs, 240 | pub index: zend_ulong, 241 | } 242 | #[repr(C)] 243 | #[derive(Debug, Copy, Clone)] 244 | pub struct _zend_class_iterator_funcs { 245 | pub funcs: *mut zend_object_iterator_funcs, 246 | pub zf_new_iterator: *mut _zend_function, 247 | pub zf_valid: *mut _zend_function, 248 | pub zf_current: *mut _zend_function, 249 | pub zf_key: *mut _zend_function, 250 | pub zf_next: *mut _zend_function, 251 | pub zf_rewind: *mut _zend_function, 252 | } 253 | pub type zend_class_iterator_funcs = _zend_class_iterator_funcs; 254 | #[repr(C)] 255 | #[derive(Debug, Copy, Clone)] 256 | pub struct _zend_serialize_data { 257 | _unused: [u8; 0], 258 | } 259 | #[repr(C)] 260 | #[derive(Debug, Copy, Clone)] 261 | pub struct _zend_unserialize_data { 262 | _unused: [u8; 0], 263 | } 264 | pub type zend_serialize_data = _zend_serialize_data; 265 | pub type zend_unserialize_data = _zend_unserialize_data; 266 | #[repr(C)] 267 | #[derive(Debug, Copy, Clone)] 268 | pub struct _zend_trait_method_reference { 269 | pub method_name: *mut zend_string, 270 | pub ce: *mut zend_class_entry, 271 | pub class_name: *mut zend_string, 272 | } 273 | pub type zend_trait_method_reference = _zend_trait_method_reference; 274 | #[repr(C)] 275 | #[derive(Debug, Copy, Clone)] 276 | pub struct _zend_trait_precedence { 277 | pub trait_method: *mut zend_trait_method_reference, 278 | pub exclude_from_classes: *mut _zend_trait_precedence__bindgen_ty_1, 279 | } 280 | #[repr(C)] 281 | #[derive(Copy, Clone)] 282 | pub union _zend_trait_precedence__bindgen_ty_1 { 283 | pub ce: *mut zend_class_entry, 284 | pub class_name: *mut zend_string, 285 | _bindgen_union_align: u64, 286 | } 287 | pub type zend_trait_precedence = _zend_trait_precedence; 288 | #[repr(C)] 289 | #[derive(Debug, Copy, Clone)] 290 | pub struct _zend_trait_alias { 291 | pub trait_method: *mut zend_trait_method_reference, 292 | #[doc = " name for method to be added"] 293 | pub alias: *mut zend_string, 294 | #[doc = " modifiers to be set on trait method"] 295 | pub modifiers: u32, 296 | } 297 | pub type zend_trait_alias = _zend_trait_alias; 298 | #[repr(C)] 299 | #[derive(Copy, Clone)] 300 | pub struct _zend_class_entry { 301 | pub type_: ::std::os::raw::c_char, 302 | pub name: *mut zend_string, 303 | pub parent: *mut _zend_class_entry, 304 | pub refcount: ::std::os::raw::c_int, 305 | pub ce_flags: u32, 306 | pub default_properties_count: ::std::os::raw::c_int, 307 | pub default_static_members_count: ::std::os::raw::c_int, 308 | pub default_properties_table: *mut zval, 309 | pub default_static_members_table: *mut zval, 310 | pub static_members_table: *mut zval, 311 | pub function_table: HashTable, 312 | pub properties_info: HashTable, 313 | pub constants_table: HashTable, 314 | pub constructor: *mut _zend_function, 315 | pub destructor: *mut _zend_function, 316 | pub clone: *mut _zend_function, 317 | pub __get: *mut _zend_function, 318 | pub __set: *mut _zend_function, 319 | pub __unset: *mut _zend_function, 320 | pub __isset: *mut _zend_function, 321 | pub __call: *mut _zend_function, 322 | pub __callstatic: *mut _zend_function, 323 | pub __tostring: *mut _zend_function, 324 | pub __debugInfo: *mut _zend_function, 325 | pub serialize_func: *mut _zend_function, 326 | pub unserialize_func: *mut _zend_function, 327 | pub iterator_funcs: zend_class_iterator_funcs, 328 | pub create_object: ::std::option::Option< 329 | unsafe extern "C" fn(class_type: *mut zend_class_entry) -> *mut zend_object, 330 | >, 331 | pub get_iterator: ::std::option::Option< 332 | unsafe extern "C" fn( 333 | ce: *mut zend_class_entry, 334 | object: *mut zval, 335 | by_ref: ::std::os::raw::c_int, 336 | ) -> *mut zend_object_iterator, 337 | >, 338 | pub interface_gets_implemented: ::std::option::Option< 339 | unsafe extern "C" fn( 340 | iface: *mut zend_class_entry, 341 | class_type: *mut zend_class_entry, 342 | ) -> ::std::os::raw::c_int, 343 | >, 344 | pub get_static_method: ::std::option::Option< 345 | unsafe extern "C" fn( 346 | ce: *mut zend_class_entry, 347 | method: *mut zend_string, 348 | ) -> *mut _zend_function, 349 | >, 350 | pub serialize: ::std::option::Option< 351 | unsafe extern "C" fn( 352 | object: *mut zval, 353 | buffer: *mut *mut ::std::os::raw::c_uchar, 354 | buf_len: *mut usize, 355 | data: *mut zend_serialize_data, 356 | ) -> ::std::os::raw::c_int, 357 | >, 358 | pub unserialize: ::std::option::Option< 359 | unsafe extern "C" fn( 360 | object: *mut zval, 361 | ce: *mut zend_class_entry, 362 | buf: *const ::std::os::raw::c_uchar, 363 | buf_len: usize, 364 | data: *mut zend_unserialize_data, 365 | ) -> ::std::os::raw::c_int, 366 | >, 367 | pub num_interfaces: u32, 368 | pub num_traits: u32, 369 | pub interfaces: *mut *mut zend_class_entry, 370 | pub traits: *mut *mut zend_class_entry, 371 | pub trait_aliases: *mut *mut zend_trait_alias, 372 | pub trait_precedences: *mut *mut zend_trait_precedence, 373 | pub info: _zend_class_entry__bindgen_ty_1, 374 | } 375 | #[repr(C)] 376 | #[derive(Copy, Clone)] 377 | pub union _zend_class_entry__bindgen_ty_1 { 378 | pub user: _zend_class_entry__bindgen_ty_1__bindgen_ty_1, 379 | pub internal: _zend_class_entry__bindgen_ty_1__bindgen_ty_2, 380 | _bindgen_union_align: [u64; 3usize], 381 | } 382 | #[repr(C)] 383 | #[derive(Debug, Copy, Clone)] 384 | pub struct _zend_class_entry__bindgen_ty_1__bindgen_ty_1 { 385 | pub filename: *mut zend_string, 386 | pub line_start: u32, 387 | pub line_end: u32, 388 | pub doc_comment: *mut zend_string, 389 | } 390 | #[repr(C)] 391 | #[derive(Debug, Copy, Clone)] 392 | pub struct _zend_class_entry__bindgen_ty_1__bindgen_ty_2 { 393 | pub builtin_functions: *const _zend_function_entry, 394 | pub module: *mut _zend_module_entry, 395 | } 396 | pub const zend_error_handling_t_EH_NORMAL: zend_error_handling_t = 0; 397 | pub const zend_error_handling_t_EH_SUPPRESS: zend_error_handling_t = 1; 398 | pub const zend_error_handling_t_EH_THROW: zend_error_handling_t = 2; 399 | pub type zend_error_handling_t = u32; 400 | pub type zend_object_read_property_t = ::std::option::Option< 401 | unsafe extern "C" fn( 402 | object: *mut zval, 403 | member: *mut zval, 404 | type_: ::std::os::raw::c_int, 405 | cache_slot: *mut *mut ::std::os::raw::c_void, 406 | rv: *mut zval, 407 | ) -> *mut zval, 408 | >; 409 | pub type zend_object_read_dimension_t = ::std::option::Option< 410 | unsafe extern "C" fn( 411 | object: *mut zval, 412 | offset: *mut zval, 413 | type_: ::std::os::raw::c_int, 414 | rv: *mut zval, 415 | ) -> *mut zval, 416 | >; 417 | pub type zend_object_write_property_t = ::std::option::Option< 418 | unsafe extern "C" fn( 419 | object: *mut zval, 420 | member: *mut zval, 421 | value: *mut zval, 422 | cache_slot: *mut *mut ::std::os::raw::c_void, 423 | ), 424 | >; 425 | pub type zend_object_write_dimension_t = ::std::option::Option< 426 | unsafe extern "C" fn(object: *mut zval, offset: *mut zval, value: *mut zval), 427 | >; 428 | pub type zend_object_get_property_ptr_ptr_t = ::std::option::Option< 429 | unsafe extern "C" fn( 430 | object: *mut zval, 431 | member: *mut zval, 432 | type_: ::std::os::raw::c_int, 433 | cache_slot: *mut *mut ::std::os::raw::c_void, 434 | ) -> *mut zval, 435 | >; 436 | pub type zend_object_set_t = 437 | ::std::option::Option; 438 | pub type zend_object_get_t = 439 | ::std::option::Option *mut zval>; 440 | pub type zend_object_has_property_t = ::std::option::Option< 441 | unsafe extern "C" fn( 442 | object: *mut zval, 443 | member: *mut zval, 444 | has_set_exists: ::std::os::raw::c_int, 445 | cache_slot: *mut *mut ::std::os::raw::c_void, 446 | ) -> ::std::os::raw::c_int, 447 | >; 448 | pub type zend_object_has_dimension_t = ::std::option::Option< 449 | unsafe extern "C" fn( 450 | object: *mut zval, 451 | member: *mut zval, 452 | check_empty: ::std::os::raw::c_int, 453 | ) -> ::std::os::raw::c_int, 454 | >; 455 | pub type zend_object_unset_property_t = ::std::option::Option< 456 | unsafe extern "C" fn( 457 | object: *mut zval, 458 | member: *mut zval, 459 | cache_slot: *mut *mut ::std::os::raw::c_void, 460 | ), 461 | >; 462 | pub type zend_object_unset_dimension_t = 463 | ::std::option::Option; 464 | pub type zend_object_get_properties_t = 465 | ::std::option::Option *mut HashTable>; 466 | pub type zend_object_get_debug_info_t = ::std::option::Option< 467 | unsafe extern "C" fn(object: *mut zval, is_temp: *mut ::std::os::raw::c_int) -> *mut HashTable, 468 | >; 469 | pub type zend_object_call_method_t = ::std::option::Option< 470 | unsafe extern "C" fn( 471 | method: *mut zend_string, 472 | object: *mut zend_object, 473 | execute_data: *mut zend_execute_data, 474 | return_value: *mut zval, 475 | ) -> ::std::os::raw::c_int, 476 | >; 477 | pub type zend_object_get_method_t = ::std::option::Option< 478 | unsafe extern "C" fn( 479 | object: *mut *mut zend_object, 480 | method: *mut zend_string, 481 | key: *const zval, 482 | ) -> *mut _zend_function, 483 | >; 484 | pub type zend_object_get_constructor_t = 485 | ::std::option::Option *mut _zend_function>; 486 | pub type zend_object_dtor_obj_t = 487 | ::std::option::Option; 488 | pub type zend_object_free_obj_t = 489 | ::std::option::Option; 490 | pub type zend_object_clone_obj_t = 491 | ::std::option::Option *mut zend_object>; 492 | pub type zend_object_get_class_name_t = 493 | ::std::option::Option *mut zend_string>; 494 | pub type zend_object_compare_t = ::std::option::Option< 495 | unsafe extern "C" fn(object1: *mut zval, object2: *mut zval) -> ::std::os::raw::c_int, 496 | >; 497 | pub type zend_object_compare_zvals_t = ::std::option::Option< 498 | unsafe extern "C" fn(resul: *mut zval, op1: *mut zval, op2: *mut zval) -> ::std::os::raw::c_int, 499 | >; 500 | pub type zend_object_cast_t = ::std::option::Option< 501 | unsafe extern "C" fn( 502 | readobj: *mut zval, 503 | retval: *mut zval, 504 | type_: ::std::os::raw::c_int, 505 | ) -> ::std::os::raw::c_int, 506 | >; 507 | pub type zend_object_count_elements_t = ::std::option::Option< 508 | unsafe extern "C" fn(object: *mut zval, count: *mut zend_long) -> ::std::os::raw::c_int, 509 | >; 510 | pub type zend_object_get_closure_t = ::std::option::Option< 511 | unsafe extern "C" fn( 512 | obj: *mut zval, 513 | ce_ptr: *mut *mut zend_class_entry, 514 | fptr_ptr: *mut *mut _zend_function, 515 | obj_ptr: *mut *mut zend_object, 516 | ) -> ::std::os::raw::c_int, 517 | >; 518 | pub type zend_object_get_gc_t = ::std::option::Option< 519 | unsafe extern "C" fn( 520 | object: *mut zval, 521 | table: *mut *mut zval, 522 | n: *mut ::std::os::raw::c_int, 523 | ) -> *mut HashTable, 524 | >; 525 | pub type zend_object_do_operation_t = ::std::option::Option< 526 | unsafe extern "C" fn( 527 | opcode: zend_uchar, 528 | result: *mut zval, 529 | op1: *mut zval, 530 | op2: *mut zval, 531 | ) -> ::std::os::raw::c_int, 532 | >; 533 | #[repr(C)] 534 | #[derive(Debug, Copy, Clone)] 535 | pub struct _zend_object_handlers { 536 | pub offset: ::std::os::raw::c_int, 537 | pub free_obj: zend_object_free_obj_t, 538 | pub dtor_obj: zend_object_dtor_obj_t, 539 | pub clone_obj: zend_object_clone_obj_t, 540 | pub read_property: zend_object_read_property_t, 541 | pub write_property: zend_object_write_property_t, 542 | pub read_dimension: zend_object_read_dimension_t, 543 | pub write_dimension: zend_object_write_dimension_t, 544 | pub get_property_ptr_ptr: zend_object_get_property_ptr_ptr_t, 545 | pub get: zend_object_get_t, 546 | pub set: zend_object_set_t, 547 | pub has_property: zend_object_has_property_t, 548 | pub unset_property: zend_object_unset_property_t, 549 | pub has_dimension: zend_object_has_dimension_t, 550 | pub unset_dimension: zend_object_unset_dimension_t, 551 | pub get_properties: zend_object_get_properties_t, 552 | pub get_method: zend_object_get_method_t, 553 | pub call_method: zend_object_call_method_t, 554 | pub get_constructor: zend_object_get_constructor_t, 555 | pub get_class_name: zend_object_get_class_name_t, 556 | pub compare_objects: zend_object_compare_t, 557 | pub cast_object: zend_object_cast_t, 558 | pub count_elements: zend_object_count_elements_t, 559 | pub get_debug_info: zend_object_get_debug_info_t, 560 | pub get_closure: zend_object_get_closure_t, 561 | pub get_gc: zend_object_get_gc_t, 562 | pub do_operation: zend_object_do_operation_t, 563 | pub compare: zend_object_compare_zvals_t, 564 | } 565 | pub type zend_op_array = _zend_op_array; 566 | pub type zend_op = _zend_op; 567 | #[repr(C)] 568 | #[derive(Copy, Clone)] 569 | pub union _znode_op { 570 | pub constant: u32, 571 | pub var: u32, 572 | pub num: u32, 573 | pub opline_num: u32, 574 | pub jmp_offset: u32, 575 | _bindgen_union_align: u32, 576 | } 577 | pub type znode_op = _znode_op; 578 | #[repr(C)] 579 | #[derive(Copy, Clone)] 580 | pub struct _zend_op { 581 | pub handler: *const ::std::os::raw::c_void, 582 | pub op1: znode_op, 583 | pub op2: znode_op, 584 | pub result: znode_op, 585 | pub extended_value: u32, 586 | pub lineno: u32, 587 | pub opcode: zend_uchar, 588 | pub op1_type: zend_uchar, 589 | pub op2_type: zend_uchar, 590 | pub result_type: zend_uchar, 591 | } 592 | #[repr(C)] 593 | #[derive(Debug, Copy, Clone)] 594 | pub struct _zend_try_catch_element { 595 | pub try_op: u32, 596 | pub catch_op: u32, 597 | pub finally_op: u32, 598 | pub finally_end: u32, 599 | } 600 | pub type zend_try_catch_element = _zend_try_catch_element; 601 | #[repr(C)] 602 | #[derive(Debug, Copy, Clone)] 603 | pub struct _zend_live_range { 604 | pub var: u32, 605 | pub start: u32, 606 | pub end: u32, 607 | } 608 | pub type zend_live_range = _zend_live_range; 609 | #[repr(C)] 610 | #[derive(Debug, Copy, Clone)] 611 | pub struct _zend_internal_arg_info { 612 | pub name: *const ::std::os::raw::c_char, 613 | pub type_: zend_type, 614 | pub pass_by_reference: zend_uchar, 615 | pub is_variadic: zend_bool, 616 | } 617 | pub type zend_internal_arg_info = _zend_internal_arg_info; 618 | #[repr(C)] 619 | #[derive(Debug, Copy, Clone)] 620 | pub struct _zend_arg_info { 621 | pub name: *mut zend_string, 622 | pub type_: zend_type, 623 | pub pass_by_reference: zend_uchar, 624 | pub is_variadic: zend_bool, 625 | } 626 | pub type zend_arg_info = _zend_arg_info; 627 | #[repr(C)] 628 | #[derive(Debug, Copy, Clone)] 629 | pub struct _zend_op_array { 630 | pub type_: zend_uchar, 631 | pub arg_flags: [zend_uchar; 3usize], 632 | pub fn_flags: u32, 633 | pub function_name: *mut zend_string, 634 | pub scope: *mut zend_class_entry, 635 | pub prototype: *mut zend_function, 636 | pub num_args: u32, 637 | pub required_num_args: u32, 638 | pub arg_info: *mut zend_arg_info, 639 | pub refcount: *mut u32, 640 | pub last: u32, 641 | pub opcodes: *mut zend_op, 642 | pub last_var: ::std::os::raw::c_int, 643 | pub T: u32, 644 | pub vars: *mut *mut zend_string, 645 | pub last_live_range: ::std::os::raw::c_int, 646 | pub last_try_catch: ::std::os::raw::c_int, 647 | pub live_range: *mut zend_live_range, 648 | pub try_catch_array: *mut zend_try_catch_element, 649 | pub static_variables: *mut HashTable, 650 | pub filename: *mut zend_string, 651 | pub line_start: u32, 652 | pub line_end: u32, 653 | pub doc_comment: *mut zend_string, 654 | pub early_binding: u32, 655 | pub last_literal: ::std::os::raw::c_int, 656 | pub literals: *mut zval, 657 | pub cache_size: ::std::os::raw::c_int, 658 | pub run_time_cache: *mut *mut ::std::os::raw::c_void, 659 | pub reserved: [*mut ::std::os::raw::c_void; 6usize], 660 | } 661 | pub type zif_handler = ::std::option::Option< 662 | unsafe extern "C" fn(execute_data: *mut zend_execute_data, return_value: *mut zval), 663 | >; 664 | #[repr(C)] 665 | #[derive(Debug, Copy, Clone)] 666 | pub struct _zend_internal_function { 667 | pub type_: zend_uchar, 668 | pub arg_flags: [zend_uchar; 3usize], 669 | pub fn_flags: u32, 670 | pub function_name: *mut zend_string, 671 | pub scope: *mut zend_class_entry, 672 | pub prototype: *mut zend_function, 673 | pub num_args: u32, 674 | pub required_num_args: u32, 675 | pub arg_info: *mut zend_internal_arg_info, 676 | pub handler: zif_handler, 677 | pub module: *mut _zend_module_entry, 678 | pub reserved: [*mut ::std::os::raw::c_void; 6usize], 679 | } 680 | pub type zend_internal_function = _zend_internal_function; 681 | #[repr(C)] 682 | #[derive(Copy, Clone)] 683 | pub union _zend_function { 684 | pub type_: zend_uchar, 685 | pub quick_arg_flags: u32, 686 | pub common: _zend_function__bindgen_ty_1, 687 | pub op_array: zend_op_array, 688 | pub internal_function: zend_internal_function, 689 | _bindgen_union_align: [u64; 28usize], 690 | } 691 | #[repr(C)] 692 | #[derive(Debug, Copy, Clone)] 693 | pub struct _zend_function__bindgen_ty_1 { 694 | pub type_: zend_uchar, 695 | pub arg_flags: [zend_uchar; 3usize], 696 | pub fn_flags: u32, 697 | pub function_name: *mut zend_string, 698 | pub scope: *mut zend_class_entry, 699 | pub prototype: *mut _zend_function, 700 | pub num_args: u32, 701 | pub required_num_args: u32, 702 | pub arg_info: *mut zend_arg_info, 703 | } 704 | #[repr(C)] 705 | #[derive(Copy, Clone)] 706 | pub struct _zend_execute_data { 707 | pub opline: *const zend_op, 708 | pub call: *mut zend_execute_data, 709 | pub return_value: *mut zval, 710 | pub func: *mut zend_function, 711 | pub This: zval, 712 | pub prev_execute_data: *mut zend_execute_data, 713 | pub symbol_table: *mut zend_array, 714 | pub run_time_cache: *mut *mut ::std::os::raw::c_void, 715 | pub literals: *mut zval, 716 | } 717 | pub type __jmp_buf = [::std::os::raw::c_long; 8usize]; 718 | #[repr(C)] 719 | #[derive(Debug, Copy, Clone)] 720 | pub struct __jmp_buf_tag { 721 | pub __jmpbuf: __jmp_buf, 722 | pub __mask_was_saved: ::std::os::raw::c_int, 723 | pub __saved_mask: __sigset_t, 724 | } 725 | pub type jmp_buf = [__jmp_buf_tag; 1usize]; 726 | pub type zend_executor_globals = _zend_executor_globals; 727 | #[repr(C)] 728 | #[derive(Debug, Copy, Clone)] 729 | pub struct _zend_stack { 730 | pub size: ::std::os::raw::c_int, 731 | pub top: ::std::os::raw::c_int, 732 | pub max: ::std::os::raw::c_int, 733 | pub elements: *mut ::std::os::raw::c_void, 734 | } 735 | pub type zend_stack = _zend_stack; 736 | #[repr(C)] 737 | #[derive(Debug, Copy, Clone)] 738 | pub struct _zend_objects_store { 739 | pub object_buckets: *mut *mut zend_object, 740 | pub top: u32, 741 | pub size: u32, 742 | pub free_list_head: ::std::os::raw::c_int, 743 | } 744 | pub type zend_objects_store = _zend_objects_store; 745 | pub type fpu_control_t = ::std::os::raw::c_ushort; 746 | pub type zend_vm_stack = *mut _zend_vm_stack; 747 | pub type zend_ini_entry = _zend_ini_entry; 748 | #[repr(C)] 749 | #[derive(Copy, Clone)] 750 | pub struct _zend_executor_globals { 751 | pub uninitialized_zval: zval, 752 | pub error_zval: zval, 753 | pub symtable_cache: [*mut zend_array; 32usize], 754 | pub symtable_cache_limit: *mut *mut zend_array, 755 | pub symtable_cache_ptr: *mut *mut zend_array, 756 | pub symbol_table: zend_array, 757 | pub included_files: HashTable, 758 | pub bailout: *mut jmp_buf, 759 | pub error_reporting: ::std::os::raw::c_int, 760 | pub exit_status: ::std::os::raw::c_int, 761 | pub function_table: *mut HashTable, 762 | pub class_table: *mut HashTable, 763 | pub zend_constants: *mut HashTable, 764 | pub vm_stack_top: *mut zval, 765 | pub vm_stack_end: *mut zval, 766 | pub vm_stack: zend_vm_stack, 767 | pub current_execute_data: *mut _zend_execute_data, 768 | pub fake_scope: *mut zend_class_entry, 769 | pub precision: zend_long, 770 | pub ticks_count: ::std::os::raw::c_int, 771 | pub in_autoload: *mut HashTable, 772 | pub autoload_func: *mut zend_function, 773 | pub full_tables_cleanup: zend_bool, 774 | pub no_extensions: zend_bool, 775 | pub vm_interrupt: zend_bool, 776 | pub timed_out: zend_bool, 777 | pub hard_timeout: zend_long, 778 | pub regular_list: HashTable, 779 | pub persistent_list: HashTable, 780 | pub user_error_handler_error_reporting: ::std::os::raw::c_int, 781 | pub user_error_handler: zval, 782 | pub user_exception_handler: zval, 783 | pub user_error_handlers_error_reporting: zend_stack, 784 | pub user_error_handlers: zend_stack, 785 | pub user_exception_handlers: zend_stack, 786 | pub error_handling: zend_error_handling_t, 787 | pub exception_class: *mut zend_class_entry, 788 | pub timeout_seconds: zend_long, 789 | pub lambda_count: ::std::os::raw::c_int, 790 | pub ini_directives: *mut HashTable, 791 | pub modified_ini_directives: *mut HashTable, 792 | pub error_reporting_ini_entry: *mut zend_ini_entry, 793 | pub objects_store: zend_objects_store, 794 | pub exception: *mut zend_object, 795 | pub prev_exception: *mut zend_object, 796 | pub opline_before_exception: *const zend_op, 797 | pub exception_op: [zend_op; 3usize], 798 | pub current_module: *mut _zend_module_entry, 799 | pub active: zend_bool, 800 | pub flags: zend_uchar, 801 | pub assertions: zend_long, 802 | pub ht_iterators_count: u32, 803 | pub ht_iterators_used: u32, 804 | pub ht_iterators: *mut HashTableIterator, 805 | pub ht_iterators_slots: [HashTableIterator; 16usize], 806 | pub saved_fpu_cw_ptr: *mut ::std::os::raw::c_void, 807 | pub saved_fpu_cw: fpu_control_t, 808 | pub trampoline: zend_function, 809 | pub call_trampoline_op: zend_op, 810 | pub each_deprecation_thrown: zend_bool, 811 | pub reserved: [*mut ::std::os::raw::c_void; 6usize], 812 | } 813 | pub type zend_module_entry = _zend_module_entry; 814 | #[repr(C)] 815 | #[derive(Debug, Copy, Clone)] 816 | pub struct _zend_module_entry { 817 | pub size: ::std::os::raw::c_ushort, 818 | pub zend_api: ::std::os::raw::c_uint, 819 | pub zend_debug: ::std::os::raw::c_uchar, 820 | pub zts: ::std::os::raw::c_uchar, 821 | pub ini_entry: *const _zend_ini_entry, 822 | pub deps: *const _zend_module_dep, 823 | pub name: *const ::std::os::raw::c_char, 824 | pub functions: *const _zend_function_entry, 825 | pub module_startup_func: ::std::option::Option< 826 | unsafe extern "C" fn( 827 | type_: ::std::os::raw::c_int, 828 | module_number: ::std::os::raw::c_int, 829 | ) -> ::std::os::raw::c_int, 830 | >, 831 | pub module_shutdown_func: ::std::option::Option< 832 | unsafe extern "C" fn( 833 | type_: ::std::os::raw::c_int, 834 | module_number: ::std::os::raw::c_int, 835 | ) -> ::std::os::raw::c_int, 836 | >, 837 | pub request_startup_func: ::std::option::Option< 838 | unsafe extern "C" fn( 839 | type_: ::std::os::raw::c_int, 840 | module_number: ::std::os::raw::c_int, 841 | ) -> ::std::os::raw::c_int, 842 | >, 843 | pub request_shutdown_func: ::std::option::Option< 844 | unsafe extern "C" fn( 845 | type_: ::std::os::raw::c_int, 846 | module_number: ::std::os::raw::c_int, 847 | ) -> ::std::os::raw::c_int, 848 | >, 849 | pub info_func: ::std::option::Option, 850 | pub version: *const ::std::os::raw::c_char, 851 | pub globals_size: usize, 852 | pub globals_ptr: *mut ::std::os::raw::c_void, 853 | pub globals_ctor: 854 | ::std::option::Option, 855 | pub globals_dtor: 856 | ::std::option::Option, 857 | pub post_deactivate_func: 858 | ::std::option::Option ::std::os::raw::c_int>, 859 | pub module_started: ::std::os::raw::c_int, 860 | pub type_: ::std::os::raw::c_uchar, 861 | pub handle: *mut ::std::os::raw::c_void, 862 | pub module_number: ::std::os::raw::c_int, 863 | pub build_id: *const ::std::os::raw::c_char, 864 | } 865 | #[repr(C)] 866 | #[derive(Debug, Copy, Clone)] 867 | pub struct _zend_module_dep { 868 | pub name: *const ::std::os::raw::c_char, 869 | pub rel: *const ::std::os::raw::c_char, 870 | pub version: *const ::std::os::raw::c_char, 871 | pub type_: ::std::os::raw::c_uchar, 872 | } 873 | #[repr(C)] 874 | #[derive(Debug, Copy, Clone)] 875 | pub struct _zend_vm_stack { 876 | pub top: *mut zval, 877 | pub end: *mut zval, 878 | pub prev: zend_vm_stack, 879 | } 880 | #[repr(C)] 881 | #[derive(Debug, Copy, Clone)] 882 | pub struct _zend_function_entry { 883 | pub fname: *const ::std::os::raw::c_char, 884 | pub handler: zif_handler, 885 | pub arg_info: *const _zend_internal_arg_info, 886 | pub num_args: u32, 887 | pub flags: u32, 888 | } 889 | #[repr(C)] 890 | #[derive(Debug, Copy, Clone)] 891 | pub struct _zend_ini_entry { 892 | pub name: *mut zend_string, 893 | pub on_modify: ::std::option::Option< 894 | unsafe extern "C" fn( 895 | entry: *mut zend_ini_entry, 896 | new_value: *mut zend_string, 897 | mh_arg1: *mut ::std::os::raw::c_void, 898 | mh_arg2: *mut ::std::os::raw::c_void, 899 | mh_arg3: *mut ::std::os::raw::c_void, 900 | stage: ::std::os::raw::c_int, 901 | ) -> ::std::os::raw::c_int, 902 | >, 903 | pub mh_arg1: *mut ::std::os::raw::c_void, 904 | pub mh_arg2: *mut ::std::os::raw::c_void, 905 | pub mh_arg3: *mut ::std::os::raw::c_void, 906 | pub value: *mut zend_string, 907 | pub orig_value: *mut zend_string, 908 | pub displayer: ::std::option::Option< 909 | unsafe extern "C" fn(ini_entry: *mut zend_ini_entry, type_: ::std::os::raw::c_int), 910 | >, 911 | pub modifiable: ::std::os::raw::c_int, 912 | pub orig_modifiable: ::std::os::raw::c_int, 913 | pub modified: ::std::os::raw::c_int, 914 | pub module_number: ::std::os::raw::c_int, 915 | } 916 | -------------------------------------------------------------------------------- /src/php73.rs: -------------------------------------------------------------------------------- 1 | /* automatically generated by rust-bindgen */ 2 | 3 | #![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, unused)] 4 | 5 | pub type __uint8_t = ::std::os::raw::c_uchar; 6 | pub type __uint16_t = ::std::os::raw::c_ushort; 7 | pub type __uint32_t = ::std::os::raw::c_uint; 8 | pub type __int64_t = ::std::os::raw::c_long; 9 | pub type __uint64_t = ::std::os::raw::c_ulong; 10 | #[repr(C)] 11 | #[derive(Debug, Copy, Clone)] 12 | pub struct __sigset_t { 13 | pub __val: [::std::os::raw::c_ulong; 16usize], 14 | } 15 | pub type zend_long = i64; 16 | pub type zend_ulong = u64; 17 | pub type zend_bool = ::std::os::raw::c_uchar; 18 | pub type zend_uchar = ::std::os::raw::c_uchar; 19 | pub type zend_object_handlers = _zend_object_handlers; 20 | pub type zend_class_entry = _zend_class_entry; 21 | pub type zend_function = _zend_function; 22 | pub type zend_execute_data = _zend_execute_data; 23 | pub type zval = _zval_struct; 24 | pub type zend_refcounted = _zend_refcounted; 25 | pub type zend_string = _zend_string; 26 | pub type zend_array = _zend_array; 27 | pub type zend_object = _zend_object; 28 | pub type zend_resource = _zend_resource; 29 | pub type zend_reference = _zend_reference; 30 | pub type zend_ast_ref = _zend_ast_ref; 31 | pub type dtor_func_t = ::std::option::Option; 32 | pub type zend_type = usize; 33 | #[repr(C)] 34 | #[derive(Copy, Clone)] 35 | pub union _zend_value { 36 | pub lval: zend_long, 37 | pub dval: f64, 38 | pub counted: *mut zend_refcounted, 39 | pub str: *mut zend_string, 40 | pub arr: *mut zend_array, 41 | pub obj: *mut zend_object, 42 | pub res: *mut zend_resource, 43 | pub ref_: *mut zend_reference, 44 | pub ast: *mut zend_ast_ref, 45 | pub zv: *mut zval, 46 | pub ptr: *mut ::std::os::raw::c_void, 47 | pub ce: *mut zend_class_entry, 48 | pub func: *mut zend_function, 49 | pub ww: _zend_value__bindgen_ty_1, 50 | _bindgen_union_align: u64, 51 | } 52 | #[repr(C)] 53 | #[derive(Debug, Copy, Clone)] 54 | pub struct _zend_value__bindgen_ty_1 { 55 | pub w1: u32, 56 | pub w2: u32, 57 | } 58 | pub type zend_value = _zend_value; 59 | #[repr(C)] 60 | #[derive(Copy, Clone)] 61 | pub struct _zval_struct { 62 | pub value: zend_value, 63 | pub u1: _zval_struct__bindgen_ty_1, 64 | pub u2: _zval_struct__bindgen_ty_2, 65 | } 66 | #[repr(C)] 67 | #[derive(Copy, Clone)] 68 | pub union _zval_struct__bindgen_ty_1 { 69 | pub v: _zval_struct__bindgen_ty_1__bindgen_ty_1, 70 | pub type_info: u32, 71 | _bindgen_union_align: u32, 72 | } 73 | #[repr(C)] 74 | #[derive(Copy, Clone)] 75 | pub struct _zval_struct__bindgen_ty_1__bindgen_ty_1 { 76 | pub type_: zend_uchar, 77 | pub type_flags: zend_uchar, 78 | pub u: _zval_struct__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1, 79 | } 80 | #[repr(C)] 81 | #[derive(Copy, Clone)] 82 | pub union _zval_struct__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 { 83 | pub call_info: u16, 84 | pub extra: u16, 85 | _bindgen_union_align: u16, 86 | } 87 | #[repr(C)] 88 | #[derive(Copy, Clone)] 89 | pub union _zval_struct__bindgen_ty_2 { 90 | pub next: u32, 91 | pub cache_slot: u32, 92 | pub opline_num: u32, 93 | pub lineno: u32, 94 | pub num_args: u32, 95 | pub fe_pos: u32, 96 | pub fe_iter_idx: u32, 97 | pub access_flags: u32, 98 | pub property_guard: u32, 99 | pub constant_flags: u32, 100 | pub extra: u32, 101 | _bindgen_union_align: u32, 102 | } 103 | #[repr(C)] 104 | #[derive(Copy, Clone)] 105 | pub struct _zend_refcounted_h { 106 | pub refcount: u32, 107 | pub u: _zend_refcounted_h__bindgen_ty_1, 108 | } 109 | #[repr(C)] 110 | #[derive(Copy, Clone)] 111 | pub union _zend_refcounted_h__bindgen_ty_1 { 112 | pub type_info: u32, 113 | _bindgen_union_align: u32, 114 | } 115 | pub type zend_refcounted_h = _zend_refcounted_h; 116 | #[repr(C)] 117 | #[derive(Copy, Clone)] 118 | pub struct _zend_refcounted { 119 | pub gc: zend_refcounted_h, 120 | } 121 | #[repr(C)] 122 | #[derive(Copy, Clone)] 123 | pub struct _zend_string { 124 | pub gc: zend_refcounted_h, 125 | pub h: zend_ulong, 126 | pub len: usize, 127 | pub val: [::std::os::raw::c_char; 1usize], 128 | } 129 | #[repr(C)] 130 | #[derive(Copy, Clone)] 131 | pub struct _Bucket { 132 | pub val: zval, 133 | pub h: zend_ulong, 134 | pub key: *mut zend_string, 135 | } 136 | pub type Bucket = _Bucket; 137 | pub type HashTable = _zend_array; 138 | #[repr(C)] 139 | #[derive(Copy, Clone)] 140 | pub struct _zend_array { 141 | pub gc: zend_refcounted_h, 142 | pub u: _zend_array__bindgen_ty_1, 143 | pub nTableMask: u32, 144 | pub arData: *mut Bucket, 145 | pub nNumUsed: u32, 146 | pub nNumOfElements: u32, 147 | pub nTableSize: u32, 148 | pub nInternalPointer: u32, 149 | pub nNextFreeElement: zend_long, 150 | pub pDestructor: dtor_func_t, 151 | } 152 | #[repr(C)] 153 | #[derive(Copy, Clone)] 154 | pub union _zend_array__bindgen_ty_1 { 155 | pub v: _zend_array__bindgen_ty_1__bindgen_ty_1, 156 | pub flags: u32, 157 | _bindgen_union_align: u32, 158 | } 159 | #[repr(C)] 160 | #[derive(Debug, Copy, Clone)] 161 | pub struct _zend_array__bindgen_ty_1__bindgen_ty_1 { 162 | pub flags: zend_uchar, 163 | pub _unused: zend_uchar, 164 | pub nIteratorsCount: zend_uchar, 165 | pub _unused2: zend_uchar, 166 | } 167 | pub type HashPosition = u32; 168 | #[repr(C)] 169 | #[derive(Debug, Copy, Clone)] 170 | pub struct _HashTableIterator { 171 | pub ht: *mut HashTable, 172 | pub pos: HashPosition, 173 | } 174 | pub type HashTableIterator = _HashTableIterator; 175 | #[repr(C)] 176 | #[derive(Copy, Clone)] 177 | pub struct _zend_object { 178 | pub gc: zend_refcounted_h, 179 | pub handle: u32, 180 | pub ce: *mut zend_class_entry, 181 | pub handlers: *const zend_object_handlers, 182 | pub properties: *mut HashTable, 183 | pub properties_table: [zval; 1usize], 184 | } 185 | #[repr(C)] 186 | #[derive(Copy, Clone)] 187 | pub struct _zend_resource { 188 | pub gc: zend_refcounted_h, 189 | pub handle: ::std::os::raw::c_int, 190 | pub type_: ::std::os::raw::c_int, 191 | pub ptr: *mut ::std::os::raw::c_void, 192 | } 193 | #[repr(C)] 194 | #[derive(Copy, Clone)] 195 | pub struct _zend_reference { 196 | pub gc: zend_refcounted_h, 197 | pub val: zval, 198 | } 199 | #[repr(C)] 200 | #[derive(Copy, Clone)] 201 | pub struct _zend_ast_ref { 202 | pub gc: zend_refcounted_h, 203 | } 204 | pub type zend_object_iterator = _zend_object_iterator; 205 | #[repr(C)] 206 | #[derive(Debug, Copy, Clone)] 207 | pub struct _zend_object_iterator_funcs { 208 | pub dtor: ::std::option::Option, 209 | pub valid: ::std::option::Option< 210 | unsafe extern "C" fn(iter: *mut zend_object_iterator) -> ::std::os::raw::c_int, 211 | >, 212 | pub get_current_data: 213 | ::std::option::Option *mut zval>, 214 | pub get_current_key: ::std::option::Option< 215 | unsafe extern "C" fn(iter: *mut zend_object_iterator, key: *mut zval), 216 | >, 217 | pub move_forward: ::std::option::Option, 218 | pub rewind: ::std::option::Option, 219 | pub invalidate_current: 220 | ::std::option::Option, 221 | } 222 | pub type zend_object_iterator_funcs = _zend_object_iterator_funcs; 223 | #[repr(C)] 224 | #[derive(Copy, Clone)] 225 | pub struct _zend_object_iterator { 226 | pub std: zend_object, 227 | pub data: zval, 228 | pub funcs: *const zend_object_iterator_funcs, 229 | pub index: zend_ulong, 230 | } 231 | #[repr(C)] 232 | #[derive(Debug, Copy, Clone)] 233 | pub struct _zend_class_iterator_funcs { 234 | pub zf_new_iterator: *mut _zend_function, 235 | pub zf_valid: *mut _zend_function, 236 | pub zf_current: *mut _zend_function, 237 | pub zf_key: *mut _zend_function, 238 | pub zf_next: *mut _zend_function, 239 | pub zf_rewind: *mut _zend_function, 240 | } 241 | pub type zend_class_iterator_funcs = _zend_class_iterator_funcs; 242 | #[repr(C)] 243 | #[derive(Debug, Copy, Clone)] 244 | pub struct _zend_serialize_data { 245 | _unused: [u8; 0], 246 | } 247 | #[repr(C)] 248 | #[derive(Debug, Copy, Clone)] 249 | pub struct _zend_unserialize_data { 250 | _unused: [u8; 0], 251 | } 252 | pub type zend_serialize_data = _zend_serialize_data; 253 | pub type zend_unserialize_data = _zend_unserialize_data; 254 | #[repr(C)] 255 | #[derive(Debug, Copy, Clone)] 256 | pub struct _zend_trait_method_reference { 257 | pub method_name: *mut zend_string, 258 | pub class_name: *mut zend_string, 259 | } 260 | pub type zend_trait_method_reference = _zend_trait_method_reference; 261 | #[repr(C)] 262 | #[derive(Debug, Copy, Clone)] 263 | pub struct _zend_trait_precedence { 264 | pub trait_method: zend_trait_method_reference, 265 | pub num_excludes: u32, 266 | pub exclude_class_names: [*mut zend_string; 1usize], 267 | } 268 | pub type zend_trait_precedence = _zend_trait_precedence; 269 | #[repr(C)] 270 | #[derive(Debug, Copy, Clone)] 271 | pub struct _zend_trait_alias { 272 | pub trait_method: zend_trait_method_reference, 273 | #[doc = " name for method to be added"] 274 | pub alias: *mut zend_string, 275 | #[doc = " modifiers to be set on trait method"] 276 | pub modifiers: u32, 277 | } 278 | pub type zend_trait_alias = _zend_trait_alias; 279 | #[repr(C)] 280 | #[derive(Copy, Clone)] 281 | pub struct _zend_class_entry { 282 | pub type_: ::std::os::raw::c_char, 283 | pub name: *mut zend_string, 284 | pub parent: *mut _zend_class_entry, 285 | pub refcount: ::std::os::raw::c_int, 286 | pub ce_flags: u32, 287 | pub default_properties_count: ::std::os::raw::c_int, 288 | pub default_static_members_count: ::std::os::raw::c_int, 289 | pub default_properties_table: *mut zval, 290 | pub default_static_members_table: *mut zval, 291 | pub static_members_table: *mut zval, 292 | pub function_table: HashTable, 293 | pub properties_info: HashTable, 294 | pub constants_table: HashTable, 295 | pub constructor: *mut _zend_function, 296 | pub destructor: *mut _zend_function, 297 | pub clone: *mut _zend_function, 298 | pub __get: *mut _zend_function, 299 | pub __set: *mut _zend_function, 300 | pub __unset: *mut _zend_function, 301 | pub __isset: *mut _zend_function, 302 | pub __call: *mut _zend_function, 303 | pub __callstatic: *mut _zend_function, 304 | pub __tostring: *mut _zend_function, 305 | pub __debugInfo: *mut _zend_function, 306 | pub serialize_func: *mut _zend_function, 307 | pub unserialize_func: *mut _zend_function, 308 | pub iterator_funcs_ptr: *mut zend_class_iterator_funcs, 309 | pub __bindgen_anon_1: _zend_class_entry__bindgen_ty_1, 310 | pub get_iterator: ::std::option::Option< 311 | unsafe extern "C" fn( 312 | ce: *mut zend_class_entry, 313 | object: *mut zval, 314 | by_ref: ::std::os::raw::c_int, 315 | ) -> *mut zend_object_iterator, 316 | >, 317 | pub get_static_method: ::std::option::Option< 318 | unsafe extern "C" fn( 319 | ce: *mut zend_class_entry, 320 | method: *mut zend_string, 321 | ) -> *mut _zend_function, 322 | >, 323 | pub serialize: ::std::option::Option< 324 | unsafe extern "C" fn( 325 | object: *mut zval, 326 | buffer: *mut *mut ::std::os::raw::c_uchar, 327 | buf_len: *mut usize, 328 | data: *mut zend_serialize_data, 329 | ) -> ::std::os::raw::c_int, 330 | >, 331 | pub unserialize: ::std::option::Option< 332 | unsafe extern "C" fn( 333 | object: *mut zval, 334 | ce: *mut zend_class_entry, 335 | buf: *const ::std::os::raw::c_uchar, 336 | buf_len: usize, 337 | data: *mut zend_unserialize_data, 338 | ) -> ::std::os::raw::c_int, 339 | >, 340 | pub num_interfaces: u32, 341 | pub num_traits: u32, 342 | pub interfaces: *mut *mut zend_class_entry, 343 | pub traits: *mut *mut zend_class_entry, 344 | pub trait_aliases: *mut *mut zend_trait_alias, 345 | pub trait_precedences: *mut *mut zend_trait_precedence, 346 | pub info: _zend_class_entry__bindgen_ty_2, 347 | } 348 | #[repr(C)] 349 | #[derive(Copy, Clone)] 350 | pub union _zend_class_entry__bindgen_ty_1 { 351 | pub create_object: ::std::option::Option< 352 | unsafe extern "C" fn(class_type: *mut zend_class_entry) -> *mut zend_object, 353 | >, 354 | pub interface_gets_implemented: ::std::option::Option< 355 | unsafe extern "C" fn( 356 | iface: *mut zend_class_entry, 357 | class_type: *mut zend_class_entry, 358 | ) -> ::std::os::raw::c_int, 359 | >, 360 | _bindgen_union_align: u64, 361 | } 362 | #[repr(C)] 363 | #[derive(Copy, Clone)] 364 | pub union _zend_class_entry__bindgen_ty_2 { 365 | pub user: _zend_class_entry__bindgen_ty_2__bindgen_ty_1, 366 | pub internal: _zend_class_entry__bindgen_ty_2__bindgen_ty_2, 367 | _bindgen_union_align: [u64; 3usize], 368 | } 369 | #[repr(C)] 370 | #[derive(Debug, Copy, Clone)] 371 | pub struct _zend_class_entry__bindgen_ty_2__bindgen_ty_1 { 372 | pub filename: *mut zend_string, 373 | pub line_start: u32, 374 | pub line_end: u32, 375 | pub doc_comment: *mut zend_string, 376 | } 377 | #[repr(C)] 378 | #[derive(Debug, Copy, Clone)] 379 | pub struct _zend_class_entry__bindgen_ty_2__bindgen_ty_2 { 380 | pub builtin_functions: *const _zend_function_entry, 381 | pub module: *mut _zend_module_entry, 382 | } 383 | pub const zend_error_handling_t_EH_NORMAL: zend_error_handling_t = 0; 384 | pub const zend_error_handling_t_EH_THROW: zend_error_handling_t = 1; 385 | pub type zend_error_handling_t = u32; 386 | pub type zend_object_read_property_t = ::std::option::Option< 387 | unsafe extern "C" fn( 388 | object: *mut zval, 389 | member: *mut zval, 390 | type_: ::std::os::raw::c_int, 391 | cache_slot: *mut *mut ::std::os::raw::c_void, 392 | rv: *mut zval, 393 | ) -> *mut zval, 394 | >; 395 | pub type zend_object_read_dimension_t = ::std::option::Option< 396 | unsafe extern "C" fn( 397 | object: *mut zval, 398 | offset: *mut zval, 399 | type_: ::std::os::raw::c_int, 400 | rv: *mut zval, 401 | ) -> *mut zval, 402 | >; 403 | pub type zend_object_write_property_t = ::std::option::Option< 404 | unsafe extern "C" fn( 405 | object: *mut zval, 406 | member: *mut zval, 407 | value: *mut zval, 408 | cache_slot: *mut *mut ::std::os::raw::c_void, 409 | ), 410 | >; 411 | pub type zend_object_write_dimension_t = ::std::option::Option< 412 | unsafe extern "C" fn(object: *mut zval, offset: *mut zval, value: *mut zval), 413 | >; 414 | pub type zend_object_get_property_ptr_ptr_t = ::std::option::Option< 415 | unsafe extern "C" fn( 416 | object: *mut zval, 417 | member: *mut zval, 418 | type_: ::std::os::raw::c_int, 419 | cache_slot: *mut *mut ::std::os::raw::c_void, 420 | ) -> *mut zval, 421 | >; 422 | pub type zend_object_set_t = 423 | ::std::option::Option; 424 | pub type zend_object_get_t = 425 | ::std::option::Option *mut zval>; 426 | pub type zend_object_has_property_t = ::std::option::Option< 427 | unsafe extern "C" fn( 428 | object: *mut zval, 429 | member: *mut zval, 430 | has_set_exists: ::std::os::raw::c_int, 431 | cache_slot: *mut *mut ::std::os::raw::c_void, 432 | ) -> ::std::os::raw::c_int, 433 | >; 434 | pub type zend_object_has_dimension_t = ::std::option::Option< 435 | unsafe extern "C" fn( 436 | object: *mut zval, 437 | member: *mut zval, 438 | check_empty: ::std::os::raw::c_int, 439 | ) -> ::std::os::raw::c_int, 440 | >; 441 | pub type zend_object_unset_property_t = ::std::option::Option< 442 | unsafe extern "C" fn( 443 | object: *mut zval, 444 | member: *mut zval, 445 | cache_slot: *mut *mut ::std::os::raw::c_void, 446 | ), 447 | >; 448 | pub type zend_object_unset_dimension_t = 449 | ::std::option::Option; 450 | pub type zend_object_get_properties_t = 451 | ::std::option::Option *mut HashTable>; 452 | pub type zend_object_get_debug_info_t = ::std::option::Option< 453 | unsafe extern "C" fn(object: *mut zval, is_temp: *mut ::std::os::raw::c_int) -> *mut HashTable, 454 | >; 455 | pub type zend_object_call_method_t = ::std::option::Option< 456 | unsafe extern "C" fn( 457 | method: *mut zend_string, 458 | object: *mut zend_object, 459 | execute_data: *mut zend_execute_data, 460 | return_value: *mut zval, 461 | ) -> ::std::os::raw::c_int, 462 | >; 463 | pub type zend_object_get_method_t = ::std::option::Option< 464 | unsafe extern "C" fn( 465 | object: *mut *mut zend_object, 466 | method: *mut zend_string, 467 | key: *const zval, 468 | ) -> *mut zend_function, 469 | >; 470 | pub type zend_object_get_constructor_t = 471 | ::std::option::Option *mut zend_function>; 472 | pub type zend_object_dtor_obj_t = 473 | ::std::option::Option; 474 | pub type zend_object_free_obj_t = 475 | ::std::option::Option; 476 | pub type zend_object_clone_obj_t = 477 | ::std::option::Option *mut zend_object>; 478 | pub type zend_object_get_class_name_t = 479 | ::std::option::Option *mut zend_string>; 480 | pub type zend_object_compare_t = ::std::option::Option< 481 | unsafe extern "C" fn(object1: *mut zval, object2: *mut zval) -> ::std::os::raw::c_int, 482 | >; 483 | pub type zend_object_compare_zvals_t = ::std::option::Option< 484 | unsafe extern "C" fn(resul: *mut zval, op1: *mut zval, op2: *mut zval) -> ::std::os::raw::c_int, 485 | >; 486 | pub type zend_object_cast_t = ::std::option::Option< 487 | unsafe extern "C" fn( 488 | readobj: *mut zval, 489 | retval: *mut zval, 490 | type_: ::std::os::raw::c_int, 491 | ) -> ::std::os::raw::c_int, 492 | >; 493 | pub type zend_object_count_elements_t = ::std::option::Option< 494 | unsafe extern "C" fn(object: *mut zval, count: *mut zend_long) -> ::std::os::raw::c_int, 495 | >; 496 | pub type zend_object_get_closure_t = ::std::option::Option< 497 | unsafe extern "C" fn( 498 | obj: *mut zval, 499 | ce_ptr: *mut *mut zend_class_entry, 500 | fptr_ptr: *mut *mut zend_function, 501 | obj_ptr: *mut *mut zend_object, 502 | ) -> ::std::os::raw::c_int, 503 | >; 504 | pub type zend_object_get_gc_t = ::std::option::Option< 505 | unsafe extern "C" fn( 506 | object: *mut zval, 507 | table: *mut *mut zval, 508 | n: *mut ::std::os::raw::c_int, 509 | ) -> *mut HashTable, 510 | >; 511 | pub type zend_object_do_operation_t = ::std::option::Option< 512 | unsafe extern "C" fn( 513 | opcode: zend_uchar, 514 | result: *mut zval, 515 | op1: *mut zval, 516 | op2: *mut zval, 517 | ) -> ::std::os::raw::c_int, 518 | >; 519 | #[repr(C)] 520 | #[derive(Debug, Copy, Clone)] 521 | pub struct _zend_object_handlers { 522 | pub offset: ::std::os::raw::c_int, 523 | pub free_obj: zend_object_free_obj_t, 524 | pub dtor_obj: zend_object_dtor_obj_t, 525 | pub clone_obj: zend_object_clone_obj_t, 526 | pub read_property: zend_object_read_property_t, 527 | pub write_property: zend_object_write_property_t, 528 | pub read_dimension: zend_object_read_dimension_t, 529 | pub write_dimension: zend_object_write_dimension_t, 530 | pub get_property_ptr_ptr: zend_object_get_property_ptr_ptr_t, 531 | pub get: zend_object_get_t, 532 | pub set: zend_object_set_t, 533 | pub has_property: zend_object_has_property_t, 534 | pub unset_property: zend_object_unset_property_t, 535 | pub has_dimension: zend_object_has_dimension_t, 536 | pub unset_dimension: zend_object_unset_dimension_t, 537 | pub get_properties: zend_object_get_properties_t, 538 | pub get_method: zend_object_get_method_t, 539 | pub call_method: zend_object_call_method_t, 540 | pub get_constructor: zend_object_get_constructor_t, 541 | pub get_class_name: zend_object_get_class_name_t, 542 | pub compare_objects: zend_object_compare_t, 543 | pub cast_object: zend_object_cast_t, 544 | pub count_elements: zend_object_count_elements_t, 545 | pub get_debug_info: zend_object_get_debug_info_t, 546 | pub get_closure: zend_object_get_closure_t, 547 | pub get_gc: zend_object_get_gc_t, 548 | pub do_operation: zend_object_do_operation_t, 549 | pub compare: zend_object_compare_zvals_t, 550 | } 551 | pub type zend_op_array = _zend_op_array; 552 | pub type zend_op = _zend_op; 553 | #[repr(C)] 554 | #[derive(Copy, Clone)] 555 | pub union _znode_op { 556 | pub constant: u32, 557 | pub var: u32, 558 | pub num: u32, 559 | pub opline_num: u32, 560 | pub jmp_offset: u32, 561 | _bindgen_union_align: u32, 562 | } 563 | pub type znode_op = _znode_op; 564 | #[repr(C)] 565 | #[derive(Copy, Clone)] 566 | pub struct _zend_op { 567 | pub handler: *const ::std::os::raw::c_void, 568 | pub op1: znode_op, 569 | pub op2: znode_op, 570 | pub result: znode_op, 571 | pub extended_value: u32, 572 | pub lineno: u32, 573 | pub opcode: zend_uchar, 574 | pub op1_type: zend_uchar, 575 | pub op2_type: zend_uchar, 576 | pub result_type: zend_uchar, 577 | } 578 | #[repr(C)] 579 | #[derive(Debug, Copy, Clone)] 580 | pub struct _zend_try_catch_element { 581 | pub try_op: u32, 582 | pub catch_op: u32, 583 | pub finally_op: u32, 584 | pub finally_end: u32, 585 | } 586 | pub type zend_try_catch_element = _zend_try_catch_element; 587 | #[repr(C)] 588 | #[derive(Debug, Copy, Clone)] 589 | pub struct _zend_live_range { 590 | pub var: u32, 591 | pub start: u32, 592 | pub end: u32, 593 | } 594 | pub type zend_live_range = _zend_live_range; 595 | #[repr(C)] 596 | #[derive(Debug, Copy, Clone)] 597 | pub struct _zend_internal_arg_info { 598 | pub name: *const ::std::os::raw::c_char, 599 | pub type_: zend_type, 600 | pub pass_by_reference: zend_uchar, 601 | pub is_variadic: zend_bool, 602 | } 603 | pub type zend_internal_arg_info = _zend_internal_arg_info; 604 | #[repr(C)] 605 | #[derive(Debug, Copy, Clone)] 606 | pub struct _zend_arg_info { 607 | pub name: *mut zend_string, 608 | pub type_: zend_type, 609 | pub pass_by_reference: zend_uchar, 610 | pub is_variadic: zend_bool, 611 | } 612 | pub type zend_arg_info = _zend_arg_info; 613 | #[repr(C)] 614 | #[derive(Debug, Copy, Clone)] 615 | pub struct _zend_op_array { 616 | pub type_: zend_uchar, 617 | pub arg_flags: [zend_uchar; 3usize], 618 | pub fn_flags: u32, 619 | pub function_name: *mut zend_string, 620 | pub scope: *mut zend_class_entry, 621 | pub prototype: *mut zend_function, 622 | pub num_args: u32, 623 | pub required_num_args: u32, 624 | pub arg_info: *mut zend_arg_info, 625 | pub cache_size: ::std::os::raw::c_int, 626 | pub last_var: ::std::os::raw::c_int, 627 | pub T: u32, 628 | pub last: u32, 629 | pub opcodes: *mut zend_op, 630 | pub run_time_cache: *mut *mut ::std::os::raw::c_void, 631 | pub static_variables: *mut HashTable, 632 | pub vars: *mut *mut zend_string, 633 | pub refcount: *mut u32, 634 | pub last_live_range: ::std::os::raw::c_int, 635 | pub last_try_catch: ::std::os::raw::c_int, 636 | pub live_range: *mut zend_live_range, 637 | pub try_catch_array: *mut zend_try_catch_element, 638 | pub filename: *mut zend_string, 639 | pub line_start: u32, 640 | pub line_end: u32, 641 | pub doc_comment: *mut zend_string, 642 | pub last_literal: ::std::os::raw::c_int, 643 | pub literals: *mut zval, 644 | pub reserved: [*mut ::std::os::raw::c_void; 6usize], 645 | } 646 | pub type zif_handler = ::std::option::Option< 647 | unsafe extern "C" fn(execute_data: *mut zend_execute_data, return_value: *mut zval), 648 | >; 649 | #[repr(C)] 650 | #[derive(Debug, Copy, Clone)] 651 | pub struct _zend_internal_function { 652 | pub type_: zend_uchar, 653 | pub arg_flags: [zend_uchar; 3usize], 654 | pub fn_flags: u32, 655 | pub function_name: *mut zend_string, 656 | pub scope: *mut zend_class_entry, 657 | pub prototype: *mut zend_function, 658 | pub num_args: u32, 659 | pub required_num_args: u32, 660 | pub arg_info: *mut zend_internal_arg_info, 661 | pub handler: zif_handler, 662 | pub module: *mut _zend_module_entry, 663 | pub reserved: [*mut ::std::os::raw::c_void; 6usize], 664 | } 665 | pub type zend_internal_function = _zend_internal_function; 666 | #[repr(C)] 667 | #[derive(Copy, Clone)] 668 | pub union _zend_function { 669 | pub type_: zend_uchar, 670 | pub quick_arg_flags: u32, 671 | pub common: _zend_function__bindgen_ty_1, 672 | pub op_array: zend_op_array, 673 | pub internal_function: zend_internal_function, 674 | _bindgen_union_align: [u64; 27usize], 675 | } 676 | #[repr(C)] 677 | #[derive(Debug, Copy, Clone)] 678 | pub struct _zend_function__bindgen_ty_1 { 679 | pub type_: zend_uchar, 680 | pub arg_flags: [zend_uchar; 3usize], 681 | pub fn_flags: u32, 682 | pub function_name: *mut zend_string, 683 | pub scope: *mut zend_class_entry, 684 | pub prototype: *mut _zend_function, 685 | pub num_args: u32, 686 | pub required_num_args: u32, 687 | pub arg_info: *mut zend_arg_info, 688 | } 689 | #[repr(C)] 690 | #[derive(Copy, Clone)] 691 | pub struct _zend_execute_data { 692 | pub opline: *const zend_op, 693 | pub call: *mut zend_execute_data, 694 | pub return_value: *mut zval, 695 | pub func: *mut zend_function, 696 | pub This: zval, 697 | pub prev_execute_data: *mut zend_execute_data, 698 | pub symbol_table: *mut zend_array, 699 | pub run_time_cache: *mut *mut ::std::os::raw::c_void, 700 | } 701 | pub type __jmp_buf = [::std::os::raw::c_long; 8usize]; 702 | #[repr(C)] 703 | #[derive(Debug, Copy, Clone)] 704 | pub struct __jmp_buf_tag { 705 | pub __jmpbuf: __jmp_buf, 706 | pub __mask_was_saved: ::std::os::raw::c_int, 707 | pub __saved_mask: __sigset_t, 708 | } 709 | pub type jmp_buf = [__jmp_buf_tag; 1usize]; 710 | pub type zend_executor_globals = _zend_executor_globals; 711 | #[repr(C)] 712 | #[derive(Debug, Copy, Clone)] 713 | pub struct _zend_stack { 714 | pub size: ::std::os::raw::c_int, 715 | pub top: ::std::os::raw::c_int, 716 | pub max: ::std::os::raw::c_int, 717 | pub elements: *mut ::std::os::raw::c_void, 718 | } 719 | pub type zend_stack = _zend_stack; 720 | #[repr(C)] 721 | #[derive(Debug, Copy, Clone)] 722 | pub struct _zend_objects_store { 723 | pub object_buckets: *mut *mut zend_object, 724 | pub top: u32, 725 | pub size: u32, 726 | pub free_list_head: ::std::os::raw::c_int, 727 | } 728 | pub type zend_objects_store = _zend_objects_store; 729 | pub type fpu_control_t = ::std::os::raw::c_ushort; 730 | pub type zend_vm_stack = *mut _zend_vm_stack; 731 | pub type zend_ini_entry = _zend_ini_entry; 732 | #[repr(C)] 733 | #[derive(Copy, Clone)] 734 | pub struct _zend_executor_globals { 735 | pub uninitialized_zval: zval, 736 | pub error_zval: zval, 737 | pub symtable_cache: [*mut zend_array; 32usize], 738 | pub symtable_cache_limit: *mut *mut zend_array, 739 | pub symtable_cache_ptr: *mut *mut zend_array, 740 | pub symbol_table: zend_array, 741 | pub included_files: HashTable, 742 | pub bailout: *mut jmp_buf, 743 | pub error_reporting: ::std::os::raw::c_int, 744 | pub exit_status: ::std::os::raw::c_int, 745 | pub function_table: *mut HashTable, 746 | pub class_table: *mut HashTable, 747 | pub zend_constants: *mut HashTable, 748 | pub vm_stack_top: *mut zval, 749 | pub vm_stack_end: *mut zval, 750 | pub vm_stack: zend_vm_stack, 751 | pub vm_stack_page_size: usize, 752 | pub current_execute_data: *mut _zend_execute_data, 753 | pub fake_scope: *mut zend_class_entry, 754 | pub precision: zend_long, 755 | pub ticks_count: ::std::os::raw::c_int, 756 | pub persistent_constants_count: u32, 757 | pub persistent_functions_count: u32, 758 | pub persistent_classes_count: u32, 759 | pub in_autoload: *mut HashTable, 760 | pub autoload_func: *mut zend_function, 761 | pub full_tables_cleanup: zend_bool, 762 | pub no_extensions: zend_bool, 763 | pub vm_interrupt: zend_bool, 764 | pub timed_out: zend_bool, 765 | pub hard_timeout: zend_long, 766 | pub regular_list: HashTable, 767 | pub persistent_list: HashTable, 768 | pub user_error_handler_error_reporting: ::std::os::raw::c_int, 769 | pub user_error_handler: zval, 770 | pub user_exception_handler: zval, 771 | pub user_error_handlers_error_reporting: zend_stack, 772 | pub user_error_handlers: zend_stack, 773 | pub user_exception_handlers: zend_stack, 774 | pub error_handling: zend_error_handling_t, 775 | pub exception_class: *mut zend_class_entry, 776 | pub timeout_seconds: zend_long, 777 | pub lambda_count: ::std::os::raw::c_int, 778 | pub ini_directives: *mut HashTable, 779 | pub modified_ini_directives: *mut HashTable, 780 | pub error_reporting_ini_entry: *mut zend_ini_entry, 781 | pub objects_store: zend_objects_store, 782 | pub exception: *mut zend_object, 783 | pub prev_exception: *mut zend_object, 784 | pub opline_before_exception: *const zend_op, 785 | pub exception_op: [zend_op; 3usize], 786 | pub current_module: *mut _zend_module_entry, 787 | pub active: zend_bool, 788 | pub flags: zend_uchar, 789 | pub assertions: zend_long, 790 | pub ht_iterators_count: u32, 791 | pub ht_iterators_used: u32, 792 | pub ht_iterators: *mut HashTableIterator, 793 | pub ht_iterators_slots: [HashTableIterator; 16usize], 794 | pub saved_fpu_cw_ptr: *mut ::std::os::raw::c_void, 795 | pub saved_fpu_cw: fpu_control_t, 796 | pub trampoline: zend_function, 797 | pub call_trampoline_op: zend_op, 798 | pub each_deprecation_thrown: zend_bool, 799 | pub reserved: [*mut ::std::os::raw::c_void; 6usize], 800 | } 801 | pub type zend_module_entry = _zend_module_entry; 802 | #[repr(C)] 803 | #[derive(Debug, Copy, Clone)] 804 | pub struct _zend_module_entry { 805 | pub size: ::std::os::raw::c_ushort, 806 | pub zend_api: ::std::os::raw::c_uint, 807 | pub zend_debug: ::std::os::raw::c_uchar, 808 | pub zts: ::std::os::raw::c_uchar, 809 | pub ini_entry: *const _zend_ini_entry, 810 | pub deps: *const _zend_module_dep, 811 | pub name: *const ::std::os::raw::c_char, 812 | pub functions: *const _zend_function_entry, 813 | pub module_startup_func: ::std::option::Option< 814 | unsafe extern "C" fn( 815 | type_: ::std::os::raw::c_int, 816 | module_number: ::std::os::raw::c_int, 817 | ) -> ::std::os::raw::c_int, 818 | >, 819 | pub module_shutdown_func: ::std::option::Option< 820 | unsafe extern "C" fn( 821 | type_: ::std::os::raw::c_int, 822 | module_number: ::std::os::raw::c_int, 823 | ) -> ::std::os::raw::c_int, 824 | >, 825 | pub request_startup_func: ::std::option::Option< 826 | unsafe extern "C" fn( 827 | type_: ::std::os::raw::c_int, 828 | module_number: ::std::os::raw::c_int, 829 | ) -> ::std::os::raw::c_int, 830 | >, 831 | pub request_shutdown_func: ::std::option::Option< 832 | unsafe extern "C" fn( 833 | type_: ::std::os::raw::c_int, 834 | module_number: ::std::os::raw::c_int, 835 | ) -> ::std::os::raw::c_int, 836 | >, 837 | pub info_func: ::std::option::Option, 838 | pub version: *const ::std::os::raw::c_char, 839 | pub globals_size: usize, 840 | pub globals_ptr: *mut ::std::os::raw::c_void, 841 | pub globals_ctor: 842 | ::std::option::Option, 843 | pub globals_dtor: 844 | ::std::option::Option, 845 | pub post_deactivate_func: 846 | ::std::option::Option ::std::os::raw::c_int>, 847 | pub module_started: ::std::os::raw::c_int, 848 | pub type_: ::std::os::raw::c_uchar, 849 | pub handle: *mut ::std::os::raw::c_void, 850 | pub module_number: ::std::os::raw::c_int, 851 | pub build_id: *const ::std::os::raw::c_char, 852 | } 853 | #[repr(C)] 854 | #[derive(Debug, Copy, Clone)] 855 | pub struct _zend_module_dep { 856 | pub name: *const ::std::os::raw::c_char, 857 | pub rel: *const ::std::os::raw::c_char, 858 | pub version: *const ::std::os::raw::c_char, 859 | pub type_: ::std::os::raw::c_uchar, 860 | } 861 | #[repr(C)] 862 | #[derive(Debug, Copy, Clone)] 863 | pub struct _zend_vm_stack { 864 | pub top: *mut zval, 865 | pub end: *mut zval, 866 | pub prev: zend_vm_stack, 867 | } 868 | #[repr(C)] 869 | #[derive(Debug, Copy, Clone)] 870 | pub struct _zend_function_entry { 871 | pub fname: *const ::std::os::raw::c_char, 872 | pub handler: zif_handler, 873 | pub arg_info: *const _zend_internal_arg_info, 874 | pub num_args: u32, 875 | pub flags: u32, 876 | } 877 | #[repr(C)] 878 | #[derive(Debug, Copy, Clone)] 879 | pub struct _zend_ini_entry { 880 | pub name: *mut zend_string, 881 | pub on_modify: ::std::option::Option< 882 | unsafe extern "C" fn( 883 | entry: *mut zend_ini_entry, 884 | new_value: *mut zend_string, 885 | mh_arg1: *mut ::std::os::raw::c_void, 886 | mh_arg2: *mut ::std::os::raw::c_void, 887 | mh_arg3: *mut ::std::os::raw::c_void, 888 | stage: ::std::os::raw::c_int, 889 | ) -> ::std::os::raw::c_int, 890 | >, 891 | pub mh_arg1: *mut ::std::os::raw::c_void, 892 | pub mh_arg2: *mut ::std::os::raw::c_void, 893 | pub mh_arg3: *mut ::std::os::raw::c_void, 894 | pub value: *mut zend_string, 895 | pub orig_value: *mut zend_string, 896 | pub displayer: ::std::option::Option< 897 | unsafe extern "C" fn(ini_entry: *mut zend_ini_entry, type_: ::std::os::raw::c_int), 898 | >, 899 | pub module_number: ::std::os::raw::c_int, 900 | pub modifiable: u8, 901 | pub orig_modifiable: u8, 902 | pub modified: u8, 903 | } 904 | -------------------------------------------------------------------------------- /src/process_reader.rs: -------------------------------------------------------------------------------- 1 | #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 | 3 | extern crate read_process_memory; 4 | 5 | use crate::php73; 6 | use crate::php72; 7 | use crate::php56; 8 | 9 | use read_process_memory::{copy_address, ProcessHandle}; 10 | use std::mem::{size_of, transmute}; 11 | 12 | pub trait ProcessReader { 13 | fn read(&self, addr: usize) -> Trace; 14 | } 15 | 16 | pub struct Trace { 17 | 18 | } 19 | 20 | pub struct PHP730 { pub source: ProcessHandle } 21 | pub struct PHP720 { pub source: ProcessHandle } 22 | pub struct PHP560 { pub source: ProcessHandle } 23 | 24 | impl PHP730 { 25 | 26 | fn get_executor_global(&self, addr: usize) -> php73::zend_executor_globals 27 | { 28 | read_memory::(&self.source, addr) 29 | } 30 | 31 | fn get_execute_data(&self, addr: usize) -> php73::zend_execute_data 32 | { 33 | read_memory::(&self.source, addr) 34 | } 35 | 36 | fn get_function(&self, addr: usize) -> php73::zend_function 37 | { 38 | read_memory::(&self.source, addr) 39 | } 40 | 41 | fn get_string(&self, addr: usize) -> String 42 | { 43 | let zend_str = read_memory::(&self.source, addr); 44 | let offset = unsafe { &(*(::std::ptr::null::())).val as *const _ as usize }; 45 | 46 | let val = copy_address(addr + offset, zend_str.len, &self.source).unwrap(); 47 | unsafe { String::from_utf8_unchecked(val) } 48 | } 49 | } 50 | 51 | impl ProcessReader for PHP730 { 52 | 53 | fn read(&self, addr: usize) -> Trace 54 | { 55 | let eg = self.get_executor_global(addr); 56 | let mut ex_addr = eg.current_execute_data as usize; 57 | 58 | let mut output = String::new(); 59 | 60 | while ex_addr != 0 { 61 | let ex = self.get_execute_data(ex_addr); 62 | 63 | let func_addr = ex.func as usize; 64 | if func_addr == 0 { 65 | break 66 | }; 67 | 68 | let func = self.get_function(func_addr); 69 | 70 | unsafe { 71 | if func.common.scope as usize != 0 { 72 | let ce = read_memory::(&self.source, func.common.scope as usize); 73 | let scope = self.get_string(ce.name as usize); 74 | output = output + &scope + "::"; 75 | } 76 | } 77 | 78 | let function_name_addr = unsafe { func.common.function_name as usize }; 79 | if function_name_addr == 0 { 80 | output = output + "main()"; 81 | } else { 82 | let name = self.get_string(function_name_addr); 83 | output = output + &name + "()\n"; 84 | } 85 | 86 | ex_addr = ex.prev_execute_data as usize; 87 | } 88 | println!("{}", output); 89 | Trace{} 90 | } 91 | } 92 | 93 | impl PHP720 { 94 | fn get_executor_global(&self, addr: usize) -> php72::zend_executor_globals 95 | { 96 | read_memory::(&self.source, addr) 97 | } 98 | 99 | fn get_execute_data(&self, addr: usize) -> php72::zend_execute_data 100 | { 101 | read_memory::(&self.source, addr) 102 | } 103 | 104 | fn get_function(&self, addr: usize) -> php72::zend_function 105 | { 106 | read_memory::(&self.source, addr) 107 | } 108 | 109 | fn get_string(&self, addr: usize) -> String 110 | { 111 | let zend_str = read_memory::(&self.source, addr); 112 | let offset = unsafe { &(*(::std::ptr::null::())).val as *const _ as usize }; 113 | 114 | let val = copy_address(addr + offset, zend_str.len, &self.source).unwrap(); 115 | unsafe { String::from_utf8_unchecked(val) } 116 | } 117 | } 118 | 119 | impl ProcessReader for PHP720 { 120 | 121 | fn read(&self, addr: usize) -> Trace 122 | { 123 | let eg = self.get_executor_global(addr); 124 | let mut ex_addr = eg.current_execute_data as usize; 125 | 126 | let mut output = String::new(); 127 | 128 | while ex_addr != 0 { 129 | let ex = self.get_execute_data(ex_addr); 130 | 131 | let func_addr = ex.func as usize; 132 | if func_addr == 0 { 133 | break 134 | }; 135 | 136 | let func = self.get_function(func_addr); 137 | 138 | unsafe { 139 | if func.common.scope as usize != 0 { 140 | let ce = read_memory::(&self.source, func.common.scope as usize); 141 | let scope = self.get_string(ce.name as usize); 142 | output = output + &scope + "::"; 143 | } 144 | } 145 | 146 | let function_name_addr = unsafe { func.common.function_name as usize }; 147 | if function_name_addr == 0 { 148 | output = output + "main()"; 149 | } else { 150 | let name = self.get_string(function_name_addr); 151 | output = output + &name + "()\n"; 152 | } 153 | ex_addr = ex.prev_execute_data as usize; 154 | } 155 | println!("{}", output); 156 | Trace{} 157 | } 158 | } 159 | 160 | impl PHP560 { 161 | 162 | fn get_executor_global(&self, addr: usize) -> php56::zend_executor_globals 163 | { 164 | read_memory::(&self.source, addr) 165 | } 166 | 167 | fn get_execute_data(&self, addr: usize) -> php56::zend_execute_data 168 | { 169 | read_memory::(&self.source, addr) 170 | } 171 | 172 | fn get_function(&self, addr: usize) -> php56::zend_function 173 | { 174 | read_memory::(&self.source, addr) 175 | } 176 | 177 | fn get_string(&self, addr: usize) -> String 178 | { 179 | read_cstr(&self.source, addr) 180 | } 181 | } 182 | 183 | impl ProcessReader for PHP560 { 184 | 185 | fn read(&self, addr: usize) -> Trace 186 | { 187 | let eg = self.get_executor_global(addr); 188 | let mut ex_addr = eg.current_execute_data as usize; 189 | 190 | let mut output = String::new(); 191 | 192 | while ex_addr != 0 { 193 | let ex = self.get_execute_data(ex_addr); 194 | 195 | let func_addr = ex.function_state.function as usize; 196 | if func_addr == 0 { 197 | break 198 | }; 199 | 200 | let func = self.get_function(func_addr); 201 | 202 | unsafe { 203 | if func.common.scope as usize != 0 { 204 | let ce = read_memory::(&self.source, func.common.scope as usize); 205 | let scope = read_cstr(&self.source, ce.name as usize); 206 | output = output + &scope + "::"; 207 | } 208 | } 209 | 210 | let function_name_addr = unsafe { func.common.function_name as usize }; 211 | if function_name_addr == 0 { 212 | output = output + "main()"; 213 | } else { 214 | let name = self.get_string(function_name_addr); 215 | output = output + &name + "()\n"; 216 | } 217 | ex_addr = ex.prev_execute_data as usize; 218 | } 219 | print!("{}", output); 220 | Trace{} 221 | } 222 | } 223 | 224 | fn read_memory(source: &ProcessHandle, addr: usize) -> R 225 | where R: Copy 226 | { 227 | let size = size_of::(); 228 | let bytes = copy_address(addr, size, source).unwrap(); 229 | let bytes_ptr: *mut R = unsafe { transmute(bytes.as_ptr()) }; 230 | unsafe { *bytes_ptr } 231 | } 232 | 233 | fn read_cstr(source: &ProcessHandle, addr: usize) -> String 234 | { 235 | let mut result = String::new(); 236 | let mut i = 0; 237 | loop { 238 | let c = copy_address(addr + i, 1, source).unwrap()[0]; 239 | if c == 0 { 240 | return result; 241 | } else { 242 | result.push(c as char); 243 | i = i + 1; 244 | } 245 | } 246 | } 247 | -------------------------------------------------------------------------------- /wrapper.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | --------------------------------------------------------------------------------