Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40118 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35743 invoked from network); 28 Aug 2008 10:39:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Aug 2008 10:39:37 -0000 Authentication-Results: pb1.pair.com header.from=prf.kishorekumar@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=prf.kishorekumar@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.44.30 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: prf.kishorekumar@gmail.com X-Host-Fingerprint: 74.125.44.30 yx-out-2324.google.com Received: from [74.125.44.30] ([74.125.44.30:20439] helo=yx-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/42-24614-86086B84 for ; Thu, 28 Aug 2008 06:39:37 -0400 Received: by yx-out-2324.google.com with SMTP id 3so166090yxj.83 for ; Thu, 28 Aug 2008 03:39:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=f8axf/X9mqcvLidCwEoTPkJymb9Jgtj6ESpR8I9g220=; b=JV7yixHadmDYC3Wi0r5VwoEa9BZhH4I6RPRhLNvIvDhcYkE3NIMsRdVO14A9Uwd7iG looqPtJc3Mfzp86aESuazfM4R+jDrlKG3AZ7dnanDlWydZP2s9L30idd8vR+GR60ZPed 8i5Hjx/tda8fhBXwjs82Ah1Wf9hW4WJdDYXxg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=piIksNJWsNWSVkAhIt1gdnQVtld6mNplYsOGrJzWvEKVOQTH67b3n8QhPg8Z3HuqEp UiRhJ3XGHl1jXmmZ9bRkcKLJX9Wp/qPMrMJFV/voA6qQzoAeqbsGIvT9Fdanh9vQ+vSz wzkh77LZtwiKv8Pb9zoF/WZjWVedISxRHhOtw= Received: by 10.151.156.19 with SMTP id i19mr1952039ybo.45.1219919974290; Thu, 28 Aug 2008 03:39:34 -0700 (PDT) Received: by 10.151.105.15 with HTTP; Thu, 28 Aug 2008 03:39:34 -0700 (PDT) Message-ID: Date: Thu, 28 Aug 2008 16:09:34 +0530 To: "PHP Internals" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_42428_2424659.1219919974293" Subject: Unable to find bug in these few lines of code. Please help. From: prf.kishorekumar@gmail.com ("KishoreKumar Bairi") ------=_Part_42428_2424659.1219919974293 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hey guys.. This is the code of a string test_func(resource $handle) which is supposed to return the size of resource as a string. PHP_FUNCTION(test_func) *{* zval *arg1; php_stream_statbuf stat_ssb; *char* *input_stream_len_str; php_stream *input_stream; *if* (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) *{* *return*; *}* PHP_STREAM_TO_ZVAL(input_stream, &arg1); *if* (php_stream_stat(input_stream, &stat_ssb)) *{* RETURN_FALSE; *}* sprintf(input_stream_len_str,"%d",stat_ssb.sb.st_size); RETURN_STRING(input_stream_len_str, 1); *}* I'm testing the above code by using test.php but when I hit http://localhost/test.php Instead of showing the string, my browser is offering *test.php* for download. If I click save, its saving a zero byte test.php to my disk. If I comment out the function call to test_func() its showing the var_dump of $str. I couldn't understand whats going wrong. Please help. ------=_Part_42428_2424659.1219919974293--