Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning message #3030

Closed
Evanion opened this issue Jun 3, 2014 · 13 comments
Closed

Warning message #3030

Evanion opened this issue Jun 3, 2014 · 13 comments
Labels
Milestone

Comments

@Evanion
Copy link

Evanion commented Jun 3, 2014

I keep getting a warning message everytime I run 'composer update':

PHP Warning: Unterminated comment starting line 12 in phar:///home/evanions/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php on line 118

I'm using composer together with laravel.

@stof
Copy link
Contributor

stof commented Jun 3, 2014

It is really weird. The line 118 is https://github.com/composer/composer/blob/master/src/Composer/Autoload/ClassMapGenerator.php#L118 and the composer error handler should convert the warning to an exception going through the catch block, and so giving a different message

@Evanion
Copy link
Author

Evanion commented Jun 3, 2014

I have had this in the past 3-5 versions of composer.

Here is a bigger portion of the log:

Writing lock file
Generating autoload files
PHP Warning: Unterminated comment starting line 12 in phar:///home/evanions/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php on line 118
Compiling component files
Generating optimized class loader

It's not a critical error... just a tad annoying.

@pborreli
Copy link
Contributor

pborreli commented Jun 3, 2014

I have a same warning on some servers

@stof
Copy link
Contributor

stof commented Jun 3, 2014

are you using xdebug.show_exception_trace on these machines ?

@Evanion
Copy link
Author

Evanion commented Jun 3, 2014

No, it's a production server, so we aren't running xdebug.

@Evanion
Copy link
Author

Evanion commented Jun 3, 2014

I can give you a link to phpinfo if you want, just drop me a mail.

@Seldaek
Copy link
Member

Seldaek commented Jun 7, 2014

Indeed it's weird that this does not get converted to an exception, it'd be great to identify the file causing it (you must have a /* without closing */ somewhere). It seems php_strip_whitespace uses the php output buffer mechanism to collect the source though so possibly this means if php -w ... would output the warning on stderr it gets output by composer on stderr and then the stdout is collected into the source. Not sure if we can detect this somehow or not.

@Seldaek Seldaek added the Bug label Jun 7, 2014
@Seldaek Seldaek added this to the Bugs milestone Jun 7, 2014
@elazar
Copy link
Contributor

elazar commented Jul 3, 2014

I'm able to replicate this issue, though the cited line of the unterminated comment is 31 instead of 12. I was running Xdebug, but disabled it and still get the error. I've tried PHP 5.5.12-14 with e77435c. I don't know if it'll help, but I've included the composer.json file with which I'm encountering the issue below. With the exception of those under the blopboard namespace, all the packages listed are public.

{
    "name": "blopboard/services-embed",
    "description": "Blopboard web service for creating and retrieving embedded media",
    "autoload": {
        "psr-4": {
            "Blopboard\\Services\\Embed\\": "src"
        }
    },
    "require": {
        "php": ">=5.4.0",
        "ext-pdo": "*",
        "blopboard/services-commons": "dev-master",
        "silex/silex": "1.2.*",
        "monolog/monolog": "1.10.*",
        "predis/predis": "0.8.*",
        "aura/sql": "2.0.*",
        "guzzlehttp/guzzle": "4.1.*"
    },
    "suggest": {
        "ext-phpiredis": "for optimizing Redis traffic (see https://github.com/nrk/phpiredis)"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "git@github.com:blopboard/blopboard-services-commons.git"
        }
    ]
}

I can also confirm that I'm not seeing the issue with this composer.json file (presumably because of the lack of a require section):

{
    "name": "blopboard/services-commons",
    "description": "Communal code and documentation for Blopboard web services",
    "autoload": {
        "psr-4": {
            "Blopboard\\Services\\Commons\\": "src"
        }
    },
    "suggest": {
        "silex/silex": "base framework for web services, recommended 1.2.*",
        "monolog/monolog": "for using MonologServiceProvider, recommended 1.10.*",
        "predis/predis": "for using PredisServiceProvider, recommended 0.8.*",
        "ext-phpiredis": "for optimizing Redis traffic (see https://github.com/nrk/phpiredis)",
        "aura/sql": "for using PdoServiceProvider, recommended 2.0.*",
        "guzzlehttp/guzzle": "HTTP client library, recommended 4.1.*"
    }
}

@Seldaek
Copy link
Member

Seldaek commented Jul 19, 2014

I'd need someone with a repro case to run composer from source and add some debug output in the ClassMapGenerator to see which file it's coming from so we can maybe reduce the repro case. I tried with a file having /* at the end and I get no error at all here, so maybe it's some other construct that's causing issues.

@pborreli
Copy link
Contributor

Found a repro case with this file :
vendor/ezsystems/comments-bundle/EzSystems/CommentsBundle/ezpublish_legacy/ezcommentsbundle/settings/admininterface.ini.append.php

<?php /* #?ini charset="utf-8"?

[WindowControlsSettings]
AdditionalTabs[]=commentsbundle

[AdditionalTab_commentsbundle]
Title=
Description=
NavigationPartName=ezcontentnavigationpart
HeaderTemplate=commentsbundle_header.tpl
Template=commentsbundle.tpl

@Seldaek
Copy link
Member

Seldaek commented Jul 19, 2014

Seems like https://bugs.php.net/bug.php?id=41773 or some variant of it is still alive and kicking.

I got this simple repro case on 5.4.4-14+deb7u7 thanks to @pborreli's machine:

<?php
function log_error($num, $str, $file, $line, $context = null) {
    throw new ErrorException( $str, 0, $num, $file, $line );
}
set_error_handler('log_error');
ob_start();

file_put_contents('test.php', '<?php /*');
$out = php_strip_whitespace('test.php');
unlink('test.php');

var_dump(ob_get_clean(), $out); 

Which outputs:

PHP Warning:  Unterminated comment starting line 1 in /var/www/temp/run.php on line 9
string(0) ""
string(6) "<?php "

This is messed up. And I can't reproduce it on an ubuntu php5.4.6.

@Seldaek
Copy link
Member

Seldaek commented Jul 19, 2014

Looking at the source it seems the zend_strip call outputs stuff to STDERR that go through the boundary of php_output_start_default / php_output_discard. That's just my crappy understanding of PHP C though.

@Seldaek
Copy link
Member

Seldaek commented Jul 19, 2014

And just to wrap up, reported at https://bugs.php.net/bug.php?id=67655

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants