Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29155 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91471 invoked by uid 1010); 3 May 2007 14:30:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 91449 invoked from network); 3 May 2007 14:30:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 May 2007 14:30:32 -0000 Received: from [127.0.0.1] ([127.0.0.1:11962]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 38/C7-21311-802F9364 for ; Thu, 03 May 2007 10:30:32 -0400 Authentication-Results: pb1.pair.com header.from=s.tretter@szene1.at; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=s.tretter@szene1.at; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain szene1.at designates 86.56.195.12 as permitted sender) X-PHP-List-Original-Sender: s.tretter@szene1.at X-Host-Fingerprint: 86.56.195.12 cm56-195-12.liwest.at Received: from [86.56.195.12] ([86.56.195.12:40502] helo=mail.szene1.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/16-21311-B5EE9364 for ; Thu, 03 May 2007 10:14:52 -0400 Received: from [10.0.1.13] (M3732P020.adsl.highway.telekom.at [88.117.114.116]) by mail.szene1.com (Postfix) with ESMTP id 840A032C014 for ; Thu, 3 May 2007 16:14:45 +0200 (CEST) Message-ID: <4639EE58.9060703@szene1.at> Date: Thu, 03 May 2007 16:14:48 +0200 User-Agent: Thunderbird 1.5.0.10 (X11/20070403) MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------000106050309060401050808" Subject: Re: [PHP-DEV] CVS Account Request: siml From: s.tretter@szene1.at (Simon tretter) --------------000106050309060401050808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hy, i've attached my patch, it's not perfect and it's not complete.. the codebase is a little bit awful and my code isn't much better ;) , however - now it works with php 5.2.1 and spread 4.0. (only worked on connecting + sending spread messages, the rest of the code i didn't touched, so i don't know if every feature is working correctly..) ng siml ps.: sorry for my bad englisch - i'm an austrian student :) Tijnema ! schrieb: > On 5/3/07, Tretter Simon wrote: >> submitting a patch for a php extension in pecl tree (spread) >> i made a patch for php5.2 and spread 4.0 >> > > You don't need a CVS account for submitting one patch, send it to this > list and someone will submit the patch. > > Tijnema > --------------000106050309060401050808 Content-Type: text/x-patch; name="spread_1.17.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="spread_1.17.patch" 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 (spread 4.0) always returns 0 in the case of no errors, 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)); --------------000106050309060401050808--