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

2013-05-03 Thread Boris Lytochkin
Commit:a39282b64dad04a047f0ff8c230a5a64ad417a2f
Author:Boris Lytochkin  Fri, 3 May 2013 12:15:35 
+0400
Parents:   3828f6227b188bd0c8d829a375ebf51faf67c448
Branches:  PHP-5.4 PHP-5.5 master

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

Log:
update NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index c98167b..b6dc09c 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,9 @@ PHP   
 NEWS
 detected by code coverity scan. (Remi)
   . Log a warning when a syscall fails. (Remi)
 
+- SNMP:
+  . Fixed bug #64765 (Some IPv6 addresses get interpreted wrong).
+   (Boris Lytochkin)
 
 ?? ??? 2013, PHP 5.4.15
 - Core:


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



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

2013-05-03 Thread Boris Lytochkin
Commit:cbe2870b72c4cfdb5c295e83c88d7cff5c39e396
Author:Boris Lytochkin  Fri, 3 May 2013 12:25:49 
+0400
Parents:   1ce836580d03b4468d88d614f5144fdf40a03c4a
Branches:  PHP-5.5 master

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

Log:
update NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 4acfbd8..b038d06 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ PHP 
   NEWS
 detected by code coverity scan. (Remi)
   . Log a warning when a syscall fails. (Remi)
 
+- SNMP:
+  . Fixed bug #64765 (Some IPv6 addresses get interpreted wrong).
+(Boris Lytochkin)
 
 25 Apr 2013, PHP 5.5.0 Beta 4


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



[PHP-CVS] com php-src: Fix bug #64765 (enclose IPv6 address into square brackets): ext/snmp/snmp.c

2013-05-03 Thread Boris Lytochkin
Commit:3828f6227b188bd0c8d829a375ebf51faf67c448
Author:Boris Lytochkin  Fri, 3 May 2013 12:13:50 
+0400
Parents:   5af2c5d20244a7cb3c9345ef4cf8c81997eb0984
Branches:  PHP-5.4 PHP-5.5 master

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

Log:
Fix bug #64765 (enclose IPv6 address into square brackets)

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

Changed paths:
  M  ext/snmp/snmp.c


