php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57379 Update for Spread 4.0.0 API
Submitted: 2006-11-16 05:13 UTC Modified: 2008-03-02 11:49 UTC
From: clay at killersoft dot com Assigned:
Status: Closed Package: spread (PECL)
PHP Version: 5.2.0 RC4 OS: Fedora Core 5
Private report: No CVE-ID: None
 [2006-11-16 05:13 UTC] clay at killersoft dot com
Description:
------------
Please consider updating this extension to support the new Spread 4.0.0 API. Compiling the latest CVS source for this extension with PHP 5.2.0 and Spread Toolkit 4.0.0RC2 fails with errors below.

Expected result:
----------------
Successful compile.

Actual result:
--------------
/bin/sh /root/source/spread/php_spread_cvs/libtool --mode=compile gcc  -I. -I/root/source/spread/php_spread_cvs -DPHP_ATOM_INC -I/root/source/spread/php_spread_cvs/include -I/root/source/spread/php_spread_cvs/main -I/root/source/spread/php_spread_cvs -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/source/spread/php_spread_cvs/php_spread.c -o php_spread.lo 
mkdir .libs
 gcc -I. -I/root/source/spread/php_spread_cvs -DPHP_ATOM_INC -I/root/source/spread/php_spread_cvs/include -I/root/source/spread/php_spread_cvs/main -I/root/source/spread/php_spread_cvs -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/source/spread/php_spread_cvs/php_spread.c  -fPIC -DPIC -o .libs/php_spread.o
/root/source/spread/php_spread_cvs/php_spread.c:121:48: error: macro "ZEND_ME_MAPPING" requires 4 arguments, but only 3 given
/root/source/spread/php_spread_cvs/php_spread.c:122:52: error: macro "ZEND_ME_MAPPING" requires 4 arguments, but only 3 given
/root/source/spread/php_spread_cvs/php_spread.c:121: error: 'ZEND_ME_MAPPING' undeclared here (not in a function)
/root/source/spread/php_spread_cvs/php_spread.c:122: error: expected '}' before 'ZEND_ME_MAPPING'
/root/source/spread/php_spread_cvs/php_spread.c:123:42: error: macro "ZEND_ME_MAPPING" requires 4 arguments, but only 3 given
/root/source/spread/php_spread_cvs/php_spread.c:124:48: error: macro "ZEND_ME_MAPPING" requires 4 arguments, but only 3 given
/root/source/spread/php_spread_cvs/php_spread.c: In function '_connect':
/root/source/spread/php_spread_cvs/php_spread.c:308: warning: passing argument 1 of 'php_error_docref0' makes pointer from integer without a cast
/root/source/spread/php_spread_cvs/php_spread.c:308: warning: passing argument 2 of 'php_error_docref0' makes integer from pointer without a cast
/root/source/spread/php_spread_cvs/php_spread.c: In function 'zif_spread_receive':
/root/source/spread/php_spread_cvs/php_spread.c:724: warning: passing argument 6 of 'SP_receive' from incompatible pointer type
make: *** [php_spread.lo] Error 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-03 09:26 UTC] s dot tretter at szene1 dot at
try this patch:

cvs diff: Diffing .
Index: php_spread.c
===================================================================
RCS file: /repository/pecl/spread/php_spread.c,v
retrieving revision 1.17
diff -r1.17 php_spread.c
121,125c121,127
<       PHP_ME_MAPPING(connect,         spread_connect,         NULL)
<       PHP_ME_MAPPING(disconnect,      spread_disconnect,      NULL)
<       PHP_ME_MAPPING(join,            spread_join,            NULL)
<       PHP_ME_MAPPING(receive,         spread_receive,         NULL)
<       {NULL, NULL, NULL}
---
>       PHP_ME_MAPPING(connect,         spread_connect,         NULL,   0)
>       PHP_ME_MAPPING(disconnect,      spread_disconnect,      NULL,   0)
>       PHP_ME_MAPPING(join,            spread_join,            NULL,   0)
>       PHP_ME_MAPPING(receive,         spread_receive,         NULL,   0)
>       PHP_ME_MAPPING(multicast,       multicast,       NULL,   0)
>         PHP_ME_MAPPING(multicast2,       spread_multicast,       NULL,   0)
>       {NULL, NULL, NULL, 0}
308c310
<               php_error_docref(E_WARNING, "Failed to connect to spread daemon (%s) using private_name (%s), error returned was: %d", spread_name, private_name, retval);
---
>               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to connect to spread daemon (%s) using private_name (%s), error returned was: %d", spread_name, private_name, retval);
365a368
> 
407,409c410
<             } else {
<                 RETURN_FALSE;
<             }
---
>             } 
488c489
<       zval *group = NULL;
---
>       zval **group = NULL;
490c491
<       char *message = NULL;
---
>       zval **message = NULL;
496a498,499
> 
> #ifndef ZEND_ENGINE_2
503a507,508
> #endif
> 
511,513c516,549
<       default_mbox = SpG(default_conn);
<       ZEND_FETCH_RESOURCE(mbox, int *, tmp, -1, "Spread-FD", le_conn);
<       if(Z_TYPE_P(group) == IS_STRING) {
---
> 
> 
> #ifdef ZEND_ENGINE_2
>         zval *this = getThis();
>       if (this) {
>                       ze_spread_object *obj = spread_fetch_object(this);
>               if (ZEND_NUM_ARGS() > 2) {
>                       WRONG_PARAM_COUNT;
>               }
> 
>               if(zend_get_parameters_ex(2, &group, &message) == FAILURE) {
>                         return;
>                 }
>               else
>               {
>                          SEPARATE_ZVAL(group)
>                          SEPARATE_ZVAL(message)
>                          convert_to_string_ex(message);
>               }
> 
>               mbox = obj->mbox;
>         } else
> #endif
>       {
>               default_mbox = SpG(default_conn);
>               ZEND_FETCH_RESOURCE(mbox, int *, tmp, -1, "Spread-FD", le_conn);
>       }
> 
>         if (!mbox) {
>               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Resource or mailbox connection invalid.");
>               RETURN_FALSE;
>       }
> 
>       if((*group)->type == IS_STRING) {
515,517c551,553
<               convert_to_string_ex(&group);
<               tmpgrp = estrndup(group->value.str.val,group->value.str.len);
<               if (sperrno = (SP_multicast(*mbox, service_type, tmpgrp, mess_type, message_len, message) <0))
---
>               convert_to_string_ex(group);
>               tmpgrp = estrndup((*group)->value.str.val,(*group)->value.str.len);
>               if (sperrno = (SP_multicast(*mbox, service_type, tmpgrp, mess_type, (*message)->value.str.len, (*message)->value.str.val) <0))
519c555
<                       zend_error(E_WARNING, "SP_mulicast error(%d)", sperrno);
---
>                       zend_error(E_WARNING, "SP_multicast error(%d)", sperrno);
522c558,559
<               RETURN_LONG(sperrno);
---
>               // strange behaviour, SP_multicast always returns 0 in the case of no error, so we return the length of our string ;)
>               RETURN_LONG((*message)->value.str.len);
524c561
<       if(Z_TYPE_P(group) == IS_ARRAY) {
---
>         if((*group)->type == IS_ARRAY) {
529,530c566,567
<               zend_hash_internal_pointer_reset_ex(group->value.ht, &pos);
<               while(zend_hash_get_current_data_ex(group->value.ht, (void **) &tmp, &pos) == SUCCESS && n < 100) 
---
>               zend_hash_internal_pointer_reset_ex((*group)->value.ht, &pos);
>               while(zend_hash_get_current_data_ex((*group)->value.ht, (void **) &tmp, &pos) == SUCCESS && n < 100) 
535c572
<                       zend_hash_move_forward_ex(group->value.ht, &pos);
---
>                       zend_hash_move_forward_ex((*group)->value.ht, &pos);
539c576
<                                               message_len, message) <0))
---
>                                               (*message)->value.str.len, (*message)->value.str.val) <0))
546c583
<               fprintf(stderr, "type is %d\n", Z_TYPE_P(group));
---

>                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "SP_Multicast: expect groups to an array of strings or a string (got: %d)",(*group)->type);
646c683
<               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "SP_Join: expect groups to an array of strings or a string");
---
>               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "SP_Join: expect groups to an array of strings or a string (got: %d)",Z_TYPE_P(group));
 [2008-03-02 11:49 UTC] rrichards@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC