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
1
vote
1 answer

How to typecast values like (int) using zend engine API?

What I've tried: //... zend_long dest; if (UNEXPECTED(!zend_parse_arg_long(arg, &dest, NULL, 0, 0))) { zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type integer", "", zend_zval_type_name(arg), "",…
marcio
  • 10,002
  • 11
  • 54
  • 83
1
vote
0 answers

How does PHP zend.script_encoding work?

I'm trying to get zend engine to interpret my PHP scripts as UTF-16BE. On a PHP 5.4 setup, I have the following settings in my PHP.ini file: zend.script_encoding = UTF-16BE zend.detect-unicode = 0 zend.multibyte = On This is my script…
Pacerier
  • 86,231
  • 106
  • 366
  • 634
1
vote
0 answers

Tracking PHP object lifetimes from C/C++

We're using PHP to access our custom C++ objects. Some of those C++ objects are fairly large so we'd like to keep them around until the last PHP object that references them is destroyed. We've been trying to use the zend callback functions add_ref…
Howard Rubin
  • 350
  • 2
  • 14
1
vote
1 answer

How to connect external C/C++ libraries in Zend PHP extension

I am trying to make a .so PHP extension written in C using Zend framework. With stand-alone extension everything is OK. But if I try to use some other dynamic-linking library in my extension, I get the following error: PHP Warning: dl(): Unable to…
pac-man
  • 11
  • 2
1
vote
3 answers

PHP Sessions not stored

I have both pages, but the $_SESSION["1"] is not received in the 2nd one. UPDATE: Turns out, that if I type a number in the session, it won't work. I typed a normal string and worked.. I never saw this…
John Black
  • 305
  • 2
  • 8
  • 19
1
vote
1 answer

how to read a constant property in php extension?

I use zend_declare_class_constant_stringl macro to declare a constant property,but i don't konw how to read the constant? the declare code : zend_declare_class_constant_stringl(myclass_ce,ZEND_STRL("WEL"),ZEND_STRL("welcome\n") TSRMLS_CC); I want…
silenceper
  • 15
  • 1
  • 5
1
vote
2 answers

PHP uksort function using global variable fails after PHP upgrade to 5.3.3

I have a user defined sort function which uses a 'global' declaration in order to refer to a multi-dimensional array when deciding on the correct sort order. It used to work fine under PHP 5.1.6 but now fails under 5.3.3. The code throws PHP…
Claud
  • 937
  • 1
  • 12
  • 27
1
vote
1 answer

Date, Time, DSL and Timezone information handling

Timezone and Daylight Savings information can change without notice. A simple piece of legislation could alter DSL for an area and render datetime information useless for a certain area on the globe, suddenly impacting code dependent on a server's…
bob-the-destroyer
  • 3,164
  • 2
  • 23
  • 30
1
vote
1 answer

Detect during compilation whether PHP is being compiled with a given extension

I am trying to build an extension for PHP. After following Sara Golemon's book I have a basic extension which I can compile as a shared module and, in addition, I can compile it statically along PHP itself. Now I want to modify the PHP interpreter…
Yiannis
  • 880
  • 1
  • 7
  • 14
1
vote
1 answer

Why Does get_memory_usage Retain Memory?

If I run the following PHP program on my computer echo memory_get_usage(); echo "|"; echo memory_get_usage(); echo "|"; echo memory_get_usage(); I get the output 635048|635080|635080 From this, it appears the initial call to memory_get_usage is…
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
1
vote
3 answers

Get the name of running script from a PHP extension

I'm writing a small extenstion for PHP. Is there way to know at runtime, the name of the script file (e.g.: test.php) that is running? Maybe some global or environment variables?
dtoch
  • 185
  • 1
  • 2
  • 12
1
vote
2 answers

Make ZVAL persistent across the SAPI?

A ZVAL is typically created with emalloc so it is destroyed at the end of a page request. Is there a way to take an existing ZVAL and make it persist in the SAPI (equivalent of pemalloc)? What about creating a ZVAL with pemalloc? Ideally what I'd…
Luke
  • 13,678
  • 7
  • 45
  • 79
0
votes
1 answer

flex+bison in a php extension

I have created a small parser in c using flex and bison. The parser writes the result to some global variables and the caller function reads it from there. I am trying to package my parser as a php extension. From what i understand from the php…
0
votes
1 answer

PHP 5.2.9 build fails on zend_execute.lo - out of memory?

I'm trying to get PHP compiled with EXIF support. Every time I try to build PHP 5.2.9 on my virtual dedicated server running CentOS 5.3, it fails when it gets to building zend_execute.lo. I tried compiling just that file by itself, and it fails. …
mltsy
  • 6,598
  • 3
  • 38
  • 51
0
votes
1 answer

Extending the Zend Engine on a KDE platform, is gVIM the right choice?

I am trying to introduce few nifty cool concepts to the Zend Engine in a KDE environment. It's kinda "deep core" thing and requires lots and lots of veteran C coding and hacking around a moderately complex C code-base. So far I think the big guys do…
Ashkan Kh. Nazary
  • 21,844
  • 13
  • 44
  • 68