hoaproject / file Goto Github PK
View Code? Open in Web Editor NEWThe Hoa\File library.
Home Page: https://hoa-project.net/
The Hoa\File library.
Home Page: https://hoa-project.net/
In wallabag we are using RulerZ to implement custom rule for auto-tagging.
Everything works great until few days ago (we really don't know why) when a failing test occurs in a particular environment (PHP 5.6 & PostgreSQL).
It doesn't happend in any other version of PHP and any other SGBD. And we aren't able to reproduce it in our local env with the same versions ๐
Here is the failing build: https://travis-ci.org/wallabag/wallabag/jobs/174123711 (and here are other builds in context: https://travis-ci.org/wallabag/wallabag/builds/174008567).
For an unknown reason, closing a stream on __destruct
is making the build to fail.
The test is checking that a particular operator isn't available (length is this case
, see here).
Here is the plain stack trace :
[1] InvalidArgumentException: fclose(): 16442 is not a valid stream resource
at n/a
in /home/travis/build/wallabag/wallabag/vendor/hoa/file/File.php line 244
at fclose(\'Resource id #16442\')
in /home/travis/build/wallabag/wallabag/vendor/hoa/file/File.php line 244
at Hoa\\File\\File->_close()
in /home/travis/build/wallabag/wallabag/vendor/hoa/stream/Stream.php line 316
at Hoa\\Stream\\Stream->close()
in /home/travis/build/wallabag/wallabag/vendor/hoa/stream/Stream.php line 628
at Hoa\\Stream\\Stream->__destruct()
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/Form/Util/OrderedHashMap.php line 164
at Symfony\\Component\\Form\\Util\\OrderedHashMap->getIterator()
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/Form/Util/OrderedHashMap.php line 164
at Symfony\\Component\\Form\\Util\\OrderedHashMap->getIterator()
in line
at IteratorIterator->__construct(object(OrderedHashMap))
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php line 383
at Symfony\\Component\\Form\\Form->setData(object(Config))
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php line 477
at Symfony\\Component\\Form\\Form->initialize()
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php line 226
at Symfony\\Component\\Form\\FormBuilder->getForm()
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php line 39
at Symfony\\Component\\Form\\FormFactory->create(\'Wallabag\\CoreBundle\\Form\\Type\\RssType\', object(Config), array(\'action\' => \'/config#set2\'))
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php line 309
at Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller->createForm(\'Wallabag\\CoreBundle\\Form\\Type\\RssType\', object(Config), array(\'action\' => \'/config#set2\'))
in /home/travis/build/wallabag/wallabag/src/Wallabag/CoreBundle/Controller/ConfigController.php line 92
at Wallabag\\CoreBundle\\Controller\\ConfigController->indexAction(object(Request))
in line
at call_user_func_array(array(object(ConfigController), \'indexAction\'), array(object(Request)))
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 153
at Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(object(Request), \'1\')
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 68
at Symfony\\Component\\HttpKernel\\HttpKernel->handle(object(Request), \'1\', true)
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 169
at Symfony\\Component\\HttpKernel\\Kernel->handle(object(Request))
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php line 79
at Symfony\\Component\\HttpKernel\\Client->doRequest(object(Request))
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php line 131
at Symfony\\Bundle\\FrameworkBundle\\Client->doRequest(object(Request))
in /home/travis/build/wallabag/wallabag/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php line 315
at Symfony\\Component\\BrowserKit\\Client->request(\'GET\', \'/config\')
in /home/travis/build/wallabag/wallabag/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php line 500
at Tests\\Wallabag\\CoreBundle\\Controller\\ConfigControllerTest->testTaggingRuleCreationFail(array(\'tagging_rule[rule]\' => \'length(domainName) <= 42\', \'tagging_rule[tags]\' => \'cool tag\'), array(\'The operator\', \'does not exist.\'))
in line
at ReflectionMethod->invokeArgs(object(ConfigControllerTest), array(array(\'tagging_rule[rule]\' => \'length(domainName) <= 42\', \'tagging_rule[tags]\' => \'cool tag\'), array(\'The operator\', \'does not exist.\')))
in /home/travis/build/wallabag/wallabag/vendor/phpunit/phpunit/src/Framework/TestCase.php line 1103
at PHPUnit_Framework_TestCase->runTest()
in /home/travis/build/wallabag/wallabag/vendor/phpunit/phpunit/src/Framework/TestCase.php line 954
at PHPUnit_Framework_TestCase->runBare()
in /home/travis/build/wallabag/wallabag/vendor/phpunit/phpunit/src/Framework/TestResult.php line 701
at PHPUnit_Framework_TestResult->run(object(ConfigControllerTest))
in /home/travis/build/wallabag/wallabag/vendor/phpunit/phpunit/src/Framework/TestCase.php line 909
at PHPUnit_Framework_TestCase->run(object(PHPUnit_Framework_TestResult))
in /home/travis/build/wallabag/wallabag/vendor/phpunit/phpunit/src/Framework/TestSuite.php line 753
at PHPUnit_Framework_TestSuite->run(object(PHPUnit_Framework_TestResult))
in /home/travis/build/wallabag/wallabag/vendor/phpunit/phpunit/src/Framework/TestSuite.php line 753
at PHPUnit_Framework_TestSuite->run(object(PHPUnit_Framework_TestResult))
in /home/travis/build/wallabag/wallabag/vendor/phpunit/phpunit/src/Framework/TestSuite.php line 753
at PHPUnit_Framework_TestSuite->run(object(PHPUnit_Framework_TestResult))
in /home/travis/build/wallabag/wallabag/vendor/phpunit/phpunit/src/TextUI/TestRunner.php line 465
at PHPUnit_TextUI_TestRunner->doRun(object(PHPUnit_Framework_TestSuite), array(\'listGroups\' => false, \'loader\' => null, \'useDefaultConfiguration\' => true, \'verbose\' => true, \'testSuffixes\' => array(\'Test.php\', \'.phpt\'), \'configuration\' => \'/home/travis/build/wallabag/wallabag/phpunit.xml.dist\'))
in phar:///home/travis/.phpenv/versions/5.6.5/bin/phpunit/phpunit/TextUI/Command.php line 152
at PHPUnit_TextUI_Command->run(array(\'/home/travis/.phpenv/versions/5.6/bin/phpunit\', \'-v\'), true)
in phar:///home/travis/.phpenv/versions/5.6.5/bin/phpunit/phpunit/TextUI/Command.php line 104
at PHPUnit_TextUI_Command::main()
in /home/travis/.phpenv/versions/5.6.5/bin/phpunit line 722
I've really now idea why a stream is opened when we create a form ... but it seems to fail when closing it.
Did you ever encountered that issue?
I was thinking of a fix in Stream.php on line 626:
public function __destruct()
{
+ if (false === $this->isOpened()) {
+ return;
+ }
$this->close();
return;
}
What do you think?
It would be great to support Hoa\Iterator\Glob
in the finder.
The strategy would be the following: If we find a glob pattern (*
, {a,b,c}
etc.) when computing paths in the Finder::getIterator
method, then we compute a Hoa\Iterator\Glob
object to embed this path.
Thoughts @hoaproject/hoackers?
Problem:
I was looking for a Composer package that allows you to create file from a template, and I came across https://packagist.org/packages/hoa/file. I was surprised that this package has a huge download count but there is no README OR any documentation for this package. This documentation https://hoa-project.net/En/Literature/Hack/File.html is not working.
Any newbie wouldn't be able to know what it does, other than just a vague idea that it does something with files.
Propsosed resolution:
This Composer package would be more helpful if there is a good documentation. Because,
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
how to use it pls
Try:
new Hoa\File\Read('http://hoa-project.net')->getSize();
to generate the error. We have a stupid PHP warning.
Hi
Its probally not an bug, but when I run this code https://gist.github.com/camael24/5ff0e3718201845498f7
I have :
$ php main.php
58a49b3689d699cb72ffda7252d99fcb
Instead of
$ php main.php
ProgressProgressProgressProgressProgressProgressProgressProgress ....
58a49b3689d699cb72ffda7252d99fcb
An idea where I was wrong ?
ps: Same here : https://gist.github.com/8f222c0182a379da166c
What is the use of this line https://github.com/hoaproject/File/blob/master/File.php#L208 ?
parent::__construct() in File class that extends Generic which has no constructor
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.