Opened 14 years ago
Closed 9 years ago
#17120 closed defect (bug) (wontfix)
Class WP_Importer references STDIN which is not available in Web Environments
Reported by: | dd32 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | minor | Version: | 3.0 |
Component: | Import | Keywords: | needs-patch reporter-feedback close |
Focuses: | Cc: |
Description
STDERR is not defined in web environments (only certain CLI environments), you can call fopen('php://stderr'); directly, however this is not delivered to browsers.
Since this is in the Multisite code, CLI imports might be more common, but it's not a given that multisite imports will not be run from the web either.
Code ref:
http://core.trac.wordpress.org/browser/trunk/wp-admin/includes/class-wp-importer.php#L128
126 $blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id ); 127 if ( ( !$parsed = parse_url( $blog ) ) || empty( $parsed['host'] ) ) { 128 fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" ); 129 exit(); 130 } 131 if ( empty( $parsed['path'] ) ) 132 $parsed['path'] = '/'; 133 $blog = get_blog_details( array( 'domain' => $parsed['host'], 'path' => $parsed['path'] ) ); 134 if ( !$blog ) { 135 fwrite( STDERR, "Error: Could not find blog\n" ); 136 exit(); 137 }
I'm unsure of the best way to tackle this, Ideally in a CLI environment we want the error outputs going to STDERR, but since that's not available or visible to web browsers, wp_die() would be a better choice.
One potential method would be to direct wp_die() to STDERR in CLI environments - That might cause problems with the test suite however (I'm unsure)
Change History (3)
#3
@
9 years ago
- Milestone Future Release deleted
- Resolution set to wontfix
- Status changed from new to closed
Nothing happened here for over 5 years.
Let's close this in favour of https://make.wordpress.org/core/2015/11/18/wordpress-importer-redux/.
Wanted to revisit this issue, and given hosts have changed alot over the last 3 or 4 years, is this still an issue we need to address?