WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 7 months ago

#46555 new defect (bug)

update fails when I have a print statement in my code.

Reported by: rweil55 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 5.1
Component: Posts, Post Types Keywords: reporter-feedback
Focuses: Cc:
PR Number:

Description

I get the the pink bar message "update failed", when I attempt to update a page that has an executed print statement in the code.
The file saves/updates, even though there is an error message.

Can the message be changed to "update returned unexpected characters" or some such.

running wordpress 5.1.1

Change History (3)

#1 @subrataemfluence
7 months ago

  • Component changed from General to Posts, Post Types
  • Keywords reporter-feedback added

Hi, can you please let me know the exact steps to reproduce the issue?

I was unable to clearly understand "...page that has an executed print statement in the code..."

#2 @mukesh27
7 months ago

Does the issue still happen with all plugins disabled and a default theme (Twenty Nineteen) activated?

#3 @rweil55
7 months ago

I had some shortcode code that instead of returning output for wordpress to display, it had a "print" statement to send some debugging text to the browser. i.e sending output directly to the browser rather than through wordpress.

Obviously a no-no, but it took me a while to figure out that was what was causing the "update failed" message.

Here is a short code function that will cause the message. Remove the print statement, and no message.
function dothework($atts) {

print "hello world - should not do this";
return "this is the right way";

}

Hope this helps
Roy

Note: See TracTickets for help on using tickets.