svn: /php/php-src/ branches/PHP_5_4/UPGRADING.INTERNALS branches/PHP_5_4/main/fopen_wrappers.c branches/PHP_5_4/main/fopen_wrappers.h
trunk/UPGRADING.INTERNALS trunk/main/fopen_wrappers.c trunk/main/fopen_wrappers.h
| From: | Pierre Joye | Date: | Mon, 25 Jul 2011 16:50:07 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_4/UPGRADING.INTERNALS branches/PHP_5_4/main/fopen_wrappers.c branches/PHP_5_4/main/fopen_wrappers.h trunk/UPGRADING.INTERNALS trunk/main/fopen_wrappers.c trunk/main/fopen_wrappers.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-65598@lists.php.net to get a copy of this message | ||
pajoye Mon, 25 Jul 2011 16:50:07 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=313678
Log:
- add expand_filepath_with_mode (not used anywhere yet but will be used for file ops (fopen&co)
to avoid extra links resolution and other non required ops on open
Changed paths:
U php/php-src/branches/PHP_5_4/UPGRADING.INTERNALS
U php/php-src/branches/PHP_5_4/main/fopen_wrappers.c
U php/php-src/branches/PHP_5_4/main/fopen_wrappers.h
U php/php-src/trunk/UPGRADING.INTERNALS
U php/php-src/trunk/main/fopen_wrappers.c
U php/php-src/trunk/main/fopen_wrappers.h
Modified: php/php-src/branches/PHP_5_4/UPGRADING.INTERNALS
===================================================================
--- php/php-src/branches/PHP_5_4/UPGRADING.INTERNALS 2011-07-25 16:45:39 UTC (rev 313677)
+++ php/php-src/branches/PHP_5_4/UPGRADING.INTERNALS 2011-07-25 16:50:07 UTC (rev 313678)
@@ -11,6 +11,7 @@
f. streams that enclose private streams
g. leak_variable
h. API Signature changes
+ i. new TSRM function expand_filepath_with_mode
2. Build system changes
a. Unix build system changes
@@ -184,6 +185,9 @@
. php_unescape_html_entities
PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int
all, int flags, char *hint_charset TSRMLS_DC);
+ i.
+ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char
*relative_to, size_t relative_to_len, int realpath_mode TSRMLS_DC);
+ expand_filepath_with_mode lets define how realpath will behave, using one of the existing mode:
CWD_EXPAND , CWD_FILEPATH or CWD_REALPATH.
========================
2. Build system changes
Modified: php/php-src/branches/PHP_5_4/main/fopen_wrappers.c
===================================================================
--- php/php-src/branches/PHP_5_4/main/fopen_wrappers.c 2011-07-25 16:45:39 UTC (rev 313677)
+++ php/php-src/branches/PHP_5_4/main/fopen_wrappers.c 2011-07-25 16:50:07 UTC (rev 313678)
@@ -741,6 +741,14 @@
*/
PHPAPI char *expand_filepath_ex(const char *filepath, char *real_path, const char *relative_to,
size_t relative_to_len TSRMLS_DC)
{
+ return expand_filepath_with_mode(filepath, real_path, relative_to, relative_to_len, CWD_FILEPATH
TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ expand_filepath_use_realpath
+ */
+PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char
*relative_to, size_t relative_to_len, int realpath_mode TSRMLS_DC)
+{
cwd_state new_state;
char cwd[MAXPATHLEN];
int copy_len;
@@ -785,7 +793,7 @@
new_state.cwd = strdup(cwd);
new_state.cwd_length = strlen(cwd);
- if (virtual_file_ex(&new_state, filepath, NULL, CWD_FILEPATH TSRMLS_CC)) {
+ if (virtual_file_ex(&new_state, filepath, NULL, realpath_mode TSRMLS_CC)) {
free(new_state.cwd);
return NULL;
}
Modified: php/php-src/branches/PHP_5_4/main/fopen_wrappers.h
===================================================================
--- php/php-src/branches/PHP_5_4/main/fopen_wrappers.h 2011-07-25 16:45:39 UTC (rev 313677)
+++ php/php-src/branches/PHP_5_4/main/fopen_wrappers.h 2011-07-25 16:50:07 UTC (rev 313678)
@@ -28,6 +28,7 @@
PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC);
PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC);
PHPAPI char *expand_filepath_ex(const char *filepath, char *real_path, const char *relative_to,
size_t relative_to_len TSRMLS_DC);
+PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char
*relative_to, size_t relative_to_len, int realpath_mode TSRMLS_DC);
PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC);
PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC);
Modified: php/php-src/trunk/UPGRADING.INTERNALS
===================================================================
--- php/php-src/trunk/UPGRADING.INTERNALS 2011-07-25 16:45:39 UTC (rev 313677)
+++ php/php-src/trunk/UPGRADING.INTERNALS 2011-07-25 16:50:07 UTC (rev 313678)
@@ -11,6 +11,7 @@
f. streams that enclose private streams
g. leak_variable
h. API Signature changes
+ i. new TSRM function expand_filepath_with_mode
2. Build system changes
a. Unix build system changes
@@ -184,6 +185,9 @@
. php_unescape_html_entities
PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int
all, int flags, char *hint_charset TSRMLS_DC);
+ i.
+ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char
*relative_to, size_t relative_to_len, int realpath_mode TSRMLS_DC);
+ expand_filepath_with_mode lets define how realpath will behave, using one of the existing mode:
CWD_EXPAND , CWD_FILEPATH or CWD_REALPATH.
========================
2. Build system changes
Modified: php/php-src/trunk/main/fopen_wrappers.c
===================================================================
--- php/php-src/trunk/main/fopen_wrappers.c 2011-07-25 16:45:39 UTC (rev 313677)
+++ php/php-src/trunk/main/fopen_wrappers.c 2011-07-25 16:50:07 UTC (rev 313678)
@@ -741,6 +741,14 @@
*/
PHPAPI char *expand_filepath_ex(const char *filepath, char *real_path, const char *relative_to,
size_t relative_to_len TSRMLS_DC)
{
+ return expand_filepath_with_mode(filepath, real_path, relative_to, relative_to_len, CWD_FILEPATH
TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ expand_filepath_use_realpath
+ */
+PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char
*relative_to, size_t relative_to_len, int realpath_mode TSRMLS_DC)
+{
cwd_state new_state;
char cwd[MAXPATHLEN];
int copy_len;
@@ -785,7 +793,7 @@
new_state.cwd = strdup(cwd);
new_state.cwd_length = strlen(cwd);
- if (virtual_file_ex(&new_state, filepath, NULL, CWD_FILEPATH TSRMLS_CC)) {
+ if (virtual_file_ex(&new_state, filepath, NULL, realpath_mode TSRMLS_CC)) {
free(new_state.cwd);
return NULL;
}
Modified: php/php-src/trunk/main/fopen_wrappers.h
===================================================================
--- php/php-src/trunk/main/fopen_wrappers.h 2011-07-25 16:45:39 UTC (rev 313677)
+++ php/php-src/trunk/main/fopen_wrappers.h 2011-07-25 16:50:07 UTC (rev 313678)
@@ -28,6 +28,7 @@
PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC);
PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC);
PHPAPI char *expand_filepath_ex(const char *filepath, char *real_path, const char *relative_to,
size_t relative_to_len TSRMLS_DC);
+PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, const char
*relative_to, size_t relative_to_len, int use_realpath TSRMLS_DC);
PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC);
PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC);