Permalink
Browse files

0.9.3 release of PHP extension

Signed-off-by: why the lucky stiff <why@whytheluckystiff.net>
  • Loading branch information...
1 parent 3d03cb9 commit 408de75c5ccca526c5eeaa112e1203e1a2df2622 Jimi Dini committed with why the lucky stiff Jan 11, 2009
Showing with 81 additions and 23 deletions.
  1. +7 −1 ext/php/CHANGELOG
  2. +1 −1 ext/php/config.m4
  3. +29 −12 ext/php/package.xml
  4. +1 −1 ext/php/php_syck.h
  5. +23 −8 ext/php/phpext.c
  6. +20 −0 ext/php/phpunit-tests/TestLoad.php
View
@@ -1,8 +1,14 @@
--- %YAML:1.0
-- version: 0.9.3
+- version: 0.9.4
date: 2008-??-??
status: beta
changes:
+ - nothing, yet
+
+- version: 0.9.3
+ date: 2008-11-18
+ status: beta
+ changes:
- fixed bug#31 (broken yaml caused segfault)
- multiline strings are exported in folded format (for readability) now
- maps and sequences of unknown types are treated as php/hash and php/array (with notice)
View
@@ -1,4 +1,4 @@
-dnl $Id$
+dnl $Id: config.m4 264 2007-07-08 19:57:08Z indeyets $
dnl config.m4 for extension syck
PHP_ARG_WITH(syck, for syck support,
View
@@ -12,9 +12,9 @@ YAML(tm) (rhymes with "camel") is a straightforward machine parsable data serial
<email>indeyets@gmail.com</email>
<active>yes</active>
</lead>
- <date>2007-11-22</date>
+ <date>2008-11-18</date>
<version>
- <release>0.9.2</release>
+ <release>0.9.3</release>
<api>1.0</api>
</version>
<stability>
@@ -23,16 +23,9 @@ YAML(tm) (rhymes with "camel") is a straightforward machine parsable data serial
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- - gcc-2.95 compatibility (patch by Brian J. France)
- - fixed dumping of mixed arrays and numeric-arrays starting from non-zero digit
- - fixed loading of maps with numeric keys
- - short-and-flat arrays are dumped using inline-mode now (for readability)
- - changed explicit type of DateTime class to be !php/object::DateTime
- - added support for loading explicitly typed DateTime (with timestamp-compatible value)
- - added support for loading sequences into classes which implement ArrayAccess (!php/array::ClassName)
- - added support for loading maps into classes which implement ArrayAccess (!php/hash::ClassName)
- - added support for loading classes which implement Serializable (!php/object::ClassName)
- - added support for dumping classes which implement Serializable (!php/object::ClassName)
+ - fixed bug#31 (broken yaml caused segfault)
+ - multiline strings are exported in folded format (for readability) now
+ - maps and sequences of unknown types are treated as php/hash and php/array (with notice)
</notes>
<contents>
<dir name="/">
@@ -63,6 +56,30 @@ YAML(tm) (rhymes with "camel") is a straightforward machine parsable data serial
<extsrcrelease></extsrcrelease>
<changelog>
<release>
+ <date>2007-11-22</date>
+ <version>
+ <release>0.9.2</release>
+ <api>1.0</api>
+ </version>
+ <stability>
+ <release>beta</release>
+ <api>beta</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP License</license>
+ <notes>
+ - gcc-2.95 compatibility (patch by Brian J. France)
+ - fixed dumping of mixed arrays and numeric-arrays starting from non-zero digit
+ - fixed loading of maps with numeric keys
+ - short-and-flat arrays are dumped using inline-mode now (for readability)
+ - changed explicit type of DateTime class to be !php/object::DateTime
+ - added support for loading explicitly typed DateTime (with timestamp-compatible value)
+ - added support for loading sequences into classes which implement ArrayAccess (!php/array::ClassName)
+ - added support for loading maps into classes which implement ArrayAccess (!php/hash::ClassName)
+ - added support for loading classes which implement Serializable (!php/object::ClassName)
+ - added support for dumping classes which implement Serializable (!php/object::ClassName)
+ </notes>
+ </release>
+ <release>
<date>2007-07-15</date>
<version>
<release>0.9.1</release>
View
@@ -16,7 +16,7 @@
| Alexey Zakhlestin <indeyets@gmail.com> |
+----------------------------------------------------------------------+
- $Id$
+ $Id: php_syck.h 266 2007-07-10 21:41:32Z indeyets $
*/
#ifndef PHP_SYCK_H
View
@@ -16,7 +16,7 @@
| Alexey Zakhlestin <indeyets@gmail.com> |
+----------------------------------------------------------------------+
- $Id$
+ $Id: phpext.c 330 2008-11-18 19:55:57Z indeyets $
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -40,7 +40,7 @@
# define false 0
#endif
-#define PHP_SYCK_VERSION "0.9.3-dev"
+#define PHP_SYCK_VERSION "0.9.4-dev"
/**
* SyckException class
@@ -52,6 +52,17 @@
static zend_class_entry *spl_ce_RuntimeException;
zend_class_entry *syck_exception_entry;
+/* {{{ arginfo */
+ZEND_BEGIN_ARG_INFO_EX(arginfo_syck_load, 0, 0, 1)
+ ZEND_ARG_INFO(0, string)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_syck_dump, 0, 0, 1)
+ ZEND_ARG_INFO(0, variable)
+ZEND_END_ARG_INFO()
+/* }}} */
+
+
PHP_SYCK_API zend_class_entry *php_syck_get_exception_base()
{
TSRMLS_FETCH();
@@ -188,8 +199,8 @@ static int psex_determine_array_type(HashTable *myht TSRMLS_DC) /* {{{ */
function_entry syck_functions[] = {
- PHP_FE(syck_load, NULL)
- PHP_FE(syck_dump, NULL)
+ PHP_FE(syck_load, arginfo_syck_load)
+ PHP_FE(syck_dump, arginfo_syck_dump)
{NULL, NULL, NULL} /* Must be the last line in syck_functions[] */
};
@@ -608,13 +619,17 @@ void php_syck_ehandler(SyckParser *p, const char *str)
endl[0] = '\0';
- exc = zend_throw_exception_ex(syck_exception_entry, 0 TSRMLS_CC, "%s on line %d, col %d: '%s'", str, p->linect + 1, p->cursor - p->lineptr, p->lineptr);
+ if (NULL == p->bonus) {
+ /* silence second exceptions */
+ exc = zend_throw_exception_ex(syck_exception_entry, 0 TSRMLS_CC, "%s on line %d, col %d: '%s'", str, p->linect + 1, p->cursor - p->lineptr, p->lineptr);
- Z_SET_REFCOUNT_P(exc, 2);
+ Z_SET_REFCOUNT_P(exc, 2);
- st_foreach(p->syms, my_cleaner, NULL);
+ p->bonus = exc;
+ }
- p->bonus = exc;
+ if (p->syms)
+ st_foreach(p->syms, my_cleaner, NULL);
}
void php_syck_emitter_handler(SyckEmitter *e, st_data_t id)
@@ -81,6 +81,9 @@ public function testString()
1\
2"'), '12');
$this->assertSame(syck_load("'12'"), '12');
+
+ // UTF-8
+ $this->assertSame('Привет', syck_load("'Привет'"));
}
public function testInteger()
@@ -176,6 +179,9 @@ public function testHash()
$this->assertEquals(array(), syck_load('{}'));
$this->assertEquals(array('a', 'b', 'c'), syck_load('{0: a, 1: b, 2: c}'));
+ // UTF-8
+ $this->assertEquals(array('привет' => 'мир'), syck_load('{"привет": "мир"}'));
+
// ArrayObject implements ArrayAccess: OK
$this->assertEquals(new ArrayObject(), syck_load('!php/hash::ArrayObject {}'));
$this->assertEquals(
@@ -217,4 +223,18 @@ public function testBug31()
$this->assertTrue(true);
}
}
+
+ public function testBugPECL_14384()
+ {
+ $broken_string = 'test:
+ var: value
+ var2: value2';
+
+ try {
+ syck_load($broken_string);
+ $this->assertTrue(false);
+ } catch (SyckException $e) {
+ $this->assertTrue(true);
+ }
+ }
}

0 comments on commit 408de75

Please sign in to comment.