Re: [PHP-CVS] svn: /php/php-src/trunk/ INSTALL Makefile.gcov Makefile.global NEWS configure.in ext/bz2/bz2.c ext/com_dotnet/com_persist.c ext/curl/interface.c ext/curl/streams.c ext/curl/tests/curl_

2010-04-27 Thread Hannes Magnusson
On Tue, Apr 27, 2010 at 01:53, Kalle Sommer Nielsen ka...@php.net wrote:
 kalle                                    Mon, 26 Apr 2010 23:53:30 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=298625

 Log:
 Removed safe_mode
  * Removed ini options, safe_mode*
  * Removed --enable-safe-mode --with-exec-dir configure options on Unix
  * Updated extensions, SAPI's and core
  * php_get_current_user() is now declared in main.c, thrus no need to include 
 safe_mode.h anymore


Please keep the upgrade guide up to date with all this removal stuff
you are doing.

Remembering all this at release time is going to be extremely painful
as NEWS doesn't contain as much details.

-Hannes

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



Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/ enchant/enchant.c fileinfo/fileinfo.c fileinfo/libmagic/apprentice.c fileinfo/libmagic/cdf.c fileinfo/libmagic/cdf.h fileinfo/libmagic/magic.c

2010-04-27 Thread Hannes Magnusson
On Tue, Apr 27, 2010 at 01:55, Kalle Sommer Nielsen ka...@php.net wrote:
 kalle                                    Mon, 26 Apr 2010 23:55:03 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=298626

 Log:
 Merge safe_mode changes into extensions that are in sync in both branches

 Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/enchant/enchant.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/fileinfo.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/apprentice.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/cdf.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/cdf.h
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/magic.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/readcdf.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic.patch
    U   php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c
    U   
 php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
    U   php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
    U   php/php-src/branches/PHP_5_3/ext/pdo_mysql/mysql_driver.c
    U   php/php-src/branches/PHP_5_3/ext/phar/phar.c
    U   php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
    U   php/php-src/branches/PHP_5_3/ext/phar/util.c
    U   php/php-src/branches/PHP_5_3/ext/sqlite3/sqlite3.c
    U   php/php-src/branches/PHP_5_3/ext/sqlite3/tests/sqlite3_21_security.phpt
    U   php/php-src/branches/PHP_5_3/ext/zip/php_zip.c
    U   php/php-src/branches/PHP_5_3/ext/zip/php_zip.h
    U   php/php-src/branches/PHP_5_3/ext/zip/zip_stream.c



Modified: 
php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
===
--- 
php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
 2010-04-26
23:53:30 UTC (rev 298625)
+++ 
php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
 2010-04-26
23:55:03 UTC (rev 298626)
@@ -26,7 +26,6 @@
 }
 ?
 --INI--
-safe_mode=0
 open_basedir=.
 --FILE--
 ?php

Wont this break the test?

-Hannes

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



Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/ enchant/enchant.c fileinfo/fileinfo.c fileinfo/libmagic/apprentice.c fileinfo/libmagic/cdf.c fileinfo/libmagic/cdf.h fileinfo/libmagic/magic.c

2010-04-27 Thread Pierre Joye
hi,

Why do we need this change in 5.3?

Cheers,

On Tue, Apr 27, 2010 at 1:55 AM, Kalle Sommer Nielsen ka...@php.net wrote:
 kalle                                    Mon, 26 Apr 2010 23:55:03 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=298626

 Log:
 Merge safe_mode changes into extensions that are in sync in both branches

 Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/enchant/enchant.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/fileinfo.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/apprentice.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/cdf.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/cdf.h
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/magic.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/readcdf.c
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic.patch
    U   php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c
    U   
 php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt
    U   php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
    U   php/php-src/branches/PHP_5_3/ext/pdo_mysql/mysql_driver.c
    U   php/php-src/branches/PHP_5_3/ext/phar/phar.c
    U   php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
    U   php/php-src/branches/PHP_5_3/ext/phar/util.c
    U   php/php-src/branches/PHP_5_3/ext/sqlite3/sqlite3.c
    U   php/php-src/branches/PHP_5_3/ext/sqlite3/tests/sqlite3_21_security.phpt
    U   php/php-src/branches/PHP_5_3/ext/zip/php_zip.c
    U   php/php-src/branches/PHP_5_3/ext/zip/php_zip.h
    U   php/php-src/branches/PHP_5_3/ext/zip/zip_stream.c


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




-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c

2010-04-27 Thread Andrey Hristov
andrey   Tue, 27 Apr 2010 08:02:08 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298640

Log:
Fixed possible buffer overflow in mysqlnd_conn__list_fields.

Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-04-27 06:24:24 UTC (rev 298639)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-04-27 08:02:08 UTC (rev 298640)
@@ -16,6 +16,7 @@

 - Implemented FR#35638 (Adding udate to imap_fetch_overview results).
   (Charles_Duffy at dell dot com )
+- Fixed possible buffer overflow in mysqlnd_list_fields. (Andrey)

 - Fixed handling of session variable serialization on certain prefix
   characters. Reported by Stefan Esser (Ilia)

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-04-27 06:24:24 UTC 
(rev 298639)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-04-27 08:02:08 UTC 
(rev 298640)
@@ -1074,14 +1074,16 @@

p = buff;
if (table  (table_len = strlen(table))) {
-   memcpy(p, table, MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN * 
4));
-   p += table_len;
+   size_t to_copy = MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
+   memcpy(p, table, to_copy);
+   p += to_copy;
*p++ = '\0';
}

if (achtung_wild  (wild_len = strlen(achtung_wild))) {
-   memcpy(p, achtung_wild, MIN(wild_len, 
MYSQLND_MAX_ALLOWED_DB_LEN * 4));
-   p += wild_len;
+   size_t to_copy = MIN(wild_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
+   memcpy(p, achtung_wild, to_copy);
+   p += to_copy;
*p++ = '\0';
}


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-04-27 06:24:24 UTC (rev 
298639)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-04-27 08:02:08 UTC (rev 
298640)
@@ -1074,14 +1074,16 @@

p = buff;
if (table  (table_len = strlen(table))) {
-   memcpy(p, table, MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN * 
4));
-   p += table_len;
+   size_t to_copy = MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
+   memcpy(p, table, to_copy);
+   p += to_copy;
*p++ = '\0';
}

if (achtung_wild  (wild_len = strlen(achtung_wild))) {
-   memcpy(p, achtung_wild, MIN(wild_len, 
MYSQLND_MAX_ALLOWED_DB_LEN * 4));
-   p += wild_len;
+   size_t to_copy = MIN(wild_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
+   memcpy(p, achtung_wild, to_copy);
+   p += to_copy;
*p++ = '\0';
}


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/phar/tests/phar_setsignaturealgo1.phpt trunk/ext/phar/tests/phar_setsignaturealgo1.phpt

2010-04-27 Thread Hannes Magnusson
bjoriTue, 27 Apr 2010 08:17:17 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298641

Log:
Fix test

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/phar/tests/phar_setsignaturealgo1.phpt
U   php/php-src/trunk/ext/phar/tests/phar_setsignaturealgo1.phpt

Modified: 
php/php-src/branches/PHP_5_3/ext/phar/tests/phar_setsignaturealgo1.phpt
===
--- php/php-src/branches/PHP_5_3/ext/phar/tests/phar_setsignaturealgo1.phpt 
2010-04-27 08:02:08 UTC (rev 298640)
+++ php/php-src/branches/PHP_5_3/ext/phar/tests/phar_setsignaturealgo1.phpt 
2010-04-27 08:17:17 UTC (rev 298641)
@@ -3,6 +3,7 @@
 --SKIPIF--
 ?php if (!extension_loaded(phar)) die(skip); ?
 ?php if ( extension_loaded(hash)) die(skip extension hash conflicts); ?
+?php if (!defined(Phar::PGP)) die(skip PGP Signature algorithm not 
available); ?
 --INI--
 phar.require_hash=0
 phar.readonly=0

Modified: php/php-src/trunk/ext/phar/tests/phar_setsignaturealgo1.phpt
===
--- php/php-src/trunk/ext/phar/tests/phar_setsignaturealgo1.phpt
2010-04-27 08:02:08 UTC (rev 298640)
+++ php/php-src/trunk/ext/phar/tests/phar_setsignaturealgo1.phpt
2010-04-27 08:17:17 UTC (rev 298641)
@@ -3,6 +3,7 @@
 --SKIPIF--
 ?php if (!extension_loaded(phar)) die(skip); ?
 ?php if ( extension_loaded(hash)) die(skip extension hash conflicts); ?
+?php if (!defined(Phar::PGP)) die(skip PGP Signature algorithm not 
available); ?
 --INI--
 phar.require_hash=0
 phar.readonly=0

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c

2010-04-27 Thread Andrey Hristov
andrey   Tue, 27 Apr 2010 08:26:24 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298643

Log:
Fixed buffer overflow in mysqlnd_change_user

Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-04-27 08:23:25 UTC (rev 298642)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-04-27 08:26:24 UTC (rev 298643)
@@ -16,7 +16,8 @@

 - Implemented FR#35638 (Adding udate to imap_fetch_overview results).
   (Charles_Duffy at dell dot com )
-- Fixed possible buffer overflow in mysqlnd_list_fields. (Andrey)
+- Fixed possible buffer overflows in mysqlnd_list_fields,  mysqlnd_change_user
+  (Andrey)

 - Fixed handling of session variable serialization on certain prefix
   characters. Reported by Stefan Esser (Ilia)

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-04-27 08:23:25 UTC 
(rev 298642)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-04-27 08:26:24 UTC 
(rev 298643)
@@ -1782,7 +1782,7 @@
/*
  User could be max 16 * 3 (utf8), pass is 20 usually, db is up to 64*3
  Stack space is not that expensive, so use a bit more to be protected 
against
- stack overrungs.
+ buffer overflows.
*/
size_t user_len;
enum_func_status ret;
@@ -1805,7 +1805,7 @@
}

/* 1. user ASCIIZ */
-   user_len = MIN(strlen(user), MYSQLND_MAX_ALLOWED_DB_LEN);
+   user_len = MIN(strlen(user), MYSQLND_MAX_ALLOWED_USER_LEN);
memcpy(p, user, user_len);
p += user_len;
*p++ = '\0';
@@ -1821,8 +1821,8 @@

/* 3. db ASCIIZ */
if (db[0]) {
-   size_t db_len = strlen(db);
-   memcpy(p, db, MIN(db_len, MYSQLND_MAX_ALLOWED_DB_LEN));
+   size_t db_len = MIN(strlen(db), MYSQLND_MAX_ALLOWED_DB_LEN);
+   memcpy(p, db, db_len);
p += db_len;
}
*p++ = '\0';

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-04-27 08:23:25 UTC (rev 
298642)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-04-27 08:26:24 UTC (rev 
298643)
@@ -1782,7 +1782,7 @@
/*
  User could be max 16 * 3 (utf8), pass is 20 usually, db is up to 64*3
  Stack space is not that expensive, so use a bit more to be protected 
against
- stack overrungs.
+ buffer overflows.
*/
size_t user_len;
enum_func_status ret;
@@ -1805,7 +1805,7 @@
}

/* 1. user ASCIIZ */
-   user_len = MIN(strlen(user), MYSQLND_MAX_ALLOWED_DB_LEN);
+   user_len = MIN(strlen(user), MYSQLND_MAX_ALLOWED_USER_LEN);
memcpy(p, user, user_len);
p += user_len;
*p++ = '\0';
@@ -1821,8 +1821,8 @@

/* 3. db ASCIIZ */
if (db[0]) {
-   size_t db_len = strlen(db);
-   memcpy(p, db, MIN(db_len, MYSQLND_MAX_ALLOWED_DB_LEN));
+   size_t db_len = MIN(strlen(db), MYSQLND_MAX_ALLOWED_DB_LEN);
+   memcpy(p, db, db_len);
p += db_len;
}
*p++ = '\0';

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/tests/mysqli_change_user.phpt trunk/ext/mysqli/tests/mysqli_change_user.phpt

2010-04-27 Thread Andrey Hristov
andrey   Tue, 27 Apr 2010 08:45:23 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298646

Log:
Test case for the buffer overflow in mysqlnd_change_user

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_change_user.phpt
U   php/php-src/trunk/ext/mysqli/tests/mysqli_change_user.phpt

Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_change_user.phpt
===
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_change_user.phpt   
2010-04-27 08:45:02 UTC (rev 298645)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_change_user.phpt   
2010-04-27 08:45:23 UTC (rev 298646)
@@ -73,8 +73,18 @@

mysqli_close($link);

+   if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, 
$socket)) {
+   printf([020] Cannot connect to the server using host=%s, 
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n,
+   $host, $user, $db, $port, $socket);
+   }
+
+   if (false !== ($tmp = mysqli_change_user($link, str_repeat('user', 
16384), str_repeat('pass', 16384), str_repeat('dbase', 16384
+   printf([021] Expecting false, got %s/%s\n, gettype($tmp), 
$tmp);
+
+   mysqli_close($link);
+
if (NULL !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
-   printf([020] Expecting NULL, got %s/%s\n, gettype($tmp), 
$tmp);
+   printf([022] Expecting NULL, got %s/%s\n, gettype($tmp), 
$tmp);

print done!;
 ?

Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_change_user.phpt
===
--- php/php-src/trunk/ext/mysqli/tests/mysqli_change_user.phpt  2010-04-27 
08:45:02 UTC (rev 298645)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_change_user.phpt  2010-04-27 
08:45:23 UTC (rev 298646)
@@ -73,8 +73,18 @@

mysqli_close($link);

+   if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, 
$socket)) {
+   printf([020] Cannot connect to the server using host=%s, 
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n,
+   $host, $user, $db, $port, $socket);
+   }
+
+   if (false !== ($tmp = mysqli_change_user($link, str_repeat('user', 
16384), str_repeat('pass', 16384), str_repeat('dbase', 16384
+   printf([021] Expecting false, got %s/%s\n, gettype($tmp), 
$tmp);
+
+   mysqli_close($link);
+
if (NULL !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
-   printf([020] Expecting NULL, got %s/%s\n, gettype($tmp), 
$tmp);
+   printf([022] Expecting NULL, got %s/%s\n, gettype($tmp), 
$tmp);

print done!;
 ?

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/spl/spl_directory.c branches/PHP_5_3/ext/spl/tests/bug48361.phpt trunk/ext/spl/spl_directory.c trunk/ext/spl/tests/bug48361.phpt

2010-04-27 Thread Etienne Kneuss
colder   Tue, 27 Apr 2010 08:56:01 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298647

Log:
Fixed #48361 (SplFileInfo::getPathName() should return the parent

Bug: http://bugs.php.net/48361 (Assigned) SplFileInfo::getPathinfo no returning 
info of path
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c
A   php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt
U   php/php-src/trunk/ext/spl/spl_directory.c
A   php/php-src/trunk/ext/spl/tests/bug48361.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-04-27 08:45:23 UTC (rev 298646)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-04-27 08:56:01 UTC (rev 298647)
@@ -106,6 +106,8 @@
 - Fixed bug #48983 (DomDocument : saveHTMLFile wrong charset). (Rob)
 - Fixed bug #48902 (Timezone database fallback map is outdated). (Derick)
 - Fixed bug #48781 (Cyclical garbage collector memory leak). (Dmitry)
+- Fixed bug #48361 (SplFileInfo::getPathInfo should return the
+  parent dir). (Etienne)
 - Fixed bug #46111 (Some timezone identifiers can not be parsed). (Derick)
 - Fixed bug #35673 (formatOutput does not work with saveHTML). (Rob)


Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c
===
--- php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c2010-04-27 
08:45:23 UTC (rev 298646)
+++ php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c2010-04-27 
08:56:01 UTC (rev 298647)
@@ -1187,7 +1187,10 @@
int path_len;
char *path = spl_filesystem_object_get_pathname(intern, 
path_len TSRMLS_CC);
if (path) {
-   spl_filesystem_object_create_info(intern, path, 
path_len, 1, ce, return_value TSRMLS_CC);
+   char *dpath = estrndup(path, path_len);
+   path_len = php_dirname(dpath, path_len);
+   spl_filesystem_object_create_info(intern, dpath, 
path_len, 1, ce, return_value TSRMLS_CC);
+   efree(dpath);
}
}


Added: php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt
===
--- php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt
(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt2010-04-27 
08:56:01 UTC (rev 298647)
@@ -0,0 +1,14 @@
+--TEST--
+SPL: Bug #48361 SpleFileInfo::getPathName should return the dirname's path
+--FILE--
+?php
+$info = new SplFileInfo(__FILE__);
+var_dump($info-getRealPath());
+var_dump($info-getPathInfo()-getRealPath());
+?
+===DONE===
+--EXPECTF--
+string(%d) %stests%sbug48361.php
+string(%d) %stests
+===DONE===
+

Modified: php/php-src/trunk/ext/spl/spl_directory.c
===
--- php/php-src/trunk/ext/spl/spl_directory.c   2010-04-27 08:45:23 UTC (rev 
298646)
+++ php/php-src/trunk/ext/spl/spl_directory.c   2010-04-27 08:56:01 UTC (rev 
298647)
@@ -1187,7 +1187,10 @@
int path_len;
char *path = spl_filesystem_object_get_pathname(intern, 
path_len TSRMLS_CC);
if (path) {
-   spl_filesystem_object_create_info(intern, path, 
path_len, 1, ce, return_value TSRMLS_CC);
+   char *dpath = estrndup(path, path_len);
+   path_len = php_dirname(dpath, path_len);
+   spl_filesystem_object_create_info(intern, dpath, 
path_len, 1, ce, return_value TSRMLS_CC);
+   efree(dpath);
}
}


Added: php/php-src/trunk/ext/spl/tests/bug48361.phpt
===
--- php/php-src/trunk/ext/spl/tests/bug48361.phpt   
(rev 0)
+++ php/php-src/trunk/ext/spl/tests/bug48361.phpt   2010-04-27 08:56:01 UTC 
(rev 298647)
@@ -0,0 +1,14 @@
+--TEST--
+SPL: Bug #48361 SpleFileInfo::getPathName should return the dirname's path
+--FILE--
+?php
+$info = new SplFileInfo(__FILE__);
+var_dump($info-getRealPath());
+var_dump($info-getPathInfo()-getRealPath());
+?
+===DONE===
+--EXPECTF--
+string(%d) %stests%sbug48361.php
+string(%d) %stests
+===DONE===
+

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h trunk/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

2010-04-27 Thread Andrey Hristov
andrey   Tue, 27 Apr 2010 10:53:27 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298649

Log:
Move the macro to mysqlnd_enum_n_def.h, because it can be reused
in other places. Also, premultiply the values by 4 and add some
reserve for future releases of the server.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-04-27 09:50:51 UTC 
(rev 298648)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-04-27 10:53:27 UTC 
(rev 298649)
@@ -30,9 +30,6 @@
 /* for php_get_current_user() */
 #include ext/standard/basic_functions.h

-/* the server doesn't support 4byte utf8, but let's make it forward compatible 
*/
-#define MYSQLND_MAX_ALLOWED_USER_LEN   256  /* 64 char * 4byte */
-#define MYSQLND_MAX_ALLOWED_DB_LEN 256  /* 64 char * 4byte */
 /*
   TODO :
   - Don't bind so tightly the metadata with the result set. This means
@@ -1066,7 +1063,7 @@
 MYSQLND_METHOD(mysqlnd_conn, list_fields)(MYSQLND * conn, const char *table, 
const char *achtung_wild TSRMLS_DC)
 {
/* db + \0 + wild + \0 (for wild) */
-   char buff[MYSQLND_MAX_ALLOWED_DB_LEN * 4 * 2 + 1 + 1], *p;
+   char buff[MYSQLND_MAX_ALLOWED_DB_LEN * 2 + 1 + 1], *p;
size_t table_len, wild_len;
MYSQLND_RES *result = NULL;
DBG_ENTER(mysqlnd_conn::list_fields);
@@ -1074,14 +1071,14 @@

p = buff;
if (table  (table_len = strlen(table))) {
-   size_t to_copy = MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
+   size_t to_copy = MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN);
memcpy(p, table, to_copy);
p += to_copy;
*p++ = '\0';
}

if (achtung_wild  (wild_len = strlen(achtung_wild))) {
-   size_t to_copy = MIN(wild_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
+   size_t to_copy = MIN(wild_len, MYSQLND_MAX_ALLOWED_DB_LEN);
memcpy(p, achtung_wild, to_copy);
p += to_copy;
*p++ = '\0';

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-04-27 09:50:51 UTC (rev 298648)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-04-27 10:53:27 UTC (rev 298649)
@@ -39,6 +39,8 @@
 #define MYSQLND_SQLSTATE_LENGTH5
 #define MYSQLND_SQLSTATE_NULL  0

+#define MYSQLND_MAX_ALLOWED_USER_LEN   1024  /* 64 char * 4byte . MySQL 
supports now only 16 char, but let it be forward compatible */
+#define MYSQLND_MAX_ALLOWED_DB_LEN 1024  /* 256 char * 4byte. 
MySQL supports now only 64 char in the tables, but on the FS could be 
different. Forward compatible. */

 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE4096
 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE_STR4096

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-04-27 09:50:51 UTC (rev 
298648)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-04-27 10:53:27 UTC (rev 
298649)
@@ -30,9 +30,6 @@
 /* for php_get_current_user() */
 #include ext/standard/basic_functions.h

-/* the server doesn't support 4byte utf8, but let's make it forward compatible 
*/
-#define MYSQLND_MAX_ALLOWED_USER_LEN   256  /* 64 char * 4byte */
-#define MYSQLND_MAX_ALLOWED_DB_LEN 256  /* 64 char * 4byte */
 /*
   TODO :
   - Don't bind so tightly the metadata with the result set. This means
@@ -1066,7 +1063,7 @@
 MYSQLND_METHOD(mysqlnd_conn, list_fields)(MYSQLND * conn, const char *table, 
const char *achtung_wild TSRMLS_DC)
 {
/* db + \0 + wild + \0 (for wild) */
-   char buff[MYSQLND_MAX_ALLOWED_DB_LEN * 4 * 2 + 1 + 1], *p;
+   char buff[MYSQLND_MAX_ALLOWED_DB_LEN * 2 + 1 + 1], *p;
size_t table_len, wild_len;
MYSQLND_RES *result = NULL;
DBG_ENTER(mysqlnd_conn::list_fields);
@@ -1074,14 +1071,14 @@

p = buff;
if (table  (table_len = strlen(table))) {
-   size_t to_copy = MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
+   size_t to_copy = MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN);
memcpy(p, table, to_copy);
p += to_copy;
*p++ = '\0';
}

if (achtung_wild  (wild_len = strlen(achtung_wild))) {
-   size_t to_copy = MIN(wild_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
+   

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

2010-04-27 Thread Andrey Hristov
andrey   Tue, 27 Apr 2010 11:02:51 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298650

Log:
Of course, 64*4 is 256, not 1024

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-04-27 10:53:27 UTC (rev 298649)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-04-27 11:02:51 UTC (rev 298650)
@@ -39,8 +39,8 @@
 #define MYSQLND_SQLSTATE_LENGTH5
 #define MYSQLND_SQLSTATE_NULL  0

-#define MYSQLND_MAX_ALLOWED_USER_LEN   1024  /* 64 char * 4byte . MySQL 
supports now only 16 char, but let it be forward compatible */
-#define MYSQLND_MAX_ALLOWED_DB_LEN 1024  /* 256 char * 4byte. 
MySQL supports now only 64 char in the tables, but on the FS could be 
different. Forward compatible. */
+#define MYSQLND_MAX_ALLOWED_USER_LEN   256 /* 64 char * 4byte . 
MySQL supports now only 16 char, but let it be forward compatible */
+#define MYSQLND_MAX_ALLOWED_DB_LEN 1024/* 256 char * 4byte. 
MySQL supports now only 64 char in the tables, but on the FS could be 
different. Forward compatible. */

 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE4096
 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE_STR4096

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2010-04-27 10:53:27 UTC 
(rev 298649)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2010-04-27 11:02:51 UTC 
(rev 298650)
@@ -39,8 +39,8 @@
 #define MYSQLND_SQLSTATE_LENGTH5
 #define MYSQLND_SQLSTATE_NULL  0

-#define MYSQLND_MAX_ALLOWED_USER_LEN   1024  /* 64 char * 4byte . MySQL 
supports now only 16 char, but let it be forward compatible */
-#define MYSQLND_MAX_ALLOWED_DB_LEN 1024  /* 256 char * 4byte. 
MySQL supports now only 64 char in the tables, but on the FS could be 
different. Forward compatible. */
+#define MYSQLND_MAX_ALLOWED_USER_LEN   256 /* 64 char * 4byte . 
MySQL supports now only 16 char, but let it be forward compatible */
+#define MYSQLND_MAX_ALLOWED_DB_LEN 1024/* 256 char * 4byte. 
MySQL supports now only 64 char in the tables, but on the FS could be 
different. Forward compatible. */

 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE4096
 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE_STR4096

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

[PHP-CVS] svn: /php/php-src/trunk/Zend/ zend_compile.c zend_constants.c zend_constants.h zend_vm_def.h zend_vm_execute.h

2010-04-27 Thread Dmitry Stogov
dmitry   Tue, 27 Apr 2010 12:09:13 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298651

Log:
- Reimplemented ZEND_INIT_FCALL_BY_NAME and ZEND_INIT_NS_FCALL_BY_NAME to use 
literals instead of additional operands
- Optimized access to global constants

Changed paths:
U   php/php-src/trunk/Zend/zend_compile.c
U   php/php-src/trunk/Zend/zend_constants.c
U   php/php-src/trunk/Zend/zend_constants.h
U   php/php-src/trunk/Zend/zend_vm_def.h
U   php/php-src/trunk/Zend/zend_vm_execute.h

Modified: php/php-src/trunk/Zend/zend_compile.c
===
--- php/php-src/trunk/Zend/zend_compile.c	2010-04-27 11:02:51 UTC (rev 298650)
+++ php/php-src/trunk/Zend/zend_compile.c	2010-04-27 12:09:13 UTC (rev 298651)
@@ -388,7 +388,38 @@
 }
 /* }}} */

+int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC) /* {{{ */
+{
+	int ret;
+	char *lc_name, *ns_separator;
+	int lc_len;
+	zval c;
+	int lc_literal;

+	if (op_array-last_literal  0 
+	op_array-literals[op_array-last_literal - 1].constant == zv) {
+		/* we already have function name as last literal (do nothing) */
+		ret = op_array-last_literal - 1;
+	} else {
+		ret = zend_add_literal(op_array, zv);
+	}
+
+	lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRLEN_P(zv));
+	ZVAL_STRINGL(c, lc_name, Z_STRLEN_P(zv), 0);
+	lc_literal = zend_add_literal(CG(active_op_array), c);
+	CALCULATE_LITERAL_HASH(lc_literal);
+
+	ns_separator = zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)) + 1;
+	lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv));
+	lc_name = zend_str_tolower_dup(ns_separator, lc_len);
+	ZVAL_STRINGL(c, lc_name, lc_len, 0);
+	lc_literal = zend_add_literal(CG(active_op_array), c);
+	CALCULATE_LITERAL_HASH(lc_literal);
+
+	return ret;
+}
+/* }}} */
+
 int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC) /* {{{ */
 {
 	int ret;
@@ -1853,13 +1884,13 @@
 		zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
 		opline-opcode = ZEND_INIT_FCALL_BY_NAME;
 		SET_NODE(opline-op2, left_bracket);
-		if (opline-op2_type == IS_CONST) {
-			opline-op1_type = IS_CONST;
-			LITERAL_STRINGL(opline-op1, zend_str_tolower_dup(Z_STRVAL(CONSTANT(opline-op2.constant)), Z_STRLEN(CONSTANT(opline-op2.constant))), Z_STRLEN(CONSTANT(opline-op2.constant)), 0);
-			CALCULATE_LITERAL_HASH(opline-op1.constant);
-		} else {
-			SET_UNUSED(opline-op1);
-		}
+		SET_UNUSED(opline-op1);
+		if (left_bracket-op_type == IS_CONST) {
+			opline-op2_type = IS_CONST;
+			opline-op2.constant = zend_add_func_name_literal(CG(active_op_array), left_bracket-u.constant TSRMLS_CC);
+ 		} else {
+			SET_NODE(opline-op2, left_bracket);
+ 		}
 	}

 	zend_stack_push(CG(function_call_stack), (void *) ptr, sizeof(zend_function *));
@@ -1883,7 +1914,7 @@
 void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRMLS_DC) /* {{{ */
 {
 	unsigned char *ptr = NULL;
-	zend_op *opline, *opline2;
+	zend_op *opline;

 	opline = get_next_op(CG(active_op_array) TSRMLS_CC);
 	if (ns_call) {
@@ -1892,34 +1923,18 @@
 		/* In run-time PHP will check for function with full name and
 		   internal function with short name */
 		opline-opcode = ZEND_INIT_NS_FCALL_BY_NAME;
-		SET_NODE(opline-op2, function_name);
-		opline-op1_type = IS_CONST;
-		LITERAL_STRINGL(opline-op1, zend_str_tolower_dup(Z_STRVAL(CONSTANT(opline-op2.constant)), Z_STRLEN(CONSTANT(opline-op2.constant))), Z_STRLEN(CONSTANT(opline-op2.constant)), 0);
-		CALCULATE_LITERAL_HASH(opline-op1.constant);
-		slash = zend_memrchr(Z_STRVAL(CONSTANT(opline-op1.constant)), '\\', Z_STRLEN(CONSTANT(opline-op1.constant)));
-		prefix_len = slash-Z_STRVAL(CONSTANT(opline-op1.constant))+1;
-		name_len = Z_STRLEN(CONSTANT(opline-op1.constant))-prefix_len;
-		opline2 = get_next_op(CG(active_op_array) TSRMLS_CC);
-		opline2-opcode = ZEND_OP_DATA;
-		SET_UNUSED(opline2-op1);
-		if(!slash) {
-			zend_error(E_CORE_ERROR, Namespaced name %s should contain slash, Z_STRVAL(CONSTANT(opline-op1.constant)));
-		}
-		/* this is the length of namespace prefix */
-		opline2-op1.num = prefix_len;
-		/* this is the hash of the non-prefixed part, lowercased */
-		opline2-extended_value = zend_hash_func(slash+1, name_len+1);
-		SET_UNUSED(opline2-op2);
+		SET_UNUSED(opline-op1);
+		opline-op2_type = IS_CONST;
+		opline-op2.constant = zend_add_ns_func_name_literal(CG(active_op_array), function_name-u.constant TSRMLS_CC);
 	} else {
 		opline-opcode = ZEND_INIT_FCALL_BY_NAME;
-		SET_NODE(opline-op2, function_name);
-		if (opline-op2_type == IS_CONST) {
-			opline-op1_type = IS_CONST;
-			LITERAL_STRINGL(opline-op1, zend_str_tolower_dup(Z_STRVAL(CONSTANT(opline-op2.constant)), Z_STRLEN(CONSTANT(opline-op2.constant))), Z_STRLEN(CONSTANT(opline-op2.constant)), 0);
-			CALCULATE_LITERAL_HASH(opline-op1.constant);
-		} else {
-			SET_UNUSED(opline-op1);
-		}
+		SET_UNUSED(opline-op1);
+		if 

[PHP-CVS] svn: /php/php-src/trunk/Zend/ zend_compile.c

2010-04-27 Thread Dmitry Stogov
dmitry   Tue, 27 Apr 2010 12:17:32 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298653

Log:
- ws
- removed unused variables

Changed paths:
U   php/php-src/trunk/Zend/zend_compile.c

Modified: php/php-src/trunk/Zend/zend_compile.c
===
--- php/php-src/trunk/Zend/zend_compile.c   2010-04-27 12:09:18 UTC (rev 
298652)
+++ php/php-src/trunk/Zend/zend_compile.c   2010-04-27 12:17:32 UTC (rev 
298653)
@@ -1883,14 +1883,13 @@
} else {
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline-opcode = ZEND_INIT_FCALL_BY_NAME;
-   SET_NODE(opline-op2, left_bracket);
SET_UNUSED(opline-op1);
if (left_bracket-op_type == IS_CONST) {
opline-op2_type = IS_CONST;
opline-op2.constant = 
zend_add_func_name_literal(CG(active_op_array), left_bracket-u.constant 
TSRMLS_CC);
-   } else {
+   } else {
SET_NODE(opline-op2, left_bracket);
-   }
+   }
}

zend_stack_push(CG(function_call_stack), (void *) ptr, 
sizeof(zend_function *));
@@ -1918,8 +1917,6 @@

opline = get_next_op(CG(active_op_array) TSRMLS_CC);
if (ns_call) {
-   char *slash;
-   int prefix_len, name_len;
/* In run-time PHP will check for function with full name and
   internal function with short name */
opline-opcode = ZEND_INIT_NS_FCALL_BY_NAME;
@@ -1932,9 +1929,9 @@
if (function_name-op_type == IS_CONST) {
opline-op2_type = IS_CONST;
opline-op2.constant = 
zend_add_func_name_literal(CG(active_op_array), function_name-u.constant 
TSRMLS_CC);
-   } else {
+   } else {
SET_NODE(opline-op2, function_name);
-   }
+   }
}

zend_stack_push(CG(function_call_stack), (void *) ptr, 
sizeof(zend_function *));

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

[PHP-CVS] svn: /php/php-src/trunk/Zend/ zend_vm_def.h zend_vm_execute.h

2010-04-27 Thread Dmitry Stogov
dmitry   Tue, 27 Apr 2010 12:23:29 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298655

Log:
ws

Changed paths:
U   php/php-src/trunk/Zend/zend_vm_def.h
U   php/php-src/trunk/Zend/zend_vm_execute.h

