Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7.1 compatibility #62

Open
esurov opened this issue Jan 23, 2017 · 6 comments
Open

PHP 7.1 compatibility #62

esurov opened this issue Jan 23, 2017 · 6 comments

Comments

@esurov
Copy link

esurov commented Jan 23, 2017

Hey,

I was doing some tests of the library with php 7.1 and there are 4 tests failing:

  1. DumpTest::testDump
    Failed asserting that two arrays are equal.
    --- Expected
    +++ Actual
    @@ @@
    'NewLine' => '\n'
  • 'QuotedNewLine' => '
  • '
  • 'QuotedNewLine' => '\n'

@@ @@
'float_test_with_quotes' => '1.0'

  • 'float_inverse_test' => 1.0
  • 'float_inverse_test' => 1
    'a_really_large_number' => '11579208923731619542357098500...639936'
    'int array' => Array (...)
    'array on several lines' => Array (...)
    'morelesskey' => ''
    'array_of_zero' => Array (...)
    'sophisticated_array_of_zero' => Array (...)
    'switches' => Array (...)
    'empty_sequence' => Array ()
    'empty_hash' => Array ()
    'special_characters' => '[{]]{{]]'
    'asterisks' => '*'
    'empty_key' => Array (...)
    'trailing_colon' => 'foo:'
    'multiline_items' => Array (...)
    'many_lines' => 'A quick\nfox\n\n\njumped\nover\n\n\n\n...\n\n\ndog'
    'werte' => Array (...)
    'noindent_records' => ''
    1041 => Array (...)
    1042 => Array (...)
    'a:1' => Array (...)
    'a:2' => Array (...)
    'a:3' => Array (...)
    'complex_unquoted_key' => Array (...)
    'array with commas' => Array (...)
    'invoice' => Array (...)
    'quotes' => Array (...)
    'endloop' => 'Does this line in the end ind... loop?'
    )

/Users/gene/Work/oDesk/Vena/vena/vendor/mustangostang/spyc/tests/DumpTest.php:24

  1. DumpTest::testDumpWithQuotes
    Failed asserting that two arrays are equal.
    --- Expected
    +++ Actual
    @@ @@
    'SmallFloat' => 0.7
  • 'NewLine' => '\n'
  • 'QuotedNewLine' => '
  • 'NewLine' => '
    '
  • 'QuotedNewLine' => '\n'

@@ @@
'float_test_with_quotes' => '1.0'

  • 'float_inverse_test' => 1.0
  • 'float_inverse_test' => 1
    'a_really_large_number' => '11579208923731619542357098500...639936'
    'int array' => Array (...)
    'array on several lines' => Array (...)
    'morelesskey' => ''
    'array_of_zero' => Array (...)
    'sophisticated_array_of_zero' => Array (...)
    'switches' => Array (...)
    'empty_sequence' => Array ()
    'empty_hash' => Array ()
    'special_characters' => '[{]]{{]]'
    'asterisks' => '*'
    'empty_key' => Array (...)
    'trailing_colon' => 'foo:'
    'multiline_items' => Array (...)
    'many_lines' => 'A quick\nfox\n\n\njumped\nover\n\n\n\n...\n\n\ndog'
    'werte' => Array (...)
    'noindent_records' => ''
    1041 => Array (...)
    1042 => Array (...)
    'a:1' => Array (...)
    'a:2' => Array (...)
    'a:3' => Array (...)
    'complex_unquoted_key' => Array (...)
    'array with commas' => Array (...)
    'invoice' => Array (...)
    'quotes' => Array (...)
    'endloop' => 'Does this line in the end ind... loop?'
    )

/Users/gene/Work/oDesk/Vena/vena/vendor/mustangostang/spyc/tests/DumpTest.php:35

  1. ParseTest::testMappingsHex
    Failed asserting that '0xf3' is identical to 243.

/Users/gene/Work/oDesk/Vena/vena/vendor/mustangostang/spyc/tests/ParseTest.php:47

  1. RoundTripTest::testNewLines
    Failed asserting that two arrays are equal.
    --- Expected
    +++ Actual
    @@ @@
    Array (
  • 'x' => '
  • '
  • 'x' => '\n'
    )

/Users/gene/Work/oDesk/Vena/vena/vendor/mustangostang/spyc/tests/RoundTripTest.php:38

FAILURES!
Tests: 132, Assertions: 135, Failures: 4.

@jackmcdade
Copy link
Collaborator

Are you able to send a PR on any of those items that pass the tests?

@esurov
Copy link
Author

esurov commented Jan 23, 2017

Sorry, PR stands for?

@jackmcdade
Copy link
Collaborator

My apologies. Pull Request - when you fork a repo, make changes, and submit them for review.

@esurov
Copy link
Author

esurov commented Jan 23, 2017

Hmm, I know the reason of one failure:

Disallow the ASCII delete control character in identifiers
The ASCII delete control character (0x7F) can no longer be used in identifiers that are not quoted.

http://php.net/manual/en/migration71.incompatible.php#migration71.incompatible.delete-control-character-in-identifiers

If you replace line 18 in spyc.yml with the following one it stops failing:
Hex: '0xf3'

@FossPrime
Copy link
Contributor

the only difference I get comparing php 7 with php 5.6 is with NewLine. I don't see control characters anywhere.
screenshot from 2017-02-08 15-00-00

PHP 7.0.15

$ phpunit DumpTest.php 
PHPUnit 5.7.5 by Sebastian Bergmann and contributors.

.FF........................                                       27 / 27 (100%)

Time: 91 ms, Memory: 4.00MB

There were 2 failures:

1) DumpTest::testDump
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
     'NewLine' => '\n'
-    'QuotedNewLine' => '
-    '
+    'QuotedNewLine' => '\n'

@@ @@
     'float_test_with_quotes' => '1.0'
-    'float_inverse_test' => 1.0
+    'float_inverse_test' => 1

PHP 5.6.29

# phpunit DumpTest.php 
PHPUnit 4.2.6 by Sebastian Bergmann.

.FF........................

Time: 58 ms, Memory: 3.25Mb

There were 2 failures:

1) DumpTest::testDump
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
     'NewLine' => '\n'
-    'QuotedNewLine' => '
-    '
+    'QuotedNewLine' => '\n'

@@ @@
     'float_test_with_quotes' => '1.0'
-    'float_inverse_test' => 1.0
+    'float_inverse_test' => 1
     'a_really_large_number' => '11579208923731619542357098500...639936'
     'int array' => Array (...)
     'array on several lines' => Array (...)
     'morelesskey' => '<value>'
     'array_of_zero' => Array (...)
     'sophisticated_array_of_zero' => Array (...)
     'switches' => Array (...)
     'empty_sequence' => Array ()
     'empty_hash' => Array ()
     'special_characters' => '[{]]{{]]'
     'asterisks' => '*'
     'empty_key' => Array (...)
     'trailing_colon' => 'foo:'
     'multiline_items' => Array (...)
     'many_lines' => 'A quick\nfox\n\n\njumped\nover\n\n\n\n...\n\n\ndog'
     'werte' => Array (...)
     'noindent_records' => ''
     1041 => Array (...)
     1042 => Array (...)
     'a:1' => Array (...)
     'a:2' => Array (...)
     'a:3' => Array (...)
     'complex_unquoted_key' => Array (...)
     'array with commas' => Array (...)
     'invoice' => Array (...)
     'quotes' => Array (...)
     'endloop' => 'Does this line in the end ind... loop?'
 )

/root/spyc/tests/DumpTest.php:24

2) DumpTest::testDumpWithQuotes
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
     'SmallFloat' => 0.69999999999999996
-    'NewLine' => '\n'
-    'QuotedNewLine' => '
+    'NewLine' => '
     '
+    'QuotedNewLine' => '\n'

@@ @@
     'float_test_with_quotes' => '1.0'
-    'float_inverse_test' => 1.0
+    'float_inverse_test' => 1

@Gummibeer
Copy link

@rayfoss it's about php7.1 not php7.0 - related to types, conversion and things like this php7.1 is much stricter than php7.0 or php5.6, we had to change all $numString * 1 cause php7.1 dropped an TypeError exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants