Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21843 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69456 invoked by uid 1010); 11 Feb 2006 12:35:17 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 69441 invoked from network); 11 Feb 2006 12:35:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2006 12:35:17 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:46747] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id FF/4B-35443-40ADDE34 for ; Sat, 11 Feb 2006 07:35:16 -0500 Received: from [192.168.1.3] (dslb-084-063-005-097.pools.arcor-ip.net [84.63.5.97]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 07ADD35C1DE; Sat, 11 Feb 2006 13:35:11 +0100 (CET) Date: Sat, 11 Feb 2006 13:33:39 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <389062322.20060211133339@marcus-boerger.de> To: "D. Walsh" Cc: PHP-DEV In-Reply-To: <187B7C4E-FC8A-48AA-B641-D905EBB1DFC5@daleenterprise.com> References: <187B7C4E-FC8A-48AA-B641-D905EBB1DFC5@daleenterprise.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] API issues or me? From: helly@php.net (Marcus Boerger) 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. 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