Questions tagged [php-internals]
How the PHP programming language works underneath, and questions about the underlying C code.
php-internals
268
questions
5
votes
4
answers
1k
views
PHP Internals: How does TSRMLS_FETCH Work?
How does the PHP Internals TSRMLS_FETCH macro do its job?
Per the PHP Manual
While developing extensions, build errors that contain "tsrm_ls is undefined" or errors to that effect stem from the ...
29
votes
1
answer
5k
views
Where's the php-src/PHP-Internals Main Entry Point
What function or bit of code serves as the main entry point for executing/interpreting a PHP program in the source of PHP itself? Based on things I've googled or read in books, I know that PHP is ...
2
votes
1
answer
282
views
PHP Internals: Difference Between INI Macros
I'm working in a C codebase for a PHP extension. This extension defines several php.ini settings. From what I've seen, there are two macros that do this. They are PHP_INI_ENTRY_EX and ...
1
vote
0
answers
76
views
Explanation on year format behaviour for PHP DateTime
Using ISO 8601 to manage date and time formats I'm in trouble dealing with "year only" dates.
Example : new DateTime(2013); give me:
DateTime Object
(
[date] => 2017-11-27 20:13:00.000000
...
2
votes
1
answer
190
views
Confusion using xdebug_debug_zval between refcount and is_ref
I'm using xdebug_debug_zval in order to understand how references changed between PHP 5 and PHP 7.
<?php
$array = array('k1', 'k2', 'k3');
echo PHP_VERSION. '<br/>';
foreach ($array as &$...
0
votes
0
answers
484
views
Hooking zend_execute() to retrieve PHP bytecode
I'm trying to retrieve PHP bytecode (and saving it to a file for further analysis) but I'm not sure exactly how to do it... I'm torn between two options:
1) Extending the Zend framework. A good ...
0
votes
0
answers
126
views
error: 'execute_data' undeclared #define EX(element) ((execute_data)->element) in php 7.0
https://github.com/php/php-src/blob/PHP-7.0/Zend/zend_builtin_functions.c#L2322
In the above link i used the backtrace function in my extension where I am getting the following error message because ...
1
vote
1
answer
308
views
How to get a function name when I hooked it in a php extension
I tried to write a PHP module which is used to detect zend internal function which is called in a php cgi file. Liked code shown below,I want get its name -- 'printf' in my code.
<?php printf("...
0
votes
1
answer
309
views
Try to write an internal function in the PHP extension, the results reported memory leak, looking for a long time did not find the reason
Recently, I read a book about PHP extensions and are ready to write a function, the function prototype is as follows:
array_groupBy(string $key, array $input, $forget = false):array
The function of ...
1
vote
0
answers
272
views
why does openssl_public_encrypt not accept even modulos for unpadded RSA?
Unpadded RSA is basically modular exponentiation. So it seems like openssl_public_encrypt($plaintext, $result, "$rsa", OPENSSL_NO_PADDING) ought to be a good way to do fast modular exponentiation (...
-1
votes
1
answer
59
views
What happens internally when you invoke a function in php
A function defines the instructions which are to be taken when you invoke the function. That part is crystal clear to me. I also know that when functions are invoked that they are placed on a ...
10
votes
2
answers
15k
views
What is the difference between Mysqlnd, PDO and PDO_Mysql extensions in php?
They seem to be the same thing, and yet different. I don't know which one is which: I know we can use PDO as new PDO() and use prepare() and query() methods, to fetch data from database. So, if this ...
1
vote
2
answers
416
views
Invoking a PHP function after all objects have been destroyed
I have seen several answers on object destruction order, and all point out that order is not guaranteed. Since I cannot control the order, I would like to invoke a function after all objects have been ...
2
votes
2
answers
1k
views
Implicit void return in PHP 7.1?
I found in here the new spec: https://wiki.php.net/rfc/void_return_type
function lacks_return(): void {
// valid
}
function returns_nothing(): void {
return; // valid
}
function returns_void()...
2
votes
1
answer
144
views
Using custom PHP module, why isn't $_POST being populated?
I have compiled PHP 5.6.27 on macOS 10.12.1 Sierra as a static library (no small feat in and of itself). I have linked my app to all required libraries and it is building without error. Using the ...