Modified: php/php-src/trunk/Zend/zend_vm_def.h
===
--- php/php-src/trunk/Zend/zend_vm_def.h2010-04-27 12:19:40 UTC (rev 
298654)
+++ php/php-src/trunk/Zend/zend_vm_def.h2010-04-27 12:23:29 UTC (rev 
298655)
@@ -2374,9 +2374,9 @@
 {
USE_OPLINE
zend_literal *func_name;
-
-   zend_ptr_stack_3_push(EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
-
+
+   zend_ptr_stack_3_push(EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
+
func_name = opline-op2.literal + 1;
if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(func_name-constant), Z_STRLEN(func_name-constant)+1, 
func_name-hash_value, (void **) EX(fbc))==FAILURE) {
func_name++;

Modified: php/php-src/trunk/Zend/zend_vm_execute.h
===
--- php/php-src/trunk/Zend/zend_vm_execute.h2010-04-27 12:19:40 UTC (rev 
298654)
+++ php/php-src/trunk/Zend/zend_vm_execute.h2010-04-27 12:23:29 UTC (rev 
298655)
@@ -926,7 +926,7 @@
USE_OPLINE
zend_literal *func_name;

-   zend_ptr_stack_3_push(EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
+   zend_ptr_stack_3_push(EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));

func_name = opline-op2.literal + 1;
if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(func_name-constant), Z_STRLEN(func_name-constant)+1, 
func_name-hash_value, (void **) EX(fbc))==FAILURE) {

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c trunk/ext/mysqli/tests/mys

2010-04-27 Thread Andrey Hristov
andrey   Tue, 27 Apr 2010 12:32:34 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298657

Log:
Fixed very rare memory leak in mysqlnd, when binding thousands of columns

Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
A   
php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
A   
php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS	2010-04-27 12:27:15 UTC (rev 298656)
+++ php/php-src/branches/PHP_5_3/NEWS	2010-04-27 12:32:34 UTC (rev 298657)
@@ -16,8 +16,10 @@

 - Implemented FR#35638 (Adding udate to imap_fetch_overview results).
   (Charles_Duffy at dell dot com )
-- Fixed possible buffer overflows in mysqlnd_list_fields,  mysqlnd_change_user
+- Fixed possible buffer overflows in mysqlnd_list_fields,  mysqlnd_change_user.
   (Andrey)
+- Fixed very rare memory leak in mysqlnd, when binding thousands of columns.
+  (Andrey)

 - Fixed handling of session variable serialization on certain prefix
   characters. Reported by Stefan Esser (Ilia)

Added: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
===
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt	2010-04-27 12:32:34 UTC (rev 298657)
@@ -0,0 +1,76 @@
+--TEST--
+mysqli_stmt_bind_param() - Binding with very high number of columns
+--SKIPIF--
+?php
+require_once('skipif.inc');
+require_once('skipifemb.inc');
+require_once('skipifconnectfailure.inc');
+?
+--FILE--
+?php
+	/*
+	The way we test the INSERT and data types overlaps with
+	the mysqli_stmt_bind_result test in large parts. There is only
+	one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to
+	fetch the inserted values. This way we test
+	mysqli_query()/mysqli_fetch_assoc() for all possible data types
+	in this file and we test mysqli_stmt_bind_result() in the other
+	test -- therefore the duplicate makes some sense to me.
+	*/
+	require_once(connect.inc);
+
+	if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+		printf(Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n,
+			$host, $user, $db, $port, $socket);
+		exit(1);
+	}
+
+	if (!mysqli_query($link, 'DROP TABLE IF EXISTS ps_test')) {
+		printf(Failed to drop old test table: [%d] %s\n, mysqli_errno($link), mysqli_error($link));
+		exit(1);
+	}
+
+	$cols = 2500;
+	$str = array();
+	for ($i = 1; $i = $cols; $i++) {
+		$str[] =a$i INT;
+	}
+	$link-query(CREATE TABLE ps_test( . implode( , , $str) . ));
+	if (mysqli_errno($link)) {
+		printf(Failed to create the test table: [%d] %s\n, mysqli_errno($link), mysqli_error($link));
+		die();
+	}
+	$stmt = $link-prepare(INSERT INTO ps_test VALUES(.str_repeat(?, , $cols-1) . ?));
+	var_dump($stmt-id);
+	$eval_str=\$stmt-bind_param(\.str_repeat(i,$cols).\, ;
+	for ($i = 1; $i  $cols; $i++) {
+		$eval_str.=\$i,;
+	}
+	$eval_str.=\$i;
+	$eval_str.=);;
+	eval($eval_str);
+	var_dump($stmt-execute());
+
+	mysqli_stmt_close($stmt);
+
+
+	mysqli_close($link);
+
+	print done!;
+?
+--CLEAN--
+?php
+	if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+		printf(Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n,
+			$host, $user, $db, $port, $socket);
+		exit(1);
+	}
+	if (!mysqli_query($link, 'DROP TABLE IF EXISTS ps_test')) {
+		printf(Failed to drop the test table: [%d] %s\n, mysqli_errno($link), mysqli_error($link));
+		exit(1);
+	}
+?
+--EXPECTF--
+int(1)
+bool(true)
+done!

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c	2010-04-27 12:27:15 UTC (rev 298656)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c	2010-04-27 12:32:34 UTC (rev 298657)
@@ -599,6 +599,7 @@
 {
 	MYSQLND_STMT_DATA * stmt = s-data;
 	unsigned int i = 0;
+	zend_uchar * provided_buffer = *buf;
 	size_t left = (*buf_len - (*p - *buf));
 	size_t data_size = 0;
 	zval **copies = NULL;/* if there are different types */
@@ -714,9 +715,17 @@
 		*buf_len = offset + data_size + 10; /* Allocate + 10 for safety */
 		tmp_buf = mnd_emalloc(*buf_len);
 		memcpy(tmp_buf, *buf, offset);
+		/*
+		  When too many columns the buffer provided to the function might not be sufficient.
+		  In this case new buffer has been allocated above. When we allocate a buffer and then
+		  allocate a 

[PHP-CVS] svn: /php/php-src/trunk/ext/spl/ php_spl.c

2010-04-27 Thread Dmitry Stogov
dmitry   Tue, 27 Apr 2010 13:31:55 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298660

Log:
Fixed memory leak in ext/spl/tests/spl_autoload_bug48541.phpt

Bug: http://bugs.php.net/48541 (Closed) spl_autoload_register only registers 
first closure, then leaks the others
  
Changed paths:
U   php/php-src/trunk/ext/spl/php_spl.c

Modified: php/php-src/trunk/ext/spl/php_spl.c
===
--- php/php-src/trunk/ext/spl/php_spl.c 2010-04-27 13:15:07 UTC (rev 298659)
+++ php/php-src/trunk/ext/spl/php_spl.c 2010-04-27 13:31:55 UTC (rev 298660)
@@ -556,7 +556,14 @@
}
}

-   zend_hash_add(SPL_G(autoload_functions), lc_name, 
func_name_len+1, alfi.func_ptr, sizeof(autoload_func_info), NULL);
+   if (zend_hash_add(SPL_G(autoload_functions), lc_name, 
func_name_len+1, alfi.func_ptr, sizeof(autoload_func_info), NULL) == FAILURE) {
+   if (obj_ptr  !(alfi.func_ptr-common.fn_flags  
ZEND_ACC_STATIC)) {
+   Z_DELREF_P(alfi.obj);
+   }
+   if (alfi.closure) {
+   Z_DELREF_P(alfi.closure);
+   }
+   }
if (prepend  SPL_G(autoload_functions)-nNumOfElements  1) {
/* Move the newly created element to the head of the 
hashtable */
HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions));

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/phar/dirstream.c branches/PHP_5_3/ext/phar/stream.c trunk/ext/phar/dirstream.c trunk/ext/phar/stream.c

2010-04-27 Thread Ilia Alshanetsky
iliaaTue, 27 Apr 2010 17:13:24 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298667

Log:
Fixed string format validation inside phar extension. Reported by Stefan Esser

Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/phar/dirstream.c
U   php/php-src/branches/PHP_5_3/ext/phar/stream.c
U   php/php-src/trunk/ext/phar/dirstream.c
U   php/php-src/trunk/ext/phar/stream.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-04-27 17:12:03 UTC (rev 298666)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-04-27 17:13:24 UTC (rev 298667)
@@ -21,6 +21,8 @@
 - Fixed very rare memory leak in mysqlnd, when binding thousands of columns.
   (Andrey)

+- Fixed string format validation inside phar extension. Reported by Stefan
+  Esser (Ilia)
 - Fixed handling of session variable serialization on certain prefix
   characters. Reported by Stefan Esser (Ilia)
 - Fixed a NULL pointer dereference when processing invalid XML-RPC

Modified: php/php-src/branches/PHP_5_3/ext/phar/dirstream.c
===
--- php/php-src/branches/PHP_5_3/ext/phar/dirstream.c   2010-04-27 17:12:03 UTC 
(rev 298666)
+++ php/php-src/branches/PHP_5_3/ext/phar/dirstream.c   2010-04-27 17:13:24 UTC 
(rev 298667)
@@ -360,7 +360,7 @@

if (FAILURE == phar_get_archive(phar, resource-host, host_len, NULL, 
0, error TSRMLS_CC)) {
if (error) {
-   php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, error);
+   php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, %s, error);
efree(error);
} else {
php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, phar file \%s\ is unknown, resource-host);

Modified: php/php-src/branches/PHP_5_3/ext/phar/stream.c
===
--- php/php-src/branches/PHP_5_3/ext/phar/stream.c  2010-04-27 17:12:03 UTC 
(rev 298666)
+++ php/php-src/branches/PHP_5_3/ext/phar/stream.c  2010-04-27 17:13:24 UTC 
(rev 298667)
@@ -117,7 +117,7 @@
{
if (error) {
if (!(options  PHP_STREAM_URL_STAT_QUIET)) {
-   php_stream_wrapper_log_error(wrapper, 
options TSRMLS_CC, error);
+   php_stream_wrapper_log_error(wrapper, 
options TSRMLS_CC, %s, error);
}
efree(error);
}
@@ -128,7 +128,7 @@
if (error) {
spprintf(error, 0, Cannot open cached phar 
'%s' as writeable, copy on write failed, resource-host);
if (!(options  PHP_STREAM_URL_STAT_QUIET)) {
-   php_stream_wrapper_log_error(wrapper, 
options TSRMLS_CC, error);
+   php_stream_wrapper_log_error(wrapper, 
options TSRMLS_CC, %s, error);
}
efree(error);
}
@@ -140,7 +140,7 @@
{
if (error) {
if (!(options  PHP_STREAM_URL_STAT_QUIET)) {
-   php_stream_wrapper_log_error(wrapper, 
options TSRMLS_CC, error);
+   php_stream_wrapper_log_error(wrapper, 
options TSRMLS_CC, %s, error);
}
efree(error);
}
@@ -192,7 +192,7 @@
if (mode[0] == 'w' || (mode[0] == 'r'  mode[1] == '+')) {
if (NULL == (idata = 
phar_get_or_create_entry_data(resource-host, host_len, internal_file, 
strlen(internal_file), mode, 0, error, 1 TSRMLS_CC))) {
if (error) {
-   php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, error);
+   php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, %s, error);
efree(error);
} else {
php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, phar error: file \%s\ could not be created in phar \%s\, 
internal_file, resource-host);
@@ -297,7 +297,7 @@
if ((FAILURE == phar_get_entry_data(idata, resource-host, 
host_len, internal_file, strlen(internal_file), r, 0, error, 0 TSRMLS_CC)) 
|| !idata) {
 idata_error:
if (error) {
-   php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, error);
+   php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, 

[PHP-CVS] svn: /SVNROOT/ global_avail

2010-04-27 Thread Philip Olson
philip   Tue, 27 Apr 2010 17:55:00 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=298668

Log:
- phpdoc/es karma for Edwin Alexander Cartagena Hernandez (edwincartagenah)

Changed paths:
U   SVNROOT/global_avail

Modified: SVNROOT/global_avail
===
--- SVNROOT/global_avail2010-04-27 17:13:24 UTC (rev 298667)
+++ SVNROOT/global_avail2010-04-27 17:55:00 UTC (rev 298668)
@@ -74,7 +74,7 @@
 avail|mkoula|phpdoc/cs
 avail|penguin,tkxs|phpdoc/da
 avail|kore,thorstenr,lapistano|phpdoc/de
-avail|mgonzalezle,ianasa,gustavo,soywiz,ladderalice,ideados,fcaroberga,dulasoft,benjamin,argosback,tatai,jesusruiz,jpberdejo,lduran,sabathorn,julionc,jorgeeolayap,x1v4nx,jesus_cova|phpdoc/es
+avail|mgonzalezle,ianasa,gustavo,soywiz,ladderalice,ideados,fcaroberga,dulasoft,benjamin,argosback,tatai,jesusruiz,jpberdejo,lduran,sabathorn,julionc,jorgeeolayap,x1v4nx,jesus_cova,edwincartagenah|phpdoc/es
 avail|parstic|phpdoc/fa
 avail|magidev,mikaelkael,jpauli|phpdoc/fr
 avail|xdanger,jiania,haohappy|phpdoc/zh,phpdoc/hk,phpdoc/tw

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