Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21845 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44610 invoked by uid 1010); 11 Feb 2006 16:32:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 44594 invoked from network); 11 Feb 2006 16:32:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2006 16:32:39 -0000 X-Host-Fingerprint: 67.78.11.229 daleenterprise.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (1) Received: from ([67.78.11.229:52275] helo=daleenterprise.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 74/43-35443-7A11EE34 for ; Sat, 11 Feb 2006 11:32:39 -0500 Received: from localhost (localhost [127.0.0.1]) by daleenterprise.com (Postfix) with ESMTP id 79C25736FA3; Sat, 11 Feb 2006 11:32:35 -0500 (EST) Received: from daleenterprise.com ([127.0.0.1]) by localhost (daleenterprise.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18736-02; Sat, 11 Feb 2006 11:32:34 -0500 (EST) Received: from [10.1.100.11] (relay.mustangrestomods.com [67.78.11.226]) by daleenterprise.com (Postfix) with ESMTP id A62BF736F9D; Sat, 11 Feb 2006 11:32:34 -0500 (EST) In-Reply-To: <389062322.20060211133339@marcus-boerger.de> References: <187B7C4E-FC8A-48AA-B641-D905EBB1DFC5@daleenterprise.com> <389062322.20060211133339@marcus-boerger.de> Mime-Version: 1.0 (Apple Message framework v746.2) X-Priority: 3 (Normal) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-ID: Cc: PHP-DEV Content-Transfer-Encoding: 7bit Date: Sat, 11 Feb 2006 11:32:33 -0500 To: Marcus Boerger X-Mailer: Apple Mail (2.746.2) MTA-Interface: amavisd-new-2.2.1 (2004-12-22) + Maia Mailguard 1.1.0 at daleenterprise.com Subject: Re: [PHP-DEV] API issues or me? From: info@daleenterprise.com ("D. Walsh") On Feb 11, 2006, at 07:33 , Marcus Boerger wrote: > Hello D., > > you are using the old parameter parsing api which is deprecated for > very long now. Maybe changing to the new one will fix your problems or > find you more help. I'm using the documentation that Wez directed me too about 8 months ago, where's the newer? > marcus > > Saturday, February 11, 2006, 1:24:04 PM, you wrote: > >> I've been coding modules using the current available API and I've >> recently tried compiling PHP-5.1.2 for Apache 2.0 and I'm not >> obtaining the expected results when a function that should return an >> array but doesn't. > >> Compiling PHP 5.1.2 (or any previous version) for Apache 1.3.x the >> module works properly and the issue only occurs when compiling for >> 2.0. > >> I'm not sure if there are API changes that are not in the current >> documentation so if someone could examine the following code and sees >> something obvious I'd appreciate it if you'd point it out. > >> -- Dale > > > >> PHP_FUNCTION(ram_disk_file_load) >> { >> pval *file, *args, *p_argc; >> pval *entry; >> zval *p_prcalc; >> HashTable *args_arr; >> int i, xsize, ysize, argc; >> double ymin,ymax; >> char **argv, **prcalc; > >> /* >> * xsize is the number of bytes per sector >> * ysize is the number of bytes (in kb) for the ramdisk. >> * argv[0] is the command to perform. >> * argv[1] is either 'disk' mode or 'raw' mode >> * argv[2] contains the file with the disk images contents >> to load >> into it >> */ > >> if ( disk_test_error() ) >> disk_clear_error(); > >> if ( (ZEND_NUM_ARGS() >= 3 && ZEND_NUM_ARGS() <= 6) && >> zend_get_parameters(ht, 3, &file, &args, &p_argc) == SUCCESS) >> { >> if ( args->type != IS_ARRAY ) >> { >> php_error(E_WARNING, "2nd Variable passed >> to disk_config is not an >> array!\n"); >> RETURN_FALSE; >> } > >> convert_to_long(p_argc); >> convert_to_string(file); > >> convert_to_array(args); >> args_arr = args->value.ht; > >> // here we want to raw copy our saved content file >> to the new ram disk >> argc = p_argc->value.lval + 3; >> argv = (char **) emalloc(argc * sizeof(char *)); >> argv[0] = "init"; >> argv[1] = estrdup("raw"); >> argv[2] = estrdup(file->value.str.val); > >> for (i = 3; i < argc; i++) >> { >> pval **dataptr; > >> if ( zend_hash_get_current_data(args_arr, >> (void *) &dataptr) == >> FAILURE ) >> continue; > >> entry = *dataptr; > >> if ( entry->type != IS_STRING ) >> convert_to_string(entry); > >> argv[i] = estrdup(entry->value.str.val); > >> if ( i < argc ) >> zend_hash_move_forward(args_arr); >> } > >> optind = 0; opterr = 0; >> if (size _config(argc-1, &argv[1], &prcalc, >> &xsize, &ysize) != -1 ) >> { >> array_init(return_value); >> add_assoc_long(return_value, "xsize", xsize); >> add_assoc_long(return_value, "ysize", ysize); > >> MAKE_STD_ZVAL(p_prcalc); >> array_init(p_prcalc); > >> if (prcalc) >> { >> for (i = 0; prcalc[i]; i++) >> { >> add_next_index_string >> (p_prcalc, prcalc[i], 1); >> free(prcalc[i]); >> } >> free(prcalc); >> } >> zend_hash_update(return_value->value.ht, >> "prcalc", sizeof("prcalc"), >> (void *) >> &p_prcalc, sizeof(zval *), NULL); >> } >> else >> { >> RETVAL_FALSE; // PROBLEM - FAILED TO >> PERFORM THE TASK >> } >> for (i = 1; i < argc; i++) >> efree(argv[i]); > >> efree(argv); >> } >> else >> { >> WRONG_PARAM_COUNT; >> } >> return; >> } > > > > > Best regards, > Marcus -- Dale