php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71179 memory limit exhausted when running scss parser from richthegeek
Submitted: 2015-12-21 11:08 UTC Modified: 2015-12-21 13:47 UTC
From: am05mhz at live dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.0.1 OS: windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: am05mhz at live dot com
New email:
PHP Version: OS:

 

 [2015-12-21 11:08 UTC] am05mhz at live dot com
Description:
------------
memory limit exhausted when using win 10 with PHP 7.0.1 VC14 x64 Thread Safe (2015-Dec-17 00:17:17)

no matter how high I set my memory limit, it will get exhausted, and it only happen when running the php scss parser from richthegeek, sample code provided below.

memory limit I have tried: 128MB, 256MB, 512MB

this does not happen in PHP 5.6 VC11 x64 Thread Safe (2015-Nov-26 04:33:59)
with memory limit 128MB and other supported settings the same (obviously excluding mysql extension)

changes to php.ini:
include_path = ".;S:\php\PEAR"
memory_limit = 512MB

Test script:
---------------
this error only happen when using scss parser from richthegeek
https://github.com/richthegeek/phpsass

require 'SassParser.php';

$options = array(
	'style' => 'nested',
	'cache' => false,
	'syntax' => 'scss',
	'debug' => false,
);

$parser = new SassParser($options);
$css = $parser->toCss($some_big_scss_file);
//note my scss file have around 1000 lines

Expected result:
----------------
scss code should be successfully parsed regardless if there is error in the scss (as like the behavior in php 5.6)

Actual result:
--------------
php stopped the execution with memory limit exhausted

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 134217736 bytes) in some_path\libraries\script\SassScriptLexer.php on line 118
A PHP Error was encountered

Severity: Error

Message: Allowed memory size of 536870912 bytes exhausted (tried to allocate 134217736 bytes)

Filename: script/SassScriptLexer.php

Line Number: 118

Backtrace:

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-21 13:47 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2015-12-21 13:47 UTC] laruence@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

this is due to now:

substr("", 0) will return "" instead of false: http://php.net/manual/en/function.substr.php

I have create an issue in phpsass, hope they will fix it soon, thanks

https://github.com/richthegeek/phpsass/issues/179
 [2015-12-21 16:31 UTC] am05mhz at live dot com
hi laurence, thanks for responding,

though i did not consult substr function reference, i did consult the php 7 backward compatibility manual.
in that case, i have to report for documentation error, as the changes in substr behavior is not yet documented in the backward incompatible changes, and i failed to see why the change in behavior resulted in memory limit exhausted, as "" is equal to false under loose comparison, but thanks anyway, now i can try do fix something :D

http://php.net/manual/en/migration70.incompatible.php
 [2015-12-21 16:46 UTC] am05mhz at live dot com
well now, this is embarrassing, i only checked the function reference, and then check you bug report on phpsass after commenting. sorry for that.

but the missing documentation part is still true

thank you very much
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 04:01:32 2024 UTC