WIKI: phpng-upgrading
| From: | Yasuo Ohgaki | Date: | Wed, 20 Jan 2016 21:55:41 +0000 |
| Subject: | WIKI: phpng-upgrading | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-90745@lists.php.net to get a copy of this message | ||
Hi ZendEngine developers,
I'm not sure if the wiki page is maintained, but I noticed few errors.
https://wiki.php.net/phpng-upgrading#strings
has following example.
- ZVAL_STRING(zv, str, 1);
+ ZVAL_STRING(zv, str);
- ZVAL_STRINGL(zv, str, len, 1);
+ ZVAL_STRINGL(zv, str, len);
- ZVAL_STRING(zv, str, 0);
+ ZVAL_STRING(zv, str);
+ efree(str);
- ZVAL_STRINGL(zv, str, len, 0);
+ ZVAL_STRINGL(zv, str, len);
+ efree(str);
Since PHP5 has following definition for ZVAL_STRING*()
#define ZVAL_STRING(z, s, duplicate) do { \
const char *__s=(s); \
zval *__z = (z); \
Z_STRLEN_P(__z) = strlen(__s); \
Z_STRVAL_P(__z) = (duplicate?estrndup(__s,
Z_STRLEN_P(__z)):(char*)__s);\
Z_TYPE_P(__z) = IS_STRING; \
} while (0)
the example's 0 and 1 are flipped, efree() locations are wrong.
In https://wiki.php.net/phpng-upgrading#zend_string_api
,
it says
zend_string_init(char *val, int len, int persistent)
Current definition is
zend_string_init(char *val, size_t len, int persistent)
Should I update the doc or is the doc is maintained
elsewhere?
Regards
--
Yasuo Ohgaki
yohgaki@ohgaki.net