Learn icon indicating copy to clipboard operation
Learn copied to clipboard

Examining the state of your PHP code

Open jonathanbossenger opened this issue 1 year ago • 8 comments

Details

  • Content type (Online Workshop, Lesson, Course, Tutorial, or Lesson Plan):Lesson
  • Content title: Examining the state of your PHP code
  • Topic description: Discover a few different ways to output or log variables in PHP
  • Audience (User, Developer, Designer, Contributor, etc.):Developer
  • Experience Level (Beginner, Intermediate, Advanced, Any):Beginner

Learning Objectives

  • Describe why it would be useful to use debugging functions.
  • List a few functions that aide debugging, with examples

Related Resources and Other Notes

Automation Code

//lesson

jonathanbossenger avatar Apr 18 '24 13:04 jonathanbossenger

Lesson Development Checklist

  • [x] Gather any relevant links to Support, Docs, or related material
  • [x] Description and Objectives finalized
  • [x] Lesson created and announced to the team for review
  • [x] Lesson reviewed
  • [ ] Lesson video submitted and published to WPTV
  • [ ] Lesson created on Learn.WordPress.org
  • [ ] Lesson video published to YouTube
  • [ ] Lesson on Learn.WordPress.org updated with YouTube video
  • [ ] Lesson published to Learn.WordPress.org

github-actions[bot] avatar May 14 '24 16:05 github-actions[bot]

Script: https://github.com/jonathanbossenger/wp-content/blob/main/developer-learning-pathway/12-debugging-in-wordpress/02-examining-the-state-of-your-php-code.md

jonathanbossenger avatar May 14 '24 16:05 jonathanbossenger

Audio track: https://drive.google.com/file/d/1IhnJR8a5qv5mwyKp0orXeslIpKlXHVbu/view?usp=sharing

jonathanbossenger avatar May 14 '24 16:05 jonathanbossenger

@agiljulio, here is the script and audio file.

I don't have a pre-existing video, because this will be a brand new lesson, so you'll have to create the visuals yourself, in the same style as the previous lesson.

Are you comfortable to take on this lesson video next?

jonathanbossenger avatar May 14 '24 16:05 jonathanbossenger

Hi @jonathanbossenger thank you for sending the script and audio file.

Noted it, I will adjust the style to the same as the previous video.

Yes, I feel comfortable taking on this lesson for the next video, If I have any questions, I will ask here 🙏

agiljulio avatar May 15 '24 08:05 agiljulio

Thank you @agiljulio I look forward to reviewing the next video.

jonathanbossenger avatar May 15 '24 10:05 jonathanbossenger

Hi @jonathanbossenger the video has been edited and is ready for review. Please feel free to provide any feedback, thank you 🙏

agiljulio avatar May 23 '24 04:05 agiljulio

Thank you @agiljulio I will do my best to review it today or tomorrow.

jonathanbossenger avatar May 23 '24 10:05 jonathanbossenger

Hey @agiljulio sorry for the delay here. Great work on the video.

I'm going to open this for the training team to review, and then get started on the scripts and voice recordings for the next two videos. I'd like to try and get these to you by the end of this week.

jonathanbossenger avatar May 28 '24 07:05 jonathanbossenger

Nice clear overview of debugging @jonathanbossenger

I have one piece of feedback, i'm not sure if I missed it.

  • When you highlight enabling debugging in the wp-config is it worth showing what that looks like in the wp-config because by default, enabling debugging does not enable the debug.log file.

digitalchild avatar May 28 '24 07:05 digitalchild

Thanks @digitalchild

This configuration was covered in the previous lesson in this module on enabling the debugging options. Do you think it would be beneficial to refer to this in the spot you mention?

jonathanbossenger avatar May 28 '24 08:05 jonathanbossenger

@jonathanbossenger Yes I think if you mention its in the previous lesson that should be enough. The reason I ask is because you have the wp-config open in the IDE :)

digitalchild avatar May 28 '24 08:05 digitalchild

Aha, that's a solid point. I didn't actually create the video, Agil and I are collaborating on this one.

I'm planning my own review later, so I'll keep an eye out for this.

jonathanbossenger avatar May 28 '24 10:05 jonathanbossenger

Yes I think if you mention its in the previous lesson that should be enough.

@digitalchild at 0:28 in this lesson, it directly references the "The built in WordPress debugging options" lesson, which contains the relevant settings to enable debug.log (here is the relevant section in that lesson).

As this is the next lesson in the learning pathway after that one, would you agree this is sufficient reference to that lesson, and the settings therein?

jonathanbossenger avatar May 30 '24 07:05 jonathanbossenger

Hi @agiljulio

As always, a great video. I do have a few change requests. Mostly they are adding some additional pauses in the voice, to allow viewers to take in what's on the screen.

  • at 0:58, after the transition to the IDE, would it be possible to insert a 1 second pause to show the use of error_log, before the voice explanation?
  • at 1:47 - 2:00, would it be possible to insert additional pauses in the voice to display the PHP code and the output for a few more seconds each.
  • at 2:22 could you add a pause before the var_dump explanation starts
  • 2:37 - 2:39 could you add additional pauses for the example code and output
  • 2:44 could you stay on the output in the browser here, and use annotations (eg arrows) to show how var_dump displays the value of the variable and the additional information about variable type and length.
  • at 2:57, when it's talking about var_dump not having a "return" option, the video can switch back to the code IDE
  • at 3:30, would it be possible to show a screenshot of those actual pages on the php docs, it's helpful for folks to see what that page looks like, along with the url.

Thanks in advance.

jonathanbossenger avatar May 30 '24 08:05 jonathanbossenger

Hi @jonathanbossenger , thank you for your feedback. It was very detailed and will help me maintain the quality of the video. Here is the updated version.

agiljulio avatar May 30 '24 23:05 agiljulio

Thanks @agiljulio it's looking great.

I did pick up one additional small bug.

At 2:15 when you update the code to wrap print_r using the second parameter in the error_log call, you don't need the <pre> tags anymore, as the code is now logging to the debug.log

So instead of

$some_array = array( 'apple', 'banana', 'cherry' );
echo '<pre>';
error_log( print_r( $some_array, true ) );
echo '</pre>';

It should just be

$some_array = array( 'apple', 'banana', 'cherry' );
error_log( print_r( $some_array, true ) );

Apologies if this wasn't clear in the script, I'll make sure to make these examples clearer going forward.

jonathanbossenger avatar May 31 '24 13:05 jonathanbossenger

No problem @jonathanbossenger . Here is another update. Thank you for clarifying 🙏

agiljulio avatar Jun 03 '24 04:06 agiljulio

No problem, @agiljulio. Thank you for always being open to updates and changes.

I will work on getting this video lesson published this week and share the next two scripts with you.

jonathanbossenger avatar Jun 03 '24 10:06 jonathanbossenger

My pleasure @jonathanbossenger 🙏 I look forward to receiving the next script.

agiljulio avatar Jun 04 '24 01:06 agiljulio

https://wordpress.tv/2024/06/07/examining-the-state-of-your-php-code/

jonathanbossenger avatar Jun 07 '24 12:06 jonathanbossenger

https://youtu.be/ThyDq0misbk

jonathanbossenger avatar Jun 07 '24 12:06 jonathanbossenger

https://learn.wordpress.org/lesson/examining-the-state-of-your-php-code/

//publish

jonathanbossenger avatar Jun 07 '24 12:06 jonathanbossenger