• Resolved Scott DeLuzio

    (@scottdeluzio)


    I had the same PHP Fatal Error as @cousinhub was having on this thread. It looks like one of the CodeSniffer functions is stripping out the \ character on Windows/localhost servers.

    Note: I ran this plugin on a WPE site with one of the plugins that failed to process on a local install and it worked fine. On the local install no plugins or themes are processed. All get the error “The plugin/theme was skipped as it was too large to scan before the server killed the process.”

    Example error log:

    PHP Fatal error:  Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Source file C:UsersScottDevSitesdelete-cwcfp.devwp-contentpluginswp-crontrol/ does not exist' in C:\Users\Scott\DevSites\testphp7.dev\wp-content\plugins\php-compatibility-checker\vendor\squizlabs\php_codesniffer\CodeSniffer.php:1723
    Stack trace:
    #0 C:\Users\Scott\DevSites\testphp7.dev\wp-content\plugins\php-compatibility-checker\vendor\squizlabs\php_codesniffer\CodeSniffer.php(636): PHP_CodeSniffer->processFile('C:UsersScottDev...', NULL)
    #1 C:\Users\Scott\DevSites\testphp7.dev\wp-content\plugins\php-compatibility-checker\vendor\squizlabs\php_codesniffer\CodeSniffer\CLI.php(949): PHP_CodeSniffer->processFiles('C:UsersScottDev...', false)
    #2 C:\Users\Scott\DevSites\testphp7.dev\wp-content\plugins\php-compatibility-checker\src\wpephpcompat.php(276): PHP_CodeSniffer_CLI->process(Array)
    #3 C:\Users\Scott\DevSites\testphp7.dev\wp-content\plugins\php-compatibility-checker\src\wpephpcompat. in C:\Users\Scott\DevSites\testphp7.dev\wp-content\plugins\php-compatibility-checker\vendor\squizlabs\php_codesniffer\CodeSniffer.php on line 1723

    Edit
    PHP max_execution_time is set to 300

    • This topic was modified 7 years, 11 months ago by Scott DeLuzio. Reason: add max execution time
Viewing 4 replies - 1 through 4 (of 4 total)
  • @scottdeluzio

    It seems the wp_insert_post() function is stripping backslashes from values in the post_content column of wp_posts table when saving new post in the database.

    To fix this make sure the paths do not contain backslashes.
    In src/wpephpcompat.php file:

    In generate_directory_list() method:

    line 351 (plugins):

    //$id = $this->add_directory( $v[‘Name’], $plugin_path );
    $id = $this->add_directory( $v[‘Name’], str_replace( ‘\\’, ‘/’, $plugin_path ) );

    line 381 (themes):

    //$this->add_directory( $all_themes[ $k ]->Name, $theme_path );
    $this->add_directory( $all_themes[ $k ]->Name, str_replace( ‘\\’, ‘/’, $theme_path ) );

    After the above 2 changes it should work fine on Windows platform.

    • This reply was modified 7 years, 10 months ago by pronl.

    Addendum:

    line 390 (parent theme):

    //$this->add_directory( $parent_theme_name, $parent_theme_path );
    $this->add_directory( $parent_theme_name, str_replace( ‘\\’, ‘/’, $parent_theme_path ) );
    Plugin Contributor Jason Stallings

    (@octalmage)

    Thanks for the solution! It looks like we might be able to use

    https://developer.www.ads-software.com/reference/functions/kses_remove_filters/#source

    and

    https://developer.www.ads-software.com/reference/functions/kses_init_filters/#source

    to disable the filtering before doing the wp_insert_post.

    I had the same problem (not running on windows XAMPP)

    I spent about 10 hours chasing around with PHP settings before stumbling on this thread as the error returned is a php timeout otherwise

    the solution above fixed it for me (but I also had to replace the angled single quotes such as ‘\\’, ‘/’ with straight ones ‘\\’, ‘/’)

    -Steve

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Windows Localhost Not Processing’ is closed to new replies.