You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Greg Fodor (Created) (JIRA)" <ji...@apache.org> on 2011/12/31 10:26:30 UTC

[jira] [Created] (THRIFT-1478) TJSONProtocol

TJSONProtocol
-------------

                 Key: THRIFT-1478
                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
             Project: Thrift
          Issue Type: Improvement
          Components: PHP - Library
    Affects Versions: 0.8
            Reporter: Greg Fodor
            Priority: Minor


We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Andrew Grumet (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Grumet updated THRIFT-1478:
----------------------------------

    Attachment: THRIFT-1478.patch

Ok guys, here's an updated patchfile that includes Greg's implementation and a bunch of phpunit tests.  More details in the next comment.

Greg, I applied some light edits to TJSONProtocol.php, fixing a bug in unicode-literal handling (it's a bug in java too!) and adding support for i64s on 32bit machines.  Hope that's ok.
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Andrew Grumet (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178053#comment-13178053 ] 

Andrew Grumet commented on THRIFT-1478:
---------------------------------------

You may need the patch in THRIFT-1479.  Coincidentally, we were just about to submit our own port.  I've hit some challenges getting the full test suite working, going to post about it now on the mail list.  
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Jake Farrell (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13179148#comment-13179148 ] 

Jake Farrell commented on THRIFT-1478:
--------------------------------------

Greg, nice work here. Any chance you can provide some phpunit tests with this, we really need to start adding test cases to the php lib
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1478) TJSONProtocol

Posted by "Greg Fodor (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Fodor updated THRIFT-1478:
-------------------------------

    Attachment: THRIFT-1478.patch
    
> TJSONProtocol
> -------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Roger Meier (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191544#comment-13191544 ] 

Roger Meier edited comment on THRIFT-1478 at 1/23/12 10:21 PM:
---------------------------------------------------------------

This looks great! Here's the updated version which integrates the test with automake and friends [^THRIFT-1478_incl_make_check.patch]

I have the folling issue now:
{noformat}

make[3]: Entering directory `/home/roger/thrift/lib/php/test'
mkdir -p ../src/packages
../../../compiler/cpp/thrift --gen php -r --out ../src/packages ../../../test/ThriftTest.thrift
/usr/bin/phpunit protocol/TestTJSONProtocol.php
PHPUnit 3.4.14 by Sebastian Bergmann.

..................F.......F.....

Time: 1 second, Memory: 6.75Mb

There were 2 failures:

1) TestTJSONProtocol::testDouble_Read
Failed asserting that <double:3.1415926535898> matches expected <double:3.1415926535898>.

/home/roger/thrift/lib/php/test/protocol/TestTJSONProtocol.php:305

2) TestTJSONProtocol::testSet_Read
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array
 (
     [0] => 1
-    [1] => 2
-    [2] => 3
+    [1] => 1
+    [2] => 1
 )

/home/roger/thrift/lib/php/test/protocol/TestTJSONProtocol.php:422

FAILURES!
Tests: 32, Assertions: 30, Failures: 2.
make[3]: *** [check] Error 1

{noformat}

-roger
                
      was (Author: roger.meier):
    This looks great! Here's the updated version which integrates the test with automake and friends [^THRIFT-1249_incl_make_check.patch]

I have the folling issue now:
{noformat}

make[3]: Entering directory `/home/roger/thrift/lib/php/test'
mkdir -p ../src/packages
../../../compiler/cpp/thrift --gen php -r --out ../src/packages ../../../test/ThriftTest.thrift
/usr/bin/phpunit protocol/TestTJSONProtocol.php
PHPUnit 3.4.14 by Sebastian Bergmann.

..................F.......F.....

Time: 1 second, Memory: 6.75Mb

There were 2 failures:

1) TestTJSONProtocol::testDouble_Read
Failed asserting that <double:3.1415926535898> matches expected <double:3.1415926535898>.

/home/roger/thrift/lib/php/test/protocol/TestTJSONProtocol.php:305

2) TestTJSONProtocol::testSet_Read
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array
 (
     [0] => 1
-    [1] => 2
-    [2] => 3
+    [1] => 1
+    [2] => 1
 )

/home/roger/thrift/lib/php/test/protocol/TestTJSONProtocol.php:422

FAILURES!
Tests: 32, Assertions: 30, Failures: 2.
make[3]: *** [check] Error 1

{noformat}

-roger
                  
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478_incl_make_check.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Greg Fodor (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Fodor updated THRIFT-1478:
-------------------------------

    Attachment: THRIFT-1478.patch

Fixes for tests
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Andrew Grumet (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178070#comment-13178070 ] 

Andrew Grumet commented on THRIFT-1478:
---------------------------------------

Here's a better link to the test steps

http://mail-archives.apache.org/mod_mbox/thrift-dev/201112.mbox/%3CCAECOq5Kdypw8m%3DFZQHvx7EZFr7iYO21viMFSqtP8n1XppXmnmA%40mail.gmail.com%3E

                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Greg Fodor (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Fodor updated THRIFT-1478:
-------------------------------

    Attachment: THRIFT-1478.patch

whitespace issues
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Roger Meier (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier updated THRIFT-1478:
--------------------------------

    Attachment:     (was: THRIFT-1249_incl_make_check.patch)
    
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478_incl_make_check.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Bryan Duxbury (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178848#comment-13178848 ] 

Bryan Duxbury commented on THRIFT-1478:
---------------------------------------

Greg and Andrew, should I wait for you guys to come to consensus on a test-passing protocol implementation?
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192468#comment-13192468 ] 

Hudson commented on THRIFT-1478:
--------------------------------

Integrated in Thrift #394 (See [https://builds.apache.org/job/Thrift/394/])
    THRIFT-1478 TJSONProtocol in PHP
Patch: Greg Fodor, Andrew Grumet, Roger Meier

roger : http://svn.apache.org/viewvc/?view=rev&rev=1235403
Files : 
* /thrift/trunk/configure.ac
* /thrift/trunk/lib/php/Makefile.am
* /thrift/trunk/lib/php/src/protocol/TJSONProtocol.php
* /thrift/trunk/lib/php/test
* /thrift/trunk/lib/php/test/Fixtures.php
* /thrift/trunk/lib/php/test/Makefile.am
* /thrift/trunk/lib/php/test/protocol
* /thrift/trunk/lib/php/test/protocol/TestTJSONProtocol.php

                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478_incl_make_check.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Andrew Grumet (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191848#comment-13191848 ] 

Andrew Grumet commented on THRIFT-1478:
---------------------------------------

OK.  I've patched a clean checkout and run the tests without errors.
{code}

lib/php/test$ make stubs
mkdir -p ../src/packages
../../../compiler/cpp/thrift --gen php -r --out ../src/packages ../../../test/ThriftTest.thrift
aegrumet@ubuntu11:~/thrift/lib/php/test$ phpunit protocol/TestTJSONProtocol.php 
PHPUnit 3.6.8 by Sebastian Bergmann.

................................

Time: 2 seconds, Memory: 5.25Mb

OK (32 tests, 30 assertions)
{code}

Let me see if I can install an older version of phpunit for comparison.


                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478_incl_make_check.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Andrew Grumet (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13189682#comment-13189682 ] 

Andrew Grumet commented on THRIFT-1478:
---------------------------------------

Working my way up the learning curve.  Submitted a couple of related patches that came out of working with the existing php test code.
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Greg Fodor (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178072#comment-13178072 ] 

Greg Fodor commented on THRIFT-1478:
------------------------------------

Excellent, thanks a lot!
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192538#comment-13192538 ] 

Hudson commented on THRIFT-1478:
--------------------------------

Integrated in Thrift #395 (See [https://builds.apache.org/job/Thrift/395/])
    THRIFT-1478 TJSONProtocol in PHP
fix: remove dist and add lunit log format

roger : http://svn.apache.org/viewvc/?view=rev&rev=1235467
Files : 
* /thrift/trunk/.gitignore
* /thrift/trunk/lib/php/test/Makefile.am

                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478_incl_make_check.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Andrew Grumet (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13190954#comment-13190954 ] 

Andrew Grumet commented on THRIFT-1478:
---------------------------------------

Notes on the php unit tests:

1. The tests require compiling ThriftTest.thrift

lib/php/test$ mkdir ../src/packages
lib/php/test$ ../../../compiler/cpp/thrift --gen php -r --out ../src/packages ../../../test/ThriftTest.thrift

2. Run the tests like so:

/lib/php/test$ phpunit protocol/TestTJSONProtocol.php
phpunit protocol/TestTJSONProtocol.php
PHPUnit 3.6.8 by Sebastian Bergmann.

................................

Time: 2 seconds, Memory: 5.25Mb

OK (32 tests, 30 assertions)


                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Roger Meier (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier resolved THRIFT-1478.
---------------------------------

    Resolution: Fixed

comitted including phpunit test suite! see also THRIFT-1484
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478_incl_make_check.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Roger Meier (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier updated THRIFT-1478:
--------------------------------

    Attachment: THRIFT-1478_incl_make_check.patch

correct name;-)
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478_incl_make_check.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Roger Meier (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier reassigned THRIFT-1478:
-----------------------------------

    Assignee: Roger Meier
    
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Andrew Grumet (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13179308#comment-13179308 ] 

Andrew Grumet commented on THRIFT-1478:
---------------------------------------

Still seeing i64 errors on my 32bit machine, but everything else passes.  Nice. 

Jake, Bryan, are there conventions for how to properly handle i64s on a 32bit php?

Jake, happy to help with the unit tests.  Any pointers on getting started?
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Andrew Grumet (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178069#comment-13178069 ] 

Andrew Grumet commented on THRIFT-1478:
---------------------------------------

Yep!  I'm a bit of a n00b to this stuff too, so I've posted my process here to ensure correctness:

http://mail-archives.apache.org/mod_mbox/thrift-dev/201112.mbox/browser

Assuming that's ok, you'll need something like this for the server endpoint (note that the paths on your system will be different):

http://pastebin.com/LnAw902b

Also, I ran the tests, results are here: http://imm.io/dPTx

The i64 errors are probably due to me testing on a 32 bit machine.  Not sure yet how best to deal with that, but my thought is to return strings since that's what the PHP bc stuff expects.

Also, there are errors with the more complex structs.  I'm pretty sure you've got the same bug in pushContext that we ran into.  It's pretty subtle.  You actually want to push the current context, $this->context_, onto the stack and not $c.




                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Greg Fodor (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191344#comment-13191344 ] 

Greg Fodor commented on THRIFT-1478:
------------------------------------

Awesome, thanks for writing those tests and fixing that bug!
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Greg Fodor (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178969#comment-13178969 ] 

Greg Fodor commented on THRIFT-1478:
------------------------------------

Hey Bryan & Andrew, I just attached an updated patch that passes the tests as per Andrew's helpful steps above. I had a few bugs in the implementation -- first was the edge case with contexts Andrew mentioned, the second was due to the fact that numeric values being used as keys in maps were not being quoted properly. 
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Greg Fodor (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Fodor updated THRIFT-1478:
-------------------------------

    Summary: TJSONProtocol in PHP  (was: TJSONProtocol)
    
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Roger Meier (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier updated THRIFT-1478:
--------------------------------

    Attachment: THRIFT-1249_incl_make_check.patch

This looks great! Here's the updated version which integrates the test with automake and friends [^THRIFT-1249_incl_make_check.patch]

I have the folling issue now:
{noformat}

make[3]: Entering directory `/home/roger/thrift/lib/php/test'
mkdir -p ../src/packages
../../../compiler/cpp/thrift --gen php -r --out ../src/packages ../../../test/ThriftTest.thrift
/usr/bin/phpunit protocol/TestTJSONProtocol.php
PHPUnit 3.4.14 by Sebastian Bergmann.

..................F.......F.....

Time: 1 second, Memory: 6.75Mb

There were 2 failures:

1) TestTJSONProtocol::testDouble_Read
Failed asserting that <double:3.1415926535898> matches expected <double:3.1415926535898>.

/home/roger/thrift/lib/php/test/protocol/TestTJSONProtocol.php:305

2) TestTJSONProtocol::testSet_Read
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array
 (
     [0] => 1
-    [1] => 2
-    [2] => 3
+    [1] => 1
+    [2] => 1
 )

/home/roger/thrift/lib/php/test/protocol/TestTJSONProtocol.php:422

FAILURES!
Tests: 32, Assertions: 30, Failures: 2.
make[3]: *** [check] Error 1

{noformat}

-roger
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478_incl_make_check.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Andrew Grumet (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Grumet updated THRIFT-1478:
----------------------------------

    Attachment: THRIFT-1478.patch

All right, reverting to the older version of phpunit reproduces the errors.

The attached patch is a re-do of the patch file that passes in both old and new phpunit versions.  Not sure what was up with the pi comparison, but replacing the function call with a literal fixed it.  The testSet error was legit; fixed now.  Also, I added a new test for strings that end in double-backslash -- this was a bug that is now fixed.

The patchfile does not include the extra makefile stuff...hopefully it's easy for you to reapply that piece.  Thanks!
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478.patch, THRIFT-1478_incl_make_check.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1478) TJSONProtocol in PHP

Posted by "Greg Fodor (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178068#comment-13178068 ] 

Greg Fodor commented on THRIFT-1478:
------------------------------------

Ah, I wasn't able to figure out what tests exercised this stuff, can you point me to the right place?
                
> TJSONProtocol in PHP
> --------------------
>
>                 Key: THRIFT-1478
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1478
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.8
>            Reporter: Greg Fodor
>            Priority: Minor
>         Attachments: THRIFT-1478.patch
>
>
> We needed to be able to serialize and deserialize javascript thrift calls from within PHP, so I spent a few hours porting over the Java implementation of TJSONProtocol to PHP. It has not been exhaustively tested but it seems to be in reasonable working order. Please let me know what steps are necessary to get this onto trunk. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira