Re: Another output buffering oddity

From: Date: Sun, 25 Aug 2002 10:01:49 +0000
Subject: Re: Another output buffering oddity
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-87426@lists.php.net to get a copy of this message
You are using an undocumented feature of ouput.
        if (!$this->_started) {
            ob_start(
              array(
                $this, 'transform'
              )
            );
You set the output handler by passing an object and a method name in an array but this and arrays itself weren't officially supported by putput. I am working on that so please be patient: We can make that a documented feature and require array[object,string] where string is the name of the method to call. Another way would be to implement a special method named __output_handler(). The first would be easier to implement for both c and php. But it is no good idea since it is hard to understand... The latter conformes to other changes lately done. Implementing __output_handler would allow minimal changes since you would only need to pass the object to ob_start(). Also this solution would not require an additional change in internal API structures. regards marcus At 11:34 25.08.2002, Sebastian Bergmann wrote:
Just noticed that PEAR::XML::Transformer doesn't work with current HEAD, but works fine with PHP 4.2.3-RC1. This script
    <?php
    require_once 'XML/Transformer.php';
    $t = new XML_Transformer;
    $t->overloadElement(
      'bold',
      'startElementBold',
      'endElementBold'
    );
    $t->start();
    function startElementBold($attributes) {
      return '<b>';
    }
    function endElementBold($cdata) {
      return $cdata . '</b>';
    }
    ?>
    <bold>text</bold>
outputs
    <bold>text</bold>
instead of
    <b>text</b>
-- Sebastian Bergmann
  http://sebastian-bergmann.de/                 http://phpOpenTracker.de/
Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.dev (#87426) next »