Corona: Added MsgPackView

Review Request #491 — Created Feb. 20, 2017 and submitted

p.valk
Lunr
ML-439
b79ba10...
lunr
Corona: Added MsgPackView

unittests.

  • 0
  • 0
  • 13
  • 0
  • 13
Description From Last Updated
There are no open issues
pprkut
  1. 
      
  2. src/Lunr/Corona/MsgpackView.php (Diff revision 1)
     
     
    The issue has been resolved. Show all issues

    we don't do those kind of comments

  3. src/Lunr/Corona/MsgpackView.php (Diff revision 1)
     
     
     
     
     

    This is a JSON specific workaround. Is this needed for msgpack as well?

    1. removed this, i thought it was workaround for client.

    2. I don't follow. "client"?

    3. i thought the media using this, didnt know this was a workaround for json.

    4. Still don't follow. "media"?

      The workaround is for this:

      [ object => [ 'key' => value ] ]

      translates to a JSON object, but

      [ object => [] ]

      translates to a JSON array.

      So in order to not break JSON parsers that expect an object, we catch that and force an empty array to be treated like an object.

  4. src/Lunr/Corona/MsgpackView.php (Diff revision 1)
     
     
     
     
     
     
     
     
     
    The issue has been resolved. Show all issues

    there's not really a point for this, is there?

    1. removed it, i thought it would look better for cli

    2. well, my point was that there is no point in the separation. That doesn't mean we can't make it look nice on the CLI

    3. i can add a small line if cli then echo '\n' if thats better.

    4. why the if? Why not just echo it all the time?

  5. 
      
p.valk
p.valk
tardypad
  1. Ship It!
  2. 
      
pprkut
  1. 
      
  2. The issue has been resolved. Show all issues

    what's up with the "stdClass" here?
    IMHO, that shouldn't end up in the output, no?

    1. msgpack adds this, when unserializing it goes to a stdclass object in php.

  3. 
      
p.valk
pprkut
  1. 
      
  2. src/Lunr/Corona/Tests/MsgpackViewPrintFatalErrorTest.php (Diff revision 3)
     
     
     
     
     
     
     
     
    The issue has been resolved. Show all issues

    missing @requires

    also, PHP 5.5.12?

    1. cope paste bug~~

  3. src/Lunr/Corona/Tests/MsgpackViewPrintTest.php (Diff revision 3)
     
     
     
     
     
     
     
     
     
     
     
    The issue has been resolved. Show all issues

    ditto

  4. 
      
p.valk
pprkut
  1. 
      
  2. src/Lunr/Corona/Tests/MsgpackViewPrintTest.php (Diff revisions 3 - 4)
     
     
    The issue has been resolved. Show all issues

    not necessary to place this here.
    The 5.5.12 was specifically needed because it fixed a bug that changed json encode behavior

    1. ok i'l clean it.

  3. src/Lunr/Corona/Tests/MsgpackViewPrintTest.php (Diff revisions 3 - 4)
     
     
    The issue has been resolved. Show all issues

    why the specific version?

    1. this is the version i tested it on, also its the latest that works on php 5

    2. no need to be specific then.
      You need to be specific when you know that earlier versions don't work.
      Not when you have no idea.

  4. 
      
p.valk
smillernl
  1. 
      
  2. src/Lunr/Corona/MsgpackView.php (Diff revision 5)
     
     

    It's not calles $return nor is naming the variable here in the php/javadoc spec as it doesn't say anything.

    1. this came from the json view. used the same implementation.

  3. 
      
smillernl
  1. Ship It!
  2. 
      
pprkut
  1. 
      
  2. src/Lunr/Corona/MsgpackView.php (Diff revision 5)
     
     
    The issue has been resolved. Show all issues

    superfluous empty line

  3. src/Lunr/Corona/MsgpackView.php (Diff revision 5)
     
     
    The issue has been resolved. Show all issues

    That sounds like str_replace did something wrong before and this fixes it.

    1. this was because we couldnt make an empty map in php, this is a workaround to change the stdclass with a real msgpack empty map datatype.

    2. I know what it does. But the comment doesn't explain what it does :P
      "used to" is past tense, meaning it's not doing it anymore

  4. 
      
p.valk
pprkut
  1. 
      
  2. src/Lunr/Corona/MsgpackView.php (Diff revision 6)
     
     
     
    The issue has been resolved. Show all issues

    Better, but still not quite :)

    Do X because Y

    i.e. something like

    "Replace empty stdClass with empty map manually, because...."

  3. src/Lunr/Corona/MsgpackView.php (Diff revision 6)
     
     
    The issue has been resolved. Show all issues

    And here too ;)

  4. 
      
p.valk
pprkut
  1. Ship It!
  2. 
      
pprkut
  1. 
      
  2. The issue has been resolved. Show all issues

    that's not working

  3. 
      
p.valk
pprkut
  1. 
      
  2. src/Lunr/Corona/Tests/MsgpackViewTest.php (Diff revisions 7 - 8)
     
     
     
     
    The issue has been resolved. Show all issues

    eh, no. Check previous changes on how we solved this pls

  3. 
      
p.valk
pprkut
  1. Unit tests still failing:

    PHP Fatal error: Call to undefined function Lunr\Corona\msgpack_pack() in /mnt/progs/projects/web/lunr/src/Lunr/Corona/MsgpackView.php on line 115
    PHP Stack trace:
    PHP 1. {main}() /usr/bin/phpunit:0
    PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:583
    PHP 3. PHPUnit_TextUI_Command->run() phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:116
    PHP 4. PHPUnit_TextUI_TestRunner->doRun() phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:186
    PHP 5. PHPUnit_Framework_TestSuite->run() phar:///usr/bin/phpunit/phpunit/TextUI/TestRunner.php:517
    PHP 6. PHPUnit_Framework_TestSuite->run() phar:///usr/bin/phpunit/phpunit/Framework/TestSuite.php:722
    PHP 7. PHPUnit_Framework_TestSuite->run() phar:///usr/bin/phpunit/phpunit/Framework/TestSuite.php:722
    PHP 8. PHPUnit_Framework_TestCase->run() phar:///usr/bin/phpunit/phpunit/Framework/TestSuite.php:722
    PHP 9. PHPUnit_Framework_TestResult->run() phar:///usr/bin/phpunit/phpunit/Framework/TestCase.php:860
    PHP 10. PHPUnit_Framework_TestCase->runBare() phar:///usr/bin/phpunit/phpunit/Framework/TestResult.php:686
    PHP 11. PHPUnit_Framework_TestCase->runTest() phar:///usr/bin/phpunit/phpunit/Framework/TestCase.php:905
    PHP 12. ReflectionMethod->invokeArgs() phar:///usr/bin/phpunit/phpunit/Framework/TestCase.php:1054
    PHP 13. Lunr\Corona\Tests\MsgpackViewPrintFatalErrorTest->testPrintFatalErrorPrintsMsgpack() phar:///usr/bin/phpunit/phpunit/Framework/TestCase.php:1054
    PHP 14. Lunr\Corona\MsgpackView->print_fatal_error() /mnt/progs/projects/web/lunr/src/Lunr/Corona/Tests/MsgpackViewPrintFatalErrorTest.php:92

    1. you need the msgpack extension for php

    2. I know, but with it not present the tests shouldn't fail, they should be skipped.

  2. 
      
p.valk
p.valk
Review request changed

Status: Closed (submitted)

Change Summary:

Merged into master

Loading...