simonschaufi / cssmin

Automatically exported from code.google.com/p/cssmin
0 stars 0 forks source link

Warning: get_class() expects parameter 1 to be object, null given in ...CssRemoveEmptyRulesetsMinifierFilter.php on line 25 #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of CssMin are you using?
3.0.0.b3 BUILD & SOURCE version

And what is the actual result and/or error message?
Warning: get_class() expects parameter 1 to be object, null given in 
D:\devel\www\_minify\include\cssmin\minifier\filter\CssRemoveEmptyRulesetsMinifi
erFilter.php on line 25

Please provide any additional information below.

Here are the tokens :
Array
(
    [0] => Array
        (
            [Selectors] => Array
                (
                    [0] => body
                )

        )

    [1] => Array
        (
            [Property] => width
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => 300px
        )

    [2] => Array
        (
            [Property] => margin
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => auto
        )

    [3] => Array
        (
        )

    [4] => Array
        (
            [Selectors] => Array
                (
                    [0] => .bouton
                )

        )

    [5] => Array
        (
            [Property] => width
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => 296px
        )

    [6] => Array
        (
            [Property] => height
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => 48px
        )

    [7] => Array
        (
            [Property] => margin
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => 20px 0px 0px 0px
        )

    [8] => Array
        (
            [Property] => padding
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => 7px 0px 0px 0px
        )

    [9] => Array
        (
            [Property] => background-image
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => url(../img/btn.png)
        )

    [10] => Array
        (
            [Property] => background-position
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => top left
        )

    [11] => Array
        (
            [Property] => background-repeat
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => no-repeat
        )

    [12] => Array
        (
            [Property] => font-family
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => Verdana, Arial, Helvetica, sans-serif
        )

    [13] => Array
        (
            [Property] => font-size
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => 24px
        )

    [14] => Array
        (
            [Property] => font-style
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => normal
        )

    [15] => Array
        (
            [Property] => font-weight
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => bold
        )

    [16] => Array
        (
            [Property] => text-transform
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => none
        )

    [17] => Array
        (
            [Property] => color
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => #ffffff
        )

    [18] => Array
        (
            [Property] => text-decoration
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => none
        )

    [19] => Array
        (
            [Property] => text-align
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => center
        )

    [20] => Array
        (
            [Property] => cursor
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => pointer
        )

    [21] => Array
        (
        )

    [22] => Array
        (
            [Selectors] => Array
                (
                    [0] => .bouton:hover
                )

        )

    [23] => Array
        (
            [Property] => background-image
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => url(../img/btn_over.png)
        )

    [24] => Array
        (
        )

    [25] => Array
        (
            [Selectors] => Array
                (
                    [0] => .bouton:active
                )

        )

    [26] => Array
        (
            [Property] => background-image
            [IsImportant] => 
            [IsLast] => 
            [MediaTypes] => Array
                (
                    [0] => all
                )

            [Value] => url(../img/btn_active.png)
        )

    [27] => Array
        (
        )

)

Original issue reported on code.google.com by d.dussou...@2n-tech.com on 23 Feb 2011 at 9:20

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry but i'm unable to reproduce this error. You sample stylesheet get 
minified correctly without any errors.

Result:

string(482) 
"body{width:300px;margin:auto}.bouton{width:296px;height:48px;margin:20px 
0;padding:7px 0;background-image:url(../img/btn.png);background-position:top 
left;background-repeat:no-repeat;font-family:Verdana, Arial, Helvetica, 
sans-serif;font-size:24px;font-style:normal;font-weight:700;text-transform:none;
color:#fff;text-decoration:none;text-align:center;cursor:pointer}.bouton:hover{b
ackground-image:url(../img/btn_over.png)}.bouton:active{background-image:url(../
img/btn_active.png)}"

Code:

