Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6948985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:53:42+00:00 2026-05-27T13:53:42+00:00

This a variation on my Why doesn’t update_post_meta work for certain strings? question on

  • 0

This a variation on my Why doesn’t update_post_meta work for certain strings? question on WordPress Answers. I have brought it here because I suspect this is more likely a pure PHP issue than just a WordPress one.

My question is based around the following code:

$upload = wp_handle_upload ( $_FILES [WPSM_MAIL_META_ATTACHMENT], array ('test_form' => false ) );
$path = 'C:\xampp\htdocs\wordpress/wp-content/uploads/2011/12/ReSharper-6.1-License.txt';
var_dump($path);
$path = $upload['file'];
var_dump($path);
die();
update_post_meta ( 34, WPSM_MAIL_META_ATTACHMENT, $path );

The update_post_meta call updates the WPSM_MAIL_META_ATTACHMENT column in the WordPress database for post no. 34. The string literal assignment in line 2 gives $path exactly the same value as the array member assignment does in line 4, yet with the code as it is, the WPSM_MAIL_META_ATTACHMENT column is updated to an empty string. If I comment out line 4, therefore using only the literal assignment, the WPSM_MAIL_META_ATTACHMENT column is updated to the correct file path value.

I can only imagine that the two different strings assigned to $path differ in some way that is invisible to me with my very noob debugging tools var_dump and die. How can I go about diagnosing what is different between the two cases I describe above? Or, as a compromise, is there anything I can do to modify the $path = $upload['file'] assignment so that I get the same outcome as with the literal assignment?

The output in my browser window after this code executes is exactly as follows, reproduced as is, on a single line, for fidelity’s sake:

string(78) "C:\xampp\htdocs\wordpress/wp-content/uploads/2011/12/ReSharper-6.1-License.txt" string(78) "C:\xampp\htdocs\wordpress/wp-content/uploads/2011/12/ReSharper-6.1-License.txt"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:53:43+00:00Added an answer on May 27, 2026 at 1:53 pm

    This is hard to trace and require some source code digging :-

    • http://core.trac.wordpress.org/browser/tags/3.3/wp-includes/post.php
      • http://core.trac.wordpress.org/browser/tags/3.3/wp-includes/meta.php
        • http://core.trac.wordpress.org/browser/tags/3.3/wp-includes/formatting.php
      • http://core.trac.wordpress.org/browser/tags/3.3/wp-includes/plugin.php

    Turn out should be related to function stripslahses_deep, and apply_filter

    php > $path = 'C:\xampp\htdocs\wordpress/wp-content/uploads/2011/12/ReSharper-6.1-License.txt';
    php > var_dump ( stripslashes_deep($path));
    string(75) "C:xampphtdocswordpress/wp-content/uploads/2011/12/ReSharper-6.1-License.txt"
    

    If you do this :-

    php > var_dump ( stripslashes_deep( addslashes($path) ) );
    string(78) "C:\xampp\htdocs\wordpress/wp-content/uploads/2011/12/ReSharper-6.1-License.txt"
    

    I don’t have the definite conclusion,
    likely is caused by slashes

    To start a quick debug,
    try to test value with

    /wp-content/uploads/2011/12/ReSharper-6.1-License.txt
    C:/xampp/htdocs/wordpress/wp-content/uploads/2011/12/ReSharper-6.1-License.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have no idea why this doesn't work, but doing some validation functions and
I suppose this question is a variation on a theme , but different. Torrents
(I asked a variation of this question on comp.std.c++ but didn't get an answer.)
This is my first time using StackOverflow myself. I have found many answers to
This is a variation of this question: Remove Trailing Slash From Batch File Input
Every variation on the following code that I try doesn't work - whether DoSomething()
Variations of this question have been asked before, but it seems like the issue
Variation of my question on Ubuntu.SE: This is (basically) what I'm doing when I
I'm trying to understand why this does not work. (Basic example with no validation
This is a specific variation on the can't connect problem. In my case, I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.