0001-Allow-close_buffer-to-be-called-regardless-of-PHP.patch

against trunk - Chris Bandy, 05/12/2009 08:42 pm

Download (1.8 kB)

 
system/core/Kohana.php (working copy)
628 628
	}
629 629

  
630 630
	/**
631
	 * Kohana output handler.
631
	 * Kohana output handler. Called during ob_clean, ob_flush, and their variants.
632 632
	 *
633 633
	 * @param   string  current output buffer
634 634
	 * @return  string
635 635
	 */
636 636
	public static function output_buffer($output)
637 637
	{
638
		// Could be flushing, so send headers first
638 639
		if ( ! Event::has_run('system.send_headers'))
639 640
		{
640
			// Run the send_headers event, specifically for cookies being set
641
			// Run the send_headers event
641 642
			Event::run('system.send_headers');
642 643
		}
643 644

  
644
		// Set final output
645
		self::$output = $output;
646

  
647 645
		// Set and return the final output
648
		return $output;
646
		return self::$output = $output;
649 647
	}
650 648

  
651 649
	/**
652
	 * Closes all open output buffers, either by flushing or cleaning all
653
	 * open buffers, including the Kohana output buffer.
650
	 * Closes all open output buffers, either by flushing or cleaning, and stores the Kohana
651
	 * output buffer for display during shutdown.
654 652
	 *
655 653
	 * @param   boolean  disable to clear buffers, rather than flushing
656 654
	 * @return  void
......
668 666
				$close();
669 667
			}
670 668

  
671
			// This will flush the Kohana buffer, which sets self::$output
669
			// Store the Kohana output buffer
672 670
			ob_end_clean();
673

  
674
			// Reset the buffer level
675
			self::$buffer_level = ob_get_level();
676 671
		}
677 672
	}
678 673

  
......
888 883
				}
889 884
			}
890 885
	
886
			// Close all output buffers except for Kohana
891 887
			while (ob_get_level() > self::$buffer_level)
892 888
			{
893
				// Close open buffers
894 889
				ob_end_clean();
895 890
			}
896 891