[PHP-CVS] com php-src: clarify NEWS: NEWS

2013-03-20 Thread Stanislav Malyshev
Commit:5aaff8d634ec919a5fa24c05485b5ad250588982
Author:Stanislav Malyshev s...@php.net Tue, 19 Mar 2013 22:32:50 
-0700
Parents:   cb76420fe04d6d5531d5f98c1c232696ed4d361c
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5aaff8d634ec919a5fa24c05485b5ad250588982

Log:
clarify NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index ef2fc8f..597010b 100644
--- a/NEWS
+++ b/NEWS
@@ -3,8 +3,8 @@ PHP 
   NEWS
 ?? ??? 20??, PHP 5.5.0 Beta 1
 
 - Core:
-  . Added Zend Opcache extension and enable it by default. More details here:
-https://wiki.php.net/rfc/optimizerplus. (Dmitry)
+  . Added Zend Opcache extension and enable building it by default. 
+More details here: https://wiki.php.net/rfc/optimizerplus. (Dmitry)
   . Fixed bug #64354 (Unserialize array of objects whose class can't
 be autoloaded fail). (Laruence)
   . Added support for changing the process's title in CLI/CLI-Server SAPIs.


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



Re: [PHP-CVS] com php-src: Backported fix for bug #62852: NEWS ext/date/php_date.c ext/date/tests/bug62852.phpt ext/date/tests/bug62852_var2.phpt ext/date/tests/bug62852_var3.phpt

2013-03-20 Thread Anatol Belski
Stas,

The issue is that a warning wouldn't destroy that object. That object will
occasionally segfault PHP. E_ERROR is the simplest solution which doesn't
change the behavior of the normal operations.

There is another one bug #53437. The patch there has E_ERROR as well, but
for the same reason. A more permissive fix would involve even more
behavior change as every method/use case of that inconsistent object
should be checked.

Regards

Anatol

On Wed, March 20, 2013 01:47, Stas Malyshev wrote:
 Hi!


 +if (!php_date_initialize_from_hash(return_value, dateobj, myht
 TSRMLS_CC)) {
 +php_error(E_ERROR, Invalid serialization data for DateTime 
 object);
  +   }


 Why this is E_ERROR? Can't we recover from this problem? Bad
 serialization data is E_NOTICE for unserialize(), why suddenly it becomes
 fatal error?

 --
 Stanislav Malyshev, Software Architect
 SugarCRM: http://www.sugarcrm.com/
 (408)454-6900 ext. 227




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



Re: [PHP-CVS] com php-src: Backported fix for bug #62852: NEWS ext/date/php_date.c ext/date/tests/bug62852.phpt ext/date/tests/bug62852_var2.phpt ext/date/tests/bug62852_var3.phpt

2013-03-20 Thread Stas Malyshev
Hi!

 The issue is that a warning wouldn't destroy that object. That object will
 occasionally segfault PHP. E_ERROR is the simplest solution which doesn't
 change the behavior of the normal operations.

Can't we just reset the object data to some known zero state? Having
E_ERROR in a function that is not supposed to normally bail out is not a
good thing - especially unserialize which may deal with external data.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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



[PHP-CVS] com php-src: Fixed bug #64452 Zip PHPTs crash intermittently: NEWS ext/zip/lib/zip_close.c ext/zip/lib/zip_dirent.c

2013-03-20 Thread Anatol Belski
Commit:bb935ff8dc65c52efea6aae6697a806dc86c8580
Author:Anatol Belski a...@php.net Wed, 20 Mar 2013 09:10:10 +0100
Parents:   8d199c7c4f93ebe5b9293096143d7007a6ad13a4
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=bb935ff8dc65c52efea6aae6697a806dc86c8580

Log:
Fixed bug #64452 Zip PHPTs crash intermittently

Bugs:
https://bugs.php.net/64452

Changed paths:
  M  NEWS
  M  ext/zip/lib/zip_close.c
  M  ext/zip/lib/zip_dirent.c


Diff:
diff --git a/NEWS b/NEWS
index facb9ad..d62e1a1 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,9 @@ PHP   
 NEWS
 - DateTime
   . Fixed bug #62852 (Unserialize Invalid Date causes crash). (Anatol)
 
+- Zip:
+  . Bug #64452 (Zip crash intermittently). (Anatol)
+
 
 14 Mar 2013, PHP 5.3.23
 
diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c
index 362f92d..e66c566 100644
--- a/ext/zip/lib/zip_close.c
+++ b/ext/zip/lib/zip_close.c
@@ -88,6 +88,9 @@ zip_close(struct zip *za)
 if (za == NULL)
return -1;
 
+if (za-zp == NULL)
+return -1;
+
 if (!_zip_changed(za, survivors)) {
_zip_free(za);
return 0;
@@ -164,9 +167,10 @@ zip_close(struct zip *za)
 for (j=0; jsurvivors; j++) {
i = filelist[j].idx;
 
+   _zip_dirent_init(de);
+
/* create new local directory entry */
if (ZIP_ENTRY_DATA_CHANGED(za-entry+i) || new_torrentzip) {
-   _zip_dirent_init(de);
 
if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0))
_zip_dirent_torrent_normalize(de);
diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c
index b5b9d27..b9dac5c 100644
--- a/ext/zip/lib/zip_dirent.c
+++ b/ext/zip/lib/zip_dirent.c
@@ -157,11 +157,17 @@ _zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct 
zip_error *error)
 void
 _zip_dirent_finalize(struct zip_dirent *zde)
 {
-free(zde-filename);
+if (zde-filename_len  0) {
+free(zde-filename);
+}
 zde-filename = NULL;
-free(zde-extrafield);
+if (zde-extrafield_len  0) {
+free(zde-extrafield);
+}
 zde-extrafield = NULL;
-free(zde-comment);
+if (zde-comment_len  0) {
+free(zde-comment);
+}
 zde-comment = NULL;
 }


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



[PHP-CVS] com php-src: updated NEWS: NEWS

2013-03-20 Thread Anatol Belski
Commit:bf8026aacf6ebeafca9c78928e3e660d7698ff6a
Author:Anatol Belski a...@php.net Wed, 20 Mar 2013 09:15:16 +0100
Parents:   0125ec77d21fa585206617fc593da3ebce74304a
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=bf8026aacf6ebeafca9c78928e3e660d7698ff6a

Log:
updated NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 597010b..18d4d1e 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,9 @@ PHP   
 NEWS
   . Implement FR #48358 (Add SplDoublyLinkedList::add() to insert an element
 at a given offset). (Mark Baker, David Soria Parra)
 
+- Zip:
+  . Bug #64452 (Zip crash intermittently). (Anatol)
+
 07 Mar 2013, PHP 5.5.0 Alpha 6
 
 - Core:


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



[PHP-CVS] com php-src: updated NEWS: NEWS

2013-03-20 Thread Anatol Belski
Commit:0881ff046686197984013e3ca3d84a797144ffcd
Author:Anatol Belski a...@php.net Wed, 20 Mar 2013 09:13:13 +0100
Parents:   06a526be3e0e819b48b340eae3e8b315beba441c
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=0881ff046686197984013e3ca3d84a797144ffcd

Log:
updated NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index ca51fc3..4e4557f 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,9 @@ PHP   
 NEWS
   . Fixed bug #61981 (OO API, walk: $suffix_as_key is not working correctly).
(Boris Lytochkin)
 
+- Zip:
+  . Bug #64452 (Zip crash intermittently). (Anatol)
+
 14 Mar 2013, PHP 5.4.13
 
 - Core:


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



Re: [PHP-CVS] com php-src: Backported fix for bug #62852: NEWS ext/date/php_date.c ext/date/tests/bug62852.phpt ext/date/tests/bug62852_var2.phpt ext/date/tests/bug62852_var3.phpt

2013-03-20 Thread Anatol Belski
On Wed, March 20, 2013 09:05, Stas Malyshev wrote:
 Hi!


 The issue is that a warning wouldn't destroy that object. That object
 will occasionally segfault PHP. E_ERROR is the simplest solution which
 doesn't change the behavior of the normal operations.

 Can't we just reset the object data to some known zero state? Having
 E_ERROR in a function that is not supposed to normally bail out is not a
 good thing - especially unserialize which may deal with external data. --

Hi,

Theoretically that's possible in DateTime while much more complicated in
DatePeriod, I wouldn't have a good conscience after that.

In the existing one there is really no intrusion into the normal datetime
functionality. Users who have used bad unserialization data or __set_state
with invalid data had a crash before. I'd apply the patch for #53437 as is
as that's the safest solution. Serialized by the usual way objects will
still work while bad data will not crash.

Regards

Anatol


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



[PHP-CVS] com php-src: - config.m4 sync with .w32: ext/gd/config.m4

2013-03-20 Thread Pierre Joye
Commit:00a53ca817fcc5bca852e5ed65ee4136210601a2
Author:Pierre Joye pierre@gmail.com Wed, 20 Mar 2013 07:52:23 
+0100
Parents:   22159fb7b7324c3d4bb9fe00d3d2ce575a15743d
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=00a53ca817fcc5bca852e5ed65ee4136210601a2

Log:
- config.m4 sync with .w32

Changed paths:
  M  ext/gd/config.m4


Diff:
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
index 2f71705..e6cc036 100644
--- a/ext/gd/config.m4
+++ b/ext/gd/config.m4
@@ -298,7 +298,7 @@ if test $PHP_GD = yes; then
  libgd/gdcache.c libgd/gdkanji.c libgd/wbmp.c libgd/gd_wbmp.c 
libgd/gdhelpers.c \
  libgd/gd_topal.c libgd/gd_gif_in.c libgd/xbm.c 
libgd/gd_gif_out.c libgd/gd_security.c \
  libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c 
