Make WordPress Core

Opened 6 years ago

Last modified 6 years ago

#46555 new defect (bug)

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

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

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
6 years 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
6 years ago

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

#3 @rweil55
6 years 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.