note 127921 added to ffi.cast

From: Date: Sun, 13 Nov 2022 09:40:54 +0000
Subject: note 127921 added to ffi.cast
Groups: php.notes 
Request: Send a blank email to php-notes+get-219876@lists.php.net to get a copy of this message
For example, stdlib.h headfile defines a function called "system()" in Linux: extern int system (const char *__command) __wur; And we can call it using FFI extension: <?php $ffi_obj = FFI::cdef('int system(char *command);') $ffi_obj->system('whoami'); ?> Then execute the php script as if we were calling the real C system(): $ whoami > root $ php demo.php > root ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.161 (proxied: 103.93.75.176) ---- Manual Page -- https://php.net/manual/en/ffi.cast.php Edit -- https://main.php.net/note/edit/127921 Del: integrated -- https://main.php.net/note/delete/127921/integrated Del: useless -- https://main.php.net/note/delete/127921/useless Del: bad code -- https://main.php.net/note/delete/127921/bad+code Del: spam -- https://main.php.net/note/delete/127921/spam Del: non-english -- https://main.php.net/note/delete/127921/non-english Del: in docs -- https://main.php.net/note/delete/127921/in+docs Del: other reasons-- https://main.php.net/note/delete/127921 Reject -- https://main.php.net/note/reject/127921 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219876) next »