@@ -299,7 +299,7 @@ static void ReleaseCharSet(CharSet *cset)
299299 *
300300 *----------------------------------------------------------------------
301301*/
302- static int ValidateFormat (const char * format , uint32_t numVars , uint32_t * totalSubs )
302+ static int ValidateFormat (const zend_string * zstr_format , uint32_t numVars , uint32_t * totalSubs )
303303{
304304#define STATIC_LIST_SIZE 16
305305 int flags ;
@@ -325,6 +325,7 @@ static int ValidateFormat(const char *format, uint32_t numVars, uint32_t *totalS
325325 }
326326 memset (nassign , 0 , sizeof (uint32_t )* numVars );
327327
328+ const char * format = ZSTR_VAL (zstr_format );
328329 while (* format != '\0' ) {
329330 ch = format ++ ;
330331 flags = 0 ;
@@ -570,7 +571,7 @@ static int ValidateFormat(const char *format, uint32_t numVars, uint32_t *totalS
570571 * return_value set with the results of the scan
571572 */
572573
573- PHPAPI int php_sscanf_internal (const char * string , const char * format ,
574+ PHPAPI int php_sscanf_internal (const char * string , const zend_string * zstr_format ,
574575 uint32_t argCount , zval * args ,
575576 zval * return_value )
576577{
@@ -601,7 +602,7 @@ PHPAPI int php_sscanf_internal(const char *string, const char *format,
601602 * Check for errors in the format string.
602603 */
603604 uint32_t totalVars = 0 ;
604- if (ValidateFormat (format , numVars , & totalVars ) != SCAN_SUCCESS ) {
605+ if (ValidateFormat (zstr_format , numVars , & totalVars ) != SCAN_SUCCESS ) {
605606 scan_set_error_return ( assignToVariables , return_value );
606607 return SCAN_ERROR_INVALID_FORMAT ;
607608 }
@@ -646,6 +647,7 @@ PHPAPI int php_sscanf_internal(const char *string, const char *format,
646647 nconversions = 0 ;
647648 /* note ! - we need to limit the loop for objIndex to keep it in bounds */
648649
650+ const char * format = ZSTR_VAL (zstr_format );
649651 while (* format != '\0' ) {
650652 ch = format ++ ;
651653 flags = 0 ;
0 commit comments