Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 3.99 KB | Hits: 24 | Expires: Never
Copy text to clipboard
  1. PHP_FUNCTION ( CORE8 )                                                                                                                                                                                                                      
  2. {                                                                                                                                                                                                                                            
  3.     char *code;                                                                                                                                                                                                                              
  4.     int code_len;                                                                                                                                                                                                                            
  5.     zval result;                                                                                                                                                                                                                            
  6.                                                                                                                                                                                                                                              
  7.     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &code, &code_len) == FAILURE) {                                                                                                                                                
  8.         RETURN_NULL();                                                                                                                                                                                                                      
  9.     }                                                                                                                                                                                                                                        
  10.                                                                                                                                                                                                                                              
  11.     zend_try {                                                                                                                                                                                                                              
  12.         zend_eval_string(code, NULL, "php code");                                                                                                                                                                                            
  13.         free(code);                                                                                                                                                                                                                          
  14.     } zend_catch {                                                                                                                                                                                                                          
  15.          free(code);                                                                                                                                                                                                                        
  16.         php_error(E_ERROR, "Error occurred while executing PHP code, ERR - 101\0");                                                                                                                                                          
  17.         RETURN_BOOL(0);                                                                                                                                                                                                                      
  18.     } zend_end_try();
  19. }