Questions tagged [php-internals]

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

PHP Internals

Tag purpose

The purpose of the tag is to indicate a question about the internals of PHP. Possible questions could be about how references counting or copy on write. E.g. When you want to know what happens under the hood while doing things in PHP. It can also be applied to questions in the tag that deal with extending PHP at the core. This tag should also be used for any questions about the Zend Engine powering PHP.


External Links

269 questions
0
votes
1 answer

var_dump(object) results "*RECURSION*"

I'm write simple extension with class definition extension.h zend_class_entry * ExampleClass_class; zend_class_entry * get_ExampleClass_class(); extension.c #include "php.h" #include "extension.h" ... zend_class_entry * get_ExampleClass_class(){ …
rjhdby
  • 1,278
  • 13
  • 15
0
votes
1 answer

How does Zend recognize a variable by specify the dollar prefix when parse it?

I currently knows how Zend parse operators by reading the Zend/zend_language_parser.y file of php-src. But I'm very confusing about how variables are recognized. The Bison token is: %token T_VARIABLE "variable (T_VARIABLE)" How does it…
Gavin Kwok
  • 98
  • 6
0
votes
1 answer

What do exactly mean by "PHP compilation options"?

I'm using PHP 7.2.8 on my laptop that runs on Windows 10 Home Single Language 64-bit Operating System I've installed PHP 7.2.8 on my laptop using the latest copy of XAMPP installer. I come across the following text from Description of phpinfo()…
PHPLover
  • 1
  • 51
  • 158
  • 311
0
votes
0 answers

Where the CGI is engaged in Zend Engine code compiling

I am trying to get deeper in the zend engine and the whole server processes at all and from what I understood is - when I send a request to the server, the Zend Engine first engages the scanning\lexing process which converts the plain-text to…
Toma Tomov
  • 1,476
  • 19
  • 55
0
votes
0 answers

Reads the Value from zval* in separate thread - PHP extension c++

I am using Centos 7 (PHP - 5.6.36 Thread safety - disabled) i have created PHP extension in c++ to store the function call stack traces. Storing the information starts from PHP_RINIT_FUNCTION and end in PHP_RSHUTDOWN_FUNCTION. Here, I have used…
Durai
  • 87
  • 12
0
votes
3 answers

PHP: inherit from a class that implements an interface

I have two files, let's say a.php and b.php: a.php: require 'b.php'; interface testInterface{} class a implements testInterface{} b.php: class b extends a{} When I run a.php, it throws this fatal error: Fatal error: Class 'a' not found in b.php…
T30
  • 11,422
  • 7
  • 53
  • 57
0
votes
0 answers

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 article I found about this was this one:…
MyUsername112358
  • 1,320
  • 14
  • 39
0
votes
0 answers

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 of the line EX(prev_execute_data) error:…
sai kiran
  • 1
  • 1
  • 2
0
votes
1 answer

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 this function is to group the $input in accordance…
fang xing
  • 55
  • 1
  • 6
0
votes
1 answer

Can't find Zend directory in EasyPHP folder

I'm about reading a tutorial about creating php extensions in C. I'm using Visual Studio 2008 and EasyPHP whose directory includes /ext folder (PHP extensions directory) this is the tutorial :…
SmootQ
  • 2,096
  • 7
  • 33
  • 58
0
votes
4 answers

Anyone familiar with PHP source code?

zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &r1, &n, &r2, &m) What's "ss" for here?
pc2
  • 3
  • 1
0
votes
2 answers

php7 zend extension: refcount for stack variable?

What will happen with reference counting in the following c code for php7? In php7 zvals are created on stack, so the reference issues arise: zval destination; array_init(destination); { // scope begin zval val; // does val's refcount…
pavelkolodin
  • 2,859
  • 3
  • 31
  • 74
0
votes
1 answer

PHP 7 : How to generate zend_string variable of length 0

I am working in PHP 7, I have a case in which i want to pass a string of length 0. so how can we generate zend_string variable of length 0. I tried assigning NULL to zend_string variable but down the line code crashed because it is trying to…
abhi7436
  • 43
  • 6
0
votes
1 answer

How do i return an array from php extension?

How do I return an array from a php extension method? This is what I have so far: struct myClass_object { zend_object std; MyClass *myClassInstance; }; PHP_METHOD(MyClass, getMyArray) { zval *obj = getThis(); MyClass *myClass =…
razz
  • 9,770
  • 7
  • 50
  • 68
0
votes
1 answer

Compiling PHP with modified DEBUG_ZEND level

I'm debugging a PHP extension and found this while poking through the PHP source code: #if DEBUG_ZEND>=2 printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, Z_REFCOUNT_PP(zval_ptr), Z_REFCOUNT_PP(zval_ptr) - 1); #endif So I…
Ed Mazur
  • 3,042
  • 3
  • 21
  • 21