[PHP-CVS] cvs: php-src /ext/spl spl_array.c

2007-12-14 Thread David Coallier
davidc  Sat Dec 15 01:18:28 2007 UTC

  Modified files:  
/php-src/ext/splspl_array.c 
  Log:
  - MFB: Bug #41528
  - Added possibility to serialize and unserialize classes that extend to 
ArrayObject
  - See ext/spl/tests/array_023.phpt and ext/spl/tests/bug41528.php for 
references
  - Put a folding for all SPL_ARRAY_METHOD() def
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.133&r2=1.134&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.133 php-src/ext/spl/spl_array.c:1.134
--- php-src/ext/spl/spl_array.c:1.133   Fri Dec 14 22:52:53 2007
+++ php-src/ext/spl/spl_array.c Sat Dec 15 01:18:28 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.133 2007/12/14 22:52:53 colder Exp $ */
+/* $Id: spl_array.c,v 1.134 2007/12/15 01:18:28 davidc Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -25,7 +25,10 @@
 #include "php.h"
 #include "php_ini.h"
 #include "ext/standard/info.h"
+#include "ext/standard/php_var.h"
+#include "ext/standard/php_smart_str.h"
 #include "zend_interfaces.h"
+#include "zend_API.h"
 #include "zend_exceptions.h"
 
 #include "php_spl.h"
@@ -53,7 +56,7 @@
 #define SPL_ARRAY_IS_SELF0x0200
 #define SPL_ARRAY_USE_OTHER  0x0400
 #define SPL_ARRAY_INT_MASK   0x
-#define SPL_ARRAY_CLONE_MASK 0x0307
+#define SPL_ARRAY_CLONE_MASK 0x030F
 
 typedef struct _spl_array_object {
zend_object   std;
@@ -69,7 +72,7 @@
zend_class_entry* ce_get_iterator;
 } spl_array_object;
 
-static inline HashTable *spl_array_get_hash_table(spl_array_object* intern, 
int check_std_props TSRMLS_DC) {
+static inline HashTable *spl_array_get_hash_table(spl_array_object* intern, 
int check_std_props TSRMLS_DC) { /* {{{ */
if ((intern->ar_flags & SPL_ARRAY_IS_SELF) != 0) {
return intern->std.properties;
} else if ((intern->ar_flags & SPL_ARRAY_USE_OTHER) && (check_std_props 
== 0 || (intern->ar_flags & SPL_ARRAY_STD_PROP_LIST) == 0) && 
Z_TYPE_P(intern->array) == IS_OBJECT) {
@@ -80,7 +83,7 @@
} else {
return HASH_OF(intern->array);
}
-}
+} /* }}} */
 
 SPL_API int spl_hash_verify_pos(spl_array_object * intern TSRMLS_DC) /* {{{ */
 {
@@ -553,7 +556,6 @@
spl_array_write_dimension_ex(0, getThis(), index, value TSRMLS_CC);
 } /* }}} */
 
-
 void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC) /* 
{{{ */
 {
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
@@ -600,7 +602,7 @@
spl_array_unset_dimension_ex(0, getThis(), index TSRMLS_CC);
 } /* }}} */
 
-/* {{ proto array ArrayObject::getArrayCopy() U
+/* {{{ proto array ArrayObject::getArrayCopy() U
   proto array ArrayIterator::getArrayCopy() U
  Return a copy of the contained array */
 SPL_METHOD(Array, getArrayCopy)
@@ -759,11 +761,11 @@
}
 } /* }}} */
 
-/* define an overloaded iterator structure */
+/* {{{ define an overloaded iterator structure */
 typedef struct {
zend_user_iteratorintern;
spl_array_object  *object;
-} spl_array_it;
+} spl_array_it; /* }}} */
 
 static void spl_array_it_dtor(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
 {
@@ -892,7 +894,7 @@
 }
 /* }}} */
 
-/* iterator handler table */
+/* {{{ iterator handler table */
 zend_object_iterator_funcs spl_array_it_funcs = {
spl_array_it_dtor,
spl_array_it_valid,
@@ -900,7 +902,7 @@
spl_array_it_get_current_key,
spl_array_it_move_forward,
spl_array_it_rewind
-};
+}; /* }}} */
 
 zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval 
*object, int by_ref TSRMLS_DC) /* {{{ */
 {
@@ -1201,6 +1203,7 @@
RETURN_LONG(count);
 } /* }}} */
 
+/* {{{ static void spl_array_method */
 static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int 
fname_len, int use_arg)
 {
spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
@@ -1220,45 +1223,41 @@
} else {
zend_call_method(NULL, NULL, NULL, fname, fname_len, 
&return_value, 1, &tmp, NULL TSRMLS_CC);
}
-}
+} /* }}} */
 
+/* {{{ SPL_ARRAY_METHOD */
 #define SPL_ARRAY_METHOD(cname, fname, use_arg) \
 SPL_METHOD(cname, fname) \
 { \
spl_array_method(INTERNAL_FUNCTION_PARAM_PASSTHRU, #fname, 
sizeof(#fname)-1, use_arg); \
 }
 
-/* {{{ proto int ArrayObject::asort() U
+/*  proto int ArrayObject::asort() U
proto int ArrayIterator::asort() U
  Sort the entries by values. */
 SPL_ARRAY_METHOD(Array, asort, 0)
-/* }}} */
 
-/* {{{ proto int ArrayObject::ksort() U
+/*  proto int ArrayObject::ksort() U
proto int ArrayIterator::ksort() U
  Sort the entries by key. */
 SPL_ARRAY_METHOD(Array, ksort, 0)
-/* }}} */
 
-/* {{{ proto int ArrayObject::uasort(callba

[PHP-CVS] cvs: php-src /ext/spl spl_array.c

2007-12-14 Thread Etienne Kneuss
colder  Fri Dec 14 22:52:53 2007 UTC

  Modified files:  
/php-src/ext/splspl_array.c 
  Log:
  Fix folding
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.132&r2=1.133&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.132 php-src/ext/spl/spl_array.c:1.133
--- php-src/ext/spl/spl_array.c:1.132   Thu Oct 18 05:19:13 2007
+++ php-src/ext/spl/spl_array.c Fri Dec 14 22:52:53 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: spl_array.c,v 1.132 2007/10/18 05:19:13 helly Exp $ */
+/* $Id: spl_array.c,v 1.133 2007/12/14 22:52:53 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1232,31 +1232,37 @@
proto int ArrayIterator::asort() U
  Sort the entries by values. */
 SPL_ARRAY_METHOD(Array, asort, 0)
+/* }}} */
 
 /* {{{ proto int ArrayObject::ksort() U
proto int ArrayIterator::ksort() U
  Sort the entries by key. */
 SPL_ARRAY_METHOD(Array, ksort, 0)
+/* }}} */
 
 /* {{{ proto int ArrayObject::uasort(callback cmp_function) U
proto int ArrayIterator::uasort(callback cmp_function) U
  Sort the entries by values user defined function. */
 SPL_ARRAY_METHOD(Array, uasort, 1)
+/* }}} */
 
 /* {{{ proto int ArrayObject::uksort(callback cmp_function) U
proto int ArrayIterator::uksort(callback cmp_function) U
  Sort the entries by key using user defined function. */
 SPL_ARRAY_METHOD(Array, uksort, 1)
+/* }}} */
 
 /* {{{ proto int ArrayObject::natsort() U
proto int ArrayIterator::natsort() U
  Sort the entries by values using "natural order" algorithm. */
 SPL_ARRAY_METHOD(Array, natsort, 0)
+/* }}} */
 
 /* {{{ proto int ArrayObject::natcasesort() U
proto int ArrayIterator::natcasesort() U
  Sort the entries by key using case insensitive "natural order" algorithm. */
 SPL_ARRAY_METHOD(Array, natcasesort, 0)
+/* }}} */
 
 /* {{{ proto mixed|NULL ArrayIterator::current() U
Return current array entry */
@@ -1324,6 +1330,7 @@
 {
spl_array_iterator_key(getThis(), return_value TSRMLS_CC);
 }
+/* }}} */
 
 /* {{{ proto void ArrayIterator::next() U
Move to next entry */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: CVSROOT / avail

2007-12-14 Thread Derick Rethans
derick  Fri Dec 14 16:14:04 2007 UTC

  Modified files:  
/CVSROOTavail 
  Log:
  - Upgrade Raghubansh to full PHP Developer
  
  
http://cvs.php.net/viewvc.cgi/CVSROOT/avail?r1=1.1334&r2=1.1335&diff_format=u
Index: CVSROOT/avail
diff -u CVSROOT/avail:1.1334 CVSROOT/avail:1.1335
--- CVSROOT/avail:1.1334Tue Dec 11 15:48:09 2007
+++ CVSROOT/avail   Fri Dec 14 16:14:03 2007
@@ -17,7 +17,7 @@
 # The PHP Developers have full access to the full source trees for
 # PHP, as well as the documentation.
 
-avail|colder,lwe,auroraeosrose,mike,rolland,cawa,msisolak,alan_k,rrichards,tal,mfischer,fmk,hirokawa,jah,eschmid,dbeu,sebastian,samjam,avsm,ronabob,derick,sterling,venaas,stas,hholzgra,cmv,phildriscoll,jmoore,andre,jani,sr,david,jdonagher,chagenbu,jon,elixer,joosters,jason,mysql,kalowsky,opaquedave,steinm,phanto,gluke,svanegmond,rjs,vlad,jimjag,emile,wez,sasha,camber,ohrn,romolo,martin,lurcher,wsanchez,dreid,bmcadams,swm,zhang,kevin,joey,entity,cardinal,coar,jflemer,raphael,danda,rbb,mboeren,dougm,edink,alexwaugh,bernd,zak,sesser,yohgaki,imajes,markonen,dickmeiss,helly,sander,jan,kir,aaron,jwoolley,pbannister,rvenkat,dali,rodif_bl,hyanantha,witten,georg,msopacua,mpdoremus,fujimoto,iliaa,chregu,azzit,gschlossnagle,andrey,dan,moriyoshi,dviner,bfrance,flex,iwakiri,john,harrie,pollita,ianh,k.schroeder,dcowgill,jerenkrantz,jay,ddhill,jorton,thetaphi,abies,vincent,goba,dmitry,pajoye,shie,rafi,magnus,tony2001,johannes,dbs,skoduru,nrathna,jesus,gopalv,bjori,nlopess,wrowe,shire,zoe,!
 
scottmac,t2man,dsp,davidw,ab5602,nicholsr,lsmith|phpfi,php3,php-src,pecl,non-pecl,spl,phpdoc,phpdoc-ar,phpdoc-bg,phpdoc-cs,phpdoc-da,phpdoc-de,phpdoc-el,phpdoc-es,phpdoc-fa_IR,phpdoc-fi,phpdoc-fr,phpdoc-he,phpdoc-hk,phpdoc-hu,phpdoc-id,phpdoc-it,phpdoc-ja,phpdoc-kr,phpdoc-lt,phpdoc-nl,phpdoc-pl,phpdoc-pt_BR,phpdoc-pt,phpdoc-ro,phpdoc-ru,phpdoc-sk,phpdoc-sl,phpdoc-sv,phpdoc-tr,phpdoc-tw,phpdoc-zh,phpdoc-ca,phpdoc-no
+avail|kraghuba,colder,lwe,auroraeosrose,mike,rolland,cawa,msisolak,alan_k,rrichards,tal,mfischer,fmk,hirokawa,jah,eschmid,dbeu,sebastian,samjam,avsm,ronabob,derick,sterling,venaas,stas,hholzgra,cmv,phildriscoll,jmoore,andre,jani,sr,david,jdonagher,chagenbu,jon,elixer,joosters,jason,mysql,kalowsky,opaquedave,steinm,phanto,gluke,svanegmond,rjs,vlad,jimjag,emile,wez,sasha,camber,ohrn,romolo,martin,lurcher,wsanchez,dreid,bmcadams,swm,zhang,kevin,joey,entity,cardinal,coar,jflemer,raphael,danda,rbb,mboeren,dougm,edink,alexwaugh,bernd,zak,sesser,yohgaki,imajes,markonen,dickmeiss,helly,sander,jan,kir,aaron,jwoolley,pbannister,rvenkat,dali,rodif_bl,hyanantha,witten,georg,msopacua,mpdoremus,fujimoto,iliaa,chregu,azzit,gschlossnagle,andrey,dan,moriyoshi,dviner,bfrance,flex,iwakiri,john,harrie,pollita,ianh,k.schroeder,dcowgill,jerenkrantz,jay,ddhill,jorton,thetaphi,abies,vincent,goba,dmitry,pajoye,shie,rafi,magnus,tony2001,johannes,dbs,skoduru,nrathna,jesus,gopalv,bjori,nlopess,wrowe,s!
 
hire,zoe,scottmac,t2man,dsp,davidw,ab5602,nicholsr,lsmith|phpfi,php3,php-src,pecl,non-pecl,spl,phpdoc,phpdoc-ar,phpdoc-bg,phpdoc-cs,phpdoc-da,phpdoc-de,phpdoc-el,phpdoc-es,phpdoc-fa_IR,phpdoc-fi,phpdoc-fr,phpdoc-he,phpdoc-hk,phpdoc-hu,phpdoc-id,phpdoc-it,phpdoc-ja,phpdoc-kr,phpdoc-lt,phpdoc-nl,phpdoc-pl,phpdoc-pt_BR,phpdoc-pt,phpdoc-ro,phpdoc-ru,phpdoc-sk,phpdoc-sl,phpdoc-sv,phpdoc-tr,phpdoc-tw,phpdoc-zh,phpdoc-ca,phpdoc-no
 
 # fastcgi implementation for IIS
 avail|shane,wez,edink|fastcgi-isapi
@@ -219,7 +219,7 @@
 avail|aditus|jpgraph
 avail|phallstrom|php-gtk-web/apps,php-gtk-web/include/apps.inc
 avail|tal,momo|php-src/ext/calendar
-avail|momo,kraghuba|php-src/ext/standard
+avail|momo|php-src/ext/standard
 avail|mbretter,philippe|pecl/radius,pecl/mqseries
 avail|mcmontero,blade106,scottmac,mkoppanen|pecl/imagick
 avail|bjori|php-src/ext/date
@@ -247,8 +247,8 @@
 avail|simenec,ttk|pecl/maxdb,phpdoc/en/reference
 avail|ksadlocha|pecl/simplesql
 avail|uw|pecl/maxdb,php-src/ext/mysqli,php-src/ext/mysql,phpdoc
-avail|magnus,michael,kraghuba|Zend/tests,ZendEngine2/tests
-avail|michael,kraghuba|php-src/tests
+avail|magnus,michael|Zend/tests,ZendEngine2/tests
+avail|michael|php-src/tests
 avail|blindman|pecl/colorer
 avail|mike|pecl/http
 avail|gabe|pecl/intercept

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/date php_date.c

2007-12-14 Thread Scott MacVicar
scottmacFri Dec 14 14:52:38 2007 UTC

  Modified files:  
/php-src/ext/date   php_date.c 
  Log:
  MFB: Change createFromTimestamp to setTimestamp
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.149&r2=1.150&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.149 php-src/ext/date/php_date.c:1.150
--- php-src/ext/date/php_date.c:1.149   Fri Dec 14 14:27:18 2007
+++ php-src/ext/date/php_date.c Fri Dec 14 14:52:38 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.149 2007/12/14 14:27:18 scottmac Exp $ */
+/* $Id: php_date.c,v 1.150 2007/12/14 14:52:38 scottmac Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -212,7 +212,7 @@
PHP_ME_MAPPING(setTime, date_time_set, NULL, 0)
PHP_ME_MAPPING(setDate, date_date_set, NULL, 0)
PHP_ME_MAPPING(setISODate,  date_isodate_set,  NULL, 0)
-   PHP_ME_MAPPING(createFromTimestamp, date_timestamp_set, NULL, 0)
+   PHP_ME_MAPPING(setTimestamp,date_timestamp_set, NULL, 0)
{NULL, NULL, NULL}
 };
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/date php_date.c

2007-12-14 Thread Scott MacVicar
scottmacFri Dec 14 14:49:16 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcNEWS 
/php-src/ext/date   php_date.c 
  Log:
  Change createFromTimestamp to setTimestamp
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.57&r2=1.2027.2.547.2.965.2.58&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.57 
php-src/NEWS:1.2027.2.547.2.965.2.58
--- php-src/NEWS:1.2027.2.547.2.965.2.57Fri Dec 14 14:28:36 2007
+++ php-src/NEWSFri Dec 14 14:49:15 2007
@@ -23,7 +23,7 @@
   (Etienne Kneuss)
 - Added "compact" handler for Zend MM storage. (Dmitry)
 - Added "+" and "*" specifiers to zend_parse_parameters(). (Andrei)
-- Added DateTime::createFromTimestamp() to set a unix timestamp without
+- Added DateTime::setTimestamp() to set a unix timestamp without
   invoking the date parser. (Scott)
 
 - Upgraded PCRE to version 7.4 (Nuno)
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.4&r2=1.43.2.45.2.51.2.5&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.4 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.5
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.4  Fri Dec 14 14:28:36 2007
+++ php-src/ext/date/php_date.c Fri Dec 14 14:49:15 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.4 2007/12/14 14:28:36 scottmac Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.5 2007/12/14 14:49:15 scottmac Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -209,7 +209,7 @@
PHP_ME_MAPPING(setTime, date_time_set,  NULL, 0)
PHP_ME_MAPPING(setDate, date_date_set,  NULL, 0)
PHP_ME_MAPPING(setISODate,  date_isodate_set,   NULL, 0)
-   PHP_ME_MAPPING(createFromTimestamp, date_timestamp_set, NULL, 0)
+   PHP_ME_MAPPING(setTimestamp,date_timestamp_set, NULL, 0)
{NULL, NULL, NULL}
 };
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/date php_date.c php_date.h

2007-12-14 Thread Scott MacVicar
scottmacFri Dec 14 14:27:18 2007 UTC

  Modified files:  
/php-src/ext/date   php_date.c php_date.h 
  Log:
  - Add Datetime::createFromTimestamp to allow setting of a unix timestamp 
without invoking the date parser.
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.148&r2=1.149&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.148 php-src/ext/date/php_date.c:1.149
--- php-src/ext/date/php_date.c:1.148   Fri Nov 23 00:15:37 2007
+++ php-src/ext/date/php_date.c Fri Dec 14 14:27:18 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.148 2007/11/23 00:15:37 iliaa Exp $ */
+/* $Id: php_date.c,v 1.149 2007/12/14 14:27:18 scottmac Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -180,6 +180,7 @@
PHP_FE(date_time_set, NULL)
PHP_FE(date_date_set, NULL)
PHP_FE(date_isodate_set, NULL)
+   PHP_FE(date_timestamp_set, NULL)
 
PHP_FE(timezone_open, NULL)
PHP_FE(timezone_name_get, NULL)
@@ -211,6 +212,7 @@
PHP_ME_MAPPING(setTime, date_time_set, NULL, 0)
PHP_ME_MAPPING(setDate, date_date_set, NULL, 0)
PHP_ME_MAPPING(setISODate,  date_isodate_set,  NULL, 0)
+   PHP_ME_MAPPING(createFromTimestamp, date_timestamp_set, NULL, 0)
{NULL, NULL, NULL}
 };
 
@@ -2171,6 +2173,25 @@
 }
 /* }}} */
 
+/* {{{ proto void date_timestamp_set(DateTime object, long unixTimestamp)
+   Sets the date and time based on an Unix timestamp.
+*/
+PHP_FUNCTION(date_timestamp_set)
+{
+   zval *object;
+   php_date_obj *dateobj;
+   long  timestamp;
+
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Ol", &object, date_ce_date, ×tamp) == FAILURE) {
+   RETURN_FALSE;
+   }
+   dateobj = (php_date_obj *) zend_object_store_get_object(object 
TSRMLS_CC);
+   DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
+   timelib_unixtime2gmt(dateobj->time, (timelib_sll)timestamp);
+   timelib_update_ts(dateobj->time, NULL);
+}
+/* }}} */
+
 static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz 
TSRMLS_DC)
 {
char *tzid;
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.h?r1=1.32&r2=1.33&diff_format=u
Index: php-src/ext/date/php_date.h
diff -u php-src/ext/date/php_date.h:1.32 php-src/ext/date/php_date.h:1.33
--- php-src/ext/date/php_date.h:1.32Mon Jan  1 09:29:22 2007
+++ php-src/ext/date/php_date.h Fri Dec 14 14:27:18 2007
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_date.h,v 1.32 2007/01/01 09:29:22 sebastian Exp $ */
+/* $Id: php_date.h,v 1.33 2007/12/14 14:27:18 scottmac Exp $ */
 
 #ifndef PHP_DATE_H
 #define PHP_DATE_H
@@ -60,6 +60,7 @@
 PHP_FUNCTION(date_time_set);
 PHP_FUNCTION(date_date_set);
 PHP_FUNCTION(date_isodate_set);
+PHP_FUNCTION(date_timestamp_set);
 
 PHP_METHOD(DateTimeZone, __construct);
 PHP_FUNCTION(timezone_open);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/date php_date.c php_date.h

2007-12-14 Thread Scott MacVicar
scottmacFri Dec 14 14:28:36 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcNEWS 
/php-src/ext/date   php_date.c php_date.h 
  Log:
  MFH: Add Datetime::createFromTimestamp to allow setting of a unix timestamp 
without invoking the date parser.
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.56&r2=1.2027.2.547.2.965.2.57&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.56 
php-src/NEWS:1.2027.2.547.2.965.2.57
--- php-src/NEWS:1.2027.2.547.2.965.2.56Thu Dec 13 08:57:51 2007
+++ php-src/NEWSFri Dec 14 14:28:36 2007
@@ -23,6 +23,8 @@
   (Etienne Kneuss)
 - Added "compact" handler for Zend MM storage. (Dmitry)
 - Added "+" and "*" specifiers to zend_parse_parameters(). (Andrei)
+- Added DateTime::createFromTimestamp() to set a unix timestamp without
+  invoking the date parser. (Scott)
 
 - Upgraded PCRE to version 7.4 (Nuno)
 
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.3&r2=1.43.2.45.2.51.2.4&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.3 
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.4
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.3  Fri Nov 23 00:15:24 2007
+++ php-src/ext/date/php_date.c Fri Dec 14 14:28:36 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.3 2007/11/23 00:15:24 iliaa Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.4 2007/12/14 14:28:36 scottmac Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -178,6 +178,7 @@
PHP_FE(date_time_set, NULL)
PHP_FE(date_date_set, NULL)
PHP_FE(date_isodate_set, NULL)
+   PHP_FE(date_timestamp_set, NULL)
 
PHP_FE(timezone_open, NULL)
PHP_FE(timezone_name_get, NULL)
@@ -208,6 +209,7 @@
PHP_ME_MAPPING(setTime, date_time_set,  NULL, 0)
PHP_ME_MAPPING(setDate, date_date_set,  NULL, 0)
PHP_ME_MAPPING(setISODate,  date_isodate_set,   NULL, 0)
+   PHP_ME_MAPPING(createFromTimestamp, date_timestamp_set, NULL, 0)
{NULL, NULL, NULL}
 };
 
