Date: 07/06/00
- Next message: Andi Gutmans: "Re: [PHP-DEV] RE:Class::? - accessing data, no success..."
- Previous message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #5424 Updated: Apache Segmentation Fault, exit on signal 11"
- Next in thread: Andrei Zmievski: "Re: [PHP-DEV] Accessing values in associative arrays within C code?"
- Reply: Andrei Zmievski: "Re: [PHP-DEV] Accessing values in associative arrays within C code?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm having a minor problem accessing values in a single associative array
which is passed into a function I am writing. It works, for the most part,
until I attempt to convert the 'zval *' pointers to the type I need.
The offending code looks like this:
%%%%%
HashTable *ht;
zval *l_onoff;
zval *l_linger;
convert_to_array_ex(optval);
ht = HASH_OF(*optval);
if (zend_hash_find(ht, "l_onoff", strlen("l_onoff") + 1,
(void **) &l_onoff) == FAILURE) {
zend_error(E_ERROR, "No key \"l_onoff\" passed in optval");
}
if (zend_hash_find(ht, "l_linger", strlen("l_linger") + 1,
(void **) &l_linger) == FAILURE) {
zend_error(E_ERROR, "No key \"l_linger\" passed in optval");
}
/* here are the offending lines of code */
convert_to_long(l_onoff);
convert_to_long(l_linger);
/* ------------------------------------ */
lv.l_onoff = ZVAL(&l_onoff, lval);
lv.l_linger = ZVAL(&l_linger, lval);
optlen = sizeof(lv);
ret = setsockopt(ZVAL(fd, lval), ZVAL(level, lval), ZVAL(optname, lval),
&lv, optlen);
%%%%%
Upon calling the function in PHP:
$optval["l_onoff"] = 0;
$optval["l_linger"] = 100;
$ret = setsockopt($fd, SOL_SOCKET, SO_LINGER, $optval);
PHP spits out the error:
<br>
<b>Warning</b>: Cannot convert to ordinal value in <b>sockets.php</b> on
line <b>26</b><br>
Can anyone help with this?
Chris
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andi Gutmans: "Re: [PHP-DEV] RE:Class::? - accessing data, no success..."
- Previous message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #5424 Updated: Apache Segmentation Fault, exit on signal 11"
- Next in thread: Andrei Zmievski: "Re: [PHP-DEV] Accessing values in associative arrays within C code?"
- Reply: Andrei Zmievski: "Re: [PHP-DEV] Accessing values in associative arrays within C code?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