libgd/gd_rotate.c libgd/gd_color.c \
-libgd/gd_transform.c libgd/gd_crop.c
+libgd/gd_transform.c libgd/gd_crop.c 
libgd/gd_interpolation.c libgd/gd_matrix.c
 
 dnl check for fabsf and floorf which are available since C99
   AC_CHECK_FUNCS(fabsf floorf)


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



[PHP-CVS] com php-src: - fix unix build: ext/gd/libgd/gd_interpolation.c

2013-03-20 Thread Pierre Joye
Commit:a46065ef7105514cc9b866b907ae6dd0ad529d25
Author:Pierre Joye pierre@gmail.com Wed, 20 Mar 2013 09:24:54 
+0100
Parents:   a7a53d369bfcf3208b445b9aa12aa8a6e114c5fd
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=a46065ef7105514cc9b866b907ae6dd0ad529d25

Log:
- fix unix build

Changed paths:
  M  ext/gd/libgd/gd_interpolation.c


Diff:
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c
index 29dbe19..b2c6f41 100644
--- a/ext/gd/libgd/gd_interpolation.c
+++ b/ext/gd/libgd/gd_interpolation.c
@@ -925,7 +925,7 @@ static inline LineContribType 
*_gdContributionsCalc(unsigned int line_size, unsi
 for (u = 0; u  line_size; u++) {
 const double dCenter = (double)u / scale_d;
 /* get the significant edge points affecting the pixel */
-register int iLeft = max (0, (int)floor (dCenter - width_d));
+register int iLeft = MAX(0, (int)floor (dCenter - width_d));
 int iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1);
 double dTotalWeight = 0.0;
int iSrc;


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



[PHP-CVS] com php-src: - add imageaffinematrixget and imagematrixconcat: ext/gd/gd.c ext/gd/libgd/gd_interpolation.c ext/gd/php_gd.h

2013-03-20 Thread Pierre Joye
Commit:1ec484d3c536e85bc536e809a403ce5e7d7849d8
Author:Pierre Joye pierre@gmail.com Wed, 20 Mar 2013 12:19:03 
+0100
Parents:   780c6e0a9cedb8dbecf5e4aca00996c73c0723d5
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=1ec484d3c536e85bc536e809a403ce5e7d7849d8

Log:
- add imageaffinematrixget and imagematrixconcat

Changed paths:
  M  ext/gd/gd.c
  M  ext/gd/libgd/gd_interpolation.c
  M  ext/gd/php_gd.h


Diff:
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 038f7c4..caf84e3 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -918,12 +918,17 @@ ZEND_BEGIN_ARG_INFO(arginfo_imageaffine, 0)
ZEND_ARG_INFO(0, affine)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO(arginfo_imageaffinegetmatrix, 0)
+ZEND_BEGIN_ARG_INFO(arginfo_imageaffinematrixget, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_INFO(0, matrox)
ZEND_ARG_INFO(0, options)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO(arginfo_imageaffinematrixconcat, 0)
+   ZEND_ARG_INFO(0, m1)
+   ZEND_ARG_INFO(0, m2)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO(arginfo_imagesetinterpolation, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_INFO(0, method)
@@ -994,7 +999,8 @@ const zend_function_entry gd_functions[] = {
PHP_FE(imagecropauto,   
arginfo_imagecropauto)
PHP_FE(imagescale,  
arginfo_imagescale)
PHP_FE(imageaffine, 
arginfo_imageaffine)
-   PHP_FE(imageaffinegetmatrix,
arginfo_imageaffinegetmatrix)
+   PHP_FE(imageaffinematrixconcat, 
arginfo_imageaffinematrixconcat)
+   PHP_FE(imageaffinematrixget,
arginfo_imageaffinematrixget)
PHP_FE(imagesetinterpolation,   
arginfo_imagesetinterpolation)
 #endif
 
@@ -1280,7 +1286,13 @@ PHP_MINIT_FUNCTION(gd)
REGISTER_LONG_CONSTANT(IMG_NEAREST_NEIGHBOUR, GD_NEAREST_NEIGHBOUR, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(IMG_WEIGHTED4, GD_WEIGHTED4, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(IMG_TRIANGLE, GD_TRIANGLE, CONST_CS | 
CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(IMG_DEFAULT,  GD_BICUBIC_FIXED, CONST_CS | 
CONST_PERSISTENT);
+
+   REGISTER_LONG_CONSTANT(IMG_AFFINE_TRANSLATE, GD_AFFINE_TRANSLATE, 
CONST_CS | CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(IMG_AFFINE_SCALE, GD_AFFINE_SCALE, CONST_CS | 
CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(IMG_AFFINE_ROTATE, GD_AFFINE_ROTATE, CONST_CS 
| CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(IMG_AFFINE_SHEAR_HORIZONTAL, 
GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(IMG_AFFINE_SHEAR_VERTICAL, 
GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT);
+
 #else
REGISTER_LONG_CONSTANT(GD_BUNDLED, 0, CONST_CS | CONST_PERSISTENT);
 #endif
@@ -5488,26 +5500,24 @@ PHP_FUNCTION(imageaffine)
 }
 /* }}} */
 
-/* {{{ proto array imageaffinegetmatrix(type[, options])
+/* {{{ proto array imageaffinematrixget(type[, options])
Return an image containing the affine tramsformed src image, using an 
optional clipping area */
-PHP_FUNCTION(imageaffinegetmatrix)
+PHP_FUNCTION(imageaffinematrixget)
 {
double affine[6];
gdAffineStandardMatrix type;
zval *options;
zval **tmp;
-   int args_required;
-   int res;
+   int res, i;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l|z, type, 
options) == FAILURE)  {
return;
}
-   
+
switch(type) {
case GD_AFFINE_TRANSLATE:
case GD_AFFINE_SCALE: {
double x, y;
-   args_required = 2;
if (Z_TYPE_P(options) != IS_ARRAY) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Array expected as options);
}
@@ -5557,6 +5567,81 @@ PHP_FUNCTION(imageaffinegetmatrix)
php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
type for element %i, type);
RETURN_FALSE;
}
+
+   array_init(return_value);
+   for (i = 0; i  6; i++) {
+   add_index_double(return_value, i, affine[i]);
+   }
+}
+
+
+/* {{{ proto array imageaffineconcat(array m1, array m2)
+   Concat two matrices (as in doing many ops in one go) */
+PHP_FUNCTION(imageaffinematrixconcat)
+{
+   double m1[6];
+   double m2[6];
+   double mr[6];
+
+   zval **tmp;
+   zval *z_m1;
+   zval *z_m2;
+   int i, nelems;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, aa, z_m1, 
z_m2) == FAILURE)  {
+   return;
+   }
+
+   if (((nelems = zend_hash_num_elements(Z_ARRVAL_P(z_m1))) != 6) || 
(nelems = 

[PHP-CVS] com php-src: - add affine matrix helper for translate, scale, rotate and shear: ext/gd/gd.c ext/gd/libgd/gd.h ext/gd/php_gd.h

2013-03-20 Thread Pierre Joye
Commit:780c6e0a9cedb8dbecf5e4aca00996c73c0723d5
Author:Pierre Joye pierre@gmail.com Wed, 20 Mar 2013 11:01:37 
+0100
Parents:   a46065ef7105514cc9b866b907ae6dd0ad529d25
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=780c6e0a9cedb8dbecf5e4aca00996c73c0723d5

Log:
- add affine matrix helper for translate, scale, rotate and shear

Changed paths:
  M  ext/gd/gd.c
  M  ext/gd/libgd/gd.h
  M  ext/gd/php_gd.h


Diff:
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index c4cdea3..038f7c4 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -918,6 +918,12 @@ ZEND_BEGIN_ARG_INFO(arginfo_imageaffine, 0)
ZEND_ARG_INFO(0, affine)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO(arginfo_imageaffinegetmatrix, 0)
+   ZEND_ARG_INFO(0, im)
+   ZEND_ARG_INFO(0, matrox)
+   ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO(arginfo_imagesetinterpolation, 0)
ZEND_ARG_INFO(0, im)
ZEND_ARG_INFO(0, method)
@@ -988,6 +994,7 @@ const zend_function_entry gd_functions[] = {
PHP_FE(imagecropauto,   
arginfo_imagecropauto)
PHP_FE(imagescale,  
arginfo_imagescale)
PHP_FE(imageaffine, 
arginfo_imageaffine)
+   PHP_FE(imageaffinegetmatrix,
arginfo_imageaffinegetmatrix)
PHP_FE(imagesetinterpolation,   
arginfo_imagesetinterpolation)
 #endif
 
@@ -5394,6 +5401,7 @@ PHP_FUNCTION(imageaffine)
double affine[6];
int i, nelems;
zval **zval_affine_elem = NULL;
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ra|a, IM, 
z_affine, z_rect) == FAILURE)  {
return;
}
@@ -5427,6 +5435,7 @@ PHP_FUNCTION(imageaffine)
 
if (z_rect != NULL) {
if (zend_hash_find(HASH_OF(z_rect), x, sizeof(x), (void 
**)tmp) != FAILURE) {
+   convert_to_long_ex(tmp);
rect.x = Z_LVAL_PP(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Missing x 
position);
@@ -5434,6 +5443,7 @@ PHP_FUNCTION(imageaffine)
}
 
if (zend_hash_find(HASH_OF(z_rect), y, sizeof(x), (void 
**)tmp) != FAILURE) {
+   convert_to_long_ex(tmp);
rect.y = Z_LVAL_PP(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Missing y 
position);
@@ -5441,6 +5451,7 @@ PHP_FUNCTION(imageaffine)
}
 
if (zend_hash_find(HASH_OF(z_rect), width, sizeof(width), 
(void **)tmp) != FAILURE) {
+   convert_to_long_ex(tmp);
rect.width = Z_LVAL_PP(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Missing 
width);
@@ -5448,6 +5459,7 @@ PHP_FUNCTION(imageaffine)
}
 
if (zend_hash_find(HASH_OF(z_rect), height, sizeof(height), 
(void **)tmp) != FAILURE) {
+   convert_to_long_ex(tmp);
rect.height = Z_LVAL_PP(tmp);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Missing 
height);
@@ -5476,6 +5488,77 @@ PHP_FUNCTION(imageaffine)
 }
 /* }}} */
 
+/* {{{ proto array imageaffinegetmatrix(type[, options])
+   Return an image containing the affine tramsformed src image, using an 
optional clipping area */
+PHP_FUNCTION(imageaffinegetmatrix)
+{
+   double affine[6];
+   gdAffineStandardMatrix type;
+   zval *options;
+   zval **tmp;
+   int args_required;
+   int res;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l|z, type, 
options) == FAILURE)  {
+   return;
+   }
+   
+   switch(type) {
+   case GD_AFFINE_TRANSLATE:
+   case GD_AFFINE_SCALE: {
+   double x, y;
+   args_required = 2;
+   if (Z_TYPE_P(options) != IS_ARRAY) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Array expected as options);
+   }
+   if (zend_hash_find(HASH_OF(options), x, sizeof(x), 
(void **)tmp) != FAILURE) {
+   convert_to_double_ex(tmp);
+   x = Z_DVAL_PP(tmp);
+   } else {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Missing x position);
+   RETURN_FALSE;
+   }
+
+   if (zend_hash_find(HASH_OF(options), y, sizeof(y), 
(void **)tmp) != FAILURE) {
+   convert_to_double_ex(tmp);
+   y = Z_DVAL_PP(tmp);
+   } else {
+ 

[PHP-CVS] com php-src: - add new interpolation method . imagescale . imageaffine . replace imagerotate with new generic and optimized new implementations . imagesetinterpolationmethod, to set

2013-03-20 Thread Pierre Joye
Commit:22159fb7b7324c3d4bb9fe00d3d2ce575a15743d
Author:Pierre Joye pierre@gmail.com Wed, 20 Mar 2013 07:46:59 
+0100
Parents:   cb76420fe04d6d5531d5f98c1c232696ed4d361c
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=22159fb7b7324c3d4bb9fe00d3d2ce575a15743d

Log:
- add new interpolation method
  . imagescale
  . imageaffine
  . replace imagerotate with new generic and optimized new implementations
  . imagesetinterpolationmethod, to set the default interpolation to be
used with the new functions
  . add imagepalettetotruecolor

Changed paths:
  M  Zend/zend_language_scanner.c
  M  Zend/zend_language_scanner_defs.h
  M  ext/gd/config.w32
  M  ext/gd/gd.c
  M  ext/gd/libgd/gd.c
  M  ext/gd/libgd/gd.h
  M  ext/gd/php_gd.h


Diff: Diff exceeded maximum size

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



[PHP-CVS] com php-src: - update the comment to match the code/features: ext/gd/libgd/gd_interpolation.c

2013-03-20 Thread Pierre Joye
Commit:f0078897c7a76bf9332fb1c19aeb51a9e28bab9f
Author:Pierre Joye pierre@gmail.com Wed, 20 Mar 2013 12:29:47 
+0100
Parents:   1ec484d3c536e85bc536e809a403ce5e7d7849d8
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f0078897c7a76bf9332fb1c19aeb51a9e28bab9f

Log:
- update the comment to match the code/features

Changed paths:
  M  ext/gd/libgd/gd_interpolation.c


Diff:
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c
index ab3e988..5ad5de6 100644
--- a/ext/gd/libgd/gd_interpolation.c
+++ b/ext/gd/libgd/gd_interpolation.c
@@ -1,4 +1,5 @@
 /*
+ * The two pass scaling function is based on:
  * Filtered Image Rescaling
  * Based on Gems III
  *  - Schumacher general filtered image rescaling
@@ -13,6 +14,7 @@
  *
  * Initial sources code is avaibable in the Gems Source Code Packages:
  * http://www.acm.org/pubs/tog/GraphicsGems/GGemsIII.tar.gz
+ *
  */
 
 /*
@@ -35,6 +37,17 @@
 */
 
 /*
+   Additional functions are available for simple rotation or 
up/downscaling.
+   downscaling using the fixed point implementations are usually much 
faster
+   than the existing gdImageCopyResampled while having a similar or better
+   quality.
+   
+   For image rotations, the optimized versions have a lazy antialiasing 
for 
+   the edges of the images. For a much better antialiased result, the 
affine
+   function is recommended.
+*/
+
+/*
 TODO:
  - Optimize pixel accesses and loops once we have continuous buffer
  - Add scale support for a portion only of an image (equivalent of 
copyresized/resampled)


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': ext/gd/gd.c

2013-03-20 Thread Pierre Joye
Commit:09854f1fb9d4fbd11ef36a1d5cd11eec63569458
Author:Pierre Joye pierre@gmail.com Wed, 20 Mar 2013 12:34:51 
+0100
Parents:   83e81c40ae61b66dc9ae1f804ee623fdeca66ac8 
ff7d7bb290176f76a9108c839a38ecf39d4fef87
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=09854f1fb9d4fbd11ef36a1d5cd11eec63569458

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  - add gd changes

Conflicts:
UPGRADING

Changed paths:
  MM  ext/gd/gd.c


Diff:
diff --cc ext/gd/gd.c
index caf84e3,caf84e3..e571c04
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@@ -5486,8 -5486,8 +5486,6 @@@ PHP_FUNCTION(imageaffine
pRect = NULL;
}
  
--
--  //int gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, 
gdRectPtr src_area, const double affine[6]);
if (gdTransformAffineGetImage(dst, src, pRect, affine) != GD_TRUE) {
RETURN_FALSE;
}


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



[PHP-CVS] com php-src: - add gd changes: UPGRADING

2013-03-20 Thread Pierre Joye
Commit:ff7d7bb290176f76a9108c839a38ecf39d4fef87
Author:Pierre Joye pierre@gmail.com Wed, 20 Mar 2013 12:34:01 
+0100
Parents:   f0078897c7a76bf9332fb1c19aeb51a9e28bab9f
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=ff7d7bb290176f76a9108c839a38ecf39d4fef87

Log:
- add gd changes

Changed paths:
  M  UPGRADING


Diff:
diff --git a/UPGRADING b/UPGRADING
index ca35a99..3d5fae5 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -182,6 +182,12 @@ PHP 5.5 UPGRADE NOTES
   - imageflip
   - imagecrop
   - imagecropauto
+  - imagescale
+  - imageaffine
+  - imageaffinematrixget
+  - imageaffinematrixconcat
+  - imagesetinterpolation
+  - imagepalettetotruecolor
 
 - Hash:
   - hash_pbkdf2()
@@ -326,6 +332,33 @@ PHP 5.5 UPGRADE NOTES
 . IMG_CROP_WHITE
 . IMG_CROP_SIDES
 . IMG_CROP_THRESHOLD
+ - Added constants for the interpolation function (scale, affine, rotation)
+. IMG_BELL
+. IMG_BESSEL
+. IMG_BILINEAR_FIXED
+. IMG_BICUBIC
+. IMG_BICUBIC_FIXED
+. IMG_BLACKMAN
+. IMG_BOX
+. IMG_BSPLINE
+. IMG_CATMULLROM
+. IMG_GAUSSIAN
+. IMG_GENERALIZED_CUBIC
+. IMG_HERMITE
+. IMG_HAMMING
+. IMG_HANNING
+. IMG_MITCHELL
+. IMG_POWER
+. IMG_QUADRATIC
+. IMG_SINC
+. IMG_NEAREST_NEIGHBOUR
+. IMG_WEIGHTED4
+. IMG_TRIANGLE
+. IMG_AFFINE_TRANSLATE
+. IMG_AFFINE_SCALE
+. IMG_AFFINE_ROTATE
+. IMG_AFFINE_SHEAR_HORIZONTAL
+. IMG_AFFINE_SHEAR_VERTICAL
 
 
 10. Changes to INI File Handling


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



[PHP-CVS] com php-src: - ws: UPGRADING

2013-03-20 Thread Pierre Joye
Commit:15ecea760284008ec755ab467f97d3987cca80fb
Author:Pierre Joye pierre@gmail.com Wed, 20 Mar 2013 12:37:13 
+0100
Parents:   ff7d7bb290176f76a9108c839a38ecf39d4fef87
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=15ecea760284008ec755ab467f97d3987cca80fb

Log:
- ws

Changed paths:
  M  UPGRADING


Diff:
diff --git a/UPGRADING b/UPGRADING
index 3d5fae5..18ed156 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -325,6 +325,7 @@ PHP 5.5 UPGRADE NOTES
 . IMG_FLIP_HORIZONTAL
. IMG_FLIP_VERTICAL
 . IMG_FLIP_BOTH
+
   - Added constants for imagecrop
 . IMG_CROP_DEFAULT
 . IMG_CROP_TRANSPARENT
@@ -332,6 +333,7 @@ PHP 5.5 UPGRADE NOTES
 . IMG_CROP_WHITE
 . IMG_CROP_SIDES
 . IMG_CROP_THRESHOLD
+
  - Added constants for the interpolation function (scale, affine, rotation)
 . IMG_BELL
 . IMG_BESSEL


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



[PHP-CVS] com php-src: NEWS for array_column: NEWS

2013-03-20 Thread David Soria Parra
Commit:66b4e5cdec09782b3036a9c86250b09f6d22f521
Author:David Soria Parra d...@php.net Wed, 20 Mar 2013 13:14:20 
+0100
Parents:   0173c4bab0357e58e74e2a84b18fa31034699582
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=66b4e5cdec09782b3036a9c86250b09f6d22f521

Log:
NEWS for array_column

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 18d4d1e..f6432e8 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP 
   NEWS
 - Core:
   . Added Zend Opcache extension and enable building it by default. 
 More details here: https://wiki.php.net/rfc/optimizerplus. (Dmitry)
+  . Added array_column function which returns a column in a multidimensional
+array. https://wiki.php.net/rfc/array_column. (Ben Ramsey)
   . Fixed bug #64354 (Unserialize array of objects whose class can't
 be autoloaded fail). (Laruence)
   . Added support for changing the process's title in CLI/CLI-Server SAPIs.


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



[PHP-CVS] com php-src: Merge branch 'pull-request/257' into PHP-5.5: ext/standard/array.c ext/standard/basic_functions.c ext/standard/php_array.h

2013-03-20 Thread David Soria Parra
Commit:0173c4bab0357e58e74e2a84b18fa31034699582
Author:David Soria Parra d...@php.net Wed, 20 Mar 2013 13:02:33 
+0100
Parents:   bf8026aacf6ebeafca9c78928e3e660d7698ff6a 
f5bf1ba88fbacfebbb59b1e7bf43dd73649fa686
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=0173c4bab0357e58e74e2a84b18fa31034699582

Log:
Merge branch 'pull-request/257' into PHP-5.5

* pull-request/257:
  array_column: Fix compile-time warnings
  array_column: Removed array_pluck() alias
  array_column: Set array_pluck as an alias for array_column
  array_column: Implement ability to specify an index column
  Cleaning up a memory leak.
  array_column: Adding test for IS_OBJECT and converting object to string
  array_column: Using add_next_index_zval() at nikic's recommendation.
  array_column: Improved tests
  array_column: Cleaning up, as recommended in pull request #56 comments
  Fixing typo in test for array_column()
  Simplify the code and use zend_hash_next_index_insert()
  Adding test for columns not present in all rows for array_column().
  Adding tests for the negative results of array_column()
  Implement new array function array_column()

Bugs:
https://bugs.php.net/56

Changed paths:
  MM  ext/standard/array.c
  MM  ext/standard/basic_functions.c
  MM  ext/standard/php_array.h


Diff:



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



[PHP-CVS] com php-src: array_column: Fix compile-time warnings: ext/standard/array.c

2013-03-20 Thread David Soria Parra
Commit:f5bf1ba88fbacfebbb59b1e7bf43dd73649fa686
Author:Ben Ramsey ram...@php.net Tue, 19 Mar 2013 20:44:19 -0500
Parents:   3439a098a0b646ff05d4da9748996214cac39d12
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=f5bf1ba88fbacfebbb59b1e7bf43dd73649fa686

Log:
array_column: Fix compile-time warnings

Changed paths:
  M  ext/standard/array.c


Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index fa19737..6983764 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2571,9 +2571,9 @@ PHP_FUNCTION(array_column)
zval *zarray, *zcolumn, *zkey = NULL, **data, **zcolval, **zkeyval;
HashTable *arr_hash;
HashPosition pointer;
-   ulong column_idx = 0, key_idx = 0, keyval_idx = 0;
+   ulong column_idx = 0, key_idx = 0;
char *column = NULL, *key = NULL, *keyval = NULL;
-   int column_len = 0, key_len = 0;
+   int column_len = 0, key_len = 0, keyval_idx = -1;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, az|z, zarray, 
zcolumn, zkey) == FAILURE) {
return;
@@ -2640,13 +2640,13 @@ PHP_FUNCTION(array_column)
Z_ADDREF_PP(zcolval);
 
keyval = NULL;
-   keyval_idx = NULL;
+   keyval_idx = -1;
 
if (zkey) {
if (key  zend_hash_find(Z_ARRVAL_PP(data), 
key, key_len + 1, (void**)zkeyval) == FAILURE) {
-   keyval_idx = NULL;
+   keyval_idx = -1;
} else if (!key  
zend_hash_index_find(Z_ARRVAL_PP(data), key_idx, (void**)zkeyval) == FAILURE) {
-   keyval_idx = NULL;
+   keyval_idx = -1;
} else {
switch (Z_TYPE_PP(zkeyval)) {
case IS_LONG:
@@ -2660,14 +2660,14 @@ PHP_FUNCTION(array_column)
keyval = 
Z_STRVAL_PP(zkeyval);
break;
default:
-   keyval_idx = NULL;
+   keyval_idx = -1;
}
}
}
 
if (keyval) {
add_assoc_zval(return_value, keyval, *zcolval);
-   } else if (keyval_idx != NULL) {
+   } else if (keyval_idx != -1) {
add_index_zval(return_value, keyval_idx, 
*zcolval);
} else {
add_next_index_zval(return_value, *zcolval);


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



[PHP-CVS] com php-src: array_column: Removed array_pluck() alias: ext/standard/basic_functions.c ext/standard/tests/array/array_column_pluck_alias.phpt ext/standard/tests/array/array_column_pluck_alia

2013-03-20 Thread David Soria Parra
Commit:3439a098a0b646ff05d4da9748996214cac39d12
Author:Ben Ramsey ram...@php.net Mon, 14 Jan 2013 10:04:14 -0600
Parents:   a1876b6846898724f564208f78281dfd8ce07112
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=3439a098a0b646ff05d4da9748996214cac39d12

Log:
array_column: Removed array_pluck() alias

Changed paths:
  M  ext/standard/basic_functions.c
  D  ext/standard/tests/array/array_column_pluck_alias.phpt
  D  ext/standard/tests/array/array_column_pluck_alias_error.phpt

diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 6e1835d..5e12352 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -3306,7 +3306,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(array_values,
arginfo_array_values)
PHP_FE(array_count_values,  
arginfo_array_count_values)
PHP_FE(array_column,
arginfo_array_column)
-   PHP_FALIAS(array_pluck, array_column,   
arginfo_array_column)
PHP_FE(array_reverse,   
arginfo_array_reverse)
PHP_FE(array_reduce,
arginfo_array_reduce)
PHP_FE(array_pad,   
arginfo_array_pad)
diff --git a/ext/standard/tests/array/array_column_pluck_alias.phpt 
b/ext/standard/tests/array/array_column_pluck_alias.phpt
deleted file mode 100644
index 4bd251a..000
--- a/ext/standard/tests/array/array_column_pluck_alias.phpt
+++ /dev/null
@@ -1,307 +0,0 @@
---TEST--
-Test array_pluck() function: basic functionality
---FILE--
-?php
-/* Prototype:
- *  array array_pluck(array $input, mixed $column_key[, mixed $index_key]);
- * Description:
- *  Returns an array containing all the values from
- *  the specified column in a two-dimensional array.
- */
-
-echo *** Testing array_pluck() : basic functionality ***\n;
-/* Array representing a possible record set returned from a database */
-$records = array(
-   array(
-   'id' = 1,
-   'first_name' = 'John',
-   'last_name' = 'Doe'
-   ),
-   array(
-   'id' = 2,
-   'first_name' = 'Sally',
-   'last_name' = 'Smith'
-   ),
-   array(
-   'id' = 3,
-   'first_name' = 'Jane',
-   'last_name' = 'Jones'
-   )
-);
-
-echo -- first_name column from recordset --\n;
-var_dump(array_pluck($records, 'first_name'));
-
-echo -- id column from recordset --\n;
-var_dump(array_pluck($records, 'id'));
-
-echo -- last_name column from recordset, keyed by value from id column --\n;
-var_dump(array_pluck($records, 'last_name', 'id'));
-
-echo -- last_name column from recordset, keyed by value from first_name 
column --\n;
-var_dump(array_pluck($records, 'last_name', 'first_name'));
-
-echo \n*** Testing multiple data types ***\n;
-$file = basename(__FILE__);
-$fh = fopen($file, 'r', true);
-$values = array(
-   array(
-   'id' = 1,
-   'value' = new stdClass
-   ),
-   array(
-   'id' = 2,
-   'value' = 34.2345
-   ),
-   array(
-   'id' = 3,
-   'value' = true
-   ),
-   array(
-   'id' = 4,
-   'value' = false
-   ),
-   array(
-   'id' = 5,
-   'value' = null
-   ),
-   array(
-   'id' = 6,
-   'value' = 1234
-   ),
-   array(
-   'id' = 7,
-   'value' = 'Foo'
-   ),
-   array(
-   'id' = 8,
-   'value' = $fh
-   )
-);
-var_dump(array_pluck($values, 'value'));
-var_dump(array_pluck($values, 'value', 'id'));
-
-echo \n*** Testing numeric column keys ***\n;
-$numericCols = array(
-   array('aaa', '111'),
-   array('bbb', '222'),
-   array('ccc', '333')
-);
-var_dump(array_pluck($numericCols, 1));
-var_dump(array_pluck($numericCols, 1, 0));
-
-echo \n*** Testing failure to find specified column ***\n;
-var_dump(array_pluck($numericCols, 2));
-var_dump(array_pluck($numericCols, 'foo'));
-var_dump(array_pluck($numericCols, 0, 'foo'));
-
-echo \n*** Testing single dimensional array ***\n;
-$singleDimension = array('foo', 'bar', 'baz');
-var_dump(array_pluck($singleDimension, 1));
-
-echo \n*** Testing columns not present in all rows ***\n;
-$mismatchedColumns = 

[PHP-CVS] com php-src: array_column: Set array_pluck as an alias for array_column: ext/standard/basic_functions.c ext/standard/tests/array/array_column_pluck_alias.phpt ext/standard/tests/array/array_

2013-03-20 Thread David Soria Parra
Commit:a1876b6846898724f564208f78281dfd8ce07112
Author:Ben Ramsey ram...@php.net Fri, 11 Jan 2013 17:09:34 -0600
Parents:   5bc2854b37778d7f402db8bb9be9fe33df64258e
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=a1876b6846898724f564208f78281dfd8ce07112

Log:
array_column: Set array_pluck as an alias for array_column

Changed paths:
  M  ext/standard/basic_functions.c
  A  ext/standard/tests/array/array_column_pluck_alias.phpt
  A  ext/standard/tests/array/array_column_pluck_alias_error.phpt

diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 5e12352..6e1835d 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -3306,6 +3306,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(array_values,
arginfo_array_values)
PHP_FE(array_count_values,  
arginfo_array_count_values)
PHP_FE(array_column,
arginfo_array_column)
+   PHP_FALIAS(array_pluck, array_column,   
arginfo_array_column)
PHP_FE(array_reverse,   
arginfo_array_reverse)
PHP_FE(array_reduce,
arginfo_array_reduce)
PHP_FE(array_pad,   
arginfo_array_pad)
diff --git a/ext/standard/tests/array/array_column_pluck_alias.phpt 
b/ext/standard/tests/array/array_column_pluck_alias.phpt
new file mode 100644
index 000..4bd251a
--- /dev/null
+++ b/ext/standard/tests/array/array_column_pluck_alias.phpt
@@ -0,0 +1,307 @@
+--TEST--
+Test array_pluck() function: basic functionality
+--FILE--
+?php
+/* Prototype:
+ *  array array_pluck(array $input, mixed $column_key[, mixed $index_key]);
+ * Description:
+ *  Returns an array containing all the values from
+ *  the specified column in a two-dimensional array.
+ */
+
+echo *** Testing array_pluck() : basic functionality ***\n;
+/* Array representing a possible record set returned from a database */
+$records = array(
+   array(
+   'id' = 1,
+   'first_name' = 'John',
+   'last_name' = 'Doe'
+   ),
+   array(
+   'id' = 2,
+   'first_name' = 'Sally',
+   'last_name' = 'Smith'
+   ),
+   array(
+   'id' = 3,
+   'first_name' = 'Jane',
+   'last_name' = 'Jones'
+   )
+);
+
+echo -- first_name column from recordset --\n;
+var_dump(array_pluck($records, 'first_name'));
+
+echo -- id column from recordset --\n;
+var_dump(array_pluck($records, 'id'));
+
+echo -- last_name column from recordset, keyed by value from id column --\n;
+var_dump(array_pluck($records, 'last_name', 'id'));
+
+echo -- last_name column from recordset, keyed by value from first_name 
column --\n;
+var_dump(array_pluck($records, 'last_name', 'first_name'));
+
+echo \n*** Testing multiple data types ***\n;
+$file = basename(__FILE__);
+$fh = fopen($file, 'r', true);
+$values = array(
+   array(
+   'id' = 1,
+   'value' = new stdClass
+   ),
+   array(
+   'id' = 2,
+   'value' = 34.2345
+   ),
+   array(
+   'id' = 3,
+   'value' = true
+   ),
+   array(
+   'id' = 4,
+   'value' = false
+   ),
+   array(
+   'id' = 5,
+   'value' = null
+   ),
+   array(
+   'id' = 6,
+   'value' = 1234
+   ),
+   array(
+   'id' = 7,
+   'value' = 'Foo'
+   ),
+   array(
+   'id' = 8,
+   'value' = $fh
+   )
+);
+var_dump(array_pluck($values, 'value'));
+var_dump(array_pluck($values, 'value', 'id'));
+
+echo \n*** Testing numeric column keys ***\n;
+$numericCols = array(
+   array('aaa', '111'),
+   array('bbb', '222'),
+   array('ccc', '333')
+);
+var_dump(array_pluck($numericCols, 1));
+var_dump(array_pluck($numericCols, 1, 0));
+
+echo \n*** Testing failure to find specified column ***\n;
+var_dump(array_pluck($numericCols, 2));
+var_dump(array_pluck($numericCols, 'foo'));
+var_dump(array_pluck($numericCols, 0, 'foo'));
+
+echo \n*** Testing single dimensional array ***\n;
+$singleDimension = array('foo', 'bar', 'baz');
+var_dump(array_pluck($singleDimension, 1));
+
+echo \n*** Testing columns not present in all rows ***\n;

[PHP-CVS] com php-src: array_column: Implement ability to specify an index column: ext/standard/array.c ext/standard/basic_functions.c ext/standard/tests/array/array_column_basic.phpt ext/standard/tes

2013-03-20 Thread David Soria Parra
Commit:5bc2854b37778d7f402db8bb9be9fe33df64258e
Author:Ben Ramsey ram...@php.net Fri, 11 Jan 2013 16:57:11 -0600
Parents:   94d5b2519aa6790e603cec7a054900941ffe07a9
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5bc2854b37778d7f402db8bb9be9fe33df64258e

Log:
array_column: Implement ability to specify an index column

Changed paths:
  M  ext/standard/array.c
  M  ext/standard/basic_functions.c
  M  ext/standard/tests/array/array_column_basic.phpt
  M  ext/standard/tests/array/array_column_error.phpt

diff --git a/ext/standard/array.c b/ext/standard/array.c
index 91a8833..fa19737 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2563,42 +2563,66 @@ PHP_FUNCTION(array_count_values)
 }
 /* }}} */
 
-/* {{{ proto array array_column(array input, mixed key)
-   Return the values from a single column in the input array, identified by 
the key */
+/* {{{ proto array array_column(array input, mixed column_key[, mixed 
index_key])
+   Return the values from a single column in the input array, identified by the
+   value_key and optionally indexed by the index_key */
 PHP_FUNCTION(array_column)
 {
-   zval *zarray, *zoffset, **data, **zvalue;
+   zval *zarray, *zcolumn, *zkey = NULL, **data, **zcolval, **zkeyval;
HashTable *arr_hash;
HashPosition pointer;
-   long index = 0;
-   char *key = NULL;
-   int key_len = 0;
+   ulong column_idx = 0, key_idx = 0, keyval_idx = 0;
+   char *column = NULL, *key = NULL, *keyval = NULL;
+   int column_len = 0, key_len = 0;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, az, zarray, 
zoffset) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, az|z, zarray, 
zcolumn, zkey) == FAILURE) {
return;
}
 
-   switch (Z_TYPE_P(zoffset)) {
+   switch (Z_TYPE_P(zcolumn)) {
case IS_NULL:
-   index = 0;
+   column_idx = 0;
break;
case IS_LONG:
-   index = Z_LVAL_P(zoffset);
+   column_idx = Z_LVAL_P(zcolumn);
break;
case IS_STRING:
-   key = Z_STRVAL_P(zoffset);
-   key_len = Z_STRLEN_P(zoffset);
+   column = Z_STRVAL_P(zcolumn);
+   column_len = Z_STRLEN_P(zcolumn);
break;
case IS_OBJECT:
-   convert_to_string(zoffset);
-   key = Z_STRVAL_P(zoffset);
-   key_len = Z_STRLEN_P(zoffset);
+   convert_to_string(zcolumn);
+   column = Z_STRVAL_P(zcolumn);
+   column_len = Z_STRLEN_P(zcolumn);
break;
default:
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, The key 
should be either a string or an integer);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The column 
key should be either a string or an integer);
RETURN_FALSE;
}
 
+   if (zkey) {
+   switch (Z_TYPE_P(zkey)) {
+   case IS_NULL:
+   key_idx = 0;
+   break;
+   case IS_LONG:
+   key_idx = Z_LVAL_P(zkey);
+   break;
+   case IS_STRING:
+   key = Z_STRVAL_P(zkey);
+   key_len = Z_STRLEN_P(zkey);
+   break;
+   case IS_OBJECT:
+   convert_to_string(zkey);
+   key = Z_STRVAL_P(zkey);
+   key_len = Z_STRLEN_P(zkey);
+   break;
+   default:
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
The index key should be either a string or an integer);
+   RETURN_FALSE;
+   }
+   }
+
arr_hash = Z_ARRVAL_P(zarray);
array_init(return_value);
 
@@ -2607,14 +2631,47 @@ PHP_FUNCTION(array_column)
zend_hash_move_forward_ex(arr_hash, pointer)) {
 
if (Z_TYPE_PP(data) == IS_ARRAY) {
-   if (key  zend_hash_find(Z_ARRVAL_PP(data), key, 
key_len + 1, (void**)zvalue) == FAILURE) {
+   if (column  zend_hash_find(Z_ARRVAL_PP(data), column, 
column_len + 1, (void**)zcolval) == FAILURE) {
continue;
-   } else if (!key  
zend_hash_index_find(Z_ARRVAL_PP(data), index, (void**)zvalue) == FAILURE) {
+   } else if (!column  
zend_hash_index_find(Z_ARRVAL_PP(data), column_idx, (void**)zcolval) == 
FAILURE) {
  

[PHP-CVS] com php-src: Cleaning up a memory leak.: ext/standard/array.c

2013-03-20 Thread David Soria Parra
Commit:94d5b2519aa6790e603cec7a054900941ffe07a9
Author:Ben Ramsey ram...@php.net Thu, 21 Jun 2012 12:47:54 -0500
Parents:   20ab30339d9731dd6e85ea5029280148f519cdc7
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=94d5b2519aa6790e603cec7a054900941ffe07a9

Log:
Cleaning up a memory leak.

Changed paths:
  M  ext/standard/array.c


Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 00850ba..91a8833 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2590,7 +2590,7 @@ PHP_FUNCTION(array_column)
key_len = Z_STRLEN_P(zoffset);
break;
case IS_OBJECT:
-   convert_to_string_ex(zoffset);
+   convert_to_string(zoffset);
key = Z_STRVAL_P(zoffset);
key_len = Z_STRLEN_P(zoffset);
break;


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



[PHP-CVS] com php-src: array_column: Adding test for IS_OBJECT and converting object to string: ext/standard/array.c ext/standard/tests/array/array_column_basic.phpt

2013-03-20 Thread David Soria Parra
Commit:20ab30339d9731dd6e85ea5029280148f519cdc7
Author:Ben Ramsey ram...@php.net Sun, 15 Apr 2012 21:40:45 -0500
Parents:   66a02eb25e1533c2ace47f8d934b193ebe317cde
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=20ab30339d9731dd6e85ea5029280148f519cdc7

Log:
array_column: Adding test for IS_OBJECT and converting object to string

Changed paths:
  M  ext/standard/array.c
  M  ext/standard/tests/array/array_column_basic.phpt


Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 40ee947..00850ba 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2589,6 +2589,11 @@ PHP_FUNCTION(array_column)
key = Z_STRVAL_P(zoffset);
key_len = Z_STRLEN_P(zoffset);
break;
+   case IS_OBJECT:
+   convert_to_string_ex(zoffset);
+   key = Z_STRVAL_P(zoffset);
+   key_len = Z_STRLEN_P(zoffset);
+   break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, The key 
should be either a string or an integer);
RETURN_FALSE;
diff --git a/ext/standard/tests/array/array_column_basic.phpt 
b/ext/standard/tests/array/array_column_basic.phpt
index efa98ce..fa8fe2f 100644
--- a/ext/standard/tests/array/array_column_basic.phpt
+++ b/ext/standard/tests/array/array_column_basic.phpt
@@ -97,6 +97,17 @@ $mismatchedColumns = array(
 );
 var_dump(array_column($mismatchedColumns, 'c'));
 
+echo \n*** Testing use of object converted to string ***\n;
+class Foo
+{
+public function __toString()
+{
+return 'last_name';
+}
+}
+$f = new Foo();
+var_dump(array_column($records, $f));
+
 echo Done\n;
 ?
 --EXPECTF--
@@ -166,4 +177,14 @@ array(1) {
   [0]=
   string(3) qux
 }
+
+*** Testing use of object converted to string ***
+array(3) {
+  [0]=
+  string(3) Doe
+  [1]=
+  string(5) Smith
+  [2]=
+  string(5) Jones
+}
 Done


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



[PHP-CVS] com php-src: array_column: Using add_next_index_zval() at nikic's recommendation.: ext/standard/array.c

2013-03-20 Thread David Soria Parra
Commit:66a02eb25e1533c2ace47f8d934b193ebe317cde
Author:Ben Ramsey ram...@php.net Sat, 14 Apr 2012 11:36:58 -0500
Parents:   5f6b20a44d833ede5e47b3b09c98678522347de1
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=66a02eb25e1533c2ace47f8d934b193ebe317cde

Log:
array_column: Using add_next_index_zval() at nikic's recommendation.

Changed paths:
  M  ext/standard/array.c


Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index b5d8275..40ee947 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2609,7 +2609,7 @@ PHP_FUNCTION(array_column)
}
 
Z_ADDREF_PP(zvalue);
-   zend_hash_next_index_insert(HASH_OF(return_value), 
(void **)zvalue, sizeof(zval *), NULL);
+   add_next_index_zval(return_value, *zvalue);
}
 
}


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



[PHP-CVS] com php-src: array_column: Improved tests: ext/standard/tests/array/array_column.phpt ext/standard/tests/array/array_column_basic.phpt ext/standard/tests/array/array_column_error.phpt

2013-03-20 Thread David Soria Parra
Commit:5f6b20a44d833ede5e47b3b09c98678522347de1
Author:Ben Ramsey ram...@php.net Sat, 14 Apr 2012 11:19:55 -0500
Parents:   e921d28ae31e77965800c29454c4d426650126f0
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5f6b20a44d833ede5e47b3b09c98678522347de1

Log:
array_column: Improved tests

Changed paths:
  D  ext/standard/tests/array/array_column.phpt
  A  ext/standard/tests/array/array_column_basic.phpt
  A  ext/standard/tests/array/array_column_error.phpt

diff --git a/ext/standard/tests/array/array_column.phpt 
b/ext/standard/tests/array/array_column.phpt
deleted file mode 100644
index a7a1b45..000
--- a/ext/standard/tests/array/array_column.phpt
+++ /dev/null
@@ -1,169 +0,0 @@
---TEST--
-Test array_column() function
---FILE--
-?php
-/* Prototype:
- *  array array_column(array $input, mixed $key);
- * Description:
- *  Returns an array containing all the values from
- *  the specified column in a two-dimensional array.
- */
-
-echo *** Testing basic functionalities ***\n;
-/* Array representing a possible record set returned from a database */
-$records = array(
-   array(
-   'id' = 1,
-   'first_name' = 'John',
-   'last_name' = 'Doe'
-   ),
-   array(
-   'id' = 2,
-   'first_name' = 'Sally',
-   'last_name' = 'Smith'
-   ),
-   array(
-   'id' = 3,
-   'first_name' = 'Jane',
-   'last_name' = 'Jones'
-   )
-);
-
-echo -- first_name column from recordset --\n;
-var_dump(array_column($records, 'first_name'));
-
-echo -- id column from recordset --\n;
-var_dump(array_column($records, 'id'));
-
-echo \n*** Testing multiple data types ***\n;
-$file = basename(__FILE__);
-$fh = fopen($file, 'r', true);
-$values = array(
-   array(
-   'id' = 1,
-   'value' = new stdClass
-   ),
-   array(
-   'id' = 2,
-   'value' = 34.2345
-   ),
-   array(
-   'id' = 3,
-   'value' = true
-   ),
-   array(
-   'id' = 4,
-   'value' = false
-   ),
-   array(
-   'id' = 5,
-   'value' = null
-   ),
-   array(
-   'id' = 6,
-   'value' = 1234
-   ),
-   array(
-   'id' = 7,
-   'value' = 'Foo'
-   ),
-   array(
-   'id' = 8,
-   'value' = $fh
-   )
-);
-var_dump(array_column($values, 'value'));
-
-echo \n*** Testing numeric column keys ***\n;
-$numericCols = array(
-   array('aaa', '111'),
-   array('bbb', '222'),
-   array('ccc', '333')
-);
-var_dump(array_column($numericCols, 1));
-
-echo \n*** Testing failure to find specified column ***\n;
-var_dump(array_column($numericCols, 2));
-var_dump(array_column($numericCols, 'foo'));
-
-echo \n*** Testing single dimensional array ***\n;
-$singleDimension = array('foo', 'bar', 'baz');
-var_dump(array_column($singleDimension, 1));
-
-echo \n*** Testing columns not present in all rows ***\n;
-$mismatchedColumns = array(
-array('a' = 'foo', 'b' = 'bar'),
-array('a' = 'baz', 'c' = 'qux'),
-);
-var_dump(array_column($mismatchedColumns, 'c'));
-
-echo Done\n;
-?
---EXPECTF--
-*** Testing basic functionalities ***
--- first_name column from recordset --
-array(3) {
-  [0]=
-  string(4) John
-  [1]=
-  string(5) Sally
-  [2]=
-  string(4) Jane
-}
--- id column from recordset --
-array(3) {
-  [0]=
-  int(1)
-  [1]=
-  int(2)
-  [2]=
-  int(3)
-}
-
-*** Testing multiple data types ***
-array(8) {
-  [0]=
-  object(stdClass)#1 (0) {
-  }
-  [1]=
-  float(34.2345)
-  [2]=
-  bool(true)
-  [3]=
-  bool(false)
-  [4]=
-  NULL
-  [5]=
-  int(1234)
-  [6]=
-  string(3) Foo
-  [7]=
-  resource(5) of type (stream)
-}
-
-*** Testing numeric column keys ***
-array(3) {
-  [0]=
-  string(3) 111
-  [1]=
-  string(3) 222
-  [2]=
-  string(3) 333
-}
-
-*** Testing failure to find specified column ***
-array(0) {
-}
-array(0) {
-}
-
-*** Testing single dimensional array ***
-array(0) {
-}
-
-*** Testing columns not present in all rows ***
-array(1) {
-  [0]=
-  string(3) qux
-}
-Done
diff --git a/ext/standard/tests/array/array_column_basic.phpt 
b/ext/standard/tests/array/array_column_basic.phpt
new file mode 100644
index 000..efa98ce
--- /dev/null
+++ b/ext/standard/tests/array/array_column_basic.phpt
@@ -0,0 +1,169 @@
+--TEST--
+Test array_column() function: basic functionality
+--FILE--
+?php
+/* Prototype:
+ *  array array_column(array $input, mixed $key);
+ * Description:
+ *  Returns an array containing all the values from
+ *  the specified column in a two-dimensional array.
+ */
+
+echo *** Testing array_column() : basic functionality ***\n;
+/* Array representing a possible record set returned from a database */
+$records = array(
+   array(
+   'id' = 1,
+   'first_name' = 'John',
+   

[PHP-CVS] com php-src: array_column: Cleaning up, as recommended in pull request #56 comments: ext/standard/array.c

2013-03-20 Thread David Soria Parra
Commit:e921d28ae31e77965800c29454c4d426650126f0
Author:Ben Ramsey ram...@php.net Sat, 14 Apr 2012 08:23:51 -0500
Parents:   10da6f00b8d0fa573b3c44f685377a98a816af51
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e921d28ae31e77965800c29454c4d426650126f0

Log:
array_column: Cleaning up, as recommended in pull request #56 comments

Bugs:
https://bugs.php.net/56

Changed paths:
  M  ext/standard/array.c


Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index c5d0fa7..b5d8275 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2578,19 +2578,11 @@ PHP_FUNCTION(array_column)
return;
}
 
-   arr_hash = Z_ARRVAL_P(zarray);
-   array_init(return_value);
-
switch (Z_TYPE_P(zoffset)) {
case IS_NULL:
index = 0;
break;
-   case IS_DOUBLE:
-   index = (long)Z_DVAL_P(zoffset);
-   break;
-   case IS_BOOL:
case IS_LONG:
-   case IS_RESOURCE:
index = Z_LVAL_P(zoffset);
break;
case IS_STRING:
@@ -2599,9 +2591,12 @@ PHP_FUNCTION(array_column)
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, The key 
should be either a string or an integer);
-   return;
+   RETURN_FALSE;
}
 
+   arr_hash = Z_ARRVAL_P(zarray);
+   array_init(return_value);
+
for (zend_hash_internal_pointer_reset_ex(arr_hash, pointer);
zend_hash_get_current_data_ex(arr_hash, (void**)data, 
pointer) == SUCCESS;
zend_hash_move_forward_ex(arr_hash, pointer)) {


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



[PHP-CVS] com php-src: Simplify the code and use zend_hash_next_index_insert(): ext/standard/array.c

2013-03-20 Thread David Soria Parra
Commit:6a27b890e6d643f17072e561a5d4f87211195a7c
Author:Ben Ramsey ram...@php.net Sat, 14 Apr 2012 02:39:25 -0500
Parents:   dc4dfe8ae019ec1fddc05ac340ed612a9c3f6d34
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=6a27b890e6d643f17072e561a5d4f87211195a7c

Log:
Simplify the code and use zend_hash_next_index_insert()

Changed paths:
  M  ext/standard/array.c


Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index b707301..c5d0fa7 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2613,31 +2613,8 @@ PHP_FUNCTION(array_column)
continue;
}
 
-   switch (Z_TYPE_PP(zvalue)) {
-   case IS_NULL:
-   add_next_index_null(return_value);
-   break;
-   case IS_LONG:
-   add_next_index_long(return_value, 
Z_LVAL_PP(zvalue));
-   break;
-   case IS_DOUBLE:
-   add_next_index_double(return_value, 
Z_DVAL_PP(zvalue));
-   break;
-   case IS_BOOL:
-   add_next_index_bool(return_value, 
Z_BVAL_PP(zvalue));
-   break;
-   case IS_OBJECT:
-   zval_add_ref(zvalue);
-   add_next_index_zval(return_value, 
*zvalue);
-   break;
-   case IS_STRING:
-   add_next_index_stringl(return_value, 
Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 1);
-   break;
-   case IS_RESOURCE:
-   zval_add_ref(zvalue);
-   add_next_index_resource(return_value, 
Z_RESVAL_PP(zvalue));
-   break;
-   }
+   Z_ADDREF_PP(zvalue);
+   zend_hash_next_index_insert(HASH_OF(return_value), 
(void **)zvalue, sizeof(zval *), NULL);
}
 
}


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



[PHP-CVS] com php-src: Implement new array function array_column(): ext/standard/array.c ext/standard/basic_functions.c ext/standard/php_array.h ext/standard/tests/array/array_column.phpt

2013-03-20 Thread David Soria Parra
Commit:9035a1ed246d4d2d867edc01616ca96b40a7cd11
Author:Ben Ramsey ram...@php.net Fri, 13 Apr 2012 23:17:56 -0500
Parents:   e1410b5a70543856de3978603b41fbf2ca5d330c
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=9035a1ed246d4d2d867edc01616ca96b40a7cd11

Log:
Implement new array function array_column()

array_column() returns the values of the specified column from a
multi-dimensional array.

Changed paths:
  M  ext/standard/array.c
  M  ext/standard/basic_functions.c
  M  ext/standard/php_array.h
  A  ext/standard/tests/array/array_column.phpt


Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index d1397a5..b707301 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2563,6 +2563,87 @@ PHP_FUNCTION(array_count_values)
 }
 /* }}} */
 
+/* {{{ proto array array_column(array input, mixed key)
+   Return the values from a single column in the input array, identified by 
the key */
+PHP_FUNCTION(array_column)
+{
+   zval *zarray, *zoffset, **data, **zvalue;
+   HashTable *arr_hash;
+   HashPosition pointer;
+   long index = 0;
+   char *key = NULL;
+   int key_len = 0;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, az, zarray, 
zoffset) == FAILURE) {
+   return;
+   }
+
+   arr_hash = Z_ARRVAL_P(zarray);
+   array_init(return_value);
+
+   switch (Z_TYPE_P(zoffset)) {
+   case IS_NULL:
+   index = 0;
+   break;
+   case IS_DOUBLE:
+   index = (long)Z_DVAL_P(zoffset);
+   break;
+   case IS_BOOL:
+   case IS_LONG:
+   case IS_RESOURCE:
+   index = Z_LVAL_P(zoffset);
+   break;
+   case IS_STRING:
+   key = Z_STRVAL_P(zoffset);
+   key_len = Z_STRLEN_P(zoffset);
+   break;
+   default:
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The key 
should be either a string or an integer);
+   return;
+   }
+
+   for (zend_hash_internal_pointer_reset_ex(arr_hash, pointer);
+   zend_hash_get_current_data_ex(arr_hash, (void**)data, 
pointer) == SUCCESS;
+   zend_hash_move_forward_ex(arr_hash, pointer)) {
+
+   if (Z_TYPE_PP(data) == IS_ARRAY) {
+   if (key  zend_hash_find(Z_ARRVAL_PP(data), key, 
key_len + 1, (void**)zvalue) == FAILURE) {
+   continue;
+   } else if (!key  
zend_hash_index_find(Z_ARRVAL_PP(data), index, (void**)zvalue) == FAILURE) {
+   continue;
+   }
+
+   switch (Z_TYPE_PP(zvalue)) {
+   case IS_NULL:
+   add_next_index_null(return_value);
+   break;
+   case IS_LONG:
+   add_next_index_long(return_value, 
Z_LVAL_PP(zvalue));
+   break;
+   case IS_DOUBLE:
+   add_next_index_double(return_value, 
Z_DVAL_PP(zvalue));
+   break;
+   case IS_BOOL:
+   add_next_index_bool(return_value, 
Z_BVAL_PP(zvalue));
+   break;
+   case IS_OBJECT:
+   zval_add_ref(zvalue);
+   add_next_index_zval(return_value, 
*zvalue);
+   break;
+   case IS_STRING:
+   add_next_index_stringl(return_value, 
Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 1);
+   break;
+   case IS_RESOURCE:
+   zval_add_ref(zvalue);
+   add_next_index_resource(return_value, 
Z_RESVAL_PP(zvalue));
+   break;
+   }
+   }
+
+   }
+}
+/* }}} */
+
 /* {{{ proto array array_reverse(array input [, bool preserve keys])
Return input as a new array with the order of the entries reversed */
 PHP_FUNCTION(array_reverse)
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 61e2f39..2e44150 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -433,6 +433,11 @@ ZEND_BEGIN_ARG_INFO(arginfo_array_count_values, 0)
ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_array_column, 0, 0, 2)
+   ZEND_ARG_INFO(0, 

[PHP-CVS] com php-src: NEWS section for beta 2: NEWS

2013-03-20 Thread David Soria Parra
Commit:225835045045c9227199382f763f424e2d3be1e2
Author:David Soria Parra d...@php.net Wed, 20 Mar 2013 15:07:08 
+0100
Parents:   7f2424bb1d329bb25694f309b09905180aca228e
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=225835045045c9227199382f763f424e2d3be1e2

Log:
NEWS section for beta 2

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 5f29170..36a98ab 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 PHPNEWS
 |||
+?? ??? 20??, PHP 5.5.0 Beta 2
+
+
 21 Mar 2013, PHP 5.5.0 Beta 1
 
 - Core:


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



[PHP-CVS] com php-src: NEWS for beta 1: NEWS

2013-03-20 Thread David Soria Parra
Commit:7f2424bb1d329bb25694f309b09905180aca228e
Author:David Soria Parra d...@php.net Wed, 20 Mar 2013 15:06:15 
+0100
Parents:   52171aeaf41545205fb960e1a01d4dd33d09137b
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=7f2424bb1d329bb25694f309b09905180aca228e

Log:
NEWS for beta 1

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index f6432e8..5f29170 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 PHPNEWS
 |||
-?? ??? 20??, PHP 5.5.0 Beta 1
+21 Mar 2013, PHP 5.5.0 Beta 1
 
 - Core:
   . Added Zend Opcache extension and enable building it by default.


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



[PHP-CVS] com php-src: Allow local override of PHPROOT in makedist: makedist

2013-03-20 Thread David Soria Parra
Commit:52171aeaf41545205fb960e1a01d4dd33d09137b
Author:David Soria Parra d...@php.net Wed, 20 Mar 2013 15:16:24 
+0100
Parents:   66b4e5cdec09782b3036a9c86250b09f6d22f521
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=52171aeaf41545205fb960e1a01d4dd33d09137b

Log:
Allow local override of PHPROOT in makedist

Changed paths:
  M  makedist


Diff:
diff --git a/makedist b/makedist
index bce40a9..f5823d3 100755
--- a/makedist
+++ b/makedist
@@ -35,7 +35,10 @@ if test ${1} = 1 -a ${2} -lt 28; then
 fi
 IFS=$old_IFS
 
-PHPROOT=g...@git.php.net:php-src.git
+if test $PHPROOTx == x; then
+PHPROOT=g...@git.php.net:php-src.git;
+fi
+
 LT_TARGETS='ltconfig ltmain.sh config.guess config.sub'
 
 if echo '\c' | grep -s c /dev/null 21


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



[PHP-CVS] tag php-src: create tag php-5.5.0beta1

2013-03-20 Thread David Soria Parra
Tag php-5.5.0beta1 in php-src.git was created
Tag: 90029edadd35fc2a61f812c34f9374c338ce8016
Tagger:  David Soria Parrad...@php.net Wed Mar 20 15:17:06 2013 
+0100
Log:
PHP 5.5.0 Beta 1
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.13 (GNU/Linux)

iQIcBAABAgAGBQJRScTmAAoJEME8cLhyZ7Ut0UUQALHl7eJ9tJT/Gt86zc4h6qzy
Zhp4dxCg0kEvsModpRMK8BpAZKxyChV+iJS8dKuZnrJdYmKCcZl0paARfvYNvqdU
tzYGjfdrP2CU5hCQsrPnrgR3t/4cngQ2sGR+2J+VLGdm/p4SKWjPDSTzLst5o6X+
rjudKDzfs26NsPoMMe6M2JNU4aVB0S7Vj8CS9Bpd77j9vOmwPXFUOcrMUqF2+l9r
slpLxLGKaTcg0WmrywwNi2T31RieQRQFNReKEQx1PH6ljv5feSCRMppIqRq2ZSv9
+29VciSPwPhXtNba7S0w4tW7LJG69aLoH5Iw1V+VRgutsnHkZ2rzZv49doXN0xh2
MAGmWDcCegpYUTqmXf6lWBK6nZGXhTB11bafYV5O2hK4yu2rMDFMJk3enZY28HPJ
6Fen23Z1S0BscMzBxMtC6Ui2tkMxNcSF3WaeY9xUnO85H6KAe1YMO7AIzVJkllpv
Al/Ku+1NZWN5rvErrRvuahwxJ9wFMVmNnR0pOsFcsSykZdTTntB1ahMeicGSYUP+
8nobx4IunRNQ0isC/mvZN/2GHIqwjcyvKSCViClP8zlf80x8FqPF6umAmWVH/1d2
keADTl3a8KP7Uw6xGSt6LgwwydwZyjlDjEwpV9MVHuifeUF/Ejoelr7ghWP9XN0R
fwz/wcMDGRfEYfJZaqtH
=nGea
-END PGP SIGNATURE-

Link: 
http://git.php.net/?p=php-src.git;a=tag;h=90029edadd35fc2a61f812c34f9374c338ce8016

Target:  e941690b242b0cbf63baed95d067eaf94a231165
Author:  David Soria Parra d...@php.net Wed, 20 Mar 2013 15:09:27 
+0100
Parents: 87c05c1d337714941585d70bf81fd919d3eb5c50
Target link: 
http://git.php.net/?p=php-src.git;a=commitdiff;h=e941690b242b0cbf63baed95d067eaf94a231165
Target log:
PHP-5.5.0beta1

Changed paths:
  M  configure.in
  M  main/php_version.h



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



[PHP-CVS] com php-src: add array_column(): UPGRADING

2013-03-20 Thread Stanislav Malyshev
Commit:6f17c6242fcc1c26ba987f185662b8dd815fd7dc
Author:Stanislav Malyshev s...@php.net Wed, 20 Mar 2013 14:14:17 
-0700
Parents:   225835045045c9227199382f763f424e2d3be1e2
Branches:  PHP-5.5

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=6f17c6242fcc1c26ba987f185662b8dd815fd7dc

Log:
add array_column()

Changed paths:
  M  UPGRADING


Diff:
diff --git a/UPGRADING b/UPGRADING
index ca35a99..126bc26 100755
--- a/UPGRADING
+++ b/UPGRADING
@@ -169,6 +169,7 @@ PHP 5.5 UPGRADE NOTES
 
 
 - Core:
+  - array_column()
   - boolval()
   - password_get_info()
   - password_hash()


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



[PHP-CVS] com php-src: fix memory leak: ext/spl/spl_dllist.c

2013-03-20 Thread Xinchen Hui
Commit:d99c14b1a64ffe18fd6ed45e956ace020fcd8440
Author:Xinchen Hui larue...@php.net Thu, 21 Mar 2013 10:56:30 
+0800
Parents:   45b1d014f262a7881095b8f413e8ee43de6e8e6f
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=d99c14b1a64ffe18fd6ed45e956ace020fcd8440

Log:
fix memory leak

the value shouldn't be ref, use z_add_ref is enough

Changed paths:
  M  ext/spl/spl_dllist.c


Diff:
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 8361086..aa462df 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -1246,7 +1246,6 @@ SPL_METHOD(SplDoublyLinkedList, add)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zz, zindex, 
value) == FAILURE) {
return;
}
-   SEPARATE_ARG_IF_REF(value);
 
intern = (spl_dllist_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
index  = spl_offset_convert_to_long(zindex TSRMLS_CC);
@@ -1256,6 +1255,7 @@ SPL_METHOD(SplDoublyLinkedList, add)
return;
}
 
+   Z_ADDREF_P(value);
if (index == intern-llist-count) {
/* If index is the last entry+1 then we do a push because we're 
not inserting before any entry */
spl_ptr_llist_push(intern-llist, value TSRMLS_CC);


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



[PHP-CVS] com php-src: fix memory leak: ext/spl/spl_dllist.c

2013-03-20 Thread Xinchen Hui
Commit:da6916a770b7be6e029579a1d34302b5d2112ece
Author:Xinchen Hui larue...@php.net Thu, 21 Mar 2013 10:56:30 
+0800
Parents:   6f17c6242fcc1c26ba987f185662b8dd815fd7dc
Branches:  PHP-5.5

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=da6916a770b7be6e029579a1d34302b5d2112ece

Log:
fix memory leak

the value shouldn't be ref, use z_add_ref is enough

Changed paths:
  M  ext/spl/spl_dllist.c


Diff:
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 8361086..aa462df 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -1246,7 +1246,6 @@ SPL_METHOD(SplDoublyLinkedList, add)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zz, zindex, 
value) == FAILURE) {
return;
}
-   SEPARATE_ARG_IF_REF(value);
 
intern = (spl_dllist_object*)zend_object_store_get_object(getThis() 
TSRMLS_CC);
index  = spl_offset_convert_to_long(zindex TSRMLS_CC);
@@ -1256,6 +1255,7 @@ SPL_METHOD(SplDoublyLinkedList, add)
return;
}
 
+   Z_ADDREF_P(value);
if (index == intern-llist-count) {
/* If index is the last entry+1 then we do a push because we're 
not inserting before any entry */
spl_ptr_llist_push(intern-llist, value TSRMLS_CC);


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



[PHP-CVS] com php-src: Fixed bug #64432 (more empty delimiter warning in strX methods): NEWS ext/standard/string.c ext/standard/tests/strings/stristr_error.phpt ext/standard/tests/strings/strstr.phpt

2013-03-20 Thread Xinchen Hui
Commit:0fd3572f4edbe7b3d9efdd212e214a9052dcfd01
Author:Xinchen Hui larue...@php.net Thu, 21 Mar 2013 11:14:10 
+0800
Parents:   0881ff046686197984013e3ca3d84a797144ffcd
Branches:  PHP-5.4

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=0fd3572f4edbe7b3d9efdd212e214a9052dcfd01

Log:
Fixed bug #64432 (more empty delimiter warning in strX methods)

Bugs:
https://bugs.php.net/64432

Changed paths:
  M  NEWS
  M  ext/standard/string.c
  M  ext/standard/tests/strings/stristr_error.phpt
  M  ext/standard/tests/strings/strstr.phpt


Diff:
diff --git a/NEWS b/NEWS
index 4e4557f..d60fcb3 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ PHP 
   NEWS
 |||
 ?? ??? 2013, PHP 5.4.14
 - Core
+  . Fixed bug #64432 (more empty delimiter warning in strX methods). (Laruence)
   . Fixed bug #64417 (ArrayAccess::offsetGet() in a trait causes fatal error).
 (Dmitry)
   . Fixed bug #64370 (microtime(true) less than 
$_SERVER['REQUEST_TIME_FLOAT']).
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 42bf198..77e0dff 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1715,7 +1715,7 @@ PHP_FUNCTION(stristr)
if (Z_TYPE_P(needle) == IS_STRING) {
char *orig_needle;
if (!Z_STRLEN_P(needle)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty 
delimiter);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty 
needle);
efree(haystack_dup);
RETURN_FALSE;
}
@@ -1765,7 +1765,7 @@ PHP_FUNCTION(strstr)
 
if (Z_TYPE_P(needle) == IS_STRING) {
if (!Z_STRLEN_P(needle)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty 
delimiter);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty 
needle);
RETURN_FALSE;
}
 
diff --git a/ext/standard/tests/strings/stristr_error.phpt 
b/ext/standard/tests/strings/stristr_error.phpt
index 831d93f..2da35de 100644
--- a/ext/standard/tests/strings/stristr_error.phpt
+++ b/ext/standard/tests/strings/stristr_error.phpt
@@ -50,11 +50,11 @@ NULL
 
 -- Testing stristr() function with empty haystack --
 
-Warning: stristr(): Empty delimiter in %s on line %d
+Warning: stristr(): Empty needle in %s on line %d
 bool(false)
 
 -- Testing stristr() function with empty needle --
 
-Warning: stristr(): Empty delimiter in %s on line %d
+Warning: stristr(): Empty needle in %s on line %d
 bool(false)
 ===DONE===
diff --git a/ext/standard/tests/strings/strstr.phpt 
b/ext/standard/tests/strings/strstr.phpt
index 1c8d753..b135258 100644
Binary files a/ext/standard/tests/strings/strstr.phpt and 
b/ext/standard/tests/strings/strstr.phpt differ


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/standard/string.c

2013-03-20 Thread Xinchen Hui
Commit:b29a9fa75d12c781495fdc271c5ed14901464898
Author:Xinchen Hui larue...@php.net Thu, 21 Mar 2013 11:14:36 
+0800
Parents:   da6916a770b7be6e029579a1d34302b5d2112ece 
0fd3572f4edbe7b3d9efdd212e214a9052dcfd01
Branches:  PHP-5.5

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=b29a9fa75d12c781495fdc271c5ed14901464898

Log:
Merge branch 'PHP-5.4' into PHP-5.5

Changed paths:
  MM  ext/standard/string.c


Diff:



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