@@ -1742,10 +1742,11 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
1742
1742
}
1743
1743
1744
1744
if (protocol ) {
1745
- char * tmp = estrndup (protocol , n );
1746
- if (NULL == (wrapper = zend_hash_str_find_ptr (wrapper_hash , (char * )tmp , n ))) {
1745
+ if (NULL == (wrapper = zend_hash_str_find_ptr (wrapper_hash , protocol , n ))) {
1746
+ char * tmp = estrndup (protocol , n );
1747
+
1747
1748
php_strtolower (tmp , n );
1748
- if (NULL == (wrapper = zend_hash_str_find_ptr (wrapper_hash , ( char * ) tmp , n ))) {
1749
+ if (NULL == (wrapper = zend_hash_str_find_ptr (wrapper_hash , tmp , n ))) {
1749
1750
char wrapper_name [32 ];
1750
1751
1751
1752
if (n >= sizeof (wrapper_name )) {
@@ -1758,8 +1759,8 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
1758
1759
wrapper = NULL ;
1759
1760
protocol = NULL ;
1760
1761
}
1762
+ efree (tmp );
1761
1763
}
1762
- efree (tmp );
1763
1764
}
1764
1765
/* TODO: curl based streams probably support file:// properly */
1765
1766
if (!protocol || !strncasecmp (protocol , "file" , n )) {
@@ -1833,13 +1834,11 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
1833
1834
PG (in_user_include )) && !PG (allow_url_include )))) {
1834
1835
if (options & REPORT_ERRORS ) {
1835
1836
/* protocol[n] probably isn't '\0' */
1836
- char * protocol_dup = estrndup (protocol , n );
1837
1837
if (!PG (allow_url_fopen )) {
1838
- php_error_docref (NULL , E_WARNING , "%s:// wrapper is disabled in the server configuration by allow_url_fopen=0" , protocol_dup );
1838
+ php_error_docref (NULL , E_WARNING , "%.* s:// wrapper is disabled in the server configuration by allow_url_fopen=0" , ( int ) n , protocol );
1839
1839
} else {
1840
- php_error_docref (NULL , E_WARNING , "%s:// wrapper is disabled in the server configuration by allow_url_include=0" , protocol_dup );
1840
+ php_error_docref (NULL , E_WARNING , "%.* s:// wrapper is disabled in the server configuration by allow_url_include=0" , ( int ) n , protocol );
1841
1841
}
1842
- efree (protocol_dup );
1843
1842
}
1844
1843
return NULL ;
1845
1844
}
0 commit comments