felipe Fri May 16 12:18:43 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard dl.c dl.h Log: - MFH: Improved fix (used 's' in parameter parsing) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dl.c?r1=1.106.2.1.2.5.2.7&r2=1.106.2.1.2.5.2.8&diff_format=u Index: php-src/ext/standard/dl.c diff -u php-src/ext/standard/dl.c:1.106.2.1.2.5.2.7 php-src/ext/standard/dl.c:1.106.2.1.2.5.2.8 --- php-src/ext/standard/dl.c:1.106.2.1.2.5.2.7 Fri May 16 03:01:20 2008 +++ php-src/ext/standard/dl.c Fri May 16 12:18:43 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dl.c,v 1.106.2.1.2.5.2.7 2008/05/16 03:01:20 felipe Exp $ */ +/* $Id: dl.c,v 1.106.2.1.2.5.2.8 2008/05/16 12:18:43 felipe Exp $ */ #include "php.h" #include "dl.h" @@ -53,13 +53,12 @@ Load a PHP extension at runtime */ PHP_FUNCTION(dl) { - zval *filename; + char *filename; + int filename_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/", &filename) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { return; } - - convert_to_string(filename); if (!PG(enable_dl)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Dynamically loaded extensions aren't enabled"); @@ -69,7 +68,7 @@ RETURN_FALSE; } - if (Z_STRLEN_P(filename) >= MAXPATHLEN) { + if (filename_len >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "File name exceeds the maximum allowed length of %d characters", MAXPATHLEN); RETURN_FALSE; } @@ -79,10 +78,10 @@ (strncmp(sapi_module.name, "embed", 5) != 0) ) { #ifdef ZTS - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported in multithreaded Web servers - use extension=%s in your php.ini", Z_STRVAL_P(filename)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported in multithreaded Web servers - use extension=%s in your php.ini", filename); RETURN_FALSE; #else - php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "dl() is deprecated - use extension=%s in your php.ini", Z_STRVAL_P(filename)); + php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "dl() is deprecated - use extension=%s in your php.ini", filename); #endif } @@ -250,14 +249,10 @@ /* {{{ php_dl */ -PHPAPI void php_dl(zval *file, int type, zval *return_value, int start_now TSRMLS_DC) +PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now TSRMLS_DC) { - char *filename; - - filename = Z_STRVAL_P(file); - /* Load extension */ - if (php_load_extension(filename, type, start_now TSRMLS_CC) == FAILURE) { + if (php_load_extension(file, type, start_now TSRMLS_CC) == FAILURE) { RETVAL_FALSE; } else { RETVAL_TRUE; @@ -272,9 +267,9 @@ #else -PHPAPI void php_dl(zval *file, int type, zval *return_value, int start_now TSRMLS_DC) +PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now TSRMLS_DC) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", Z_STRVAL_P(file)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", file); RETURN_FALSE; } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dl.h?r1=1.23.2.1.2.1.2.2&r2=1.23.2.1.2.1.2.3&diff_format=u Index: php-src/ext/standard/dl.h diff -u php-src/ext/standard/dl.h:1.23.2.1.2.1.2.2 php-src/ext/standard/dl.h:1.23.2.1.2.1.2.3 --- php-src/ext/standard/dl.h:1.23.2.1.2.1.2.2 Mon Dec 31 07:17:14 2007 +++ php-src/ext/standard/dl.h Fri May 16 12:18:43 2008 @@ -18,13 +18,13 @@ +----------------------------------------------------------------------+ */ -/* $Id: dl.h,v 1.23.2.1.2.1.2.2 2007/12/31 07:17:14 sebastian Exp $ */ +/* $Id: dl.h,v 1.23.2.1.2.1.2.3 2008/05/16 12:18:43 felipe Exp $ */ #ifndef DL_H #define DL_H PHPAPI int php_load_extension(char *filename, int type, int start_now TSRMLS_DC); -PHPAPI void php_dl(zval *file,int type, zval *return_value, int start_now TSRMLS_DC); +PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now TSRMLS_DC); /* dynamic loading functions */ PHP_FUNCTION(dl);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php