PHP OpenID lib: use of globals

dAniel hAhler dev-list-openidenabled at thequod.de
Wed Jan 17 13:21:27 PST 2007


On Tuesday 16 January 2007 01:43, Jonathan wrote:

> # I require the classes out of a class method (for performance reasons
> # only if necessary) and therefor a "global $foo" statement in your
> # class methods does not work. I would have to use "global $foo" in
> # the method where I'm requiring your classes, too.
>
> This is a known problem with the current release, and the fix is
> merely to include our library files at the file scope, rather than
> doing it inside a method.

I know, but I want to require the files only if the Plugin gets used.

I could have worked around this, of course, but I think a lib like this should 
not depend on such "restrictions".

I've attached a patch against 1.2.1.

I've found another todo, but I'll write to the dev list for this.

Unfortunately I've discovered the test framework too late. Now I have some 
lines > 80 chars and it does not seem to work with PHPUnit 3.x.

I get:
$ ./PHP-openid-1.2.1-modified/admin/runtests
Running test tabs
Running test longlines
Found lines > 80 characters in:

Auth/OpenID/URINorm.php (line 112 exceeds length 80)
Auth/OpenID/Server.php (lines 176, 485, 742, 763, 1184, and others exceed 
length 80)
Auth/OpenID/DiffieHellman.php (line 35 exceeds length 80)
Auth/OpenID/BigMath.php (line 423 exceeds length 80)
Running test nobadbraces
Running test nobadcase
Running test opentag
Running test docblocks
Running test php

Warning: require_once(PHPUnit.php): failed to open stream: No such file or 
directory 
in /home/daniel/dev/b2evo.HEAD/blogs/plugins/openid_plugin/PHP-openid-1.2.1-modified/Tests/TestDriver.php 
on line 16

Call Stack:
    0.0023     124776   1. {main}
() /home/daniel/dev/b2evo.HEAD/blogs/plugins/openid_plugin/PHP-openid-1.2.1-modified/admin/texttest.php:0
    0.0044     172136   2. 
require_once('/home/daniel/dev/b2evo.HEAD/blogs/plugins/openid_plugin/PHP-openid-1.2.1-modified/Tests/TestDriver.php') /home/daniel/dev/b2evo.HEAD/blogs/plugins/openid_plugin/PHP-openid-1.2.1-modified/admin/texttest.php:3


Fatal error: require_once(): Failed opening required 'PHPUnit.php' 
(include_path='.:/usr/local/lib/php:/usr/share/php') 
in /home/daniel/dev/b2evo.HEAD/blogs/plugins/openid_plugin/PHP-openid-1.2.1-modified/Tests/TestDriver.php 
on line 16

Call Stack:
    0.0023     124776   1. {main}
() /home/daniel/dev/b2evo.HEAD/blogs/plugins/openid_plugin/PHP-openid-1.2.1-modified/admin/texttest.php:0
    0.0044     172136   2. 
require_once('/home/daniel/dev/b2evo.HEAD/blogs/plugins/openid_plugin/PHP-openid-1.2.1-modified/Tests/TestDriver.php') /home/daniel/dev/b2evo.HEAD/blogs/plugins/openid_plugin/PHP-openid-1.2.1-modified/admin/texttest.php:3

Running test import
Failures in:  longlines php

I hope the patch gets applied (and cleaned up) though.

Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PHP-openid-remove-global-statements-in-lib-files.patch
Type: text/x-diff
Size: 27724 bytes
Desc: not available
Url : http://lists.openidenabled.com/pipermail/dev/attachments/20070117/b9af951e/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.openidenabled.com/pipermail/dev/attachments/20070117/b9af951e/attachment-0001.pgp 


More information about the Dev mailing list