LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   PHP - zend_hash_find throwing segmentation fault (https://www.linuxquestions.org/questions/debian-26/php-zend_hash_find-throwing-segmentation-fault-4175546211/)

gamelaster 06-23-2015 11:24 AM

PHP - zend_hash_find throwing segmentation fault
 
Good day,

first, this is a first forum where i though i can write my trouble, so if im wrong, + move or delete. Thanks

To topic, i trying to run a (relative) old DBUS library for PHP (https://github.com/GAMELASTER/php-dbus - my fork and upgrade for success building) and SkypePHP library (https://github.com/fujimoto/php-skype ). I successfully fixed a DBUS (just trivial forgot of rename) and builded. When i execute skype_bot.php from console as root, its little work but then PHP throw Segmentation fault. Im not a newbie in programming and linux, but with c++ and linux building-debugging i dont have some skills. But i gets a GDB dump and found the root of trouble.
GDB pastebins:
http://pastebin .com/aXnumw74
http://pastebin .com/kWsKkipV

PHP Code:

/* {{{ _dbus_message_resource */
static DBusMessage_dbus_message_resource(zval *obj TSRMLS_DC) {
   
zval **tmp;
   
int resource_type;
   
   if (
obj == NULL) {
      return 
NULL;
   }
   
dbus_objprop_get(*obj"message"tmp0); // line 308
   
if (tmp == NULL) {
      return 
NULL;
   }
   
void *message = (void*)zend_list_find(Z_LVAL_PP(tmp), &resource_type);
   if (
message == NULL || resource_type != le_dbus_message) {
      
php_error_docref(NULL TSRMLS_CCE_WARNING"message identifier not found");
      return 
NULL;
   }

   return 
message;



Here is macro for dbus_objprop_get:
PHP Code:

#define   dbus_objprop_get(zv, key, element, on_error) { \
   
fprintf(stderr"execute dbus_objprop_get\n");\
   if (
zend_hash_find(Z_OBJPROP(zv), keystrlen(key)+1, (void**)&element) != SUCCESS) { \
      
fprintf(stderr"all good\n");\
      
php_error_docref(NULL TSRMLS_CCE_WARNING"property [%s] is not set"key); \
      
fprintf(stderr"good2\n");\
      
element NULL; \
      
on_error; \
   } \


So trouble is in zend_hash_find... As i said, i dont have so much experiences but... :-) I tryied to print a zv, key, element, on_error ... But i dont knowed the values of zend_hash_find so i cant fprintf (my low skills in C++). So, what to do now?

Thanks

P.S. If im fully wrong, where i can ask to this problem? (I tryied ask a author of PHP DBUS but he is inactive... :/ )


All times are GMT -5. The time now is 09:12 AM.