Diff:
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 0ae140f..fad5d05 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -1162,9 +1162,10 @@ static int netsnmp_session_init(php_snmp_session 
**session_p, int version, char
continue;
}
if ((*res)->sa_family == AF_INET6) {
-   strcpy(session->peername, "udp6:");
+   strcpy(session->peername, "udp6:[");
pptr = session->peername + strlen(session->peername);
inet_ntop((*res)->sa_family, &(((struct 
sockaddr_in6*)(*res))->sin6_addr), pptr, MAX_NAME_LEN);
+   strcat(pptr, "]");
} else if ((*res)->sa_family == AF_INET) {
inet_ntop((*res)->sa_family, &(((struct 
sockaddr_in*)(*res))->sin_addr), pptr, MAX_NAME_LEN);
} else {


--
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/snmp/snmp.c

2013-05-03 Thread Boris Lytochkin
Commit:1ce836580d03b4468d88d614f5144fdf40a03c4a
Author:Boris Lytochkin  Fri, 3 May 2013 12:19:10 
+0400
Parents:   5f67584fd7038ed28087a384c2d76093430ac996 
a39282b64dad04a047f0ff8c230a5a64ad417a2f
Branches:  PHP-5.5 master

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

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

* PHP-5.4:
  update NEWS
  Fix bug #64765 (enclose IPv6 address into square brackets)

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

Changed paths:
  MM  ext/snmp/snmp.c


Diff:



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



[PHP-CVS] com php-src: Fixed bug #64159 (Truncated snmpget): NEWS

2013-05-03 Thread Boris Lytochkin
Commit:2c336c9cde524cb6465bbd75924b7e40251aefab
Author:Boris Lytochkin  Fri, 3 May 2013 15:46:43 
+0400
Parents:   c68f9d5503dda84326cfdde4c5e9c51d077aabd0
Branches:  PHP-5.5 master

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

Log:
Fixed bug #64159 (Truncated snmpget)

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

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index b038d06..00b11c4 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ PHP   
 NEWS
 - SNMP:
   . Fixed bug #64765 (Some IPv6 addresses get interpreted wrong).
 (Boris Lytochkin)
+  . Fixed bug #64159 (Truncated snmpget). (Boris Lytochkin)
 
 25 Apr 2013, PHP 5.5.0 Beta 4


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



[PHP-CVS] com php-src: Fixed bug #64159 (Truncated snmpget): NEWS ext/snmp/snmp.c

2013-05-03 Thread Boris Lytochkin
Commit:e36adfe94a663bc1eeb5d9d378dc80883de179db
Author:Boris Lytochkin  Fri, 3 May 2013 15:35:09 
+0400
Parents:   a39282b64dad04a047f0ff8c230a5a64ad417a2f
Branches:  PHP-5.4 PHP-5.5 master

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

Log:
Fixed bug #64159 (Truncated snmpget)

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

Changed paths:
  M  NEWS
  M  ext/snmp/snmp.c


Diff:
diff --git a/NEWS b/NEWS
index b6dc09c..dba1508 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ PHP   
 NEWS
 - SNMP:
   . Fixed bug #64765 (Some IPv6 addresses get interpreted wrong).
(Boris Lytochkin)
+  . Fixed bug #64159 (Truncated snmpget). (Boris Lytochkin)
 
 ?? ??? 2013, PHP 5.4.15
 - Core:
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index fad5d05..9d854ec 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -561,25 +561,50 @@ static void php_snmp_getvalue(struct variable_list *vars, 
zval *snmpval TSRMLS_D
int buflen = sizeof(sbuf) - 1;
int val_len = vars->val_len;

-   if ((valueretrieval & SNMP_VALUE_PLAIN) == 0) {
-   val_len += 32; /* snprint_value will add type info into value, 
make some space for it */
+   /* use emalloc() for large values, use static array otherwize */
+
+   /* There is no way to know the size of buffer snprint_value() needs in 
order to print a value there.
+* So we are forced to probe it
+*/
+   while ((valueretrieval & SNMP_VALUE_PLAIN) == 0) {
+   *buf = '\0';
+   if (snprint_value(buf, buflen, vars->name, vars->name_length, 
vars) == -1) {
+/* buffer is not long enough to hold full output, 
double it */
+   val_len *= 2;
+   } else {
+   break;
+   }
+
+   if (buf == dbuf) {
+   dbuf = (char *)erealloc(dbuf, val_len + 1);
+   } else {
+   dbuf = (char *)emalloc(val_len + 1);
+   }
+
+   if (!dbuf) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "emalloc() 
failed: %s, fallback to static buffer", strerror(errno));
+   buf = &(sbuf[0]);
+   buflen = sizeof(sbuf) - 1;
+   break;
+   }
+
+   buf = dbuf;
+   buflen = val_len;
}
 
-   /* use emalloc() for large values, use static array otherwize */
-   if(val_len > buflen){
+   if((valueretrieval & SNMP_VALUE_PLAIN) && val_len > buflen){
if ((dbuf = (char *)emalloc(val_len + 1))) {
buf = dbuf;
buflen = val_len;
} else {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "emalloc() 
failed: %s, fallback to static array", strerror(errno));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "emalloc() 
failed: %s, fallback to static buffer", strerror(errno));
}
}
 
-   *buf = 0;
-
MAKE_STD_ZVAL(val);
 
if (valueretrieval & SNMP_VALUE_PLAIN) {
+   *buf = 0;
switch (vars->type) {
case ASN_BIT_STR:   /* 0x03, asn1.h */
ZVAL_STRINGL(val, (char *)vars->val.bitstring, 
vars->val_len, 1);
@@ -652,7 +677,7 @@ static void php_snmp_getvalue(struct variable_list *vars, 
zval *snmpval TSRMLS_D
break;
}
} else /* use Net-SNMP value translation */ {
-   snprint_value(buf, buflen, vars->name, vars->name_length, vars);
+   /* we have desired string in buffer, just use it */
ZVAL_STRING(val, buf, 1);
}


--
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/snmp/snmp.c

2013-05-03 Thread Boris Lytochkin
Commit:c68f9d5503dda84326cfdde4c5e9c51d077aabd0
Author:Boris Lytochkin  Fri, 3 May 2013 15:39:57 
+0400
Parents:   cbe2870b72c4cfdb5c295e83c88d7cff5c39e396 
e36adfe94a663bc1eeb5d9d378dc80883de179db
Branches:  PHP-5.5 master

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

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

* PHP-5.4:
  Fixed bug #64159 (Truncated snmpget)

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

Changed paths:
  MM  ext/snmp/snmp.c


Diff:



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



[PHP-CVS] com php-src: Fixed bug #64770 stream_select() fails with pipes: NEWS ext/standard/streamsfuncs.c ext/standard/tests/streams/bug64770.phpt

2013-05-03 Thread Anatol Belski
Commit:b1ea0b7a7a580f074d889f9ff7a46566917088f2
Author:Anatol Belski  Fri, 3 May 2013 17:01:33 +0200
Parents:   aa448adc8347c072421103d1a92b0a7a75ec873f
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

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

Log:
Fixed bug #64770 stream_select() fails with pipes

returned by proc_open() on Windows x64

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

Changed paths:
  M  NEWS
  M  ext/standard/streamsfuncs.c
  A  ext/standard/tests/streams/bug64770.phpt


Diff:
diff --git a/NEWS b/NEWS
index cd865d2..2d831ae 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,10 @@ PHP  
  NEWS
   . Fixed bug #64726 (Segfault when calling fetch_object on a use_result and DB
 pointer has closed). (Laruence)
 
+- Streams:
+  . Fixed bug #64770 (stream_select() fails with pipes returned by proc_open()
+on Windows x64). (Anatol)
+
 ?? ??? 2013, PHP 5.3.25
 
 ### ADD ENTRIES ABOVE FOR 5.3.26. 5.3.25 NEWS WILL BE UPDATED BY RM ON MERGE 
###
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 27042f6..465d72d 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -611,7 +611,7 @@ static int stream_array_to_fd_set(zval *stream_array, 
fd_set *fds, php_socket_t
 {
zval **elem;
php_stream *stream;
-   php_socket_t this_fd;
+   php_socket_t this_fd = 0;
int cnt = 0;
 
if (Z_TYPE_P(stream_array) != IS_ARRAY) {
@@ -648,7 +648,7 @@ static int stream_array_from_fd_set(zval *stream_array, 
fd_set *fds TSRMLS_DC)
zval **elem, **dest_elem;
php_stream *stream;
HashTable *new_hash;
-   php_socket_t this_fd;
+   php_socket_t this_fd = 0;
int ret = 0;
 
if (Z_TYPE_P(stream_array) != IS_ARRAY) {
diff --git a/ext/standard/tests/streams/bug64770.phpt 
b/ext/standard/tests/streams/bug64770.phpt
new file mode 100644
index 000..ae738d8
--- /dev/null
+++ b/ext/standard/tests/streams/bug64770.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Bug #64770 stream_select() fails with pipes from proc_open() 
+--FILE--
+ array('pipe', 'r'), // stdin
+   1 => array('pipe', 'w'), // stdout
+   2 => array('pipe', 'w'), // strerr
+);
+
+$other_opts = array('suppress_errors' => false, 'binary_pipes' => true);
+
+$p = proc_open('dir', $descs, $pipes, '.', NULL, $other_opts);
+
+if (is_resource($p)) {
+   $data = '';
+
+   while (1) { 
+   $w = $e = NULL;
+   $n = stream_select($pipes, $w, $e, 300);
+
+   if ($n === false) {
+   echo "no streams \n";
+   break;
+   } else if ($n === 0) {
+   echo "process timed out\n";
+   proc_terminate($p, 9);
+   break;
+   } else if ($n > 0) {
+   $line = fread($pipes[1], 8192);
+   if (strlen($line) == 0) {
+   /* EOF */
+   break;
+   }
+   $data .= $line;
+   }
+   }
+   var_dump(strlen($data));
+
+   $ret = proc_close($p);
+   var_dump($ret);
+} else {
+   echo "no process\n";
+}
+?>
+==DONE==
+--EXPECTF--
+int(%d)
+int(0)
+==DONE==


--
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.3' into PHP-5.4: ext/standard/streamsfuncs.c

2013-05-03 Thread Anatol Belski
Commit:aa4762572ee85e29e7d3cb063444f97074f61b85
Author:Anatol Belski  Fri, 3 May 2013 17:03:16 +0200
Parents:   e36adfe94a663bc1eeb5d9d378dc80883de179db 
b1ea0b7a7a580f074d889f9ff7a46566917088f2
Branches:  PHP-5.4 PHP-5.5 master

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

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

* PHP-5.3:
  Fixed bug #64770 stream_select() fails with pipes

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

Changed paths:
  MM  ext/standard/streamsfuncs.c


Diff:



--
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-05-03 Thread Anatol Belski
Commit:b1c24d1eac3a7e1521b2a9ee57d096e9a156d76d
Author:Anatol Belski  Fri, 3 May 2013 17:04:26 +0200
Parents:   aa4762572ee85e29e7d3cb063444f97074f61b85
Branches:  PHP-5.4 PHP-5.5 master

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

Log:
updated NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index dba1508..7040afc 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,8 @@ PHP   
 NEWS
 - Streams:
   . Fixed Windows x64 version of stream_socket_pair() and improved error
 handling. (Anatol Belski)
+  . Fixed bug #64770 (stream_select() fails with pipes returned by proc_open()
+on Windows x64). (Anatol)
 
 11 Apr 2013, PHP 5.4.14


--
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-05-03 Thread Anatol Belski
Commit:f7830e4f985d67de37078fe8033e8bde32fff6cc
Author:Anatol Belski  Fri, 3 May 2013 17:05:54 +0200
Parents:   6d41711fd9c86e6f99358bffa5b3342a415461cc
Branches:  PHP-5.5 master

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

Log:
updated NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 00b11c4..f1132f2 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,10 @@ PHP  
  NEWS
 (Boris Lytochkin)
   . Fixed bug #64159 (Truncated snmpget). (Boris Lytochkin)
 
+- Streams:
+  . Fixed bug #64770 (stream_select() fails with pipes returned by proc_open()
+on Windows x64). (Anatol)
+
 25 Apr 2013, PHP 5.5.0 Beta 4
 
 - Core:


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



[PHP-CVS] com php-src: cut PHP_VERSION_ID - we know API version now: ext/snmp/snmp.c

2013-05-03 Thread Boris Lytochkin
Commit:1c8befe893cb9b12a6122c04b8fb239e371a15d6
Author:Boris Lytochkin  Fri, 3 May 2013 19:22:21 
+0400
Parents:   74ef9b6ceab4a2fb7a18380eb759b00c07ee5d5b
Branches:  PHP-5.5

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

Log:
cut PHP_VERSION_ID - we know API version now

Changed paths:
  M  ext/snmp/snmp.c


Diff:
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 756e531..eb2eab3 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -80,14 +80,6 @@
 #include 
 #include 
 
-#if PHP_VERSION_ID < 50300
-#define Z_ADDREF_P(pz) pz->refcount++
-#define Z_ISREF_PP(oid) (PZVAL_IS_REF(*(oid)))
-#define Z_REFCOUNT_P(pz) pz->refcount
-#define Z_SET_REFCOUNT_P(pz, rc) pz->refcount = rc
-#define zend_parse_parameters_none() zend_parse_parameters(ZEND_NUM_ARGS() 
TSRMLS_CC, "")
-#endif
-
 /* For net-snmp prior to 5.4 */
 #ifndef HAVE_SHUTDOWN_SNMP_LOGGING
 extern netsnmp_log_handler *logh_head;
@@ -497,9 +489,6 @@ static void php_snmp_object_free_storage(void *object 
TSRMLS_DC)
 
 static zend_object_value php_snmp_object_new(zend_class_entry *class_type 
TSRMLS_DC) /* {{{ */
 {
-#if PHP_VERSION_ID < 50399
-   zval *tmp;
-#endif
zend_object_value retval;
php_snmp_object *intern;
 
@@ -508,11 +497,7 @@ static zend_object_value 
php_snmp_object_new(zend_class_entry *class_type TSRMLS
memset(&intern->zo, 0, sizeof(php_snmp_object));
 
zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
-#if PHP_VERSION_ID < 50399
-   zend_hash_copy(intern->zo.properties, &class_type->default_properties, 
(copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *));
-#else
object_properties_init(&intern->zo, class_type);
-#endif
 
retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t)zend_objects_destroy_object, 
(zend_objects_free_object_storage_t) php_snmp_object_free_storage, NULL 
TSRMLS_CC);
retval.handlers = (zend_object_handlers *) &php_snmp_object_handlers;
@@ -1801,11 +1786,7 @@ PHP_FUNCTION(snmp_read_mib)
char *filename;
int filename_len;
 
-#if PHP_VERSION_ID < 50399
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, 
&filename_len) == FAILURE) {
-#else
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, 
&filename_len) == FAILURE) {
-#endif
RETURN_FALSE;
}
 
