title: PHP Include Isn't Including - Woocommerce
body: <p>The short story, I'm getting php to prove to me that the file exists and is readable but the script simply seems to stop running once the include statement is hit.</p>
  
  <p>Also you'll note from the data output further down in this question that I'm using an absolute path.</p>
  
  <p>Some notable things that I've tried in resolving this issue is to:</p>
  
  <ol>
  <li>replace <strong>include</strong> with <strong>require</strong> and <strong>require_once</strong></li>
  <li>replace the <em>$include</em> var with a hardcoded string</li>
  <li>replace the hardcoded string to an invalid location using require.</li>
  </ol>
  
  <p>In each of these cases the same thing happens, no script is executed beyond the include or require statement and no errors are thrown.</p>
  
  <p>I'm working on a Woocommerce (which is probably a side and irrelevant point, but possibly helpful) system and it appears to be behaving rather oddly. My code is as follows, I've inserted a pile of <strong>var_dumps</strong> to demonstrate my issue:</p>
  
  <pre><code>/**
   * Output the cart shortcode.
   */
  public static function output() {
  
      var_dump("Hello");
  
      // Constants
      if ( ! defined( 'WOOCOMMERCE_CART' ) ) {
          define( 'WOOCOMMERCE_CART', true );
      }
  
      var_dump("After Constants");
  
      // Update Shipping
      if ( ! empty( $_POST['calc_shipping'] ) &amp;&amp; wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-cart' ) ) {
          self::calculate_shipping();
      }
  
      var_dump("After Shipping Calc");
  
      // Check cart items are valid
      do_action( 'woocommerce_check_cart_items' );
  
      var_dump("After cart items check");
  
      // Calc totals
      WC()-&gt;cart-&gt;calculate_totals();
  
      var_dump("After Calc Totals");
  
      var_dump(WC()-&gt;cart-&gt;get_cart());
      var_dump(sizeof( WC()-&gt;cart-&gt;get_cart() ));
  
      if ( 0 === sizeof( WC()-&gt;cart-&gt;get_cart() ) ) {
  
          var_dump("Size = 0 , Empty");
  
          wc_get_template( 'cart/cart-empty.php' );
      } else {
  
          var_dump("Size != 0 , Not Empty");
  
          wc_get_template( 'cart/cart.php' );
      }
  }
  </code></pre>
  
  <p>Called wc_get_template() Function:</p>
  
  <pre><code>/**
   * Get other templates (e.g. product attributes) passing attributes and including the file.
   *
   * @access public
   * @param string $template_name
   * @param array $args (default: array())
   * @param string $template_path (default: '')
   * @param string $default_path (default: '')
   * @return void
   */
  function wc_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
  
      var_dump("wc_get_template fired. Template name = " . $template_name);
  
      if ( $args &amp;&amp; is_array( $args ) ) {
          extract( $args );
      }
  
      $located = wc_locate_template( $template_name, $template_path, $default_path );
  
      var_dump($located);
  
      if ( ! file_exists( $located ) ) {
          _doing_it_wrong( __FUNCTION__, sprintf( '&lt;code&gt;%s&lt;/code&gt; does not exist.', $located ), '2.1' );
          return;
      }
  
      var_dump(file_exists( $located ), "File exists");
  
      var_dump(file_get_contents($located));
  
      // Allow 3rd party plugin filter template file from their plugin
      $located = apply_filters( 'wc_get_template', $located, $template_name, $args, $template_path, $default_path );
  
      do_action( 'woocommerce_before_template_part', $template_name, $template_path, $located, $args );
  
      var_dump("After do_action function");
  
      include $located;
  
      var_dump("After the file is included");
  
      do_action( 'woocommerce_after_template_part', $template_name, $template_path, $located, $args );
  }
  </code></pre>
  
  <p>The output:</p>
  
  <pre><code>string 'Hello' (length=5)
  string 'After Constants' (length=15)
  string 'After Shipping Calc' (length=19)
  string 'After cart items check' (length=22)
  string 'After Calc Totals' (length=17)
  array (size=2)
    'e82c4b19b8151ddc25d4d93baf7b908f' =&gt; 
      array (size=10)
        'product_id' =&gt; int 2468
        'variation_id' =&gt; string '' (length=0)
        'variation' =&gt; 
          array (size=0)
            empty
        'quantity' =&gt; int 1
        'line_total' =&gt; float 27.06
        'line_tax' =&gt; float 5.412
        'line_subtotal' =&gt; float 27.06
        'line_subtotal_tax' =&gt; float 5.412
        'line_tax_data' =&gt; 
          array (size=2)
            'total' =&gt; 
              array (size=1)
                ...
            'subtotal' =&gt; 
              array (size=1)
                ...
        'data' =&gt; 
          object(WC_Product_Simple)[101]
            public 'id' =&gt; int 2468
            public 'post' =&gt; 
              object(WP_Post)[103]
                ...
            public 'product_type' =&gt; string 'simple' (length=6)
            protected 'dimensions' =&gt; string '' (length=0)
            protected 'shipping_class' =&gt; string '' (length=0)
            protected 'shipping_class_id' =&gt; int 0
            public 'price' =&gt; string '27.06' (length=5)
            public 'manage_stock' =&gt; string 'no' (length=2)
            public 'stock_status' =&gt; string 'instock' (length=7)
            public 'tax_status' =&gt; string 'taxable' (length=7)
            public 'virtual' =&gt; string 'no' (length=2)
    '1843e35d41ccf6e63273495ba42df3c1' =&gt; 
      array (size=10)
        'product_id' =&gt; int 2463
        'variation_id' =&gt; string '' (length=0)
        'variation' =&gt; 
          array (size=0)
            empty
        'quantity' =&gt; int 1
        'line_total' =&gt; float 29.7
        'line_tax' =&gt; float 5.94
        'line_subtotal' =&gt; float 29.7
        'line_subtotal_tax' =&gt; float 5.94
        'line_tax_data' =&gt; 
          array (size=2)
            'total' =&gt; 
              array (size=1)
                ...
            'subtotal' =&gt; 
              array (size=1)
                ...
        'data' =&gt; 
          object(WC_Product_Simple)[69]
            public 'id' =&gt; int 2463
            public 'post' =&gt; 
              object(WP_Post)[67]
                ...
            public 'product_type' =&gt; string 'simple' (length=6)
            protected 'dimensions' =&gt; string '' (length=0)
            protected 'shipping_class' =&gt; string '' (length=0)
            protected 'shipping_class_id' =&gt; int 0
            public 'price' =&gt; string '29.70' (length=5)
            public 'manage_stock' =&gt; string 'no' (length=2)
            public 'stock_status' =&gt; string 'instock' (length=7)
            public 'virtual' =&gt; string 'no' (length=2)
            public 'tax_status' =&gt; string 'taxable' (length=7)
  int 2
  string 'Size != 0 , Not Empty' (length=21)
  string 'wc_get_template fired. Template name = cart/cart.php' (length=52)
  string '/var/www/public/natural-choice/wp-content/themes/theme524401/woocommerce/cart/cart.php' (length=86)
  boolean true
  string 'File exists' (length=11)
  string '&lt;?php
  /**
   * Cart Page
   *
   * @author  WooThemes
   * @package WooCommerce/Templates
   * @version 2.3.8
   */
  
  var_dump("Fired");
  
  if ( ! defined( 'ABSPATH' ) ) {
      exit; // Exit if accessed directly
  }
  
  wc_print_notices();
  
  do_action( 'woocommerce_before_cart' ); ?&gt;
  
  &lt;form action="&lt;?php echo esc_url( WC()-&gt;cart-&gt;get_cart_url() ); ?&gt;" method="post"&gt;
  
  &lt;?php do_action( 'woocommerce_before_cart_table' ); ?&gt;
  
  &lt;table class="shop_table cart" cellspacing="0"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th class="product-remove"&gt;&amp;nbsp;&lt;/th&gt;
              &lt;t'... (length=6908)
  string 'After do_action function' (length=24)
  </code></pre>
  
  <p>You'll also notice that I've edited the file I'm trying to include, so that it will fire another var_dump and print "Fired". But that expected output doesn't happen.</p>
  
  <p>What could the cause of this issue be?</p>