note 44256 added to zend.arguments.retrieval

From: Date: Mon, 19 Jul 2004 21:40:05 +0000
Subject: note 44256 added to zend.arguments.retrieval
Groups: php.notes 
Request: Send a blank email to php-notes+get-73628@lists.php.net to get a copy of this message
In fact, empty string is not writeable, even when we add an slash after the type decl. Say the implementation of my_test() is like this: char *s; int s_len; zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s/", &s, &s_len) and you pass an empty string my_test("") from the PHP script, then s[0] is not writeable. You will get a seg fault. The reason is that Zend doesn't emalloc a new copy of the empty string dynamically, instead it just assigns the empty_string (which is defined at compile time and located in unwriteable data seg) pointer to s. ---- Manual Page -- http://www.php.net/manual/en/zend.arguments.retrieval.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44256 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44256&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44256&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#73628) next »