[wp-trac] [WordPress Trac] #40339: If $home_path=='wp' then WP::parse_request() will remove 'wp' from 'wp-json/wc/v1/products' in $pathinfo

WordPress Trac noreply at wordpress.org
Sun Apr 2 13:32:08 UTC 2017


#40339: If $home_path=='wp' then WP::parse_request() will remove 'wp' from 'wp-
json/wc/v1/products' in $pathinfo
---------------------------+-----------------------------
 Reporter:  Magenta Cuda   |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Rewrite Rules  |    Version:  4.7.3
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 I have installed WordPress in a subdirectory 'wp' so $home_path is 'wp'.
 The statement

 {{{#!php
 pathinfo = preg_replace( $home_path_regex, '', $pathinfo );
 }}}

 is called with arguments

 {{{
 $home_path_regex = '|^wp|i'
 $pathinfo = 'wp-json/wc/v1/products'
 }}}

  and returns

 {{{
 $pathinfo = '-json/wc/v1/products'
 }}}


 Since, $_SERVER[ 'PATH_INFO' ] is the trailing part of the path wouldn't
 the leading home path be already removed?

 Here is the $_SERVER variable:

 {{{
 $_SERVER=Array
 (
     [SERVER_SOFTWARE] => PHP 5.6.30 Development Server
     [REQUEST_URI] => /wp/wp-json/wc/v1/products
     [DOCUMENT_ROOT] => C:\\WWW
     [REMOTE_ADDR] => 192.168.1.113
     [REMOTE_PORT] => 54207
     [SERVER_PROTOCOL] => HTTP/1.1
     [SERVER_NAME] => me.local.com
     [SERVER_PORT] => 80
     [REQUEST_METHOD] => GET
     [SCRIPT_NAME] => /wp/index.php
     [SCRIPT_FILENAME] => C:\\WWW\\wp\\index.php
     [PATH_INFO] => /wp-json/wc/v1/products
     [PHP_SELF] => /wp/index.php/wp-json/wc/v1/products
     [HTTP_HOST] => me.local.com
     [HTTP_CONNECTION] => keep-alive
     [HTTP_CACHE_CONTROL] => max-age=0
     [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
     [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; WOW64)
 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
     [HTTP_ACCEPT] =>
 text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
     [HTTP_ACCEPT_ENCODING] => gzip, deflate, sdch
     [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8,en-AU;q=0.6
     [HTTP_COOKIE] => wp-
 settings-1=libraryContent%3Dbrowse%26mfold%3Do%26editor%3Dhtml%26posts_list_mode%3Dexcerpt%26widgets_access%3Don%26post_dfw%3Don%26hidetb%3D1;
 wp-settings-time-1=1489742056; wordpress_test_cookie=WP+Cookie+check;
 wordpress_logged_in_82a92e8b6fd4f1e7bd35e69acfebe645=mc%7C1491295996%7ClSYWOrX5ljiNvjMUuOsdx3Hqd3B4PsyM6sdhaHx3VHB%7C0f85cc8928c44377d339344bd93f970151fb018ad0623b09964e252bc6104127
     [REQUEST_TIME_FLOAT] => 1491131923.8711
     [REQUEST_TIME] => 1491131923
 )
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40339>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list