maplefu0602 / spyc

Automatically exported from code.google.com/p/spyc
MIT License
0 stars 0 forks source link

Empty array inside array generates warning #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
With Spyc 0.4.2, the following code generates a warning "Warning: strpos()
expects parameter 1 to be string, array given in .../spyc-0.4.2/spyc.php on
line 298"

require_once('spyc.php');
echo Spyc::YAMLDump(array(array()));

The expected output is  a string "---\n- []".
Or an exception/error code as the spec seems to disallow empty flow
sequences. I'm not sure though.
http://yaml.org/spec/cvs/current.html#id2590072

Original issue reported on code.google.com by ran...@gmail.com on 14 Jul 2009 at 7:32

GoogleCodeExporter commented 8 years ago
Ranvis, I can't reproduce the warning. What PHP version are you using? Does the
warning appear in the latest version (from SVN) of Spyc? Thanks.

Original comment by vlad.and...@gmail.com on 3 Aug 2009 at 10:05

GoogleCodeExporter commented 8 years ago
Thank you for the reply.
I tested ^/trunk@78, and the result was that only PHP 5.3 generated a warning.

PHP 5.2.10 with php.ini-recommended:
  PHP Notice:  Array to string conversion inspyc.php on line 305

PHP 5.3.0 with php.ini-production:
  PHP Warning:  substr() expects parameter 1 to be string, array given inspyc.php on 
line 305

Original comment by ran...@gmail.com on 4 Aug 2009 at 2:44

GoogleCodeExporter commented 8 years ago
Oops. Even though I got a warning, the version above returned the correct 
answer.
Thanks.

Original comment by ran...@gmail.com on 5 Aug 2009 at 10:08

GoogleCodeExporter commented 8 years ago
Ok, and the warning should be fixed too now!

Original comment by vlad.and...@gmail.com on 20 Sep 2009 at 12:45

GoogleCodeExporter commented 8 years ago

Original comment by vlad.and...@gmail.com on 20 Sep 2009 at 12:46

GoogleCodeExporter commented 8 years ago
Thanks. Confirmed with the latest r91.
Spyc is very handy :)

Original comment by ran...@gmail.com on 21 Sep 2009 at 3:20