@@ -1830,31 +1811,17 @@ PHP_METHOD(snmp, __construct)
long retries = SNMP_DEFAULT_RETRIES;
long version = SNMP_DEFAULT_VERSION;
int argc = ZEND_NUM_ARGS();
-#if PHP_VERSION_ID > 50300
zend_error_handling error_handling;
-#endif
 
snmp_object = (php_snmp_object *)zend_object_store_get_object(object 
TSRMLS_CC);
-#if PHP_VERSION_ID > 50300
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
-#else
-   php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) 
TSRMLS_CC);
-#endif

if (zend_parse_parameters(argc TSRMLS_CC, "lss|ll", &version, &a1, 
&a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) {
-#if PHP_VERSION_ID > 50300
zend_restore_error_handling(&error_handling TSRMLS_CC);
-#else
-   php_std_error_handling();
-#endif
return;
}
 
-#if PHP_VERSION_ID > 50300
zend_restore_error_handling(&error_handling TSRMLS_CC);
-#else
-   php_std_error_handling();
-#endif
 
switch(version) {
case SNMP_VERSION_1:
@@ -2002,11 +1969,7 @@ void php_snmp_add_property(HashTable *h, const char 
*name, size_t name_length, p
 
 /* {{{ php_snmp_read_property(zval *object, zval *member, int type[, const 
zend_literal *key])
Generic object property reader */
-#if PHP_VERSION_ID < 50399
-zval *php_snmp_read_property(zval *object, zval *member, int type TSRMLS_DC)
-#else
 zval *php_snmp_read_property(zval *object, zval *member, int type, const 
zend_literal *key TSRMLS_DC)
-#endif
 {
zval tmp_member;
zval *retval;
@@ -2036,11 +1999,7 @@ zval *php_snmp_read_property(zval *object, zval *member, 
int type, const zend_li
}
} else {
zend_object_handlers * std_hnd = zend_get_std_object_handlers();
-#if PHP_VERSION_ID < 50399
-   retval = std_hnd->read_property(object, member, type TSRMLS_CC);
-#else
retval = std_hnd->read_property(object, member, type, key 
TSRMLS_CC);
-#endif
}
 
if (member == &tmp_member) {
@@ -2052,11 +2011,7 @@ zval *php_snmp_read_property(zval *object, zval *member, 
int type, const zend_li
 
 /* {{{ php_snmp_write_property(zval *object, zval *member, zval *value[, const 
zend_literal *key])
Generic object property writer */
-#if PHP_VERSION_ID < 50399
-void php_snmp_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
-#else
 void php_snmp_write_property(zval *object, zval *member, zval *value, const 
zend_literal *key T

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

2013-05-03 Thread Boris Lytochkin
Commit:eff60f993ccc9d9bbf0e2c2da12c124578be2bf9
Author:Boris Lytochkin  Fri, 3 May 2013 23:10:11 
+0400
Parents:   1c8befe893cb9b12a6122c04b8fb239e371a15d6 
c34274acb8dedda6cbb05a54fa8a2bd0b4533be1
Branches:  PHP-5.5 master

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

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

* PHP-5.4:
  re-work walkaround for net-snmp BUGid 2027834, no need to detect it anymore 
add test for Bug #64159 bump default buffer size for values(32->512): do not 
reallocate buffers in 99% cases

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

Changed paths:
  MM  ext/snmp/snmp.c


Diff:



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



[PHP-CVS] com php-src: re-work walkaround for net-snmp BUGid 2027834, no need to detect it anymore add test for Bug #64159 bump default buffer size for values(32->512): do not reallocate buffers in 99

2013-05-03 Thread Boris Lytochkin
Commit:c34274acb8dedda6cbb05a54fa8a2bd0b4533be1
Author:Boris Lytochkin  Fri, 3 May 2013 23:06:34 
+0400
Parents:   3a413f216abb1ce6564d4b8bd493664c32eb928a
Branches:  PHP-5.4 PHP-5.5 master

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

Log:
re-work walkaround for net-snmp BUGid 2027834, no need to detect it anymore
add test for Bug #64159
bump default buffer size for values(32->512): do not reallocate buffers in 99% 
cases

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

Changed paths:
  M  ext/snmp/config.m4
  M  ext/snmp/snmp.c
  M  ext/snmp/tests/README
  A  ext/snmp/tests/bigtest.sh
  A  ext/snmp/tests/bug64159.phpt
  M  ext/snmp/tests/snmpd.conf


Diff:
diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4
index ccb7eea..9c0b82f 100644
--- a/ext/snmp/config.m4
+++ b/ext/snmp/config.m4
@@ -59,67 +59,6 @@ if test "$PHP_SNMP" != "no"; then
 $SNMP_SHARED_LIBADD
   ])
 
-  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 $SNMP_SHARED_LIBADD"
-AC_TRY_RUN( [
-#include 
-#include 
-#include 
-#include 
-#include 
-
-u_char uname[] = "Linux nex1.php.net 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 
17:53:09 EST 2011 i686";
-
-int main(int argc, char **argv)
-{
-   struct variable_list vars;
-   char buf1[2048];
-   char buf2[sizeof(buf1)];
-   
-   memset(&(buf1[0]), 0, sizeof(buf1));
-   memset(&(buf2[0]), 0, sizeof(buf2));
-   memset(&vars, 0, sizeof(vars));
-   vars.type = 4;
-   vars.val.integer = (long *)&(uname[0]);
-   vars.val.string = &(uname[0]);
-   vars.val.bitstring = &(uname[0]);
-   vars.val.counter64 = (struct counter64 *)&(uname[0]);
-   vars.val.floatVal = (float *)&(uname[0]);
-   vars.val_len = sizeof(uname),
-   vars.name_loc[0] = 1;
-   vars.name_loc[1] = 3;
-   vars.name_loc[2] = 6;
-   vars.name_loc[3] = 1;
-   vars.name_loc[4] = 2;
-   vars.name_loc[5] = 1;
-   vars.name_loc[6] = 1;
-   vars.name_loc[7] = 1;
-   vars.name = (oid *)&(vars.name_loc);
-   vars.name_length = 9;
-
-   init_snmp("snmpapp");
-
-   netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
NETSNMP_DS_LIB_QUICK_PRINT, 0);
-
-   snprint_value(buf1, (sizeof(uname) + 32), vars.name, vars.name_length, 
&vars);
-   snprint_value(buf2, sizeof(buf2), vars.name, vars.name_length, &vars);
-   exit((strncmp(buf1, buf2, sizeof(buf1)) != 0));
-}
-],[
-  ac_cv_buggy_snprint_value=no
-],[
-  ac_cv_buggy_snprint_value=yes
-],[
-  ac_cv_buggy_snprint_value=no
-])
-CFLAGS="$save_CFLAGS"
-  ])
-  if test "$ac_cv_buggy_snprint_value" = "yes"; then
- AC_DEFINE(BUGGY_SNMPRINT_VALUE, 1, [ ])
-  fi
-
   PHP_NEW_EXTENSION(snmp, snmp.c, $ext_shared)
   PHP_SUBST(SNMP_SHARED_LIBADD)
 fi
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 9d854ec..c976928 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -551,11 +551,7 @@ static void php_snmp_error(zval *object, const char 
*docref TSRMLS_DC, int type,
 static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval 
TSRMLS_DC, int valueretrieval)
 {
zval *val;
-#ifdef BUGGY_SNMPRINT_VALUE
-   char sbuf[2048];
-#else
-   char sbuf[64];
-#endif
+   char sbuf[512];
char *buf = &(sbuf[0]);
char *dbuf = (char *)NULL;
int buflen = sizeof(sbuf) - 1;
@@ -569,6 +565,10 @@ static void php_snmp_getvalue(struct variable_list *vars, 
zval *snmpval TSRMLS_D
while ((valueretrieval & SNMP_VALUE_PLAIN) == 0) {
*buf = '\0';
if (snprint_value(buf, buflen, vars->name, vars->name_length, 
vars) == -1) {
+   if (val_len > 512*1024) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"snprint_value() asks for a buffer more than 512k, Net-SNMP bug?");
+   break;
+   }
 /* buffer is not long enough to hold full output, 
double it */
val_len *= 2;
} else {
diff --git a/ext/snmp/tests/README b/ext/snmp/tests/README
index 819a50d..0db1a4f 100644
--- a/ext/snmp/tests/README
+++ b/ext/snmp/tests/README
@@ -35,6 +35,8 @@ On Linux/FreeBSD
 Before launching daemon make sure that there is no file 
/var/net-snmp/snmpd.conf
 Delete it if exists. Ingoring to to so will fail SNMPv3 tests.
 
+- Place bigtest.sh near snmpd.conf, tune path to it in snmpd.conf
+
 - Launch snmpd (service snmpd start or /etc/init.d/snmpd start).
   Alternatively you can start snmpd daemon using following command line:
 sudo snmpd -C -c ./snmpd.conf -f -Le
diff --git a/ext/snmp/tests/bigtest.sh b/ext/snmp/tests/bigtest.sh
new file mode 100755
index 000..d0d8be7
--- /dev/null
+++ b/ext/snmp/tests/bigtest.sh
@@ -0,0 +1,10 @@
+#!/

[PHP-CVS] com php-src: remove OS-specific OIDs from 'WALK multiple on single OID with OID suffix as keys' test part: ext/snmp/tests/snmp-object.phpt

2013-05-03 Thread Boris Lytochkin
Commit:8c3b8f39aa00fb4a24191d9f846cd2f4006cf23d
Author:Boris Lytochkin  Sat, 4 May 2013 00:04:52 
+0400
Parents:   c34274acb8dedda6cbb05a54fa8a2bd0b4533be1
Branches:  PHP-5.4 PHP-5.5 master

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

Log:
remove OS-specific OIDs from
'WALK multiple on single OID with OID suffix as keys' test part

Changed paths:
  M  ext/snmp/tests/snmp-object.phpt


Diff:
diff --git a/ext/snmp/tests/snmp-object.phpt b/ext/snmp/tests/snmp-object.phpt
index 522d417..40567da 100644
--- a/ext/snmp/tests/snmp-object.phpt
+++ b/ext/snmp/tests/snmp-object.phpt
@@ -90,12 +90,6 @@ array_shift($z);
 var_dump(key($z));
 array_shift($z);
 var_dump(key($z));
-array_shift($z);
-var_dump(key($z));
-array_shift($z);
-var_dump(key($z));
-array_shift($z);
-var_dump(key($z));
 var_dump($session->close());
 
 echo "SNMPv3 (default security settings)\n";
@@ -211,9 +205,6 @@ string(3) "2.0"
 string(3) "3.0"
 string(3) "4.0"
 string(3) "5.0"
-string(3) "6.0"
-string(3) "7.0"
-string(3) "8.0"
 bool(true)
 SNMPv3 (default security settings)
 string(%d) "%S"


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