require("libaries/cssmin/source/CssMin.php");
$source = file_get_contents("public/temp/choix.css");
$r = CssMin::minify($source, array
    (
    "ImportImports"             => false,
    "RemoveComments"            => true, 
    "RemoveEmptyRulesets"           => true,
    "RemoveEmptyAtBlocks"           => true,
    "ConvertLevel3Properties"       => true,
    "Variables"             => true,
    "RemoveLastDelarationSemiColon"     => true
    ), array
    (
    "Variables"             => true,
    "ConvertFontWeight"         => true,
    "ConvertHslColors"          => true,
    "ConvertRgbColors"          => true,
    "ConvertNamedColors"            => true,
    "CompressColorValues"           => true,
    "CompressUnitValues"            => true,
    "CompressExpressionValues"      => true
    ));
var_dump($r);

Original comment by joe.scylla on 23 Feb 2011 at 9:41

GoogleCodeExporter commented 9 years ago
Sorry, i made a mistake.
The problem was on an other file.

The warnig appears if there is a css class without css inside :
example :

body{

}

Original comment by d.dussou...@2n-tech.com on 23 Feb 2011 at 10:03

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry im still not able to reproduce the problem (uning the same code as 
above). 

Result:
string(377) "#d_erreur{height:200px;width:600px;margin:20px 
auto;background-image:url(../img/erreur.png);background-position:top 
left;background-repeat:no-repeat;border:1px dashed #f22;padding:20px 20px 20px 
150px;font-family:Verdana, Arial, Helvetica, 
sans-serif;font-size:24px;font-style:normal;font-weight:700;text-transform:none;
color:#515151;text-decoration:none;background-color:#eee}" 

Please post your filter and plugin configuration.

Original comment by joe.scylla on 23 Feb 2011 at 10:22

GoogleCodeExporter commented 9 years ago
I tried with the same code as you :
require("D:/devel/www/_minify/include/cssmin/CssMin.php");
$source = file_get_contents("D:/devel/www/cam/css/erreur.css");
$r = CssMin::minify($source, array
    (
    "ImportImports"                 => false,
    "RemoveComments"                => true,
    "RemoveEmptyRulesets"           => true,
    "RemoveEmptyAtBlocks"           => true,
    "ConvertLevel3Properties"       => true,
    "Variables"                     => true,
    "RemoveLastDelarationSemiColon" => true
    ), array
    (
    "Variables"                     => true,
    "ConvertFontWeight"             => true,
    "ConvertHslColors"              => true,
    "ConvertRgbColors"              => true,
    "ConvertNamedColors"            => true,
    "CompressColorValues"           => true,
    "CompressUnitValues"            => true,
    "CompressExpressionValues"      => true
    ));
var_dump($r);

Here is the output :

Warning: get_class() expects parameter 1 to be object, null given in 
D:\devel\www\_minify\include\cssmin\minifier\filter\CssRemoveEmptyRulesetsMinifi
erFilter.php on line 25 string(377) 
"#d_erreur{height:200px;width:600px;margin:20px 
auto;background-image:url(../img/erreur.png);background-position:top 
left;background-repeat:no-repeat;border:1px dashed #f22;padding:20px 20px 20px 
150px;font-family:Verdana, Arial, Helvetica, 
sans-serif;font-size:24px;font-style:normal;font-weight:700;text-transform:none;
color:#515151;text-decoration:none;background-color:#eee}"

I'm using PHP 5.3.0 on Win7 x64 with error_reporting = E_ALL | E_STRICT

Original comment by d.dussou...@2n-tech.com on 23 Feb 2011 at 10:37

GoogleCodeExporter commented 9 years ago
Fixed with version 3.0.0.b4.

I did not get the error message because get_class() don't triggers an error (if 
the parameter is no object) on PHP versions lower than 5.3 (i'm using PHP 
5.2.17)

Original comment by joe.scylla on 23 Feb 2011 at 11:19

GoogleCodeExporter commented 9 years ago
It works.
Thank you !

Original comment by d.dussou...@2n-tech.com on 23 Feb 2011 at 11:50