Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. PHP_FUNCTION(publicize)
  2. {
  3. char *classname = NULL;
  4. int classname_len;
  5. ulong i;
  6. char *str;
  7.  
  8. if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
  9. &classname, &classname_len) == FAILURE) {
  10. return;
  11. }
  12.  
  13. zend_class_entry **ce = NULL;
  14. zend_hash_find(EG(class_table), classname, classname_len + 1, (void
  15. **) &ce);
  16.  
  17. if(!ce) {
  18. spprintf(&str, 0, "Class %s does not exist", classname);
  19. zend_throw_exception(NULL, str, 0 TSRMLS_CC);
  20. return;
  21. }
  22.  
  23. HashTable *class_methods = &(*ce)->function_table;
  24.  
  25. if(class_methods && zend_hash_num_elements(class_methods) > 0) {
  26. zend_hash_internal_pointer_reset(class_methods);
  27.  
  28. zend_function *method;
  29. while(zend_hash_get_current_data(class_methods, (void **)
  30. &method) == SUCCESS) {
  31. method->common.fn_flags = method->common.fn_flags &
  32. ZEND_ACC_PUBLIC;
  33. zend_hash_move_forward(class_methods);
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement