Skip to content

Commit

Permalink
0.9.3 release of PHP extension
Browse files Browse the repository at this point in the history
Signed-off-by: why the lucky stiff <why@whytheluckystiff.net>
  • Loading branch information
Jimi Dini authored and why the lucky stiff committed Jan 15, 2009
1 parent 3d03cb9 commit 408de75
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 23 deletions.
8 changes: 7 additions & 1 deletion ext/php/CHANGELOG
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,13 @@
--- %YAML:1.0 --- %YAML:1.0
- version: 0.9.3 - version: 0.9.4
date: 2008-??-?? date: 2008-??-??
status: beta status: beta
changes:
- nothing, yet

- version: 0.9.3
date: 2008-11-18
status: beta
changes: changes:
- fixed bug#31 (broken yaml caused segfault) - fixed bug#31 (broken yaml caused segfault)
- multiline strings are exported in folded format (for readability) now - multiline strings are exported in folded format (for readability) now
Expand Down
2 changes: 1 addition & 1 deletion ext/php/config.m4
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
dnl $Id$ dnl $Id: config.m4 264 2007-07-08 19:57:08Z indeyets $
dnl config.m4 for extension syck dnl config.m4 for extension syck


PHP_ARG_WITH(syck, for syck support, PHP_ARG_WITH(syck, for syck support,
Expand Down
41 changes: 29 additions & 12 deletions ext/php/package.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ YAML(tm) (rhymes with "camel") is a straightforward machine parsable data serial
<email>indeyets@gmail.com</email> <email>indeyets@gmail.com</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2007-11-22</date> <date>2008-11-18</date>
<version> <version>
<release>0.9.2</release> <release>0.9.3</release>
<api>1.0</api> <api>1.0</api>
</version> </version>
<stability> <stability>
Expand All @@ -23,16 +23,9 @@ YAML(tm) (rhymes with "camel") is a straightforward machine parsable data serial
</stability> </stability>
<license uri="http://www.php.net/license">PHP License</license> <license uri="http://www.php.net/license">PHP License</license>
<notes> <notes>
- gcc-2.95 compatibility (patch by Brian J. France) - fixed bug#31 (broken yaml caused segfault)
- fixed dumping of mixed arrays and numeric-arrays starting from non-zero digit - multiline strings are exported in folded format (for readability) now
- fixed loading of maps with numeric keys - maps and sequences of unknown types are treated as php/hash and php/array (with notice)
- 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> </notes>
<contents> <contents>
<dir name="/"> <dir name="/">
Expand Down Expand Up @@ -62,6 +55,30 @@ YAML(tm) (rhymes with "camel") is a straightforward machine parsable data serial
<providesextension>syck</providesextension> <providesextension>syck</providesextension>
<extsrcrelease></extsrcrelease> <extsrcrelease></extsrcrelease>
<changelog> <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> <release>
<date>2007-07-15</date> <date>2007-07-15</date>
<version> <version>
Expand Down
2 changes: 1 addition & 1 deletion ext/php/php_syck.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
| Alexey Zakhlestin <indeyets@gmail.com> | | Alexey Zakhlestin <indeyets@gmail.com> |
+----------------------------------------------------------------------+ +----------------------------------------------------------------------+
$Id$ $Id: php_syck.h 266 2007-07-10 21:41:32Z indeyets $
*/ */


#ifndef PHP_SYCK_H #ifndef PHP_SYCK_H
Expand Down
31 changes: 23 additions & 8 deletions ext/php/phpext.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
| Alexey Zakhlestin <indeyets@gmail.com> | | Alexey Zakhlestin <indeyets@gmail.com> |
+----------------------------------------------------------------------+ +----------------------------------------------------------------------+
$Id$ $Id: phpext.c 330 2008-11-18 19:55:57Z indeyets $
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
Expand All @@ -40,7 +40,7 @@
# define false 0 # define false 0
#endif #endif


#define PHP_SYCK_VERSION "0.9.3-dev" #define PHP_SYCK_VERSION "0.9.4-dev"


/** /**
* SyckException class * SyckException class
Expand All @@ -52,6 +52,17 @@
static zend_class_entry *spl_ce_RuntimeException; static zend_class_entry *spl_ce_RuntimeException;
zend_class_entry *syck_exception_entry; 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() PHP_SYCK_API zend_class_entry *php_syck_get_exception_base()
{ {
TSRMLS_FETCH(); TSRMLS_FETCH();
Expand Down Expand Up @@ -188,8 +199,8 @@ static int psex_determine_array_type(HashTable *myht TSRMLS_DC) /* {{{ */




function_entry syck_functions[] = { function_entry syck_functions[] = {
PHP_FE(syck_load, NULL) PHP_FE(syck_load, arginfo_syck_load)
PHP_FE(syck_dump, NULL) PHP_FE(syck_dump, arginfo_syck_dump)
{NULL, NULL, NULL} /* Must be the last line in syck_functions[] */ {NULL, NULL, NULL} /* Must be the last line in syck_functions[] */
}; };


Expand Down Expand Up @@ -608,13 +619,17 @@ void php_syck_ehandler(SyckParser *p, const char *str)


endl[0] = '\0'; 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) void php_syck_emitter_handler(SyckEmitter *e, st_data_t id)
Expand Down
20 changes: 20 additions & 0 deletions ext/php/phpunit-tests/TestLoad.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public function testString()
1\ 1\
2"'), '12'); 2"'), '12');
$this->assertSame(syck_load("'12'"), '12'); $this->assertSame(syck_load("'12'"), '12');

// UTF-8
$this->assertSame('Привет', syck_load("'Привет'"));
} }


public function testInteger() public function testInteger()
Expand Down Expand Up @@ -176,6 +179,9 @@ public function testHash()
$this->assertEquals(array(), syck_load('{}')); $this->assertEquals(array(), syck_load('{}'));
$this->assertEquals(array('a', 'b', 'c'), syck_load('{0: a, 1: b, 2: c}')); $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 // ArrayObject implements ArrayAccess: OK
$this->assertEquals(new ArrayObject(), syck_load('!php/hash::ArrayObject {}')); $this->assertEquals(new ArrayObject(), syck_load('!php/hash::ArrayObject {}'));
$this->assertEquals( $this->assertEquals(
Expand Down Expand Up @@ -217,4 +223,18 @@ public function testBug31()
$this->assertTrue(true); $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.