php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59868 addRequiredParameter : required but not set
Submitted: 2011-07-23 20:02 UTC Modified: 2013-02-18 00:35 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: javier dot sixto at gmail dot com Assigned:
Status: No Feedback Package: oauth (PECL)
PHP Version: 5.3.6 OS: GNU/Linux
Private report: No CVE-ID: None
 [2011-07-23 20:02 UTC] javier dot sixto at gmail dot com
Description:
------------
Hello,

I'm using addRequiredParameter to customise my OAuth Request Token Action. I Was not able to to get new parameter value from provider class object, there is only this members  :
    [consumer_key]
    [consumer_secret] => 
    [nonce] => 
    [token] => 
    [token_secret] => 
    [timestamp] => 1311463574
    [version] => 1.0a
    [signature_method] => HMAC-SHA1
    [callback] => 
    [request_token_endpoint] =>
    [signature] =>

My new parameter was checked as required, but not added to provider, so how can I get her value ?


I have a dirty hack on provider.c to generate a member from each required parameter on CheckToken , this declare some member twice like 'token' and 'oauth_token'. 

Index: provider.c
===================================================================
--- provider.c	(r?vision 313639)
+++ provider.c	(copie de travail)
@@ -155,7 +155,7 @@
 	return 0;
 }
 
-static void oauth_provider_check_required_params(HashTable *required_params, HashTable *params, HashTable *missing_params TSRMLS_DC) /* {{{ */
+static void oauth_provider_check_required_params(zval *provider_obj,HashTable *required_params, HashTable *params, HashTable *missing_params TSRMLS_DC) /* {{{ */
 {
 	HashPosition hpos, reqhpos, paramhpos;
 	zval **dest_entry, *param;
@@ -172,6 +172,8 @@
 				MAKE_STD_ZVAL(param);
 				ZVAL_STRING(param, key, 1);
 				zend_hash_next_index_insert(missing_params, &param, sizeof(zval *), NULL);
+			}else{
+				oauth_provider_set_param_member(provider_obj, key, *dest_entry TSRMLS_CC);
 			}
 		}
 	} while(zend_hash_move_forward_ex(required_params, &hpos)==SUCCESS);
@@ -735,7 +737,7 @@
 		oauth_provider_remove_required_param(sop->required_params, "oauth_token");
 	}
 
-	oauth_provider_check_required_params(sop->required_params, sbs_vars, sop->missing_params TSRMLS_CC);
+	oauth_provider_check_required_params(pthis,sop->required_params, sbs_vars, sop->missing_params TSRMLS_CC);
 
 	missing_param_count = zend_hash_num_elements(sop->missing_params);
 	if(missing_param_count) {
@@ -859,6 +861,7 @@
 	sop = fetch_sop_object(pthis TSRMLS_CC);
 
 	if(oauth_provider_add_required_param(sop->required_params, required_param)==SUCCESS) {
+		zend_update_property_null(Z_OBJCE_P(pthis), pthis, required_param, req_param_len  TSRMLS_CC);
 		RETURN_TRUE;
 	}
 




Reproduce code:
---------------
$provider->addRequiredParameter("oauth_newparam");

Expected result:
----------------
$provider->newparam : must exists and contain passed value?



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-24 13:12 UTC] jawed@php.net
How about setParam(key, value)?

- JJ
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 15 03:01:32 2024 UTC