Req #80661 [Opn]: Add string output format function for SNMP

From: Date: Sun, 24 Jan 2021 01:09:50 +0000
Subject: Req #80661 [Opn]: Add string output format function for SNMP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231728@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80661&edit=1 ID: 80661 User updated by: thewitness at cacti dot net Reported by: thewitness at cacti dot net Summary: Add string output format function for SNMP Status: Open Type: Feature/Change Request Package: SNMP related PHP Version: Next minor version Block user comment: N Private report: N New Comment: Okay, getting a hang of the code now. Previous Comments: ------------------------------------------------------------------------ [2021-01-23 22:34:27] thewitness at cacti dot net Here is what I get with stock master: [root@vmhost3 php-src-master]# make /bin/sh /root/php-src-master/libtool --silent --preserve-dup-deps --mode=compile cc -std=gnu99 -Iext/snmp/ -I/root/php-src-master/ext/snmp/ -I/root/php-src-master/include -I/root/php-src-master/main -I/root/php-src-master -I/root/php-src-master/ext/date/lib -I/usr/include/libxml2 -I/root/php-src-master/TSRM -I/root/php-src-master/Zend -fno-common -Wlogical-op -Wno-clobbered -Wall -Wextra -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-sign-compare -g -O2 -fvisibility=hidden -DZEND_SIGNALS -c /root/php-src-master/ext/snmp/snmp.c -o ext/snmp/snmp.lo In file included from /root/php-src-master/main/php.h:35:0, from /root/php-src-master/ext/snmp/snmp.c:26: /root/php-src-master/Zend/zend_API.h:77:88: error: expected expression before ‘,’ token #define ZEND_RAW_FENTRY(zend_name, name, arg_info, flags) { zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags }, ^ /root/php-src-master/Zend/zend_API.h:83:38: note: in expansion of macro ‘ZEND_RAW_FENTRY’ #define ZEND_FE(name, arg_info) ZEND_RAW_FENTRY(#name, zif_##name, arg_info, 0) ^ /root/php-src-master/ext/snmp/snmp_arginfo.h:217:2: note: in expansion of macro ‘ZEND_FE’ ZEND_FE(snmp_set_string_output_format, arginfo_snmp_set_string_output_format) ^ /root/php-src-master/Zend/zend_API.h:77:88: warning: missing initializer for field ‘arg_info’ of ‘zend_function_entry’ [-Wmissing-field-initializers] #define ZEND_RAW_FENTRY(zend_name, name, arg_info, flags) { zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags }, ^ /root/php-src-master/Zend/zend_API.h:83:38: note: in expansion of macro ‘ZEND_RAW_FENTRY’ #define ZEND_FE(name, arg_info) ZEND_RAW_FENTRY(#name, zif_##name, arg_info, 0) ^ /root/php-src-master/ext/snmp/snmp_arginfo.h:217:2: note: in expansion of macro ‘ZEND_FE’ ZEND_FE(snmp_set_string_output_format, arginfo_snmp_set_string_output_format) ^ In file included from /root/php-src-master/main/php.h:35:0, from /root/php-src-master/ext/snmp/snmp.c:26: /root/php-src-master/Zend/zend_API.h:38:40: note: ‘arg_info’ declared here const struct _zend_internal_arg_info *arg_info; ^ cc1: warning: unrecognized command line option "-Wno-implicit-fallthrough" [enabled by default] make: *** [ext/snmp/snmp.lo] Error 1 ------------------------------------------------------------------------ [2021-01-23 22:23:52] thewitness at cacti dot net For some reason on the master branch and stock source, when I run ./configure --with-snmp, I'm getting errors. I was able to compile just fine on PHP-7.3.26 with my changes though. I had had to slightly modify the source for 7.3.26 due to some changes, making changes to php-snmp with the stock master as the basis, with --with-snmp is failing. My guess is that there have been a bunch of type definition changes that have not been migrated to 'master'. There's been a lot of changes between releases, so I'll track the commits and wait for some upstream fixes before doing a pull. ------------------------------------------------------------------------ [2021-01-22 21:59:38] girgias@php.net As this is a new feature this can only be added in PHP 8.1.0. Please provide a PR to the master branch of php-src on GitHub. It might also need an RFC depending on the scope. ------------------------------------------------------------------------ [2021-01-22 18:28:02] thewitness at cacti dot net I've got the fix building on PHP-8 branch. It's to add a new function: snmp_string_output_format(blah); Do you want a patch, or a pull request? If so, from what branch? ------------------------------------------------------------------------ [2021-01-22 18:26:23] thewitness at cacti dot net Description: ------------ The various native snmp commands for some time have supported what is referred to as a string out put format of: GUESS ASCII HEX However, the current php-snmp implementation can not take advantage of those directives when performing a walk or a get of a variable. Test script: --------------- N/A ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80661&edit=1

« previous php.bugs (#231728) next »