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 » Tools and Utilities » CodeGen_PECL » Bug #5592

extskel compatibility broken in CVS

Details

Submitted2005-10-03 17:27 UTC
Fromstephen dot leavitt at nukote dot com
Assignedhholzgra
StatusClosed
PackageCodeGen_PECL
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-10-03 17:27 UTC] stephen dot leavitt at nukote dot com

Description:
------------
The extname compatibility in the current CVS version of CodeGen_PECL is broken because the command object fails to set the dirpath property of it's extension object prior to calling it's extension object's generateSource() method. This yields numerous "Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php" error messages on various line numbers, and if pecl_gen is run as root, will cause all of the generated files to be dumped into the root directory (/).

Test script:
---------------
The patch below is against current CVS and appears to fix the problem:

--- Command.php.orig 2005-10-03 12:13:27.000000000 -0500
+++ Command.php 2005-10-03 12:15:16.000000000 -0500
@@ -233,6 +233,8 @@
$command->terminate($err->getMessage());
}

+ $this->extension->dirpath = realpath("./$extname");
+
$err = $this->extension->generateSource("./$extname");
if (PEAR::isError($err)) {
$command->terminate($err->getMessage());

Expected result:
----------------
$ pecl-gen --extname=extension
Your extension has been created in directory ./extension.
See extension/README for further instructions.

Actual result:
--------------
$ pecl-gen --extname=extension
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 1253
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 1645
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 1719
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 1943
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 1889
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 2395
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 2149
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 2382
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 2383
Warning: rmdir(/tests): No such file or directory in /usr/share/php/CodeGen/PECL/Extension.php on line 2383
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 2204
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 2280
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 2485
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 2466
Notice: Undefined property: CodeGen_PECL_Extension::$dirpath in /usr/share/php/CodeGen/PECL/Extension.php on line 2470
Your extension has been created in directory .
See /README for further instructions.

[2005-10-03 17:39 UTC] stephen dot leavitt at nukote dot com

Please replace the patch I submitted with the following one that addresses the same issue and one other I discovered. The command object calls it's extension object's write_readme() method, except there is no write_readme() method in the extension object. The correct method name appears to be writeReadme(). The effect of this is that the script dies and outputs the following:

$ pecl-gen --extname=extension

Fatal error: Call to undefined method CodeGen_PECL_Extension::write_readme() in /usr/share/php/CodeGen/PECL/Command.php on line 257

The updated patch is below:

--- Command.php.orig 2005-10-03 12:33:00.000000000 -0500
+++ Command.php 2005-10-03 12:32:45.000000000 -0500
@@ -233,6 +233,8 @@
$command->terminate($err->getMessage());
}

+ $this->extension->dirpath = realpath("./$extname");
+
$err = $this->extension->generateSource("./$extname");
if (PEAR::isError($err)) {
$command->terminate($err->getMessage());
@@ -252,7 +254,7 @@
}
}

- $this->extension->write_readme("./$extname");
+ $this->extension->writeReadme("./$extname");

if (!$this->options->have("quiet")) {
echo $this->extension->successMsg();