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

behaviour diff: not all methods in RecursiveIteratorIterator class #404

Closed
karpa13a opened this issue Sep 12, 2011 · 8 comments
Closed

behaviour diff: not all methods in RecursiveIteratorIterator class #404

karpa13a opened this issue Sep 12, 2011 · 8 comments

Comments

@karpa13a
Copy link

http://php.net/recursiveiteratoriterator
#403 note

@ptarjan
Copy link
Contributor

ptarjan commented May 13, 2013

We're closing out all bugs older than 2 months. http://www.hiphop-php.com/wp/?p=575

If this is still an issue, please re-open it, and in order of goodness:

  1. Give detailed repro steps
  2. Write a test case in hphp/tests/quick (run it with hphp/tests/run) and send the pull request
  3. Fix it in a pull request

@ptarjan ptarjan closed this as completed May 13, 2013
@karpa13a
Copy link
Author

huh, segfault with following code.
bad permissions on directories in /tmp/ (run as normal user, not root, and create directory with root permissions only and 700 mode):

karp@karp:~/tmp/php/1$ php -v
PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) (built: Mar 11 2013 14:31:48) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
karp@karp:~/tmp/php/1$ hhvm --version
HipHop VM v2.0.2 (rel)
Compiler: tags/HPHP-2.0.2-0-ga3803ffa8aab6dd582af9f6e28bb8878954310dd
Repo schema: c9334168ca1d6fbba2f465f1bdf1e96e0e53b0cf
karp@karp:~/tmp/php/1$ cat recursiveiteratoriterator.php 
<?php
$directory = "/tmp/";
$fileSPLObjects =  new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator($directory),
                RecursiveIteratorIterator::CHILD_FIRST
            );
try {
    foreach( $fileSPLObjects as $fullFileName => $fileSPLObject ) {
        print $fullFileName . " " . $fileSPLObject->getFilename() . "\n";
    }
}
catch (UnexpectedValueException $e) {
    printf("Directory [%s] contained a directory we can not recurse into", $directory);
}
?>
karp@karp:~/tmp/php/1$ php recursiveiteratoriterator.php 
/file list in /tmp/
Directory [/tmp/] contained a directory we can not recurse into
karp@karp:~/tmp/php/1$ hhvm recursiveiteratoriterator.php 
/file list in /tmp/
Segmentation fault

@ptarjan
Copy link
Contributor

ptarjan commented May 14, 2013

I didn't segfault on my box. Can you figure out what file is causing hhvm trouble?

@karpa13a
Copy link
Author

sudo mkdir /tmp/foo
sudo chmod 700 /tmp/foo
hhvm recursiveiteratoriterator.php

under gdb --args hhvm recursiveiteratoriterator.php , i got following:
Program received signal SIGSEGV, Segmentation fault.
0x000000000076cb2b in HPHP::hash_string_i(char const*, int) ()

@karpa13a
Copy link
Author

huh, bt:

(gdb) bt
#0  0x000000000076cb2b in HPHP::hash_string_i(char const*, int) ()
#1  0x00000000007645c4 in HPHP::StringData::hashHelper() const ()
#2  0x0000000000c96d8e in HPHP::VM::FixedStringMap<unsigned int, true>::find(HPHP::StringData const*) const ()
#3  0x0000000000c9df27 in HPHP::VM::Class::getDeclPropIndex(HPHP::VM::Class*, HPHP::StringData const*, bool&) const ()
#4  0x0000000000cb74db in HPHP::VM::Instance::getProp(HPHP::VM::Class*, HPHP::StringData const*, bool&, bool&, bool&) ()
#5  0x0000000000e1adb5 in HPHP::ObjectData::o_realPropTyped(HPHP::String const&, int, HPHP::String const&, HPHP::DataType*) const
    ()
#6  0x0000000000e1ae74 in HPHP::ObjectData::o_realProp(HPHP::String const&, int, HPHP::String const&) const ()
#7  0x0000000000e1bc04 in HPHP::ObjectData::o_get(HPHP::String const&, bool, HPHP::String const&) ()
#8  0x000000000115f90a in HPHP::get_recursiveiteratoriterator(HPHP::Object const&) ()
#9  0x0000000001160ac4 in HPHP::f_hphp_recursiveiteratoriterator_valid(HPHP::Object const&) ()
#10 0x000000000116269b in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#11 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#12 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#13 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#14 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#15 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#16 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#17 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#18 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#19 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#20 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#21 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#22 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#23 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#24 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#25 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#26 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
/alot of/
#65442 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#65443 0x00000000011626ab in HPHP::f_hphp_recursiveiteratoriterator_next(HPHP::Object const&) ()
#65444 0x0000000000fd6e70 in HPHP::fg_hphp_recursiveiteratoriterator_next(HPHP::VM::ActRec*) ()
#65445 0x0000000000c05a87 in void HPHP::VMExecutionContext::dispatchImpl<0>(int) ()
#65446 0x0000000000bf9e20 in HPHP::VMExecutionContext::enterVMWork(HPHP::VM::ActRec*) ()
#65447 0x0000000000bfa10e in HPHP::VMExecutionContext::enterVM(HPHP::TypedValue*, HPHP::VM::ActRec*, HPHP::VM::ExtraArgs*) ()
#65448 0x0000000000bfa504 in HPHP::VMExecutionContext::reenterVM(HPHP::TypedValue*, HPHP::VM::ActRec*, HPHP::VM::ExtraArgs*, HPHP::TypedValue*) ()
#65449 0x0000000000bfa9b5 in HPHP::VMExecutionContext::invokeFunc(HPHP::TypedValue*, HPHP::VM::Func const*, HPHP::Array const&, HPHP::ObjectData*, HPHP::VM::Class*, HPHP::VM::VarEnv*, HPHP::StringData*, HPHP::VM::Unit*) ()
#65450 0x0000000000e1dc39 in HPHP::ObjectData::o_invoke(HPHP::String const&, HPHP::Array const&, int, bool) ()
#65451 0x0000000000a68924 in HPHP::ArrayIter::nextHelper() ()
#65452 0x0000000000a69be1 in HPHP::VM::Iter::next() ()
#65453 0x0000000000c0c94c in void HPHP::VMExecutionContext::dispatchImpl<0>(int) ()
#65454 0x0000000000bf9e20 in HPHP::VMExecutionContext::enterVMWork(HPHP::VM::ActRec*) ()
#65455 0x0000000000bfa10e in HPHP::VMExecutionContext::enterVM(HPHP::TypedValue*, HPHP::VM::ActRec*, HPHP::VM::ExtraArgs*) ()
#65456 0x0000000000bfac16 in HPHP::VMExecutionContext::invokeFunc(HPHP::TypedValue*, HPHP::VM::Func const*, HPHP::Array const&, HPHP::ObjectData*, HPHP::VM::Class*, HPHP::VM::VarEnv*, HPHP::StringData*, HPHP::VM::Unit*) ()
#65457 0x0000000000bfae32 in HPHP::VMExecutionContext::invokeUnit(HPHP::TypedValue*, HPHP::VM::Unit*) ()
#65458 0x000000000097e61d in HPHP::invoke_file(HPHP::String const&, bool, char const*) ()
#65459 0x000000000097fc78 in HPHP::include_impl_invoke(HPHP::String const&, bool, char const*) ()
#65460 0x00000000009e44f9 in HPHP::hphp_invoke(HPHP::ExecutionContext*, std::string const&, bool, HPHP::Array const&, HPHP::VRefParamValue const&, std::string const&, std::string const&, bool&, std::string&, bool, bool, bool) [clone .constprop.351] ()
#65461 0x00000000009e90f6 in HPHP::execute_program_impl(int, char**) ()
#65462 0x00000000009e9f88 in HPHP::execute_program(int, char**) ()
#65463 0x0000000000747559 in main ()

@ptarjan
Copy link
Contributor

ptarjan commented May 14, 2013

Even with the directory you suggested I'm not seeing a segfault.

Your backtrace looks like it is trying to get a property on a class. Can you compile a debug build, it should help diagnose much better.

@karpa13a
Copy link
Author

with commands do this?

@karpa13a
Copy link
Author

hhvm from current git, debug build:

gdb ./hhvm ./core
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/karp/tmp/hiphop/hiphop-php/hphp/hhvm/hhvm...done.
Unsupported JIT protocol version in descriptor!
[New LWP 11256]

warning: Can't read pathname for load map: Input/output error.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./hhvm recursiveiteratoriterator.php'.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000001987282 in HPHP::hash_string_i_inline (
    arKey=<error reading variable: Cannot access memory at address 0x7fffce49bf90>, 
    nKeyLength=<error reading variable: Cannot access memory at address 0x7fffce49bf8c>)
    at /home/karp/tmp/hiphop/hiphop-php/hphp/util/hash.h:254
254 inline strhash_t hash_string_i_inline(const char *arKey, int nKeyLength) {

may be you mail me with list of commands?

facebook-github-bot pushed a commit that referenced this issue Aug 31, 2022
Summary: fixes #404

Reviewed By: mjoras

Differential Revision: D39189119

fbshipit-source-id: c31177c8e714e3ecd5ebfc85f5b1fcbca59e4060
antonl2 added a commit to antonl2/hhvm that referenced this issue Feb 15, 2023
Summary:
X-link: facebook/mcrouter#404

Pull Request resolved: facebook#9337

Small build speed observation to avoid includes bloat.

Differential Revision: D43330734

fbshipit-source-id: fed35bf8bab770072e384de9fe0a401f2b1260b4
antonl2 added a commit to antonl2/hhvm that referenced this issue Feb 15, 2023
Summary:
X-link: facebook/mcrouter#404

Pull Request resolved: facebook#9337

Small build speed observation to avoid includes bloat.

Differential Revision: D43330734

fbshipit-source-id: 3862749f86fb6c56102868c5745b6fbc89ab9763
facebook-github-bot pushed a commit that referenced this issue Feb 17, 2023
Summary:
X-link: facebook/mcrouter#404

Pull Request resolved: #9337

Small build speed observation to avoid includes bloat.

Differential Revision: D43330734

fbshipit-source-id: 4393b37e5fee155eb58d61f00d3122b12772d73a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants