Needs some clarification on static zend_string vs zend_new_interned_string (php internals).
| From: | David Maye Kitenge | Date: | Wed, 16 Sep 2026 13:09:41 +0000 |
| Subject: | Needs some clarification on static zend_string vs zend_new_interned_string (php internals). | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-132516@lists.php.net to get a copy of this message | ||
Hello everyone,
My name is David. I'm working on the refactoring of a PHP extension from "Zephir"
language to a cleaner C language output.
I came across the fact that the extension uses a lot of "static" zend_string. No I want
to convert those static zend_string into the intern string.
From what I read today based on PHP internal book website and PHP Source online, calling a
Zen's new interest string function create a string whose value is registered into a hash table.
And then on a request in it this or that send interned string is then retrieved from the hash table
instead of creating a new Zen string. Apart from the fact that every every news and intern strings
have an immutable ref count.
My doubt is the following:
* Does ref counting increments/decrements when you create a Zend string using the static keyword?
* Assigning a new zend_string as interned zend_string, when the flag "IS_Interned_STRING"
(if I remember correctly), the string is kinda garbage collected? (Do I need to free the string)?
Thanks for your support.
David.