[
https://issues.apache.org/jira/browse/PROTON-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13968667#comment-13968667
]
Rafael H. Schloming commented on PROTON-554:
--------------------------------------------
I managed to find a debian 6 environment and I can confirm seeing the same
behaviour. I was able to work around it by backporting the following macros
from swig 2.0:
Index: proton-c/bindings/php/php.i
===================================================================
--- proton-c/bindings/php/php.i (revision 1587223)
+++ proton-c/bindings/php/php.i (working copy)
@@ -22,7 +22,38 @@
// provided by SWIG development libraries
%include php.swg
+%define CONVERT_LONG_LONG_IN(lvar,t,invar)
+ switch ((*(invar))->type) {
+ case IS_DOUBLE:
+ lvar = (t) (*(invar))->value.dval;
+ break;
+ case IS_STRING: {
+ char * endptr;
+ errno = 0;
+ lvar = (t) strtoll((*(invar))->value.str.val, &endptr, 10);
+ if (*endptr && !errno) break;
+ /* FALL THRU */
+ }
+ default:
+ convert_to_long_ex(invar);
+ lvar = (t) (*(invar))->value.lval;
+ }
+%enddef
+%pass_by_val(long long, CONVERT_LONG_LONG_IN);
+
+%typemap(out) long long
+%{
+ if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) {
+ return_value->value.lval = (long)($1);
+ return_value->type = IS_LONG;
+ } else {
+ char temp[256];
+ sprintf(temp, "%lld", (long long)$1);
+ ZVAL_STRING(return_value, temp, 1);
+ }
+%}
+
%header %{
/* Include the headers needed by the code in this wrapper file */
#include <proton/types.h>
> pn_data_put_long call fails on 64x Linux 2.6.32-5-amd64
> -------------------------------------------------------
>
> Key: PROTON-554
> URL: https://issues.apache.org/jira/browse/PROTON-554
> Project: Qpid Proton
> Issue Type: Bug
> Components: php-binding
> Affects Versions: 0.6
> Environment: Linux 2.6.32-5-amd64 #1 SMP Sun Sep 23 10:07:46 UTC 2012
> x86_64 GNU/Linux
> PHP 5.4.26-1~dotdeb.0 (cli) (built: Mar 7 2014 08:58:03)
> Copyright (c) 1997-2014 The PHP Group
> Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
> with Xdebug v2.2.4, Copyright (c) 2002-2014, by Derick Rethans
> with Suhosin v0.9.34-dev, Copyright (c) 2007-2012, by SektionEins GmbH
> Reporter: Denis Savrukov
> Attachments: qpid-proton-0.6-build-swig20.log,
> qpid-proton-0.6-build.log
>
>
> Fatal error: Type error in argument 2 of pn_data_put_long. Expected
> SWIGTYPE_p_long_long
--
This message was sent by Atlassian JIRA
(v6.2#6252)