Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Conversation

@tarjei
Copy link

@tarjei tarjei commented Aug 6, 2011

This commit fixes a notice that happens if the files array contains gaps, for exampel because of an unset during an earlier filterstep.

Part of the output I saw (on Ubuntu 10.10):
tarjei@k4v:~/Zero/div/ZeroCMS$ phpcpd src/
phpcpd 1.3.2 by Sebastian Bergmann.

PHP Notice: Undefined offset: 9 in /usr/share/php/PHPCPD/TextUI/Command.php on line 252
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpcpd:0
PHP 2. PHPCPD_TextUI_Command::main() /usr/bin/phpcpd:51
PHP 3. PHPCPD_TextUI_Command::getCommonPath() /usr/share/php/PHPCPD/TextUI/Command.php:219
PHP Notice: Undefined offset: 10 in /usr/share/php/PHPCPD/TextUI/Command.php on line 252
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpcpd:0
PHP 2. PHPCPD_TextUI_Command::main() /usr/bin/phpcpd:51
PHP 3. PHPCPD_TextUI_Command::getCommonPath() /usr/share/php/PHPCPD/TextUI/Command.php:219
PHP Notice: Undefined offset: 11 in /usr/share/php/PHPCPD/TextUI/Command.php on line 252
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpcpd:0
PHP 2. PHPCPD_TextUI_Command::main() /usr/bin/phpcpd:51
PHP 3. PHPCPD_TextUI_Command::getCommonPath() /usr/share/php/PHPCPD/TextUI/Command.php:219
PHP Notice: Undefined offset: 12 in /usr/share/php/PHPCPD/TextUI/Command.php on line 252
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpcpd:0
PHP 2. PHPCPD_TextUI_Command::main() /usr/bin/phpcpd:51
PHP 3. PHPCPD_TextUI_Command::getCommonPath() /usr/share/php/PHPCPD/TextUI/Command.php:219
PHP Notice: Undefined offset: 13 in /usr/share/php/PHPCPD/TextUI/Command.php on line 252
PHP Stack trace:

contains gaps, for exampel because of an unset during an earlier filterstep.
@mwillbanks
Copy link

This actually works; however, it is still not ideal. There is actually a better way: array_shift :)

@tarjei
Copy link
Author

tarjei commented Sep 9, 2011

mwillbanks: care to give a bit more of an example? Do you want to use array_shift in the for loop below?

@mwillbanks
Copy link

tarjei: https://gist.github.com/1236569

Although; this all changes when you now look at the repo state of phpcpd. So it may just be temporary until the next release is posted.

@tarjei
Copy link
Author

tarjei commented Sep 23, 2011

OK, this seems reasonable. I'll close the request :)
T

@tarjei tarjei closed this Sep 23, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants