Re: PHP 5.0.5 and PEAR 1.4.2...together?

From: Date: Sat, 22 Oct 2005 14:48:11 +0000
Subject: Re: PHP 5.0.5 and PEAR 1.4.2...together?
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21595@lists.php.net to get a copy of this message
On 10/20/05, Greg Beaver <cellog@php.net> wrote: > Andrew Teixeira wrote: > > [PEAR] PEAR: pear.php.net/PEAR: conflicting files found: > > OS/Guess.php (pear.php.net/Object id #11) > > PEAR/ChannelFile/Parser.php (pear.php.net/Object id #27) > > PEAR/Command/Auth-init.php (pear.php.net/Object id #17) > > PEAR/Command/Auth.php (pear.php.net/Object id #60) > > [---End Snippet---] > > > > I didn't copy all the files that it said conflicted into the snippet > > since it went on for a good distance. > > > > The conflicting files errors seem to be for every file in every PEAR > > package that PHP is attempting to install. Not sure what I'm doing > > wrong. Please let me know your thoughts. Thanks. > > Aha - this is both a rare bug and an EXTREMELY unhelpful way of > reporting it to you :). > > The Object id #11 crap is a PEAR_Error object. > > see newly opened (and fixed) http://pear.php.net/bugs/5736 > > You can at the very least find the real source of your trouble by adding > these lines to PEAR/Registry.php at line 1840: > > if (PEAR::isError($pkgs[$name])) { > return $pkgs[$name]; > } > > > This will transform the checkFileMap() method into: > > ... > if (!in_array($attrs['role'], > PEAR_Installer_Role::getBaseinstallRoles())) { > $attrs['baseinstalldir'] = is_array($package) ? > $package[1] : $package; > } > if (isset($attrs['baseinstalldir'])) { > $name = $attrs['baseinstalldir'] . > DIRECTORY_SEPARATOR . $name; > } > } > $pkgs[$name] = $this->checkFileMap($name, $package, > $api, $attrs); > if (PEAR::isError($pkgs[$name])) { > return $pkgs[$name]; > } > } > return array_filter($pkgs, $notempty); > } > if (empty($this->filemap_cache)) { > ... > > Greg > Ok, so I did that and it did clean up the errors significantly. Now I can figure out what the problem is. The problem seems to manifest itselft in Registry.php in the _readFileMap function. The function errors out because $this->filemap is set to "/.filemap". I traced this back to what I believe is a problem when the PEAR_Registry constructor is called with a NULL first parameter ($pear_install_dir). I have put some stubs in the constructor to print out the $pear_install_dir value. Since install-pear.php is called twice from the Makefile, I get the registry initialization stubs twice. Each time it prints out the following values for the $pear_install_dir: - /usr/lib/php - /usr/lib/php - <NULL> - /tmp/php-buildroot/usr/lib/php So, for some reason I believe the installer is using the 3rd registry instance (with the NULL $pear_install_dir) when trying to install my PEAR packages, causing filemap to be /.filemap. I then tried to trace back where PEAR_Registry was instantiated and found that the main source of the problem seemed to stem from the setInstallRoot function in Config.php. It seems that the if (($old != $root)...) statement evaluates to TRUE, and then cycles through the _registry array. I have printed stubs here and it seems that the 'system' registry has php_dir set to NULL, while 'default' is set to the correct value (/tmp/php-buildroot/usr/lib/php). My question now is, what do I do to fix it. Is this as simple as telling the installer to somehow use 'default' instead of 'system', or is this unfortunately more complicated. Thanks for your help.

« previous php.pear.general (#21595) next »