Skip to main content

Questions tagged [php-internals]

How the PHP programming language works underneath, and questions about the underlying C code.

php-internals
58 questions with no upvoted or accepted answers
5 votes
0 answers
288 views

PHP, Compile foreach and opline

I'm trying to figure out how a foreach statement is interpreted by PHP. That led me to use gdb while executing a dummy foreach script. I end up in zend_compile.c, in the zend_compile_foreach() ...
JesusTheHun's user avatar
  • 1,217
4 votes
0 answers
268 views

PHP5 zval container vs PHP7 zval container. How references & variables are stored now?

I am following a tutorial & reading through some articles on how variables are stored in PHP using zval (zend value) container. Most of those articles seem to be following & getting ...
Fuze's user avatar
  • 113
4 votes
0 answers
320 views

What userland strings get automatically interned by PHP?

I was trying to get a better understanding of PHP's internal mechanisms of string interning - more specifically: What are the rules PHP uses to determine whether (or not) the string created in ...
Smuuf's user avatar
  • 6,475
4 votes
1 answer
638 views

How to overload functions from a PHP extension?

I've been going through some PHP extension tutorials, but I can't find any information about how to overload existing function. For example, I want to change the fopen() to something like ...
Vasisualiy's user avatar
3 votes
1 answer
1k views

Why does set_exception_handler(func) not catch exceptions?

An exception is thrown in my shutdown function and not caught within a try/catch block, for example: <?php set_exception_handler(function($e){ echo "exception handled"; // not echoed }); ...
Pacerier's user avatar
  • 88.6k
2 votes
0 answers
174 views

How to call a PHP function from zend_compile.c?

I can't figure out how to call an existing PHP function, everytime I end up either with a segmentation fault or a Fatal error. Disclaimer: I'm not experienced at all in low level programming, just ...
Bloops's user avatar
  • 754
2 votes
0 answers
341 views

how to allocate & deallocate memory in php?

I'm trying to allocate memory dynamically in my code and release them ,I tried to use zend_mm but I couldn't add it to php 7,I'm using php 7.4 and xampp server , if it is impossible please tell my the ...
M.sharf's user avatar
  • 21
2 votes
1 answer
265 views

Getting function argument value from PHP extension in c++

I have created php extension in c++.In version php 5.6 can able to get currently executed function details. I was getting the arguments value as follows, if (real_execute_data->function_state....
Durai's user avatar
  • 87
2 votes
0 answers
2k views

The Zend Engine API version 320170718 which is installed, is newer

I am currently experiencing a problem with xdebug. I wanted to do a php bin/console cache:clear for my Symfony application but it got me this error: Warning: Xdebug MUST be loaded as a Zend ...
Lucatorze's user avatar
  • 107
2 votes
0 answers
207 views

What is the proper way to add elements to an empty array passed to an extension function in PHP 7.3?

I'm trying to port an old PHP extension of mine working for PHP 5.4 to PHP 7.3 (7.3.0 RC3 more precisely). I'm building the extension using Visual Studio 2017 on Windows 10 Pro x64, building both for ...
Carlo Pastorino's user avatar
2 votes
0 answers
166 views

Apache, mod_php, and MINIT

When running PHP programs using mod_php, when does PHP call its extension's MINIT functions? Does this happen When the apache web server restarts? Whenever apache spins up a new thread pool to ...
Alana Storm's user avatar
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 &$...
Nico's user avatar
  • 459
2 votes
0 answers
305 views

Linking Lame.h with PHP extension

I'm trying to develop my first php extension. It uses Lame , so I've installed liblame-dev lame.h is located at /usr/include/lame/ In my config.m4 LIBNAME=lame PHP_ADD_LIBRARY($LIBNAME) It ...
sl4mmer's user avatar
  • 371
1 vote
0 answers
35 views

Are PHP zvals mutable?

I've been reading about memory management in PHP and learned that variables in PHP copy the reference to zvals as long as you don't do a write operation (copy on write paradigm). https://www....
tweekz's user avatar
  • 338
1 vote
0 answers
267 views

How to create a php extension function with a return type-hint plus annotation

I'm trying to fix some php 8.1 deprecation notices in a PHP extension, which I believe involves either adding return type-hints (where possible, whilst maintaining some backwards-compatibility to php7....
Brett McBride's user avatar

15 30 50 per page