WordPress.org

Making WordPress.org

Opened 5 years ago

Closed 5 years ago

#627 closed defect (wontfix)

When parsing WordPress with non standard paths the inline code doesn't work

Reported by: atimmer Owned by:
Milestone: Priority: low
Component: Developer Hub Keywords:
Cc:

Description

If you parse WordPress from a non standard path (like in a subfolder such as wp) the inline code won't work.

The reason for this is because the parser only saves the start and ending lines and the file path. In this case the file path doesn't exist.

This should never be an issue on the live version of devhub, but still something that is worth noting.

Change History (2)

#1 @coffee2code
5 years ago

Yes, in order to parse a file for source code it needs to be able to access the file.

The option 'wp_parser_root_import_dir' should contain the path to the root directory of the WP source that was parsed. This option is set by the parser.

If that option is not set or has no value, then the path to the actively running WP site is used.

In the event you want to adjust the behavior above, you could:

  • Manually configure the path in the 'wp_parser_root_import_dir' option. (Or delete it if the path to the parsed files is different or isn't accessible to the site).
  • Filter the option (via 'pre_option_wp_parser_root_import_dir') and configure a different path
  • Pre-parse the source code for all functions and methods after the initial parsing (storing the values in '_wp-parser_source_code' meta for each) so that no runtime parsing ever takes place (and thus the parsed source doesn't need to be accessible or present).

(I present the above not as an explanation to you @atimmer since I know you know it; just documenting it for someone who may be looking into this later.)

Is there some different handling you'd like to see happen?

#2 @atimmer
5 years ago

  • Keywords needs-testing removed
  • Resolution set to wontfix
  • Status changed from new to closed

This is more for documentation purposes, your explanation sounds great and I learned a few new things as well. 😀

Note: See TracTickets for help on using tickets.