Hello D.,

  for example look here: http://talks.somabo.de

Saturday, February 11, 2006, 5:32:33 PM, you wrote:

> 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




Best regards,
 Marcus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to