{"id":25030,"date":"2015-12-10T14:27:11","date_gmt":"2015-12-10T12:27:11","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=25030"},"modified":"2015-12-10T14:30:31","modified_gmt":"2015-12-10T12:30:31","slug":"weird-php-error-output-bug","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/","title":{"rendered":"Weird PHP error output bug"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>We came across <a href=\"https:\/\/bugs.php.net\/bug.php?id=64882&amp;edit=1\">this PHP bug<\/a> at work today. \u00a0But before you go and read it, let me show you a use case. \u00a0See, if you can spot the problem.<\/p>\n<p>We had a cron job script which looked something like this (shortened for clarity):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n\r\n# ... a bunch of stuff here ... \r\n\r\ndate &amp;&amp; echo &quot;Updating products&quot;\r\nphp updateProducts.php 1&gt;\/dev\/null\r\n\r\nif &#x5B; &quot;$?&quot; -ne &quot;0&quot; ]\r\nthen\r\n  date &amp;&amp; echo &quot;Updating products failed&quot;\r\n  exit 1\r\nfi\r\n\r\n# ... more stuff here ...\r\n<\/pre>\n<p>Crystal clear, no? Output a time stamp and a log message, run the product update, redirecting all normal output to standard output, and then check if the script finished fine. If not, print the time stamp and log message and exit with non-zero status code.<\/p>\n<p>We use similar code snippets all over the place, and they work fine. \u00a0This particular one was a new addition. \u00a0So the cron job ran and &#8220;<em>Updating products failed<\/em>&#8221; part happened. \u00a0Weird. \u00a0 The PHP script in question has plenty of logging in it, but nothing was logged. \u00a0So we added more logs. \u00a0And then some more logs. \u00a0And even more logs. \u00a0Until it became obvious that something else is wrong, because even the first line of the script, which was now a logging action, wasn&#8217;t triggered.<\/p>\n<p>After a rather lengthy troubleshooting session we noticed that the updateProducts.php file was in fact named udpateProducts.php. \u00a0A simple typo in the file name. \u00a0But shouldn&#8217;t that be printed out into the error output?<\/p>\n<p>Let&#8217;s check:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ php no_such_file.php\r\nCould not open input file: no_such_file.php\r\n$ php no_such_file.php 1&gt;\/dev\/null\r\n$\r\n<\/pre>\n<p>Huh? Where&#8217;s my error? It&#8217;s gone. \u00a0 That&#8217;s because if you are as used to the command line as I am, you&#8217;d expect PHP to output to STDERR. \u00a0But PHP is much smarter than that. \u00a0It has a whole slew of configuration options in regards to error output. \u00a0In this case, in particular, you need to check the values of <strong>display_errors<\/strong> and <strong>error_log<\/strong> configuration variables. \u00a0The bug report describes a Debian machine, while I tested it on Fedora, CentOS, and Amazon AMI.<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ php -i | egrep '(display_errors|error_log)'\r\ndisplay_errors =&gt; Off =&gt; Off\r\nerror_log =&gt; no value =&gt; no value\r\n<\/pre>\n<p>Now it&#8217;s not much of a mystery. \u00a0But things like that can easily make you pull some hair out. \u00a0Hopefully, this gets some attention.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>We came across this PHP bug at work today. \u00a0But before you go and read it, let me show you a use case. \u00a0See, if you can spot the problem. We had a cron job script which looked something like this (shortened for clarity): #!\/bin\/bash # &#8230; a bunch of stuff here &#8230; date &amp;&amp; &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Weird PHP error output bug<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Weird PHP error output bug #WebDev #PHP","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_links_to":"","_links_to_target":""},"categories":[1,18,62,1334],"tags":[38,1330],"keyring_services":[],"class_list":["post-25030","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","category-web-work","tag-php","tag-web-development"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"We came across this PHP bug at work today. But before you go and read it, let me show you a use case. See, if you can spot the problem. We had a cron job script which looked something like this (shortened for clarity): [code lang=&quot;bash&quot;] #!\/bin\/bash # ... a bunch of stuff here ...\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Leonid Mamchenkov\"\/>\n\t<meta name=\"google-site-verification\" content=\"VHvdD0_usx1_4DzKy_QCVcICVgX2EgA2ybELT-wl7kQ\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Leonid Mamchenkov - Life, universe, and everything else\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Weird PHP error output bug - Leonid Mamchenkov\" \/>\n\t\t<meta property=\"og:description\" content=\"We came across this PHP bug at work today. But before you go and read it, let me show you a use case. See, if you can spot the problem. We had a cron job script which looked something like this (shortened for clarity): [code lang=&quot;bash&quot;] #!\/bin\/bash # ... a bunch of stuff here ...\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2015-12-10T12:27:11+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2015-12-10T12:30:31+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/MamchenkovBlog\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@mamchenkov\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Weird PHP error output bug - Leonid Mamchenkov\" \/>\n\t\t<meta name=\"twitter:description\" content=\"We came across this PHP bug at work today. But before you go and read it, let me show you a use case. See, if you can spot the problem. We had a cron job script which looked something like this (shortened for clarity): [code lang=&quot;bash&quot;] #!\/bin\/bash # ... a bunch of stuff here ...\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@mamchenkov\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#blogposting\",\"name\":\"Weird PHP error output bug - Leonid Mamchenkov\",\"headline\":\"Weird PHP error output bug\",\"author\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"},\"datePublished\":\"2015-12-10T14:27:11+02:00\",\"dateModified\":\"2015-12-10T14:30:31+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":5,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#webpage\"},\"articleSection\":\"All, Programming, Technology, Web work, PHP, web development\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/#listItem\",\"name\":\"Programming\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/#listItem\",\"position\":3,\"name\":\"Programming\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#listItem\",\"name\":\"Weird PHP error output bug\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#listItem\",\"position\":4,\"name\":\"Weird PHP error output bug\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/#listItem\",\"name\":\"Programming\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\",\"name\":\"Leonid Mamchenkov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/\",\"name\":\"Leonid Mamchenkov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#webpage\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/\",\"name\":\"Weird PHP error output bug - Leonid Mamchenkov\",\"description\":\"We came across this PHP bug at work today. But before you go and read it, let me show you a use case. See, if you can spot the problem. We had a cron job script which looked something like this (shortened for clarity): [code lang=\\\"bash\\\"] #!\\\/bin\\\/bash # ... a bunch of stuff here ...\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2015\\\/12\\\/10\\\/weird-php-error-output-bug\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"datePublished\":\"2015-12-10T14:27:11+02:00\",\"dateModified\":\"2015-12-10T14:30:31+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/\",\"name\":\"Blog of Leonid Mamchenkov\",\"description\":\"Life, universe, and everything else\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Weird PHP error output bug - Leonid Mamchenkov","description":"We came across this PHP bug at work today. But before you go and read it, let me show you a use case. See, if you can spot the problem. We had a cron job script which looked something like this (shortened for clarity): [code lang=\"bash\"] #!\/bin\/bash # ... a bunch of stuff here ...","canonical_url":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"VHvdD0_usx1_4DzKy_QCVcICVgX2EgA2ybELT-wl7kQ","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#blogposting","name":"Weird PHP error output bug - Leonid Mamchenkov","headline":"Weird PHP error output bug","author":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"publisher":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#person"},"image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"},"datePublished":"2015-12-10T14:27:11+02:00","dateModified":"2015-12-10T14:30:31+02:00","inLanguage":"en-US","commentCount":5,"mainEntityOfPage":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#webpage"},"isPartOf":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#webpage"},"articleSection":"All, Programming, Technology, Web work, PHP, web development"},{"@type":"BreadcrumbList","@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress#listItem","position":1,"name":"Home","item":"https:\/\/mamchenkov.net\/wordpress","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/#listItem","name":"Programming"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/#listItem","position":3,"name":"Programming","item":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#listItem","name":"Weird PHP error output bug"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#listItem","position":4,"name":"Weird PHP error output bug","previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/#listItem","name":"Programming"}}]},{"@type":"Person","@id":"https:\/\/mamchenkov.net\/wordpress\/#person","name":"Leonid Mamchenkov","image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"}},{"@type":"Person","@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author","url":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/","name":"Leonid Mamchenkov","image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"}},{"@type":"WebPage","@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#webpage","url":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/","name":"Weird PHP error output bug - Leonid Mamchenkov","description":"We came across this PHP bug at work today. But before you go and read it, let me show you a use case. See, if you can spot the problem. We had a cron job script which looked something like this (shortened for clarity): [code lang=\"bash\"] #!\/bin\/bash # ... a bunch of stuff here ...","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#website"},"breadcrumb":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/#breadcrumblist"},"author":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"creator":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"datePublished":"2015-12-10T14:27:11+02:00","dateModified":"2015-12-10T14:30:31+02:00"},{"@type":"WebSite","@id":"https:\/\/mamchenkov.net\/wordpress\/#website","url":"https:\/\/mamchenkov.net\/wordpress\/","name":"Blog of Leonid Mamchenkov","description":"Life, universe, and everything else","inLanguage":"en-US","publisher":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#person"}}]},"og:locale":"en_US","og:site_name":"Leonid Mamchenkov - Life, universe, and everything else","og:type":"article","og:title":"Weird PHP error output bug - Leonid Mamchenkov","og:description":"We came across this PHP bug at work today. But before you go and read it, let me show you a use case. See, if you can spot the problem. We had a cron job script which looked something like this (shortened for clarity): [code lang=&quot;bash&quot;] #!\/bin\/bash # ... a bunch of stuff here ...","og:url":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/","og:image":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg","og:image:secure_url":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg","og:image:width":1024,"og:image:height":1024,"article:published_time":"2015-12-10T12:27:11+00:00","article:modified_time":"2015-12-10T12:30:31+00:00","article:publisher":"https:\/\/www.facebook.com\/MamchenkovBlog","twitter:card":"summary_large_image","twitter:site":"@mamchenkov","twitter:title":"Weird PHP error output bug - Leonid Mamchenkov","twitter:description":"We came across this PHP bug at work today. But before you go and read it, let me show you a use case. See, if you can spot the problem. We had a cron job script which looked something like this (shortened for clarity): [code lang=&quot;bash&quot;] #!\/bin\/bash # ... a bunch of stuff here ...","twitter:creator":"@mamchenkov","twitter:image":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg"},"aioseo_meta_data":{"post_id":"25030","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-07-19 10:08:45","updated":"2026-01-15 11:55:45","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/\" title=\"Programming\">Programming<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWeird PHP error output bug\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/mamchenkov.net\/wordpress"},{"label":"Technology","link":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/"},{"label":"Programming","link":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/"},{"label":"Weird PHP error output bug","link":"https:\/\/mamchenkov.net\/wordpress\/2015\/12\/10\/weird-php-error-output-bug\/"}],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":16696,"url":"https:\/\/mamchenkov.net\/wordpress\/2012\/09\/10\/managing-gettext-translations-on-the-command-line\/","url_meta":{"origin":25030,"position":0},"title":"Managing gettext translations on the command line","author":"Leonid Mamchenkov","date":"September 10, 2012","format":false,"excerpt":"I am working on a rather multilingual project in the office currently. \u00a0And, as always, we tried a few alternatives before ending up with gettext again. \u00a0For those of you who don't know, gettext is the de facto standard for managing language translations in software, especially when it comes to\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":23603,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/02\/25\/php-tags-once-and-for-all-yet-again\/","url_meta":{"origin":25030,"position":1},"title":"PHP tags &#8211; once and for all. Yet again.","author":"Leonid Mamchenkov","date":"February 25, 2015","format":false,"excerpt":"For those of us who have been using PHP since the early version 3 days and such, here is a modern day refresher for PHP tags: If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27447,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/03\/22\/bulletproof-bash-stop-script-on-error\/","url_meta":{"origin":25030,"position":2},"title":"Bulletproof Bash : Stop script on error","author":"Leonid Mamchenkov","date":"March 22, 2017","format":false,"excerpt":"The other day I've been puzzled by the results of a cron job script. \u00a0The bash script in question was written in a hurry a while back, and I was under the assumption that if any of its steps fail, the whole script will fail. \u00a0I was wrong. \u00a0Some commands\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":12214,"url":"https:\/\/mamchenkov.net\/wordpress\/2010\/03\/02\/monitoring-php-errors-warnings-and-notices\/","url_meta":{"origin":25030,"position":3},"title":"Monitoring PHP errors, warnings, and notices","author":"Leonid Mamchenkov","date":"March 2, 2010","format":false,"excerpt":"There are a number of ways to monitor PHP errors, warnings, and notices. \u00a0 You can have your application code trigger some error handling, you can use PHP built-in methods, you can have some scripts running in the background\u00a0analyzing logs, etc. \u00a0While you already probably do some of it, here\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":44434,"url":"https:\/\/mamchenkov.net\/wordpress\/2019\/11\/23\/php-codesniffer-ignoring-rules\/","url_meta":{"origin":25030,"position":4},"title":"PHP CodeSniffer: Ignoring rules","author":"Leonid Mamchenkov","date":"November 23, 2019","format":false,"excerpt":"PHP CodeSniffer is a great tool for making sure all your code is consistent with a set of rules and guidelines. However, there are cases, when you need to ignore the rules for a particular code snippet. For example, when you are working with third-party frameworks or libraries. CodeSniffer provides\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27421,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/03\/17\/cakephp-3-remove-shell-welcome-header\/","url_meta":{"origin":25030,"position":5},"title":"CakePHP 3 : Remove Shell Welcome Header","author":"Leonid Mamchenkov","date":"March 17, 2017","format":false,"excerpt":"CakePHP 3\u00a0has an excellent support for command line Shells, Tasks, and Console Tools. \u00a0There are a few that are bundled with the framework itself, and that come from a variety of plugins. \u00a0And, of course, you can have your own commands, specific to your application. [code light=\"true\"] $ .\/bin\/cake Welcome\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/25030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=25030"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/25030\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=25030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=25030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=25030"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=25030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}