PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File Formats » File_Archive » Bug #4192

Strange error with > closing php code

Details

Submitted2005-04-20 19:20 UTC
Frommike at blueroot dot co dot uk
Assignedvincentlascaux
StatusClosed
PackageFile_Archive
PHP Version5.0.4
OSLinux 2.4
Roadmaps(Not assigned)

Comments

[2005-04-20 19:20 UTC] mike at blueroot dot co dot uk

Description:
------------
Trying a simple demo with File_Archive to try to open a zip file.

The file File/Archive/Reader/ChangeName.php has some strange > tags which seem to close the php tags (even though there is no ?>, just >)

It seems like every > in the file seems to close the php code. $this-> is a good example

Let me know if you cannot reproduce and ill send more config info.

php was compiled with --with-pgsql --prefix=/php5 --disable-shared --with-apxs=/www/bin/apxs --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-iconv --with-zlib --with-openssl --without-sqlite --with-mysqli --with-imap --with-kerberos --with-gettext --with-xml --with-dom --enable-mbstring --with-imap-ssl

Reproduce code:
---------------
require('File/Archive.php');

$file = getcwd() . "/myfile.odt"; // its a open document format, which is a zip
$zip_file = File_Archive::read($file);

Expected result:
----------------
no output, it should just create the reader object

Actual result:
--------------
a dump of the php code in File/Archive/Reader/ChangeName.php

it starts from the > after the email address

* @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version CVS: $Id: ChangeName.php,v 1.10 2005/02/26 10:17:06 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ require_once "Relay.php"; /** * Add a directory to the public name of all the files of a reader * * Example: * If archive.tar is a file archive containing files a.txt and foo/b.txt * new File_Archive_Reader_AddBaseName('bar', * new File_Archive_Reader_Tar( * new File_Archive_Reader_File('archive.tar') * ) * ) is a reader containing files bar/a.txt and bar/foo/b.txt */ class File_Archive_Reader_AddBaseName extends File_Archive_Reader_Relay { var $baseName; function File_Archive_Reader_AddBaseName($baseName='', &$source) { parent::File_Archive_Reader_Relay($source); $this->baseName = $this->getStandardURL($baseName); } /** * @see File_Archive_Reader::getFilename() */ function getFilename() { $name = parent::getFilename(); return $this->baseName. (empty($this->baseName) || empty($name) ? '': '/'). $name; } } /** * Change a directory name to another * * Example: * If archive.tar is a file archive containing files a.txt and foo/b.txt * new File_Archive_Reader_ChangeBaseName('foo', 'bar' * new File_Archive_Reader_Tar( * new File_Archive_Reader_File('archive.tar') * ) * ) is a reader containing files a.txt and bar/b.txt */ class File_Archive_Reader_ChangeBaseName extends File_Archive_Reader_Relay { var $oldBaseName; var $newBaseName; function File_Archive_Reader_ChangeBaseName ($oldBaseName, $newBaseName, &$source) { parent::File_Archive_Reader_Relay($source); $this->oldBaseName = $this->getStandardURL($oldBaseName); if (substr($this->oldBaseName, -1) == '/') { $this->oldBaseName = substr($this->oldBaseName, 0, -1); } $this->newBaseName = $this->getStandardURL($newBaseName); if (substr($this->newBaseName, -1) == '/') { $this->newBaseName = substr($this->newBaseName, 0, -1); } } /** * @see File_Archive_Reader::getFilename() */ function getFilename() { $name = parent::getFilename(); if (empty($this->oldBaseName) || !strncmp($name, $this->oldBaseName.'/', strlen($this->oldBaseName)+1) || strcmp($name, $this->oldBaseName) == 0) { return $this->newBaseName. ( empty($this->newBaseName) || strlen($name)<=strlen($this->oldBaseName)+1 ? '' : '/' ). substr($name, strlen($this->oldBaseName)+1); } else { return $name; } } } ?> Fatal error: Class 'File_Archive_Reader_Relay' not found in /php5/lib/php/File/Archive/Reader/Uncompress.php on line 38

[2005-04-20 22:40 UTC] mike at blueroot dot co dot uk

Hi,

The basic test works, hello world is output ok.

I have other PEAR packages that work OK (Calendar), I have a production site running on this box, so I am fairly sure its not that.

I tried uninstalling and reinstlling File_Archive, the file looks fine when opened in vi. I tried removing and reinserting the >'s but it still didnt work.

It is strange that it only appears on this file, I do not get the same output (ie lack of parsing) from the File/Archive.php file.

I have also tried including the hello world test from within a class file (as you do), it works as expected.

[2005-04-20 23:57 UTC] mike at blueroot dot co dot uk

I have looked into it a bit more, it is just a case of that file having a short opening tag.

[2005-04-21 00:00 UTC] mike at blueroot dot co dot uk

The following files also have short opening tags

Archive/Predicate/Custom.php
Archive/Predicate/Ereg.php
Archive/Predicate/Eregi.php
Archive/Predicate/Extension.php
Archive/Predicate/False.php
Archive/Predicate/MaxDepth.php
Archive/Predicate/MIME.php
Archive/Predicate/MinSize.php
Archive/Predicate/MinTime.php
Archive/Predicate/Not.php
Archive/Predicate/Or.php
Archive/Predicate/True.php
Archive/Predicate/And.php
Archive/Reader/Filter.php
Archive/Reader/Relay.php
Archive/Reader/Select.php
Archive/Reader/Archive.php
Archive/Writer/MemoryArchive.php
Archive/Writer/Archive.php
Archive/Predicate.php