@@ -2014,6 +2016,25 @@
 }
 /* }}} */
 
+/* {{{ proto void date_timestamp_set(DateTime object, long unixTimestamp)
+   Sets the date and time based on an Unix timestamp.
+*/
+PHP_FUNCTION(date_timestamp_set)
+{
+   zval *object;
+   php_date_obj *dateobj;
+   long  timestamp;
+
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Ol", &object, date_ce_date, ×tamp) == FAILURE) {
+   RETURN_FALSE;
+   }
+   dateobj = (php_date_obj *) zend_object_store_get_object(object 
TSRMLS_CC);
+   DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
+   timelib_unixtime2gmt(dateobj->time, (timelib_sll)timestamp);
+   timelib_update_ts(dateobj->time, NULL);
+}
+/* }}} */
+
 static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz 
TSRMLS_DC)
 {
char *tzid;
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.h?r1=1.17.2.11.2.3&r2=1.17.2.11.2.3.2.1&diff_format=u
Index: php-src/ext/date/php_date.h
diff -u php-src/ext/date/php_date.h:1.17.2.11.2.3 
php-src/ext/date/php_date.h:1.17.2.11.2.3.2.1
--- php-src/ext/date/php_date.h:1.17.2.11.2.3   Mon Jan  1 09:35:48 2007
+++ php-src/ext/date/php_date.h Fri Dec 14 14:28:36 2007
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_date.h,v 1.17.2.11.2.3 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: php_date.h,v 1.17.2.11.2.3.2.1 2007/12/14 14:28:36 scottmac Exp $ */
 
 #ifndef PHP_DATE_H
 #define PHP_DATE_H
@@ -59,6 +59,7 @@
 PHP_FUNCTION(date_time_set);
 PHP_FUNCTION(date_date_set);
 PHP_FUNCTION(date_isodate_set);
+PHP_FUNCTION(date_timestamp_set);
 
 PHP_METHOD(DateTimeZone, __construct);
 PHP_FUNCTION(timezone_open);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php