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

2011-05-10 Thread Adam Harvey
aharvey  Tue, 10 May 2011 08:14:55 +

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

Log:
Fix bug #54692 (SQLite3::open() Return Value) by correcting the SQLite3::open()
prototype.

Bug: http://bugs.php.net/54692 (Assigned) SQLite3::open() Return Value
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/sqlite3/sqlite3.c
U   php/php-src/trunk/ext/sqlite3/sqlite3.c

Modified: php/php-src/branches/PHP_5_3/ext/sqlite3/sqlite3.c
===
--- php/php-src/branches/PHP_5_3/ext/sqlite3/sqlite3.c  2011-05-10 07:15:22 UTC 
(rev 310876)
+++ php/php-src/branches/PHP_5_3/ext/sqlite3/sqlite3.c  2011-05-10 08:14:55 UTC 
(rev 310877)
@@ -89,7 +89,7 @@
 zend_class_entry *php_sqlite3_stmt_entry;
 zend_class_entry *php_sqlite3_result_entry;

-/* {{{ proto bool SQLite3::open(String filename [, int Flags [, string 
Encryption Key]])
+/* {{{ proto void SQLite3::open(String filename [, int Flags [, string 
Encryption Key]])
Opens a SQLite 3 Database, if the build includes encryption then it will 
attempt to use the key. */
 PHP_METHOD(sqlite3, open)
 {

Modified: php/php-src/trunk/ext/sqlite3/sqlite3.c
===
--- php/php-src/trunk/ext/sqlite3/sqlite3.c 2011-05-10 07:15:22 UTC (rev 
310876)
+++ php/php-src/trunk/ext/sqlite3/sqlite3.c 2011-05-10 08:14:55 UTC (rev 
310877)
@@ -89,7 +89,7 @@
 zend_class_entry *php_sqlite3_stmt_entry;
 zend_class_entry *php_sqlite3_result_entry;

-/* {{{ proto bool SQLite3::open(String filename [, int Flags [, string 
Encryption Key]])
+/* {{{ proto void SQLite3::open(String filename [, int Flags [, string 
Encryption Key]])
Opens a SQLite 3 Database, if the build includes encryption then it will 
attempt to use the key. */
 PHP_METHOD(sqlite3, open)
 {

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

[PHP-CVS] svn: /php/php-src/trunk/ext/snmp/ snmp.c tests/snmp-object-errno-errstr.phpt

2011-05-10 Thread Boris Lytochkin
lytboris Tue, 10 May 2011 11:48:10 +

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

Log:
method renaming:
SNMP::get_errno() - SNMP::getErrno()
SNMP::get_error() - SNMP::getError()

Changed paths:
U   php/php-src/trunk/ext/snmp/snmp.c
U   php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt

Modified: php/php-src/trunk/ext/snmp/snmp.c
===
--- php/php-src/trunk/ext/snmp/snmp.c   2011-05-10 11:34:48 UTC (rev 310886)
+++ php/php-src/trunk/ext/snmp/snmp.c   2011-05-10 11:48:10 UTC (rev 310887)
@@ -1826,9 +1826,9 @@
 }
 /* }}} */

-/* {{{ proto long SNMP::get_errno()
+/* {{{ proto long SNMP::getErrno()
Get last error code number */
-PHP_METHOD(snmp, get_errno)
+PHP_METHOD(snmp, getErrno)
 {
php_snmp_object *snmp_object;
zval *object = getThis();
@@ -1840,9 +1840,9 @@
 }
 /* }}} */

-/* {{{ proto long SNMP::error()
+/* {{{ proto long SNMP::getError()
Get last error message */
-PHP_METHOD(snmp, get_error)
+PHP_METHOD(snmp, getError)
 {
php_snmp_object *snmp_object;
zval *object = getThis();
@@ -2294,8 +2294,8 @@
PHP_ME(snmp, getnext,   arginfo_snmp_get,   
ZEND_ACC_PUBLIC)
PHP_ME(snmp, walk,  arginfo_snmp_walk,  
ZEND_ACC_PUBLIC)
PHP_ME(snmp, set,   arginfo_snmp_set,   
ZEND_ACC_PUBLIC)
-   PHP_ME(snmp, get_errno, arginfo_snmp_void,  
ZEND_ACC_PUBLIC)
-   PHP_ME(snmp, get_error, arginfo_snmp_void,  
ZEND_ACC_PUBLIC)
+   PHP_ME(snmp, getErrno,  arginfo_snmp_void,  
ZEND_ACC_PUBLIC)
+   PHP_ME(snmp, getError,  arginfo_snmp_void,  
ZEND_ACC_PUBLIC)

{NULL, NULL, NULL}
 };

Modified: php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt
===
--- php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt  
2011-05-10 11:34:48 UTC (rev 310886)
+++ php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt  
2011-05-10 11:48:10 UTC (rev 310887)
@@ -1,5 +1,5 @@
 --TEST--
-OO API: get_errno  get_error functions
+OO API: getErrno  getError functions
 --CREDITS--
 Boris Lytochkin
 --SKIPIF--
@@ -19,29 +19,29 @@
 echo SNMP::ERRNO_NOERROR\n;
 $session = new SNMP(SNMP_VERSION_2c, $hostname, $community, $timeout, 
$retries);
 var_dump(@$session-get('.1.3.6.1.2.1.1.1.0'));
-var_dump($session-get_errno() == SNMP::ERRNO_NOERROR);
-var_dump($session-get_error());
+var_dump($session-getErrno() == SNMP::ERRNO_NOERROR);
+var_dump($session-getError());
 $session-close();

 echo SNMP::ERRNO_TIMEOUT\n;
 $session = new SNMP(SNMP_VERSION_2c, $hostname, 'timeout_community_432', 
$timeout, $retries);
 $session-valueretrieval = SNMP_VALUE_LIBRARY;
 var_dump(@$session-get('.1.3.6.1.2.1.1.1.0'));
-var_dump($session-get_errno() == SNMP::ERRNO_TIMEOUT);
-var_dump($session-get_error());
+var_dump($session-getErrno() == SNMP::ERRNO_TIMEOUT);
+var_dump($session-getError());
 $session-close();
 echo SNMP::ERRNO_ERROR_IN_REPLY\n;
 $session = new SNMP(SNMP_VERSION_2c, $hostname, $community, $timeout, 
$retries);
 var_dump(@$session-get('.1.3.6.1.2.1.1.1.110'));
-var_dump($session-get_errno() == SNMP::ERRNO_ERROR_IN_REPLY);
-var_dump($session-get_error());
+var_dump($session-getErrno() == SNMP::ERRNO_ERROR_IN_REPLY);
+var_dump($session-getError());
 $session-close();
 echo SNMP::ERRNO_GENERIC\n;
 $session = new SNMP(SNMP_VERSION_3, $hostname, 'somebogususer', $timeout, 
$retries);
 $session-setSecurity('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass);
 var_dump(@$session-get('.1.3.6.1.2.1.1.1.0'));
-var_dump($session-get_errno() == SNMP::ERRNO_GENERIC);
-var_dump($session-get_error());
+var_dump($session-getErrno() == SNMP::ERRNO_GENERIC);
+var_dump($session-getError());
 $session-close();
 ?
 --EXPECTF--

-- 
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/standard/head.c trunk/ext/standard/head.c

2011-05-10 Thread Scott MacVicar
scottmac Tue, 10 May 2011 19:09:24 +

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

Log:
Turns out that more than 1% of users clocks are more than a year out of date, 
this causes cookies to never get deleted since the date is in the future.

I can only guess its due to batteries on the motherboard being dead.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/head.c
U   php/php-src/trunk/ext/standard/head.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/head.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/head.c2011-05-10 15:20:03 UTC 
(rev 310924)
+++ php/php-src/branches/PHP_5_3/ext/standard/head.c2011-05-10 19:09:24 UTC 
(rev 310925)
@@ -115,10 +115,9 @@
/*
 * MSIE doesn't delete a cookie when you set it to a null value
 * so in order to force cookies to be deleted, even on MSIE, we
-* pick an expiry date 1 year and 1 second in the past
+* pick an expiry date in the past
 */
-   time_t t = time(NULL) - 31536001;
-   dt = php_format_date(D, d-M-Y H:i:s T, sizeof(D, d-M-Y H:i:s 
T)-1, t, 0 TSRMLS_CC);
+   dt = php_format_date(D, d-M-Y H:i:s T, sizeof(D, d-M-Y H:i:s 
T)-1, 1, 0 TSRMLS_CC);
snprintf(cookie, len + 100, Set-Cookie: %s=deleted; 
expires=%s, name, dt);
efree(dt);
} else {

Modified: php/php-src/trunk/ext/standard/head.c
===
--- php/php-src/trunk/ext/standard/head.c   2011-05-10 15:20:03 UTC (rev 
310924)
+++ php/php-src/trunk/ext/standard/head.c   2011-05-10 19:09:24 UTC (rev 
310925)
@@ -114,10 +114,9 @@
/*
 * MSIE doesn't delete a cookie when you set it to a null value
 * so in order to force cookies to be deleted, even on MSIE, we
-* pick an expiry date 1 year and 1 second in the past
+* pick an expiry date in the past
 */
-   time_t t = time(NULL) - 31536001;
-   dt = php_format_date(D, d-M-Y H:i:s T, sizeof(D, d-M-Y H:i:s 
T)-1, t, 0 TSRMLS_CC);
+   dt = php_format_date(D, d-M-Y H:i:s T, sizeof(D, d-M-Y H:i:s 
T)-1, 1, 0 TSRMLS_CC);
snprintf(cookie, len + 100, Set-Cookie: %s=deleted; 
expires=%s, name, dt);
efree(dt);
} else {

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

[PHP-CVS] svn: /php/php-src/trunk/ext/snmp/ config.m4 snmp.c tests/snmp-object-errno-errstr.phpt tests/wrong_hostname.phpt

2011-05-10 Thread Boris Lytochkin
lytboris Tue, 10 May 2011 20:04:26 +

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

Log:
fixed typos in tests
ucd-snmp epoch is over, drop legacy memory allocation (non e*)
tune 'buggy snmp_snprint_value' detection on some systems

Changed paths:
U   php/php-src/trunk/ext/snmp/config.m4
U   php/php-src/trunk/ext/snmp/snmp.c
U   php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt
U   php/php-src/trunk/ext/snmp/tests/wrong_hostname.phpt

Modified: php/php-src/trunk/ext/snmp/config.m4
===
--- php/php-src/trunk/ext/snmp/config.m42011-05-10 19:59:07 UTC (rev 
310935)
+++ php/php-src/trunk/ext/snmp/config.m42011-05-10 20:04:26 UTC (rev 
310936)
@@ -62,7 +62,7 @@
   dnl Check for buggy snmp_snprint_value() (net-snmp BUGid 2027834)
   AC_CACHE_CHECK([for buggy snmp_snprint_value], ac_cv_buggy_snprint_value,[
 save_CFLAGS=$CFLAGS
-CFLAGS=$CFLAGS -I${SNMP_PREFIX}/include
+CFLAGS=$CFLAGS -I${SNMP_PREFIX}/include $SNMP_SHARED_LIBADD
 AC_TRY_RUN( [
 #include stdio.h
 #include stdlib.h

Modified: php/php-src/trunk/ext/snmp/snmp.c
===
--- php/php-src/trunk/ext/snmp/snmp.c   2011-05-10 19:59:07 UTC (rev 310935)
+++ php/php-src/trunk/ext/snmp/snmp.c   2011-05-10 20:04:26 UTC (rev 310936)
@@ -440,12 +440,20 @@
 }
 /* }}} */

+#define PHP_SNMP_SESSION_FREE(a) { \
+   if ((*session)-a) { \
+   efree((*session)-a); \
+   (*session)-a = NULL; \
+   } \
+}
+
 static void netsnmp_session_free(php_snmp_session **session)
 {
if (*session) {
-   if ((*session)-peername) {
-   efree((*session)-peername);
-   }
+   PHP_SNMP_SESSION_FREE(peername);
+   PHP_SNMP_SESSION_FREE(community);
+   PHP_SNMP_SESSION_FREE(securityName);
+   PHP_SNMP_SESSION_FREE(contextEngineID);
efree(*session);
*session = NULL;
}
@@ -1115,11 +1123,11 @@

if (version == SNMP_VERSION_3) {
/* Setting the security name. */
-   session-securityName = strdup(community);
+   session-securityName = estrdup(community);
session-securityNameLen = strlen(session-securityName);
} else {
session-authenticator = NULL;
-   session-community = (u_char *)community;
+   session-community = (u_char *)estrdup(community);
session-community_len = strlen(community);
}

@@ -1222,7 +1230,7 @@
 static int netsnmp_session_set_contextEngineID(struct snmp_session *s, char * 
contextEngineID TSRMLS_DC)
 {
size_t  ebuf_len = 32, eout_len = 0;
-   u_char  *ebuf = (u_char *) malloc(ebuf_len); /* memory freed by SNMP 
library, malloc NOT emalloc */
+   u_char  *ebuf = (u_char *) emalloc(ebuf_len);

if (ebuf == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, malloc failure 
setting contextEngineID);
@@ -1230,12 +1238,12 @@
}
if (!snmp_hex_to_binary(ebuf, ebuf_len, eout_len, 1, 
contextEngineID)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Bad engine ID 
value '%s', contextEngineID);
-   free(ebuf);
+   efree(ebuf);
return (-1);
}

if (s-contextEngineID) {
-   free(s-contextEngineID);
+   efree(s-contextEngineID);
}

s-contextEngineID = ebuf;

Modified: php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt
===
--- php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt  
2011-05-10 19:59:07 UTC (rev 310935)
+++ php/php-src/trunk/ext/snmp/tests/snmp-object-errno-errstr.phpt  
2011-05-10 20:04:26 UTC (rev 310936)
@@ -1,5 +1,5 @@
 --TEST--
-OO API: getErrno  getError functions
+OO API: getErrno  getError methods
 --CREDITS--
 Boris Lytochkin
 --SKIPIF--

Modified: php/php-src/trunk/ext/snmp/tests/wrong_hostname.phpt
===
--- php/php-src/trunk/ext/snmp/tests/wrong_hostname.phpt2011-05-10 
19:59:07 UTC (rev 310935)
+++ php/php-src/trunk/ext/snmp/tests/wrong_hostname.phpt2011-05-10 
20:04:26 UTC (rev 310936)
@@ -1,5 +1,5 @@
 --TEST--
-Generic timeout (wrong community)
+Wrong hostname
 --CREDITS--
 Boris Lytochkin
 --SKIPIF--

-- 
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_charset.c trunk/ext/mysqlnd/mysqlnd_charset.c

2011-05-10 Thread Andrey Hristov
andrey   Tue, 10 May 2011 07:15:22 +

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

Log:
Fix range
(thanks again nihen)

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

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c  2011-05-10 
07:06:29 UTC (rev 310875)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c  2011-05-10 
07:15:22 UTC (rev 310876)
@@ -327,7 +327,7 @@

 /* {{{  functions */
 #define valid_sjis_head(c) ((0x81 = (c)  (c) = 0x9F) || (0xE0 = (c) 
 (c) = 0xFC))
-#define valid_sjis_tail(c) ((0x40 = (c)  (c) = 0x7E) || (0x80 = (c) 
 (c) = 0x7C))
+#define valid_sjis_tail(c) ((0x40 = (c)  (c) = 0x7E) || (0x80 = (c) 
 (c) = 0xFC))


 static unsigned int check_mb_sjis(const char *start, const char *end)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2011-05-10 07:06:29 UTC 
(rev 310875)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2011-05-10 07:15:22 UTC 
(rev 310876)
@@ -328,7 +328,7 @@

 /* {{{ sjis functions */
 #define valid_sjis_head(c) ((0x81 = (c)  (c) = 0x9F) || (0xE0 = (c) 
 (c) = 0xFC))
-#define valid_sjis_tail(c) ((0x40 = (c)  (c) = 0x7E) || (0x80 = (c) 
 (c) = 0x7C))
+#define valid_sjis_tail(c) ((0x40 = (c)  (c) = 0x7E) || (0x80 = (c) 
 (c) = 0xFC))


 static unsigned int check_mb_sjis(const char *start, const char *end)

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