]> git.pld-linux.org Git - packages/php.git/blob - php-php_dl.patch
move php.1 manual to -program (link to actual php-cli)
[packages/php.git] / php-php_dl.patch
1 backport extension loading from 5.3
2
3 this allows to load permanent modules with full path (eases make test code)
4
5 --- php-5.2.14/ext/standard/dl.c~       2010-10-31 17:07:21.000000000 +0200
6 +++ php-5.2.14/ext/standard/dl.c        2010-10-31 17:27:21.409467169 +0200
7 @@ -114,6 +114,7 @@
8         zend_module_entry *(*get_module)(void);
9         int error_type;
10         char *extension_dir;
11 +       char *filename = Z_STRVAL_P(file);
12  
13         if (type == MODULE_PERSISTENT) {
14                 extension_dir = INI_STR("extension_dir");
15 @@ -127,23 +128,24 @@
16                 error_type = E_CORE_WARNING;
17         }
18  
19 -       if (extension_dir && extension_dir[0]){
20 -               int extension_dir_len = strlen(extension_dir);
21 -
22 +       /* Check if passed filename contains directory separators */
23 +       if (strchr(filename, '/') != NULL || strchr(filename, DEFAULT_SLASH) != NULL) {
24 +               /* Passing modules with full path is not supported for dynamically loaded extensions */
25                 if (type == MODULE_TEMPORARY) {
26 -                       if (strchr(Z_STRVAL_P(file), '/') != NULL || strchr(Z_STRVAL_P(file), DEFAULT_SLASH) != NULL) {
27 -                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Temporary module name should contain only filename");
28 -                               RETURN_FALSE;
29 -                       }
30 +                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Temporary module name should contain only filename");
31 +                       return FAILURE;
32                 }
33 +               libpath = estrdup(filename);
34 +       } else if (extension_dir && extension_dir[0]) {
35 +               int extension_dir_len = strlen(extension_dir);
36  
37                 if (IS_SLASH(extension_dir[extension_dir_len-1])) {
38 -                       spprintf(&libpath, 0, "%s%s", extension_dir, Z_STRVAL_P(file));
39 +                       spprintf(&libpath, 0, "%s%s", extension_dir, filename); /* SAFE */
40                 } else {
41 -                       spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, Z_STRVAL_P(file));
42 +                       spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, filename); /* SAFE */
43                 }
44         } else {
45 -               libpath = estrndup(Z_STRVAL_P(file), Z_STRLEN_P(file));
46 +               return FAILURE; /* Not full path given or extension_dir is not set */
47         }
48  
49         /* load dynamic symbol */
This page took 0.026404 seconds and 3 git commands to generate.