New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$worked = file_put_contents("/".$this->filepath #227

Closed
AndyNormore opened this Issue Jul 6, 2017 · 5 comments

Comments

Projects
None yet
4 participants
@AndyNormore

AndyNormore commented Jul 6, 2017

Hi, great platform.

I encountered this bug in the last standalone plugin from 2013. I had to update that file, and am surprised it's still here.

/wp-includes/fields_map.php

line 214

$worked = file_put_contents("/".$this->filepath

I had to add the / path, as it was trying to write from the relative path!

I am using PHP 7, fresh installed. Maybe it's a php5 -> 7 thing?

Anyway, fixing this let me install. CHEERS.

@PHuhn

This comment has been minimized.

Show comment
Hide comment
@PHuhn

PHuhn Sep 11, 2017

Hi Andy:
I encountered the same issue. The file /wp-includes/fields_map.php needs to dynamically create /wp-includes/fields_map.parsed_types.php. In order to do this the executing process needs to have modify rights to the wp-includes folder. In generic implementations, that user is IUSR. To find the user,
click on web-site => Authentication => right-click Anonymous Authentication select ‘Edit…’. FYI, you will also need to do the same thing for wp-content, in order to upload images.
Alternately, you can manually create the file and add one line of code:
<?php return array ( '' => array ( ), ) ?>
I initially, did the latter solution, but have gone to the first solution (though it has security implications). I am using my personal computer to try things out.
Phil

PHuhn commented Sep 11, 2017

Hi Andy:
I encountered the same issue. The file /wp-includes/fields_map.php needs to dynamically create /wp-includes/fields_map.parsed_types.php. In order to do this the executing process needs to have modify rights to the wp-includes folder. In generic implementations, that user is IUSR. To find the user,
click on web-site => Authentication => right-click Anonymous Authentication select ‘Edit…’. FYI, you will also need to do the same thing for wp-content, in order to upload images.
Alternately, you can manually create the file and add one line of code:
<?php return array ( '' => array ( ), ) ?>
I initially, did the latter solution, but have gone to the first solution (though it has security implications). I am using my personal computer to try things out.
Phil

@geoffmunn

This comment has been minimized.

Show comment
Hide comment
@geoffmunn

geoffmunn Nov 5, 2017

Contributor

I've also found this path problem, in fields_map.php. Adding the forward slash fixed it.

This was using PHP 7 and Centos 7.2.

Contributor

geoffmunn commented Nov 5, 2017

I've also found this path problem, in fields_map.php. Adding the forward slash fixed it.

This was using PHP 7 and Centos 7.2.

@patrickebates

This comment has been minimized.

Show comment
Hide comment
@patrickebates

patrickebates Nov 5, 2017

Member

I was already confused about this in general, as I've never encountered this issue after the thousands of deployments I've done myself. But now to see that it's happening on multiple OS platforms...

I think it's time to revisit. Off the cuff, one potential solution comes to mind, but it would probably be a breaking change for prior installs. Need to test and consider more options.

Member

patrickebates commented Nov 5, 2017

I was already confused about this in general, as I've never encountered this issue after the thousands of deployments I've done myself. But now to see that it's happening on multiple OS platforms...

I think it's time to revisit. Off the cuff, one potential solution comes to mind, but it would probably be a breaking change for prior installs. Need to test and consider more options.

@geoffmunn

This comment has been minimized.

Show comment
Hide comment
@geoffmunn

geoffmunn Nov 5, 2017

Contributor

Maybe a check on $this->filepath to see if it has a prepending slash, and if it doesn't, add one?

Contributor

geoffmunn commented Nov 5, 2017

Maybe a check on $this->filepath to see if it has a prepending slash, and if it doesn't, add one?

@geoffmunn

This comment has been minimized.

Show comment
Hide comment
@geoffmunn

geoffmunn Nov 5, 2017

Contributor

Ok, so I've had a quick look - is there a reason why you are using 'trim' instead of 'rtrim' on line 46 on fields_map.php?

$this->filepath = trim(str_replace('mu-plugins/wp-db-abstraction/translations/sqlsrv', '', strtr(dirname(__FILE__), '\\', '/')), '/') . $loc . '/fields_map.parsed_types.php';

If you change it to 'rtrim' then the problem goes away, and shouldn't affect other OSs or installs.

Contributor

geoffmunn commented Nov 5, 2017

Ok, so I've had a quick look - is there a reason why you are using 'trim' instead of 'rtrim' on line 46 on fields_map.php?

$this->filepath = trim(str_replace('mu-plugins/wp-db-abstraction/translations/sqlsrv', '', strtr(dirname(__FILE__), '\\', '/')), '/') . $loc . '/fields_map.parsed_types.php';

If you change it to 'rtrim' then the problem goes away, and shouldn't affect other OSs or installs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment