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

What is the substitute for is_ref__gc in php7

In php5, zval struct has a member 'is_ref__gc'. We can use it as follow: zval *x ... ... if (!x->is_ref__gc) { printf("newx or newy isn't by ref"); return; } However, in php7, zval doesn't have such a member. What is the…
Jianglong Chen
  • 515
  • 1
  • 3
  • 13
0
votes
0 answers

How to declare Closure function in PHP extension?

I learning php extension write in C. Now i meet code below, i want to declare a Closure function. How to achieve this in a PHP extension? class myClass { public function removeListener($event, $listener) { // some code } …
eaglewu
  • 458
  • 5
  • 12
0
votes
1 answer

Is it possible to prevent zend engine to free resources?

Is it possible to prevent zend engine to free resources allocated in PHP? For example, when a process is forked() and the resource is duplicated to the child process, when either child process or parent process exit, the resource is free thus other…
innocenat
  • 574
  • 7
  • 21
0
votes
1 answer

Create PHP extension

Trying to create simple Hello World PHP extension according manual. config.m4 PHP_ARG_ENABLE(hello, whether to enable Hello World support, [ --enable-hello Enable Hello World support]) if test "$PHP_HELLO" = "yes"; then AC_DEFINE(HAVE_HELLO, 1,…
vico
  • 17,051
  • 45
  • 159
  • 315
0
votes
1 answer

Register new T_OPEN_TAG and T_CLOSE_TAG through a C extension?

I'm working on a PHP C extension that needs to register new T_OPEN_TAG tags. I don't want to overwrite T_OPEN_TAG and T_CLOSE_TAG, just register new tokens. Is it possible for a PHP C extension to register new PHP tags? Ex: <:…
marcio
  • 10,002
  • 11
  • 54
  • 83
0
votes
1 answer

smart_str_alloc: error: newlen undeclared

I'm using the smart_str headers for a short FastCGI script (not related to PHP), but can't use smart_str_alloc correctly. My code: smart_str json = {0, 0, 0}; smart_str_alloc(&json, 1024 * 20, 0); This gives error: php_smart_str.h:72:37: error:…
Olle Härstedt
  • 3,799
  • 1
  • 24
  • 57
0
votes
1 answer

Does PHP interpreter compiles to bytecode every command during the reading?

Could you please clarify, PHP interpreter compiles to bytecode every command and then executes or it first reads all commands and then compiles and executes them?
Molarro
  • 1,005
  • 1
  • 10
  • 24
0
votes
1 answer

Extending PHP syntax with extensions?

I'm trying to introduce few things that I've learned in languages like Scala and Haskell to PHP and experiment with it. To give a concrete example, I would like to extend the PHP syntax to be able to do something like the following: array_map( _ +…
Ashkan Kh. Nazary
  • 21,844
  • 13
  • 44
  • 68
0
votes
1 answer

PDO::sqliteCreateCollation() API Definition

The PDO SQLite extension has a sqliteCreateCollation() method that isn't documented. Seems like it's usage involves 3 arguments: &collation_name &collation_name_len &callback I assume &collation_name must be the collation name / identifier to use…
Alix Axel
  • 151,645
  • 95
  • 393
  • 500
0
votes
1 answer

Segmentation fault on method calling inside a php extension

I am trying to pass some data to an object stored in an zval, inside a php extension with this code, and I receive segmentation fault error [core:notice] [pid 8645] AH00052: child pid 8649 exit signal Segmentation fault (11) Does anyone can help…
Szabo Bogdan
  • 73
  • 2
  • 11
0
votes
2 answers

PHP include incorrect search path taken?

I have a file test.php in the folder myfolder. myfolder also contains another folder called inner. Both myfolder and inner contain a file called msg.php. The entire layout looks like this: myfolder test.php inner msg.php msg.php In test.php,…
Pacerier
  • 86,231
  • 106
  • 366
  • 634
0
votes
1 answer

Calling extension function in zend_eval_string

When i try use zend_eval_string (i make mini php extension), there are no extensions functions avaliable. There are also no errors reporting (if php code have fatal error program exit). What i must do to enable extension and show errors when it…
0
votes
1 answer

What's the PHP APC cache's apc.shm_strings_buffer setting for?

I'm trying to understand the apc.shm_strings_buffer setting in apc.ini. After restarting PHP, the pie chart in the APC admin shows 8MB of cache is already used, even though there are no cached entries (except for apc.php, of course). I've found this…
redburn
  • 542
  • 4
  • 24
0
votes
1 answer

php extension to replace PHP class method with handler written in C

My level of experience: very comfortable with C, novice to PHP, new to and very frustrated with Zend Engine (no documentation?) I'm trying to write my first PHP extension, and I'm wondering if the following is even possible. PHP code illustrating my…
0
votes
1 answer

Trying to regenerate zend_language_scanner.c

I'm trying to add a new keyword in PHP (just learning the core), so what I did was: added a new token to zend_language_parser.y, used it in an unticket_statement, compiled PHP, but it didn't work out. It seems like I need to add that new keyword in…
nikita2206
  • 1,129
  • 2
  • 10
  • 17
1 2 3
17
18