php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36906 stream_context_set_option() crashes
Submitted: 2006-03-29 08:02 UTC Modified: 2006-05-19 01:00 UTC
Votes:4
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: sqchen at citiz dot net Assigned: pollita (profile)
Status: No Feedback Package: Streams related
PHP Version: 5.2-CVS OS: *nix
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: sqchen at citiz dot net
New email:
PHP Version: OS:

 

 [2006-03-29 08:02 UTC] sqchen at citiz dot net
Description:
------------
stream_context_get_options cause segfault, php version is 5.1.2

Reproduce code:
---------------
<?php
$dir=opendir(dirname(__FILE__));
stream_context_set_option($dir, "pathname", "path", "/u/quans/");
var_dump(stream_context_get_options($dir));
?>


Actual result:
--------------
array(1) {
  ["pathname"]=>
  array(1) {
    ["path"]=>
    string(9) "/u/quans/"
  }
}

Segmentation fault


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-05 20:45 UTC] mike@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip

Cannot reproduce.
 [2006-04-05 23:16 UTC] bjori@php.net
Verified in HEAD, 5.0 and 5.1 cvs.

#0  0x0816d92d in php_stream_context_del_link (context=0x83ce324, stream=0x83b7b24) at /usr/src/php51/main/streams/streams.c:1984
#1  0x08169df7 in _php_stream_free (stream=0x83b7b24, close_options=11) at /usr/src/php51/main/streams/streams.c:326
#2  0x0816c1c3 in stream_resource_regular_dtor (rsrc=0x83ce1a4) at /usr/src/php51/main/streams/streams.c:1373
#3  0x081a7fb5 in list_entry_destructor (ptr=0x83ce1a4) at /usr/src/php51/Zend/zend_list.c:184
#4  0x081a618c in zend_hash_apply_deleter (ht=0x829c7d4, p=0x83c5a24) at /usr/src/php51/Zend/zend_hash.c:576
#5  0x081a63af in zend_hash_graceful_reverse_destroy (ht=0x829c7d4) at /usr/src/php51/Zend/zend_hash.c:642
#6  0x081a80f9 in zend_destroy_rsrc_list (ht=0x829c7d4) at /usr/src/php51/Zend/zend_list.c:240
#7  0x0819c517 in zend_deactivate () at /usr/src/php51/Zend/zend.c:860
#8  0x0815899a in php_request_shutdown (dummy=0x0) at /usr/src/php51/main/main.c:1283
#9  0x082011c3 in main (argc=1, argv=0xbfbfea54) at /usr/src/php51/sapi/cli/php_cli.c:1245

 [2006-04-11 11:01 UTC] sniper@php.net
Sara, can you check this out?
 [2006-04-25 10:59 UTC] sqchen at citiz dot net
hi, I have tried the  http://snaps.php.net/php5.1-latest.tar.gz  version, and found that it does not fixed the problem, would you please check it again?
 [2006-05-10 07:47 UTC] sqchen at citiz dot net
hi.......the newest version of php-5.1.2 has not fixed this problem yet...would you please assign it to the php developer?
 [2006-05-10 09:14 UTC] bjori@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-05-11 09:17 UTC] bjori@php.net
I can't reproduce it in current CVS.

Mind posting backtrace?
 [2006-05-11 11:38 UTC] keochb at hotmail dot com
(gdb) backtrace
#0  0x0823cdfb in php_stream_context_del_link (context=0x847f3f4,
    stream=0x846d304) at /home/spring/php-5.1.2/main/streams/streams.c:1988
#1  0x0823d127 in _php_stream_free (stream=0x846d304, close_options=11)
    at /home/spring/php-5.1.2/main/streams/streams.c:326
#2  0x0823d81c in stream_resource_regular_dtor (rsrc=0x5a5a5a5a)
    at /home/spring/php-5.1.2/main/streams/streams.c:1373
#3  0x0827a3bf in list_entry_destructor (ptr=0x847f104)
    at /home/spring/php-5.1.2/Zend/zend_list.c:184
#4  0x08278d88 in zend_hash_apply_deleter (ht=0x83c7800, p=0x847f0ac)
    at /home/spring/php-5.1.2/Zend/zend_hash.c:574
#5  0x08278e57 in zend_hash_graceful_reverse_destroy (ht=0x83c7800)
    at /home/spring/php-5.1.2/Zend/zend_hash.c:640
#6  0x0826d46e in zend_deactivate () at /home/spring/php-5.1.2/Zend/zend.c:860
#7  0x08228455 in php_request_shutdown (dummy=0x0)
    at /home/spring/php-5.1.2/main/main.c:1284
#8  0x082eea4b in main (argc=2, argv=0xbf9a6ed4)
    at /home/spring/php-5.1.2/sapi/cli/php_cli.c:1230
 [2006-05-11 11:41 UTC] keochb at hotmail dot com
sqchen at citiz dot net 
and I are in the same team.
 [2006-05-11 11:46 UTC] keochb at hotmail dot com
From:  http://snaps.php.net/php5.2-latest.tar.gz


(gdb) backtrace
#0  0x08203f63 in php_stream_context_set_option (context=0x2,
    wrappername=0x8456964 "path", optionname=0x8455a0c "pathname",
    optionvalue=0x78f)
    at /home/spring/p52/php5.2-200605100830/main/streams/streams.c:1936
#1  0x081deb50 in zif_stream_context_set_option (ht=4, return_value=0x8455acc,
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at /home/spring/p52/php5.2-200605100830/ext/standard/streamsfuncs.c:984
#2  0x08255d4e in zend_do_fcall_common_helper_SPEC (execute_data=0xbfcc3190)
    at zend_vm_execute.h:200
#3  0x08255598 in execute (op_array=0x845126c) at zend_vm_execute.h:92
#4  0x082358b0 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /home/spring/p52/php5.2-200605100830/Zend/zend.c:1102
#5  0x081f0e77 in php_execute_script (primary_file=0xbfcc56c0)
    at /home/spring/p52/php5.2-200605100830/main/main.c:1732
#6  0x082d8edf in main (argc=2, argv=0xbfcc5754)
    at /home/spring/p52/php5.2-200605100830/sapi/cli/php_cli.c:1092
 [2006-05-11 11:51 UTC] keochb at hotmail dot com
In php5.1.2, the segmentation fault appears after the function of 'stream_context_set_option';
But in php5.2 the segmentation fault appears in the function of 'stream_context_set_option'.

Why & How?
(God smiles!)
 [2006-05-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC