php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68915 Failed assertion in DirectoryIterator_getExtension on '.' entry.
Submitted: 2015-01-26 08:26 UTC Modified: -
From: arjen at react dot com Assigned:
Status: Closed Package: SPL related
PHP Version: master-Git-2015-01-26 (Git) OS: Linux
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: arjen at react dot com
New email:
PHP Version: OS:

 

 [2015-01-26 08:26 UTC] arjen at react dot com
Description:
------------
Running our internal testsuite in with php7 (master git up-to-date) in a normal build works fine, with --enable-debug with get the following error:

php: /home/arjen/phpng/php-src/ext/spl/spl_directory.c:966: zim_spl_DirectoryIterator_getExtension: Assertion `p > fname->val' failed.

(gdb) bt
#0  0x00007ffff38d2a97 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff38d3e6a in abort () from /usr/lib/libc.so.6
#2  0x00007ffff38cb8bd in __assert_fail_base () from /usr/lib/libc.so.6
#3  0x00007ffff38cb972 in __assert_fail () from /usr/lib/libc.so.6
#4  0x00000000007d018e in zim_spl_DirectoryIterator_getExtension (execute_data=0x7ffff0ad41f0, return_value=0x7ffff0ad4150)
    at /home/arjen/phpng/php-src/ext/spl/spl_directory.c:966
#5  0x000000000098f246 in ZEND_DO_FCALL_SPEC_HANDLER (execute_data=0x7ffff0ad4040) at /home/arjen/phpng/php-src/Zend/zend_vm_execute.h:596
#6  0x000000000098e7e8 in execute_ex (execute_data=0x7ffff0ad4040) at /home/arjen/phpng/php-src/Zend/zend_vm_execute.h:352
#7  0x000000000098e941 in zend_execute (op_array=0x13fcd40, return_value=0x0) at /home/arjen/phpng/php-src/Zend/zend_vm_execute.h:381
#8  0x0000000000941c99 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/arjen/phpng/php-src/Zend/zend.c:1271
#9  0x00000000008b923a in php_execute_script (primary_file=0x7fffffffdff0) at /home/arjen/phpng/php-src/main/main.c:2554
#10 0x00000000009e4acd in do_cli (argc=2, argv=0x1267520) at /home/arjen/phpng/php-src/sapi/cli/php_cli.c:982
#11 0x00000000009e5a76 in main (argc=2, argv=0x1267520) at /home/arjen/phpng/php-src/sapi/cli/php_cli.c:1361

If it fails, the currenct DirectoryIterator entry is a '.' entry.

Test script:
---------------
<?php

$it = new DirectoryIterator(__DIR__);

foreach ($it as $entry)
{
	var_dump($entry->getPathname(), $entry->getExtension());
}

Expected result:
----------------
No assertion. Empty string for directory entries without extension:

"Returns a string containing the file extension, or an empty string if the file has no extension."

Actual result:
--------------
php: /home/arjen/phpng/php-src/ext/spl/spl_directory.c:966: zim_spl_DirectoryIterator_getExtension: Assertion `p > fname->val' failed.

(gdb) bt
#0  0x00007ffff38d2a97 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff38d3e6a in abort () from /usr/lib/libc.so.6
#2  0x00007ffff38cb8bd in __assert_fail_base () from /usr/lib/libc.so.6
#3  0x00007ffff38cb972 in __assert_fail () from /usr/lib/libc.so.6
#4  0x00000000007d018e in zim_spl_DirectoryIterator_getExtension (execute_data=0x7ffff0ad41f0, return_value=0x7ffff0ad4150)
    at /home/arjen/phpng/php-src/ext/spl/spl_directory.c:966
#5  0x000000000098f246 in ZEND_DO_FCALL_SPEC_HANDLER (execute_data=0x7ffff0ad4040) at /home/arjen/phpng/php-src/Zend/zend_vm_execute.h:596
#6  0x000000000098e7e8 in execute_ex (execute_data=0x7ffff0ad4040) at /home/arjen/phpng/php-src/Zend/zend_vm_execute.h:352
#7  0x000000000098e941 in zend_execute (op_array=0x13fcd40, return_value=0x0) at /home/arjen/phpng/php-src/Zend/zend_vm_execute.h:381
#8  0x0000000000941c99 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/arjen/phpng/php-src/Zend/zend.c:1271
#9  0x00000000008b923a in php_execute_script (primary_file=0x7fffffffdff0) at /home/arjen/phpng/php-src/main/main.c:2554
#10 0x00000000009e4acd in do_cli (argc=2, argv=0x1267520) at /home/arjen/phpng/php-src/sapi/cli/php_cli.c:982
#11 0x00000000009e5a76 in main (argc=2, argv=0x1267520) at /home/arjen/phpng/php-src/sapi/cli/php_cli.c:1361

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-27 07:58 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=59593ba66c00220f0161a721c80550b2a0305c31
Log: Fixed #68915 (wrong assertion here)
 [2015-01-27 07:58 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:39 UTC] davey@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=59593ba66c00220f0161a721c80550b2a0305c31
Log: Fixed #68915 (wrong assertion here)
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 08:01:23 2020 UTC