Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21842 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67155 invoked by uid 1010); 11 Feb 2006 12:24:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 67140 invoked from network); 11 Feb 2006 12:24:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2006 12:24:10 -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:51308] helo=daleenterprise.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E2/1B-35443-967DDE34 for ; Sat, 11 Feb 2006 07:24:09 -0500 Received: from localhost (localhost [127.0.0.1]) by daleenterprise.com (Postfix) with ESMTP id 70416736AC6 for ; Sat, 11 Feb 2006 07:24:06 -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 09274-08 for ; Sat, 11 Feb 2006 07:24:05 -0500 (EST) Received: from [10.1.100.11] (relay.mustangrestomods.com [67.78.11.226]) by daleenterprise.com (Postfix) with ESMTP id E28D6736AC0 for ; Sat, 11 Feb 2006 07:24:05 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) Content-Transfer-Encoding: 7bit Message-ID: <187B7C4E-FC8A-48AA-B641-D905EBB1DFC5@daleenterprise.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: PHP-DEV Date: Sat, 11 Feb 2006 07:24:04 -0500 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: API issues or me? From: info@daleenterprise.com ("D. Walsh") 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; }